[committed] libstdc++: Build libstdc++_libbacktrace.a as PIC [PR111936]
Checks
Commit Message
Tested x86_64-linux. Pushed to trunk, will backport to 12 and 13.
-- >8 --
In order for std::stacktrace to be used in a shared library, the
libbacktrace symbols need to be built with -fPIC. Add the libtool
-prefer-pic flag to the commands in src/libbacktrace/Makefile so that
the archive contains PIC objects.
libstdc++-v3/ChangeLog:
PR libstdc++/111936
* src/libbacktrace/Makefile.am: Add -prefer-pic to libtool
compile commands.
* src/libbacktrace/Makefile.in: Regenerate.
---
libstdc++-v3/src/libbacktrace/Makefile.am | 8 ++++++--
libstdc++-v3/src/libbacktrace/Makefile.in | 7 ++++---
2 files changed, 10 insertions(+), 5 deletions(-)
@@ -49,9 +49,13 @@ WARN_FLAGS = -W -Wall -Wwrite-strings -Wmissing-format-attribute \
-Wcast-qual
C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wno-unused-but-set-variable
CXX_WARN_FLAGS = $(WARN_FLAGS) -Wno-unused-parameter
-AM_CFLAGS = $(C_WARN_FLAGS)
+AM_CFLAGS = \
+ $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
+ $(C_WARN_FLAGS)
AM_CFLAGS += $(EXTRA_CFLAGS)
-AM_CXXFLAGS = $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions
+AM_CXXFLAGS = \
+ $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
+ $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions
AM_CXXFLAGS += $(EXTRA_CXXFLAGS)
obj_prefix = std_stacktrace
@@ -472,9 +472,10 @@ libstdc___libbacktrace_la_CPPFLAGS = \
C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wno-unused-but-set-variable
CXX_WARN_FLAGS = $(WARN_FLAGS) -Wno-unused-parameter
-AM_CFLAGS = $(C_WARN_FLAGS) $(EXTRA_CFLAGS)
-AM_CXXFLAGS = $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions \
- $(EXTRA_CXXFLAGS)
+AM_CFLAGS = $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
+ $(C_WARN_FLAGS) $(EXTRA_CFLAGS)
+AM_CXXFLAGS = $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
+ $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions $(EXTRA_CXXFLAGS)
obj_prefix = std_stacktrace
# Each FILE.c in SOURCES will be compiled to SHORTNAME-FILE.o