summaryrefslogtreecommitdiff
path: root/Makefile.rules
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2014-06-03 14:56:54 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-06-04 21:01:16 +0000
commit2a7ea567829eae57fa7b05bf23a57dd13823d56e (patch)
tree65d31bb34f24f947ac6e0018e27bbd8119ae3147 /Makefile.rules
parent8b5277defe449ba1c91066689ad457aad4c24851 (diff)
downloadchrome-ec-2a7ea567829eae57fa7b05bf23a57dd13823d56e.tar.gz
build: Move libs after source or object files
When not using gold as the linker the ordering of libraries with respect to objects and source files is important. Previously the build placed -l libraries before source and objects on the gcc command line. This doesn't work with the default ld linker because since none of the symbols in the libraries are yet required they are thrown out before their uses are found in the objects and source. BUG=none BRANCH=none TEST=make buildall Change-Id: Ic9f83ba6138d6592d3b6e28de6fb0688e664f480 Reviewed-on: https://chromium-review.googlesource.com/202469 Tested-by: Anton Staaf <robotboy@google.com> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Anton Staaf <robotboy@google.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'Makefile.rules')
-rw-r--r--Makefile.rules7
1 files changed, 4 insertions, 3 deletions
diff --git a/Makefile.rules b/Makefile.rules
index a2c3cb60c4..9319b3bddc 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -40,11 +40,12 @@ cmd_flat_to_obj = $(CC) -T $(out)/firmware_image.lds -nostdlib $(CPPFLAGS) \
-Wl,--build-id=none -o $@ $<
cmd_elf_to_flat = $(OBJCOPY) -O binary $^ $@
cmd_elf_to_dis = $(OBJDUMP) -D $< > $@
-cmd_elf = $(LD) $(LDFLAGS) $(objs) -o $@ -T $< -Map $(out)/$*.map
-cmd_exe = $(CC) $(HOST_TEST_LDFLAGS) $(objs) -o $@
+cmd_elf = $(LD) $(objs) $(LDFLAGS) -o $@ -T $< -Map $(out)/$*.map
+cmd_exe = $(CC) $(objs) $(HOST_TEST_LDFLAGS) -o $@
cmd_c_to_o = $(CC) $(CFLAGS) -MMD -MF $@.d -c $< -o $@
-cmd_c_to_build = $(BUILDCC) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) \
+cmd_c_to_build = $(BUILDCC) $(BUILD_CFLAGS) \
$(sort $(foreach c,$($(*F)-objs),util/$(c:%.o=%.c)) $*.c) \
+ $(BUILD_LDFLAGS) \
-MMD -MF $@.d -o $@
cmd_c_to_host = $(HOSTCC) $(HOST_CFLAGS) -MMD -MF $@.d -o $@ \
$(sort $(foreach c,$($(*F)-objs),util/$(c:%.o=%.c)) $*.c)