port: add 'notext' keyword linker support
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 19 Oct 2020 16:26:36 +0000 (12:26 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 19 Feb 2021 18:57:22 +0000 (13:57 -0500)
Check if the linker support the 'notext' keyword to allow relocations
against read-only segments. GNU ld defaults to notext but LLVM's ld does
not, both linkers support the keyword.

This is required for the plugins section symbols.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I952586447a837ce48711a218a2d03050ef3deb1a

configure.ac
src/plugins/ctf/Makefile.am
src/plugins/lttng-utils/Makefile.am
src/plugins/text/Makefile.am
src/plugins/utils/Makefile.am
tests/lib/test-plugin-plugins/Makefile.am

index ee22576f5f07114d703c7c53cbec9c570c1b4b75..f5b0d39215fe4821522208e23e0c8ff0772cb189 100644 (file)
@@ -195,6 +195,11 @@ AX_CHECK_LINK_FLAG([-Wl,--whole-archive,--no-whole-archive],
 # Initialize and configure libtool
 LT_INIT([win32-dll])
 
+# Check if the linker supports the "notext" keyword
+AX_CHECK_LINK_FLAG([-Wl,-z,notext],[
+       AC_SUBST([LD_NOTEXT], [-Wl,-z,notext])
+])
+
 
 ##                 ##
 ## Programs checks ##
index 783a06dd7835bfa697598b29aba7ab1fef2069cf..ec711cb8ba7996b2fcfd7f42e1ffd99508142f67 100644 (file)
@@ -11,7 +11,7 @@ babeltrace_plugin_ctf_la_SOURCES = plugin.c
 
 babeltrace_plugin_ctf_la_LDFLAGS = \
        $(LT_NO_UNDEFINED) \
-       -avoid-version -module
+       -avoid-version -module $(LD_NOTEXT)
 
 babeltrace_plugin_ctf_la_LIBADD = \
        common/libbabeltrace2-plugin-ctf-common.la \
index 52939803eec550f7ed393d0b5ea55c9ff19bc815..68e906474aa1a3858a6537fdcaaafbff2c273d9d 100644 (file)
@@ -16,7 +16,7 @@ babeltrace_plugin_lttng_utils_la_SOURCES = \
 
 babeltrace_plugin_lttng_utils_la_LDFLAGS = \
        $(LT_NO_UNDEFINED) \
-       -avoid-version -module \
+       -avoid-version -module $(LD_NOTEXT) \
        $(ELFUTILS_LIBS)
 
 if !ENABLE_BUILT_IN_PLUGINS
index 7ba0037177725d18ee74ee665e601b9580d2e4d9..f04f20abc21aa8217bde040327e9fa8bbfea054f 100644 (file)
@@ -6,7 +6,7 @@ plugin_LTLIBRARIES = babeltrace-plugin-text.la
 babeltrace_plugin_text_la_SOURCES = plugin.c
 babeltrace_plugin_text_la_LDFLAGS = \
        $(LT_NO_UNDEFINED) \
-       -avoid-version -module
+       -avoid-version -module $(LD_NOTEXT)
 
 babeltrace_plugin_text_la_LIBADD = \
        pretty/libbabeltrace2-plugin-text-pretty-cc.la \
index 3b525afe614ae609a078bca6a60d34647774f4c4..aedf2dcb4b9da9b6193d5db54a715a048ab8ecda 100644 (file)
@@ -6,7 +6,7 @@ plugin_LTLIBRARIES = babeltrace-plugin-utils.la
 babeltrace_plugin_utils_la_SOURCES = plugin.c
 babeltrace_plugin_utils_la_LDFLAGS = \
        $(LT_NO_UNDEFINED) \
-       -avoid-version -module
+       -avoid-version -module $(LD_NOTEXT)
 babeltrace_plugin_utils_la_LIBADD = \
        dummy/libbabeltrace2-plugin-dummy-cc.la \
        muxer/libbabeltrace2-plugin-muxer.la \
index d6c940b216d1e29773c9aec7a2aba3ed38dc8a33..613a91073747442a589d9be23d40fd976e6c4e61 100644 (file)
@@ -4,7 +4,7 @@ noinst_LTLIBRARIES = plugin-minimal.la plugin-sfs.la
 plugin_minimal_la_SOURCES = minimal.c
 plugin_minimal_la_LDFLAGS = \
        $(LT_NO_UNDEFINED) \
-       -rpath / -avoid-version -module
+       -rpath / -avoid-version -module $(LD_NOTEXT)
 plugin_minimal_la_LIBADD = \
        $(top_builddir)/src/lib/libbabeltrace2.la \
        $(top_builddir)/src/common/libbabeltrace2-common.la \
@@ -14,7 +14,7 @@ plugin_minimal_la_LIBADD = \
 plugin_sfs_la_SOURCES = sfs.c
 plugin_sfs_la_LDFLAGS = \
        $(LT_NO_UNDEFINED) \
-       -rpath / -avoid-version -module
+       -rpath / -avoid-version -module $(LD_NOTEXT)
 plugin_sfs_la_LIBADD = \
        $(top_builddir)/src/lib/libbabeltrace2.la \
        $(top_builddir)/src/common/libbabeltrace2-common.la \
This page took 0.027322 seconds and 4 git commands to generate.