[PATCH] Makefile.build: Fix built-in.o linking errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
-----
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)
-----

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux