Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.

Commit af6c2af

Browse files
committed
Statically link certain libraries
This arranges to statically link gdb against ncurses, xz, and expat; while continuing to dynamically link against python and libc.
1 parent d29d94b commit af6c2af

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

gdb/Makefile.in

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ READLINE_DEPS = @READLINE_DEPS@
184184
READLINE_CFLAGS = @READLINE_CFLAGS@
185185

186186
# Where is expat? This will be empty if expat was not available.
187-
LIBEXPAT = @LIBEXPAT@
187+
LIBEXPAT = -Wl,-Bstatic @LIBEXPAT@ -Wl,-Bdynamic
188188

189189
# Where is lzma? This will be empty if lzma was not available.
190-
LIBLZMA = @LIBLZMA@
190+
LIBLZMA = -Wl,-Bstatic @LIBLZMA@ -Wl,-Bdynamic
191191

192192
# Where is libbabeltrace? This will be empty if lbabeltrace was not
193193
# available.
@@ -589,6 +589,10 @@ INTERNAL_LDFLAGS = \
589589
$(CXXFLAGS) $(GLOBAL_CFLAGS) $(MH_LDFLAGS) \
590590
$(LDFLAGS) $(CONFIG_LDFLAGS)
591591

592+
CONF_LIBS = @LIBS@
593+
comma = ,
594+
LIBS = $(patsubst -lncursesw,-Wl$(comma)-Bstatic -lncursesw -ltinfo -Wl$(comma)-Bdynamic,$(CONF_LIBS))
595+
592596
# If your system is missing alloca(), or, more likely, it's there but
593597
# it doesn't work, then refer to libiberty.
594598

@@ -597,7 +601,7 @@ INTERNAL_LDFLAGS = \
597601
# LIBIBERTY appears twice on purpose.
598602
CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(ZLIB) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \
599603
$(XM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) \
600-
@LIBS@ @GUILE_LIBS@ @PYTHON_LIBS@ \
604+
$(LIBS) @GUILE_LIBS@ @PYTHON_LIBS@ \
601605
$(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) $(LIBIPT) \
602606
$(LIBIBERTY) $(WIN32LIBS) $(LIBGNU) $(LIBICONV) $(LIBMPFR)
603607
CDEPS = $(XM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) \

0 commit comments

Comments
 (0)