libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: PIE support


From: Ralf Wildenhues
Subject: FYI: PIE support
Date: Sat, 3 Dec 2005 09:48:17 +0100
User-agent: Mutt/1.5.11

[ moving from the libtool list ]

Applied to HEAD.

Cheers,
Ralf

        Basic support for PIE (position-independent executables).

        * libltdl/config/ltmain.m4sh (func_generate_dlsyms):
        Don't pass PIE flag for compilation of the symbol file object.
        (func_mode_compile): Pass PIE flag only for non-PIC objects.
        * NEWS: Updated.

Index: NEWS
===================================================================
RCS file: /cvsroot/libtool/libtool/NEWS,v
retrieving revision 1.189
diff -u -r1.189 NEWS
--- NEWS        20 Nov 2005 08:45:53 -0000      1.189
+++ NEWS        3 Dec 2005 08:44:45 -0000
@@ -29,6 +29,7 @@
 * Fixed a branch-1-5/HEAD regression to only link uninstalled libraries
   statically with `-static'.
 * Support for Interix 3 (Windows SFU).
+* Basic support for PIE (position-independent executables).
 * Bug fixes.
 
 New in 1.9f: 2004-10-23; CVS version 1.9e, Libtool team:
Index: libltdl/config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.22
diff -u -r1.22 ltmain.m4sh
--- libltdl/config/ltmain.m4sh  3 Dec 2005 08:33:48 -0000       1.22
+++ libltdl/config/ltmain.m4sh  3 Dec 2005 08:44:46 -0000
@@ -968,9 +968,16 @@
          esac
          ;;
        esac
+       symtab_cflags=
+       for arg in $LTCFLAGS; do
+         case $arg in
+         -pie | -fpie | -fPIE) ;;
+         *) symtab_cflags="$symtab_cflags $arg" ;;
+         esac
+       done
 
        # Now compile the dynamic symbol file.
-       func_show_eval '(cd $output_objdir && $LTCC $LTCFLAGS 
-c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
+       func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags 
-c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
 
        # Clean up the generated files.
        func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" 
"${nlist}T"'
@@ -1108,6 +1115,7 @@
     arg_mode=normal
     libobj=
     later=
+    pie_flag=
 
     for arg
     do
@@ -1134,6 +1142,11 @@
          continue
          ;;
 
+       -pie | -fpie | -fPIE)
+          pie_flag="$pie_flag $arg"
+         continue
+         ;;
+
        -shared | -static | -prefer-pic | -prefer-non-pic)
          later="$later $arg"
          continue
@@ -1423,7 +1436,7 @@
     if test "$build_old_libs" = yes; then
       if test "$pic_mode" != yes; then
        # Don't build PIC code
-       command="$base_compile $qsrcfile"
+       command="$base_compile $qsrcfile$pie_flag"
       else
        command="$base_compile $qsrcfile $pic_flag"
       fi




reply via email to

[Prev in Thread] Current Thread [Next in Thread]