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>
Wed, 28 Oct 2020 18:57:15 +0000 (14:57 -0400)
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.

Change-Id: I2b5f5c77865267e35c529dd17a0298cd4405303d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
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 7f92c465715474db8de38c28d7a1dc6a7e2f15bf..85677c83dc64507171e0599db34790c42f4c253d 100644 (file)
@@ -175,6 +175,11 @@ AX_CHECK_LINK_FLAG([-Wl,--whole-archive,--no-whole-archive],
   ]
 )
 
+# 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 398b5267cc9b6106e0d171a33cb78e54fbc113a4..104229d2de37844186007656791ce5959b9ced83 100644 (file)
@@ -13,7 +13,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 19cecac310319bdd689765181b82a470a00157de..d01e36fac376982e90aaa8fb8337b33c74b90d71 100644 (file)
@@ -18,7 +18,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 575baac3516fd8d801b1bf6690cfca757bb8d921..9d8ed88dd84ab00391df49789c847ff04f636702 100644 (file)
@@ -8,7 +8,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 4631d95015e689d4b1b2996772aa8d0006d64a7a..5cacc96191bb0f4714ce7402cfc49dd7de5a331a 100644 (file)
@@ -8,7 +8,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 c1826939cbbea699f5aeca922f30a3aad4dd50ba..62e48f7e17f241d4a221b365c2e221f740638871 100644 (file)
@@ -6,7 +6,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 \
@@ -16,7 +16,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.029205 seconds and 4 git commands to generate.