libtool-patches
[Top][All Lists]
Advanced

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

RE: allow specific flags through to the linker without modification


From: Boehne, Robert
Subject: RE: allow specific flags through to the linker without modification
Date: Thu, 8 May 2003 13:19:05 -0500

Peter,

I think this should be doable with -XCompiler, -Xlinker and -XCClinker.
>From the manual:
  You can pass link specific flags to the compiler driver using `-XCClinker 
flag'
  or pass linker flags with `-Wl,flag' and `-Xlinker flag'.  You can also pass
  compile specific flags using `-Wc,flag' and `-Xcompiler flag'. 

The intent is to allow anything that a user might want to have on the
compiler driver's invocation to be possible.  Can what you want to
achieve be done this way?

Thanks,

Rob

-----Original Message-----
From: Peter O'Gorman [mailto:address@hidden
Sent: Wednesday, May 07, 2003 6:41 PM
To: address@hidden
Subject: allow specific flags through to the linker without modification


Hello,

I proposed this on the libtool list, but got no response, so I thought 
I'd propose it again as a patch :)

Any flags set in pass_thru_flags_no_arg and pass_thru_flags_1_arg in 
libtool.m4 are passed directly in $compiler_flags and $linker_flags 
without modification.

I also added these flags to the darwin section of libtool.m4

_LT_AC_TAGVAR(pass_thru_flags_no_arg, $1)='-F*'
_LT_AC_TAGVAR(pass_thru_flags_1_arg, $1)='-framework -bundle_loader 
-seg1addr -init -seg_addr_table -dylib_file'

So adding "-F./foo -framework foo" to the LDFLAGS will pass these 
straight through to gcc.
I put this at the start of option processing so that the guy who wanted 
-Wc,DLL to go straight through can do that.

No ChangeLog entry, this is a call for comments :)

Peter

Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.318
diff -u -d -b -w -u -r1.318 libtool.m4
--- libtool.m4  11 Apr 2003 02:15:48 -0000      1.318
+++ libtool.m4  7 May 2003 23:39:01 -0000
@@ -2518,7 +2518,8 @@
  # Report which librarie types wil actually be built
  AC_MSG_CHECKING([if libtool supports shared libraries])
  AC_MSG_RESULT([$can_build_shared])
-
+_LT_AC_TAGVAR(pass_thru_flags_no_arg, $1)=
+_LT_AC_TAGVAR(pass_thru_flags_1_arg, $1)=
  AC_MSG_CHECKING([whether to build shared libraries])
  test "$can_build_shared" = "no" && enable_shared=no

@@ -2549,11 +2550,9 @@
        test -z ${LD_TWOLEVEL_NAMESPACE} && 
_LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined 
suppress'
        ;;
      esac
-    # FIXME: Relying on posixy $() will cause problems for
-    #        cross-compilation, but unfortunately the echo tests do not
-    #        yet detect zsh echo's removal of \ escapes.  Also zsh 
mangles
-    #         `"' quotes if we put them in here... so don't!
                output_verbose_link_cmd='echo'
+       _LT_AC_TAGVAR(pass_thru_flags_no_arg, $1)='-F*'
+       _LT_AC_TAGVAR(pass_thru_flags_1_arg, $1)='-framework -bundle_loader 
-seg1addr -init -seg_addr_table -dylib_file'
      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib 
$allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags 
-install_name $rpath/$soname $verstring'
      _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle $allow_undefined_flag 
-o $lib $libobjs $deplibs$compiler_flags'
      # Don't fix this by using the ld -exported_symbols_list flag, it 
doesn't exist in older darwin ld's
@@ -2610,6 +2609,8 @@
  _LT_AC_TAGVAR(no_undefined_flag, $1)=
  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
  _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+_LT_AC_TAGVAR(pass_thru_flags_no_arg, $1)=
+_LT_AC_TAGVAR(pass_thru_flags_1_arg, $1)=

  # Dependencies to place before and after the object being linked:
  _LT_AC_TAGVAR(predep_objects, $1)=
@@ -2877,6 +2878,8 @@
        test -z ${LD_TWOLEVEL_NAMESPACE} && 
_LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined 
suppress'
        ;;
      esac
+    _LT_AC_TAGVAR(pass_thru_flags_no_arg, $1)='-F*'
+    _LT_AC_TAGVAR(pass_thru_flags_1_arg, $1)='-framework 
-bundle_loader -seg1addr -init -seg_addr_table -dylib_file'
        lt_int_apple_cc_single_mod=no
        output_verbose_link_cmd='echo'
        if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
@@ -3626,6 +3629,8 @@
  _LT_AC_TAGVAR(no_undefined_flag, $1)=
  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
  _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+_LT_AC_TAGVAR(pass_thru_flags_no_arg, $1)=
+_LT_AC_TAGVAR(pass_thru_flags_1_arg, $1)=

  # Source file extension for f77 test sources.
  ac_ext=f
@@ -3827,6 +3832,8 @@
      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
      _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
      _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
+    _LT_AC_TAGVAR(pass_thru_flags_no_arg, $1) \
+    _LT_AC_TAGVAR(pass_thru_flags_1_arg, $1) \
      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
      _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
      _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
@@ -4063,6 +4070,10 @@
  # Compiler flag to turn off builtin functions.
  no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, 
$1)

+# Flags to pass straight to the linker
+pass_thru_flags_no_arg=$lt_[]_LT_AC_TAGVAR(pass_thru_flags_no_arg, $1)
+pass_thru_flags_1_arg=$lt_[]_LT_AC_TAGVAR(pass_thru_flags_1_arg, $1)
+
  # Compiler flag to allow reflexive dlopens.
  export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, 
$1)

@@ -5326,10 +5337,8 @@
        test -z ${LD_TWOLEVEL_NAMESPACE} && 
_LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined 
suppress'
        ;;
        esac
-      # FIXME: Relying on posixy $() will cause problems for
-      #        cross-compilation, but unfortunately the echo tests do 
not
-      #        yet detect zsh echo's removal of \ escapes.  Also zsh 
mangles
-      #               `"' quotes if we put them in here... so don't!
+      _LT_AC_TAGVAR(pass_thru_flags_no_arg, $1)='-F*'
+      _LT_AC_TAGVAR(pass_thru_flags_1_arg, $1)='-framework 
-bundle_loader -seg1addr -init -seg_addr_table -dylib_file'
        lt_int_apple_cc_single_mod=no
        output_verbose_link_cmd='echo'
        if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.335
diff -u -d -b -w -u -r1.335 ltmain.in
--- ltmain.in   9 Apr 2003 17:54:06 -0000       1.335
+++ ltmain.in   7 May 2003 23:39:01 -0000
@@ -1148,6 +1148,12 @@
          finalize_command="$finalize_command $qarg"
          continue
          ;;
+       passthru)
+         linker_flags="$linker_flags $qarg"
+         compiler_flags="$compiler_flags $qarg"
+         prev=
+         continue
+         ;;    
        *)
          eval "$prev=\"\$arg\""
          prev=
@@ -1155,8 +1161,40 @@
          ;;
        esac
        fi # test -n "$prev"
-
+# Pass through arguments in pass_thru_flags_no_arg and 
pass_thru_flags_1_arg
+# without doing anything to them, they were specifically defined in 
libtool.m4
        prevarg="$arg"
+    do_cont=no
+    for passtold in $pass_thru_flags_no_arg; do
+      case $arg in
+        $passtold)
+          arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+             compiler_flags="$compiler_flags $arg"
+             linker_flags="$linker_flags $arg"
+             do_cont=yes
+             break
+             ;;
+          esac
+       done
+       if test "$do_cont" = yes; then
+         continue
+       fi
+    for passtold in $pass_thru_flags_1_arg; do
+      case $arg in
+        $passtold)
+          arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+             compiler_flags="$compiler_flags $arg"
+             linker_flags="$linker_flags $arg"
+             prev=passthru
+             do_cont=yes
+             break
+             ;;
+          esac
+       done
+       if test "$do_cont" = yes; then
+         continue
+       fi      
+       

        case $arg in
        -all-static)




reply via email to

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