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>
This commit is contained in:
Anton Staaf
2014-06-03 14:56:54 -07:00
committed by chrome-internal-fetch
parent 8b5277defe
commit 2a7ea56782

View File

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