]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
libtool: prevent lto from stripping the magic cookie from the cwrapper
authorPeter Rosin <peda@lysator.liu.se>
Fri, 2 May 2014 12:51:02 +0000 (14:51 +0200)
committerPeter Rosin <peda@lysator.liu.se>
Fri, 2 May 2014 12:52:30 +0000 (14:52 +0200)
Whole program optimization may remove unused symbols unless told they
are really needed. Fixes sr #108559 reported by LRN.

* build-aux/ltmain.in (func_emit_cwrapperexe_src:MAGIC_EXE): Try to ensure
that the magic cookie is preserved.

Signed-off-by: Peter Rosin <peda@lysator.liu.se>
build-aux/ltmain.in

index f8e0f5fbb3be0dd4439a265c74b687b5c0c3aea9..3a0fb0c521c3c4fcc70a5290e14206e515615c2d 100644 (file)
@@ -3738,7 +3738,12 @@ void lt_dump_script (FILE *f);
 EOF
 
            cat <<EOF
-volatile const char * MAGIC_EXE = "$magic_exe";
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
+# define externally_visible volatile
+#else
+# define externally_visible __attribute__((externally_visible)) volatile
+#endif
+externally_visible const char * MAGIC_EXE = "$magic_exe";
 const char * LIB_PATH_VARNAME = "$shlibpath_var";
 EOF