Skip to content

Commit 069de07

Browse files
committed
autoconf: Don't AC_SUBST() LD in configure
The only use of $(LD) in Makefiles is for AIX, to generate the export file for the backend. We only support the system linker on AIX and we already hardcode the path to a number of other binaries. Removing LD substitution will simplify the upcoming meson PGXS compatibility. While at it, add a comment why -r is used. A subsequent commit will remove the determination of LD from configure as well. Discussion: https://postgr.es/m/20221005200710.luvw5evhwf6clig6@awork3.anarazel.de
1 parent e0f0e08 commit 069de07

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

configure

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,6 @@ STRIP_SHARED_LIB
693693
STRIP_STATIC_LIB
694694
STRIP
695695
with_gnu_ld
696-
LD
697696
LDFLAGS_SL
698697
LDFLAGS_EX
699698
ZSTD_LIBS
@@ -9645,7 +9644,6 @@ with_gnu_ld=$ac_cv_prog_gnu_ld
96459644

96469645

96479646

9648-
96499647
if test -n "$ac_tool_prefix"; then
96509648
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
96519649
set dummy ${ac_tool_prefix}strip; ac_word=$2

configure.ac

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,6 @@ AC_ARG_VAR(LDFLAGS_EX, [extra linker flags for linking executables only])
11321132
AC_ARG_VAR(LDFLAGS_SL, [extra linker flags for linking shared libraries only])
11331133

11341134
PGAC_PROG_LD
1135-
AC_SUBST(LD)
11361135
AC_SUBST(with_gnu_ld)
11371136
PGAC_CHECK_STRIP
11381137
AC_CHECK_TOOL(AR, ar, ar)

src/Makefile.global.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ LDAP_LIBS_FE = @LDAP_LIBS_FE@
289289
LDAP_LIBS_BE = @LDAP_LIBS_BE@
290290
UUID_LIBS = @UUID_LIBS@
291291
LLVM_LIBS=@LLVM_LIBS@
292-
LD = @LD@
293292
with_gnu_ld = @with_gnu_ld@
294293

295294
# It's critical that within LDFLAGS, all -L switches pointing to build-tree
@@ -316,8 +315,6 @@ LDFLAGS = $(LDFLAGS_INTERNAL) @LDFLAGS@
316315
LDFLAGS_EX = @LDFLAGS_EX@
317316
# LDFLAGS_SL might have already been assigned by calling makefile
318317
LDFLAGS_SL += @LDFLAGS_SL@
319-
LDREL = -r
320-
LDOUT = -o
321318
WINDRES = @WINDRES@
322319
X = @EXEEXT@
323320

src/backend/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,14 @@ ifeq ($(PORTNAME), aix)
100100
postgres: $(POSTGRES_IMP)
101101
$(CC) $(CFLAGS) $(call expand_subsys,$(OBJS)) $(LDFLAGS) $(LDFLAGS_EX) -Wl,-bE:$(top_builddir)/src/backend/$(POSTGRES_IMP) $(LIBS) -Wl,-brtllib -o $@
102102

103+
# Linking to a single .o with -r is a lot faster than building a .a or passing
104+
# all objects to MKLDEXPORT.
105+
#
106+
# It looks alluring to use $(CC) -r instead of ld -r, but that doesn't
107+
# trivially work with gcc, due to gcc specific static libraries linked in with
108+
# -r.
103109
$(POSTGRES_IMP): $(OBJS)
104-
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(call expand_subsys,$^)
110+
ld -r -o SUBSYS.o $(call expand_subsys,$^)
105111
$(MKLDEXPORT) SUBSYS.o . > $@
106112
@rm -f SUBSYS.o
107113

0 commit comments

Comments
 (0)