diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-12-31 17:03:46 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-12-31 17:03:46 -0500 |
| commit | ebf1d72462d6eda772eaff6409e68a1a51eff005 (patch) | |
| tree | 111d23974a8bb09530c3eb3c9861d286cb093886 | |
| parent | 89cd101af0b432c14eabb7d16a868834e0a42726 (diff) | |
Remove LTO and add some stripping
| -rw-r--r-- | Makefile | 9 | ||||
| -rwxr-xr-x | configure.sh | 11 | ||||
| -rw-r--r-- | src/tomo.c | 1 |
3 files changed, 7 insertions, 14 deletions
@@ -83,7 +83,7 @@ O=-O3 # Note: older versions of Make have buggy behavior with hash marks inside strings, so this ugly code is necessary: TOMO_VERSION=$(shell awk 'BEGIN{hashes=sprintf("%c%c",35,35)} $$1==hashes {print $$2; exit}' CHANGES.md) GIT_VERSION=$(shell git log -1 --pretty=format:"%as_%h" 2>/dev/null || echo "unknown") -CFLAGS+=$(CCONFIG) $(INCLUDE_DIRS) $(EXTRA) $(CWARN) $(G) $(O) $(OSFLAGS) $(LTO) \ +CFLAGS+=$(CCONFIG) $(INCLUDE_DIRS) $(EXTRA) $(CWARN) $(G) $(O) $(OSFLAGS) \ -DSUDO='"$(SUDO)"' -DDEFAULT_C_COMPILER='"$(DEFAULT_C_COMPILER)"' \ -DGIT_VERSION='"$(GIT_VERSION)"' -ffunction-sections -fdata-sections CFLAGS_PLACEHOLDER="$$(printf '\033[2m<flags...>\033[m\n')" @@ -140,8 +140,13 @@ $(BUILD_DIR)/bin/$(EXE_FILE): $(STDLIB_OBJS) $(COMPILER_OBJS) build/gc/lib/libgc @$(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) $^ -o $@ $(BUILD_DIR)/lib/$(AR_FILE): $(STDLIB_OBJS) build/gc/lib/libgc.a build/unistring/lib/libunistring.a build/gmp/lib/libgmp.a | $(BUILD_DIR)/lib - $(CC) -no-pie -r -flto -nostdlib $^ -o libtomo.o + $(CC) -no-pie -r -nostdlib $^ -o libtomo.o + strip --strip-all --strip-unneeded --remove-section=.comment \ + --remove-section=.note --remove-section=.note.gnu.build-id \ + --remove-section=.eh_frame --remove-section=.eh_frame_hdr \ + --remove-section=.gnu_debuglink libtomo.o ar rcs $@ libtomo.o + rm -f libtomo.o $(BUILD_DIR)/lib/tomo@$(TOMO_VERSION)/modules.ini: modules/core.ini modules/examples.ini | $(BUILD_DIR)/lib/tomo@$(TOMO_VERSION) @cat $^ > $@ diff --git a/configure.sh b/configure.sh index a4a8daa5..1b5bd272 100755 --- a/configure.sh +++ b/configure.sh @@ -37,19 +37,8 @@ read DEFAULT_C_COMPILER if [ -z "$DEFAULT_C_COMPILER" ]; then DEFAULT_C_COMPILER="cc"; fi DEFAULT_C_COMPILER="${DEFAULT_C_COMPILER/#\~/$HOME}" -printf '\033[1mDo you want to build the compiler with Link Time Optimization (LTO)?\033[m\n\033[2m(This makes building the Tomo compiler slower, but makes running Tomo programs faster)\033[m\n\033[1m[y/N]\033[m ' -read USE_LTO -if [ "$USE_LTO" = "y" -o "$USE_LTO" = "Y" ]; then - if $DEFAULT_C_COMPILER -v 2>&1 | grep -q "gcc version"; then - LTO="-flto=auto -fno-fat-lto-objects -Wl,-flto"; - elif $DEFAULT_C_COMPILER -v 2>&1 | grep -q "clang version"; then - LTO="-flto=thin"; - fi -fi - cat <<END >config.mk PREFIX=$PREFIX DEFAULT_C_COMPILER=$DEFAULT_C_COMPILER SUDO=$SUDO -LTO=$LTO END @@ -81,7 +81,6 @@ static OptionalText_t show_codegen = NONE_TEXT, cflags = Text("-Werror -fdollars-in-identifiers -std=c2x -Wno-trigraphs" " -ffunction-sections -fdata-sections" " -fno-signed-zeros" - " -flto=auto -fno-fat-lto-objects -Wl,-flto" " -D_XOPEN_SOURCE -D_DEFAULT_SOURCE -fPIC -ggdb" #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) " -D_BSD_SOURCE" |
