[Concept,13/18] ulib: Makefile: Plumb in renaming symbols for ulib
Commit Message
From: Simon Glass <sjg@chromium.org>
Plumb this feature in, so that symbols are renamed as expected.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Makefile | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
@@ -1880,32 +1880,26 @@ quiet_cmd_ulib-objs = OBJS $@
# Build U-Boot as a shared library
quiet_cmd_libu-boot.so = LD $@
- cmd_libu-boot.so = $(CC) -shared -o $@ -Wl,--build-id=none \
+ cmd_libu-boot.so = \
+ $(CC) -shared -o $@ -Wl,--build-id=none \
-Wl,-T,$(LIB_LDS) \
- $(u-boot-init) \
$(KBUILD_LDFLAGS:%=-Wl,%) $(SANITIZERS) $(LTO_FINAL_LDFLAGS) \
-Wl,--whole-archive \
- $(filter-out %/main.o,$(u-boot-main)) \
- $(u-boot-keep-syms-lto) \
+ $$(cat .ulib-objs) \
-Wl,--no-whole-archive \
$(PLATFORM_LIBS) -Wl,-Map -Wl,libu-boot.map
-libu-boot.so: $(u-boot-init) $(u-boot-main) $(u-boot-keep-syms-lto) \
- $(LIB_LDS) FORCE
+libu-boot.so: .ulib-objs $(LIB_LDS) include/u-boot-api.h FORCE
$(call if_changed,libu-boot.so)
# Build U-Boot as a static library
# Create a fat archive with all object files (except arch/sandbox/cpu/main.o)
# Avoid partial linking so as to preserve the linker-list sections
quiet_cmd_libu-boot.a = AR $@
- cmd_libu-boot.a = rm -f $@ $@.tmp $@.objlist; \
- $(AR) rcT $@.tmp $(u-boot-init) $(u-boot-main) \
- $(u-boot-keep-syms-lto); \
- $(AR) t $@.tmp | grep -v "arch/sandbox/cpu/main\.o$$" > $@.objlist; \
- cat $@.objlist | xargs $(AR) rcs $@; \
- rm -f $@.tmp $@.objlist
+ cmd_libu-boot.a = rm -f $@; \
+ cat .ulib-objs | xargs $(AR) rcs $@
-libu-boot.a: $(u-boot-init) $(u-boot-main) $(u-boot-keep-syms-lto) FORCE
+libu-boot.a: .ulib-objs include/u-boot-api.h FORCE
$(call if_changed,libu-boot.a)
# Build ulib_test that links with shared library
@@ -2347,7 +2341,9 @@ CLEAN_FILES += include/autoconf.mk* include/bmp_logo.h include/bmp_logo_data.h \
mkimage.rom.mkimage mkimage-in-simple-bin* rom.map simple-bin* \
idbloader-spi.img lib/efi_loader/helloworld_efi.S *.itb \
Test* capsule*.*.efi-capsule capsule*.map \
- test/ulib/ulib_test test/ulib/ulib_test_static
+ test/ulib/ulib_test test/ulib/ulib_test_static \
+ libu-boot.so.tmp libu-boot.so.objlist \
+ libu-boot.a.tmp libu-boot.a.objlist
# Directories & files removed with 'make mrproper'
MRPROPER_DIRS += include/config include/generated spl tpl vpl \