On Mon, Apr 09, 2018 at 04:21:54AM -0500, Yaakov Selkowitz wrote:
> On 2018-04-09 03:59, Florian Weimer wrote:
> > Is there a recommend way to get libtool to pass through all flags
> > specified in CFLAGS and LDFLAGS unchanged, and have the GCC compiler
> > driver sort out which flags to pass to the compiler/assembler/linker?
> 
> $ libtool --mode=compile --help
> [snip]
> This mode accepts the following additional options:
> [snip]
>   -Wc,FLAG          pass FLAG directly to the compiler
> 
> $ libtool --mode=link --help
> [snip]
> The following components of LINK-COMMAND are treated specially:
> [snip]
>   -Wc,FLAG
>   -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
>   -Wl,FLAG
>   -Xlinker FLAG     pass linker-specific FLAG directly to the linker
> 
> But, often when this happens, it is the fault of a poorly written
> configure.ac or Makefile.am.  Where exactly are you seeing an issue?

Even if you use -Wl,FLAG, libtool may well still screw it up, because it
arbitrarily re-orders all -Wl,FLAG args to come after/ the -lLIB args.
This breaks flags which are position sensitive like -Wl,--as-needed
eg

  libdemo_la_LDFLAGS = -Wl,--as-needed -lm -Wl,--no-as-needed -lvirt

will get turned into

  gcc .... -lm -lvirt -Wl,--as-needed -Wl,--no-as-needed

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
_______________________________________________
devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to