From a59bff614f67842539b69fe71f08b744b9b5f350 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Mon, 26 Sep 2022 14:42:01 -0700 Subject: [PATCH v2 3/5] aix: Build SUBSYS.o using $(CC) -r instead of $(LD) -r This is the only direct use of $(LD), and xlc -r and gcc -r end up with the same set of symbols and similar performance (noise is high, so hard to say if equivalent). Now that $(LD) isn't needed anymore, remove it from src/Makefile.global While at it, add a comment why -r is used. Author: Reviewed-by: Discussion: https://postgr.es/m/ Backpatch: --- src/backend/Makefile | 4 +++- configure | 2 -- configure.ac | 1 - src/Makefile.global.in | 3 --- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/backend/Makefile b/src/backend/Makefile index 181c217fae4..5b704bb3600 100644 --- a/src/backend/Makefile +++ b/src/backend/Makefile @@ -100,8 +100,10 @@ ifeq ($(PORTNAME), aix) postgres: $(POSTGRES_IMP) $(CC) $(CFLAGS) $(call expand_subsys,$(OBJS)) $(LDFLAGS) $(LDFLAGS_EX) -Wl,-bE:$(top_builddir)/src/backend/$(POSTGRES_IMP) $(LIBS) -Wl,-brtllib -o $@ +# linking to a single .o with -r is a lot faster than building a .a or passing +# all objects to MKLDEXPORT $(POSTGRES_IMP): $(OBJS) - $(LD) $(LDREL) $(LDOUT) SUBSYS.o $(call expand_subsys,$^) + $(CC) -r -o SUBSYS.o $(call expand_subsys,$^) $(MKLDEXPORT) SUBSYS.o . > $@ @rm -f SUBSYS.o diff --git a/configure b/configure index d338ae2cc8b..7eafefb062a 100755 --- a/configure +++ b/configure @@ -692,7 +692,6 @@ STRIP_SHARED_LIB STRIP_STATIC_LIB STRIP with_gnu_ld -LD LDFLAGS_SL LDFLAGS_EX ZSTD_LIBS @@ -9464,7 +9463,6 @@ with_gnu_ld=$ac_cv_prog_gnu_ld - if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 diff --git a/configure.ac b/configure.ac index 66c60974ef9..398eb422595 100644 --- a/configure.ac +++ b/configure.ac @@ -1127,7 +1127,6 @@ AC_ARG_VAR(LDFLAGS_EX, [extra linker flags for linking executables only]) AC_ARG_VAR(LDFLAGS_SL, [extra linker flags for linking shared libraries only]) PGAC_PROG_LD -AC_SUBST(LD) AC_SUBST(with_gnu_ld) PGAC_CHECK_STRIP AC_CHECK_TOOL(AR, ar, ar) diff --git a/src/Makefile.global.in b/src/Makefile.global.in index a5e2f36d217..8107643578b 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -289,7 +289,6 @@ LDAP_LIBS_FE = @LDAP_LIBS_FE@ LDAP_LIBS_BE = @LDAP_LIBS_BE@ UUID_LIBS = @UUID_LIBS@ LLVM_LIBS=@LLVM_LIBS@ -LD = @LD@ with_gnu_ld = @with_gnu_ld@ # It's critical that within LDFLAGS, all -L switches pointing to build-tree @@ -316,8 +315,6 @@ LDFLAGS = $(LDFLAGS_INTERNAL) @LDFLAGS@ LDFLAGS_EX = @LDFLAGS_EX@ # LDFLAGS_SL might have already been assigned by calling makefile LDFLAGS_SL += @LDFLAGS_SL@ -LDREL = -r -LDOUT = -o WINDRES = @WINDRES@ X = @EXEEXT@ -- 2.37.3.542.gdd3f6c4cae