From cf21cf24fc496d31938136c804cd2cffadf8c63f Mon Sep 17 00:00:00 2001 From: Anhad Singh Date: Tue, 14 Jan 2025 15:49:13 +1100 Subject: [PATCH] feat(libc.so): link flags * -z pack-relative-relocs * --sort-common * --gc-sections Signed-off-by: Anhad Singh --- Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1edf530c9b..c9a8b2bfad 100644 --- a/Makefile +++ b/Makefile @@ -218,7 +218,15 @@ $(BUILD)/release/libc.a: $(BUILD)/release/librelibc.a $(BUILD)/openlibm/libopenl $(AR) -M < "$@.mri" $(BUILD)/release/libc.so: $(BUILD)/release/librelibc.a $(BUILD)/openlibm/libopenlibm.a - $(CC) -nostdlib -shared -Wl,--allow-multiple-definition -Wl,--whole-archive $^ -Wl,--no-whole-archive -Wl,-soname,libc.so.6 -lgcc -o $@ + $(CC) -nostdlib -shared \ + -Wl,--gc-sections \ + -Wl,-z,pack-relative-relocs \ + -Wl,--sort-common \ + -Wl,--allow-multiple-definition \ + -Wl,--whole-archive $^ -Wl,--no-whole-archive \ + -Wl,-soname,libc.so.6 \ + -lgcc \ + -o $@ $(BUILD)/release/librelibc.a: $(SRC) $(CARGO) rustc --release $(CARGOFLAGS) -- --emit link=$@ $(RUSTCFLAGS)