WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH] xenpaging: correct order of linker options to av

Olaf Hering writes ("Re: [PATCH] xenpaging: correct order of linker options to 
avoid link errors with recent toolchains"):
> LDFLAGS_libxenctrl is defined in tools/Rules.mk and used in several
> Makefiles. Are you suggesting to rename these variables and update all
> users?

Linker command lines are order-sensitive.  This means that LDFLAGS and
LDLIBS are not the same and should not be conflated.  You are finding
build bugs on some toolchains because libraries have been stuffed into
LDFLAGS which come after the general linker flags but before the
objects, when you want them to be at the end (or nearly at the end).

The right answer is not to make LDFLAGS be included at the end of the
link line; nor is it to copy values from some LDFLAGS variable to an
LDLIBS variable.

I think the right answer is to rename the variables LDFLAGS_foo which
actually contain arguments like -Lfoo -lfoo to LDLIBS_foo.  If there
are mixed variables (which contain actual linker options rather than
just instructions to link against libraries) they should be split in
two.

> Also, its not clear to me why the place of LDFLAGS matters. In another
> thread it was stated that -static may behave different. Whats the reason
> for that?

-static was just an example.  It affects only libraries appearing
after it in the link line.  In general, arguments and options to the
linker are quite positional.  This means that linker options (which
are typically found in LDLIBS variables) normally need to come first,
before any object files or libraries are mentioned.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel