From a6317038378533b5a32c6c9de6b8d2afcf8e6026 Mon Sep 17 00:00:00 2001 From: Anhad Singh Date: Wed, 15 Jan 2025 19:16:37 +1100 Subject: [PATCH] cleanup(makefile): unify rule for libc.so Does the same thing. Signed-off-by: Anhad Singh --- Makefile | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index c9a8b2bfad..a76a66c630 100644 --- a/Makefile +++ b/Makefile @@ -168,6 +168,19 @@ test: sysroot $(MAKE) -C tests run $(MAKE) -C tests verify + +$(BUILD)/$(PROFILE)/libc.so: $(BUILD)/$(PROFILE)/librelibc.a $(BUILD)/openlibm/libopenlibm.a + $(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 $@ + # Debug targets $(BUILD)/debug/libc.a: $(BUILD)/debug/librelibc.a $(BUILD)/openlibm/libopenlibm.a @@ -179,9 +192,6 @@ $(BUILD)/debug/libc.a: $(BUILD)/debug/librelibc.a $(BUILD)/openlibm/libopenlibm. echo "end" >> "$@.mri" $(AR) -M < "$@.mri" -$(BUILD)/debug/libc.so: $(BUILD)/debug/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 $@ - $(BUILD)/debug/librelibc.a: $(SRC) $(CARGO) rustc $(CARGOFLAGS) -- --emit link=$@ -g -C debug-assertions=no $(RUSTCFLAGS) ./renamesyms.sh "$@" "$(BUILD)/debug/deps/" @@ -217,17 +227,6 @@ $(BUILD)/release/libc.a: $(BUILD)/release/librelibc.a $(BUILD)/openlibm/libopenl echo "end" >> "$@.mri" $(AR) -M < "$@.mri" -$(BUILD)/release/libc.so: $(BUILD)/release/librelibc.a $(BUILD)/openlibm/libopenlibm.a - $(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) # TODO: Better to only allow a certain whitelisted set of symbols? Perhaps