linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Makefile.build: Fix built-in.o linking errors
@ 2009-12-17  0:01 Jiafu He
  2009-12-17 22:34 ` Michal Marek
  0 siblings, 1 reply; 3+ messages in thread
From: Jiafu He @ 2009-12-17  0:01 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Michal Marek

This patch fixes two linking errors regarding the empty built-in.o:
- Error "...built-in.o: no such file or directory" happens if
"dirx/Makefile" contains only "obj-m += diry/ dirz/" and the empty
"dirx/built-in.o" is missing. Adding $(subdir-m) into check for
builtin-target fixes this error.
- Linking the child builtin.o's using arm-xscale-linux-gnueabi linker
fails with an EABI version mismatch error "... has EABI version 0, but
... has EABI verion 4". The cause is built-in.o created by $(AR) has
EABI verison 0, while the non-empty built-in.o's have EABI version 4.
The fix is to use $(CC) to create the empty built-in.o.

The fixes have been tested with x86/x86_64 native platforms and the
arm-xscale-linux-gnueabi cross-compiler.

Signed-off-by: Jiafu He <jay@goldhive.com>
-----
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 341b589..c8c8c81 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -82,7 +82,7 @@ ifneq ($(strip $(lib-y) $(lib-m) $(lib-n) $(lib-)),)
 lib-target := $(obj)/lib.a
 endif
 
-ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(lib-target)),)
+ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(subdir-m)
$(lib-target)),)
 builtin-target := $(obj)/built-in.o
 endif
 
@@ -291,7 +291,7 @@ quiet_cmd_link_o_target = LD      $@
 cmd_link_o_target = $(if $(strip $(obj-y)),\
                      $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^)
\
                      $(cmd_secanalysis),\
-                     rm -f $@; $(AR) rcs $@)
+                     rm -f $@; $(CC) -c -xassembler /dev/null -o $@)
 
 $(builtin-target): $(obj-y) FORCE
        $(call if_changed,link_o_target)
-----


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Makefile.build: Fix built-in.o linking errors
  2009-12-17  0:01 [PATCH] Makefile.build: Fix built-in.o linking errors Jiafu He
@ 2009-12-17 22:34 ` Michal Marek
  0 siblings, 0 replies; 3+ messages in thread
From: Michal Marek @ 2009-12-17 22:34 UTC (permalink / raw)
  To: Jiafu He; +Cc: linux-kbuild

Jiafu He napsal(a):
> This patch fixes two linking errors regarding the empty built-in.o:
> - Error "...built-in.o: no such file or directory" happens if
> "dirx/Makefile" contains only "obj-m += diry/ dirz/" and the empty
> "dirx/built-in.o" is missing. Adding $(subdir-m) into check for
> builtin-target fixes this error.
> - Linking the child builtin.o's using arm-xscale-linux-gnueabi linker
> fails with an EABI version mismatch error "... has EABI version 0, but
> ... has EABI verion 4". The cause is built-in.o created by $(AR) has
> EABI verison 0, while the non-empty built-in.o's have EABI version 4.
> The fix is to use $(CC) to create the empty built-in.o.
> 
> The fixes have been tested with x86/x86_64 native platforms and the
> arm-xscale-linux-gnueabi cross-compiler.
> 
> Signed-off-by: Jiafu He <jay@goldhive.com>
> -----
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 341b589..c8c8c81 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -82,7 +82,7 @@ ifneq ($(strip $(lib-y) $(lib-m) $(lib-n) $(lib-)),)
>  lib-target := $(obj)/lib.a
>  endif
>  
> -ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(lib-target)),)
> +ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(subdir-m)
> $(lib-target)),)
>  builtin-target := $(obj)/built-in.o
>  endif

Ack on this part, I need to think a bit more about the second part :).
Could you please send two separate patches, they fix two independent
issues after all.

Thanks,
Michal

>  
> @@ -291,7 +291,7 @@ quiet_cmd_link_o_target = LD      $@
>  cmd_link_o_target = $(if $(strip $(obj-y)),\
>                       $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^)
> \
>                       $(cmd_secanalysis),\
> -                     rm -f $@; $(AR) rcs $@)
> +                     rm -f $@; $(CC) -c -xassembler /dev/null -o $@)
>  
>  $(builtin-target): $(obj-y) FORCE
>         $(call if_changed,link_o_target)
> -----
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] Makefile.build: Fix built-in.o linking errors
@ 2009-12-18  1:04 Jiafu He
  0 siblings, 0 replies; 3+ messages in thread
From: Jiafu He @ 2009-12-18  1:04 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild

Michal wrote:
> > --- a/scripts/Makefile.build
> > +++ b/scripts/Makefile.build
> > @@ -82,7 +82,7 @@ ifneq ($(strip $(lib-y) $(lib-m) $(lib-n) $(lib-)),)
> >  lib-target := $(obj)/lib.a
> >  endif
> >  
> > -ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(lib-target)),)
> > +ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(subdir-m)
> > $(lib-target)),)
> >  builtin-target := $(obj)/built-in.o
> >  endif
> 
> Ack on this part, I need to think a bit more about the second part :).
> Could you please send two separate patches, they fix two independent
> issues after all.
> 
Sure. I'll resend the patches in two.

Thanks.

Jiafu



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-12-18  1:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-17  0:01 [PATCH] Makefile.build: Fix built-in.o linking errors Jiafu He
2009-12-17 22:34 ` Michal Marek
  -- strict thread matches above, loose matches on Subject: below --
2009-12-18  1:04 Jiafu He

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).