* [PATCH] correct order of linker options to avoid link errors with recent toolchains
@ 2010-07-23 12:11 Olaf Hering
2010-07-23 16:44 ` Ian Jackson
2010-07-23 19:55 ` Olaf Hering
0 siblings, 2 replies; 5+ messages in thread
From: Olaf Hering @ 2010-07-23 12:11 UTC (permalink / raw)
To: xen-devel
The order of objects and linked libraries is important with recent toolchain
when --as-needed is used. Move LDFLAGS to the end of cc commandline options.
Without this change, symbols in libbzip2 are not found when building with openSuSE 11.2 and newer.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
There are more places like this.
I will find and fix them when required.
tools/libxc/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- xen-unstable.hg-4.1.21836.orig/tools/libxc/Makefile
+++ xen-unstable.hg-4.1.21836/tools/libxc/Makefile
@@ -181,7 +181,7 @@ xc_dom_bzimageloader.opic: CFLAGS += $(c
libxenguest.so.$(MAJOR).$(MINOR): LDFLAGS += $(call zlib-options,l)
libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so
- $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $(GUEST_PIC_OBJS) -lz -lxenctrl $(PTHREAD_LIBS)
+ $(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $(GUEST_PIC_OBJS) $(LDFLAGS) -lz -lxenctrl $(PTHREAD_LIBS)
-include $(DEPS)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] correct order of linker options to avoid link errors with recent toolchains
2010-07-23 12:11 [PATCH] correct order of linker options to avoid link errors with recent toolchains Olaf Hering
@ 2010-07-23 16:44 ` Ian Jackson
2010-07-23 16:53 ` Keir Fraser
2010-07-23 19:55 ` Olaf Hering
1 sibling, 1 reply; 5+ messages in thread
From: Ian Jackson @ 2010-07-23 16:44 UTC (permalink / raw)
To: Olaf Hering; +Cc: xen-devel
Olaf Hering writes ("[Xen-devel] [PATCH] correct order of linker options to avoid link errors with recent toolchains"):
> The order of objects and linked libraries is important with recent toolchain
> when --as-needed is used. Move LDFLAGS to the end of cc commandline options.
> Without this change, symbols in libbzip2 are not found when building with openSuSE 11.2 and newer.
Thanks, but:
I infer that libbzip2 is in LDFLAGS (as -lbzip2, I guess). Is that
right ? But I think that libraries should be in *_LIBS, not LDFLAGS.
LDFLAGS needs to stay at the beginning so that it can work if you set
it to -static or something.
> libxenguest.so.$(MAJOR).$(MINOR): LDFLAGS += $(call zlib-options,l)
What is this program "zlib-options" ? I don't have it on my system.
Ian.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] correct order of linker options to avoid link errors with recent toolchains
2010-07-23 16:44 ` Ian Jackson
@ 2010-07-23 16:53 ` Keir Fraser
2010-07-23 16:57 ` Ian Jackson
0 siblings, 1 reply; 5+ messages in thread
From: Keir Fraser @ 2010-07-23 16:53 UTC (permalink / raw)
To: Ian Jackson, Olaf Hering; +Cc: xen-devel
On 23/07/2010 17:44, "Ian Jackson" <Ian.Jackson@eu.citrix.com> wrote:
> Olaf Hering writes ("[Xen-devel] [PATCH] correct order of linker options to
> avoid link errors with recent toolchains"):
>> The order of objects and linked libraries is important with recent toolchain
>> when --as-needed is used. Move LDFLAGS to the end of cc commandline options.
>> Without this change, symbols in libbzip2 are not found when building with
>> openSuSE 11.2 and newer.
>
> Thanks, but:
>
> I infer that libbzip2 is in LDFLAGS (as -lbzip2, I guess). Is that
> right ? But I think that libraries should be in *_LIBS, not LDFLAGS.
> LDFLAGS needs to stay at the beginning so that it can work if you set
> it to -static or something.
>
>> libxenguest.so.$(MAJOR).$(MINOR): LDFLAGS += $(call zlib-options,l)
>
> What is this program "zlib-options" ? I don't have it on my system.
It's right there in the same Makefile directly above the line you quoted.
Yes, the above line can add -l<lib> items to LDFLAGS. Sounds like the right
fix would indeed be to define a new COMPRESSION_LIBS variable and put it at
the end of the linker command line.
-- Keir
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] correct order of linker options to avoid link errors with recent toolchains
2010-07-23 16:53 ` Keir Fraser
@ 2010-07-23 16:57 ` Ian Jackson
0 siblings, 0 replies; 5+ messages in thread
From: Ian Jackson @ 2010-07-23 16:57 UTC (permalink / raw)
To: Keir Fraser; +Cc: Olaf Hering, xen-devel
Keir Fraser writes ("Re: [Xen-devel] [PATCH] correct order of linker options to avoid link errors with recent toolchains"):
> On 23/07/2010 17:44, "Ian Jackson" <Ian.Jackson@eu.citrix.com> wrote:
> >> libxenguest.so.$(MAJOR).$(MINOR): LDFLAGS += $(call zlib-options,l)
> >
> > What is this program "zlib-options" ? I don't have it on my system.
>
> It's right there in the same Makefile directly above the line you quoted.
> Yes, the above line can add -l<lib> items to LDFLAGS.
Oh, duh. I'm confusing $(call ...) with $(shell ...) so I looked in
entirely the wrong place.
> Sounds like the right fix would indeed be to define a new
> COMPRESSION_LIBS variable and put it at the end of the linker
> command line.
Yes. Olaf, would you like to provide a patch to do that ?
Ian.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] correct order of linker options to avoid link errors with recent toolchains
2010-07-23 12:11 [PATCH] correct order of linker options to avoid link errors with recent toolchains Olaf Hering
2010-07-23 16:44 ` Ian Jackson
@ 2010-07-23 19:55 ` Olaf Hering
1 sibling, 0 replies; 5+ messages in thread
From: Olaf Hering @ 2010-07-23 19:55 UTC (permalink / raw)
To: xen-devel
The order of objects and linked libraries is important with recent toolchain
when --as-needed is used.
Introduce new variable COMPRESSION_LIBS and place it at the end of cc commandline options.
Without this change, symbols in libbzip2 are not found when building with openSuSE 11.2 and newer.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
v2: use COMPRESSION_LIBS instead of moving LDFLAGS around
tools/libxc/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- xen-unstable.hg-4.1.21836.orig/tools/libxc/Makefile
+++ xen-unstable.hg-4.1.21836/tools/libxc/Makefile
@@ -179,9 +179,9 @@ endif
xc_dom_bzimageloader.o: CFLAGS += $(call zlib-options,D)
xc_dom_bzimageloader.opic: CFLAGS += $(call zlib-options,D)
-libxenguest.so.$(MAJOR).$(MINOR): LDFLAGS += $(call zlib-options,l)
+libxenguest.so.$(MAJOR).$(MINOR): COMPRESSION_LIBS = $(call zlib-options,l)
libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so
- $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $(GUEST_PIC_OBJS) -lz -lxenctrl $(PTHREAD_LIBS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $(GUEST_PIC_OBJS) $(COMPRESSION_LIBS) -lz -lxenctrl $(PTHREAD_LIBS)
-include $(DEPS)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-07-23 19:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-23 12:11 [PATCH] correct order of linker options to avoid link errors with recent toolchains Olaf Hering
2010-07-23 16:44 ` Ian Jackson
2010-07-23 16:53 ` Keir Fraser
2010-07-23 16:57 ` Ian Jackson
2010-07-23 19:55 ` Olaf Hering
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.