]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
Basic support for PIE (position-independent executables).
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 3 Dec 2005 08:48:15 +0000 (08:48 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 3 Dec 2005 08:48:15 +0000 (08:48 +0000)
* libltdl/config/ltmain.m4sh (func_generate_dlsyms):
Don't pass PIE flag for compilation of the symbol file object.
* NEWS: Updated.

ChangeLog
NEWS
libltdl/config/ltmain.m4sh

index 0c109a5b0817f1db72bead6ad58191ad43cb7caf..2bab1e9a60c3e49a78f5181c32c2be2eebd7dde5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,18 @@
 2005-12-03  Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
 
-       * libltdl/config/general.m4sh (func_show_eval):
-       Rewrite use the failure expression, because the exit status of
-       the previous command may not be preserved in the next `eval' by
-       some shells, such as pdksh.
+       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.
+
+2005-12-03  Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+       * libltdl/config/general.m4sh (func_show_eval): Rewrite use of
+       the failure expression, because the exit status of the previous
+       command may not be preserved in the next `eval' by some shells,
+       such as pdksh.
        * libltdl/config/ltmain.m4sh (func_extract_an_archive):
        Use func_show_eval correctly.
        (func_mode_link): Likewise.  Also, do not use `$status'.
diff --git a/NEWS b/NEWS
index 1c1dab808160125aa6662761c7a1c81a1f990043..ecb3c51835cf7e7e0b32748b6af1896113953bbe 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,7 @@ New in 1.9h: 2005-??-??; CVS version 2.1a, Libtool team:
 * 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.
 \f
 New in 1.9f: 2004-10-23; CVS version 1.9e, Libtool team:
index e7b5f4089edada47e7fe5119c9e22048babd6414..28a9c3d8571ba4587d3d2bcbf83e506467de0e6e 100644 (file)
@@ -968,9 +968,16 @@ static const void *lt_preloaded_setup() {
          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 @@ func_mode_compile ()
     arg_mode=normal
     libobj=
     later=
+    pie_flag=
 
     for arg
     do
@@ -1134,6 +1142,11 @@ func_mode_compile ()
          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 @@ EOF
     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