Ian Campbell
2011-Feb-01 09:09 UTC
[Xen-devel] [PATCH] tools: disable linker --as-needed option
# HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1296550939 0 # Node ID a3fb60cc3be3dc6596ed8395e0eb70514bdfcc74 # Parent 5b6663ba2bb2c54e8fa6745afa16297ebe43328d tools: disable linker --as-needed option. The Xen build system is not currently compatible with the --as-needed linker option. The proper fix for this is turning out to be rather invasive to the build system so simply disable for now with the intention of revisiting for the 4.2 release. The $(COMMA) trick allows "," in macro arguments. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Reported/Tested-by: Nathan March <nathan@gt.net> diff -r 5b6663ba2bb2 -r a3fb60cc3be3 tools/Rules.mk --- a/tools/Rules.mk Mon Jan 31 09:14:52 2011 +0000 +++ b/tools/Rules.mk Tue Feb 01 09:02:19 2011 +0000 @@ -55,6 +55,10 @@ LDFLAGS += $(shell getconf LFS_LDFLAGS) LDFLAGS += $(shell getconf LFS_LDFLAGS) endif +# Xen tools build is currently incompatible with ld --as-needed +COMMA := , +LDFLAGS += $(call cc-option,$(CC),-Wl$(COMMA)--no-as-needed) + # 32-bit x86 does not perform well with -ve segment accesses on Xen. CFLAGS-$(CONFIG_X86_32) += $(call cc-option,$(CC),-mno-tls-direct-seg-refs) CFLAGS += $(CFLAGS-y) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jan Beulich
2011-Feb-01 09:21 UTC
Re: [Xen-devel] [PATCH] tools: disable linker --as-needed option
>>> On 01.02.11 at 10:09, Ian Campbell <ian.campbell@citrix.com> wrote: > # HG changeset patch > # User Ian Campbell <ian.campbell@citrix.com> > # Date 1296550939 0 > # Node ID a3fb60cc3be3dc6596ed8395e0eb70514bdfcc74 > # Parent 5b6663ba2bb2c54e8fa6745afa16297ebe43328d > tools: disable linker --as-needed option. > > The Xen build system is not currently compatible with the --as-needed > linker option. The proper fix for this is turning out to be rather > invasive to the build system so simply disable for now with the > intention of revisiting for the 4.2 release. > > The $(COMMA) trick allows "," in macro arguments. > > Signed-off-by: Ian Campbell <ian.campbell@citrix.com> > Reported/Tested-by: Nathan March <nathan@gt.net> > > diff -r 5b6663ba2bb2 -r a3fb60cc3be3 tools/Rules.mk > --- a/tools/Rules.mk Mon Jan 31 09:14:52 2011 +0000 > +++ b/tools/Rules.mk Tue Feb 01 09:02:19 2011 +0000 > @@ -55,6 +55,10 @@ LDFLAGS += $(shell getconf LFS_LDFLAGS) > LDFLAGS += $(shell getconf LFS_LDFLAGS) > endif > > +# Xen tools build is currently incompatible with ld --as-needed > +COMMA := , > +LDFLAGS += $(call cc-option,$(CC),-Wl$(COMMA)--no-as-needed)I don''t think this actually works (Did you try with a linker not supporting this option?), as cc-option is implemented passing -S to the compiler (i.e. the linker won''t even get invoked).> + > # 32-bit x86 does not perform well with -ve segment accesses on Xen. > CFLAGS-$(CONFIG_X86_32) += $(call cc-option,$(CC),-mno-tls-direct-seg-refs) > CFLAGS += $(CFLAGS-y)Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2011-Feb-01 09:27 UTC
Re: [Xen-devel] [PATCH] tools: disable linker --as-needed option
On Tue, 2011-02-01 at 09:21 +0000, Jan Beulich wrote:> >>> On 01.02.11 at 10:09, Ian Campbell <ian.campbell@citrix.com> wrote: > > # HG changeset patch > > # User Ian Campbell <ian.campbell@citrix.com> > > # Date 1296550939 0 > > # Node ID a3fb60cc3be3dc6596ed8395e0eb70514bdfcc74 > > # Parent 5b6663ba2bb2c54e8fa6745afa16297ebe43328d > > tools: disable linker --as-needed option. > > > > The Xen build system is not currently compatible with the --as-needed > > linker option. The proper fix for this is turning out to be rather > > invasive to the build system so simply disable for now with the > > intention of revisiting for the 4.2 release. > > > > The $(COMMA) trick allows "," in macro arguments. > > > > Signed-off-by: Ian Campbell <ian.campbell@citrix.com> > > Reported/Tested-by: Nathan March <nathan@gt.net> > > > > diff -r 5b6663ba2bb2 -r a3fb60cc3be3 tools/Rules.mk > > --- a/tools/Rules.mk Mon Jan 31 09:14:52 2011 +0000 > > +++ b/tools/Rules.mk Tue Feb 01 09:02:19 2011 +0000 > > @@ -55,6 +55,10 @@ LDFLAGS += $(shell getconf LFS_LDFLAGS) > > LDFLAGS += $(shell getconf LFS_LDFLAGS) > > endif > > > > +# Xen tools build is currently incompatible with ld --as-needed > > +COMMA := , > > +LDFLAGS += $(call cc-option,$(CC),-Wl$(COMMA)--no-as-needed) > > I don''t think this actually works (Did you try with a linker not > supporting this option?), as cc-option is implemented passing > -S to the compiler (i.e. the linker won''t even get invoked).Er, no. I think you are probably right, I only tested with a linker which has the option defaulting to off and Nathan tested the default on case but noone actually tested the not available option. Any idea how we can sensibly do this test? I''m not even sure when --{no-,}as-needed came along, perhaps we don''t actually need to worry? Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jan Beulich
2011-Feb-01 09:51 UTC
Re: [Xen-devel] [PATCH] tools: disable linker --as-needed option
>>> On 01.02.11 at 10:27, Ian Campbell <Ian.Campbell@eu.citrix.com> wrote: > On Tue, 2011-02-01 at 09:21 +0000, Jan Beulich wrote: >> >>> On 01.02.11 at 10:09, Ian Campbell <ian.campbell@citrix.com> wrote: >> > # HG changeset patch >> > # User Ian Campbell <ian.campbell@citrix.com> >> > # Date 1296550939 0 >> > # Node ID a3fb60cc3be3dc6596ed8395e0eb70514bdfcc74 >> > # Parent 5b6663ba2bb2c54e8fa6745afa16297ebe43328d >> > tools: disable linker --as-needed option. >> > >> > The Xen build system is not currently compatible with the --as-needed >> > linker option. The proper fix for this is turning out to be rather >> > invasive to the build system so simply disable for now with the >> > intention of revisiting for the 4.2 release. >> > >> > The $(COMMA) trick allows "," in macro arguments. >> > >> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com> >> > Reported/Tested-by: Nathan March <nathan@gt.net> >> > >> > diff -r 5b6663ba2bb2 -r a3fb60cc3be3 tools/Rules.mk >> > --- a/tools/Rules.mk Mon Jan 31 09:14:52 2011 +0000 >> > +++ b/tools/Rules.mk Tue Feb 01 09:02:19 2011 +0000 >> > @@ -55,6 +55,10 @@ LDFLAGS += $(shell getconf LFS_LDFLAGS) >> > LDFLAGS += $(shell getconf LFS_LDFLAGS) >> > endif >> > >> > +# Xen tools build is currently incompatible with ld --as-needed >> > +COMMA := , >> > +LDFLAGS += $(call cc-option,$(CC),-Wl$(COMMA)--no-as-needed) >> >> I don''t think this actually works (Did you try with a linker not >> supporting this option?), as cc-option is implemented passing >> -S to the compiler (i.e. the linker won''t even get invoked). > > Er, no. I think you are probably right, I only tested with a linker > which has the option defaulting to off and Nathan tested the default on > case but noone actually tested the not available option. > > Any idea how we can sensibly do this test?No, not really (other than changing cc-option).> I''m not even sure when > --{no-,}as-needed came along, perhaps we don''t actually need to worry?2.15 has it (released in May 2004), 2.13.2 didn''t. I don''t have a 2.14 sitting around. Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2011-Feb-01 10:27 UTC
Re: [Xen-devel] [PATCH] tools: disable linker --as-needed option
On Tue, 2011-02-01 at 09:51 +0000, Jan Beulich wrote:> >>> On 01.02.11 at 10:27, Ian Campbell <Ian.Campbell@eu.citrix.com> wrote: > > I''m not even sure when > > --{no-,}as-needed came along, perhaps we don''t actually need to worry? > > 2.15 has it (released in May 2004), 2.13.2 didn''t. I don''t have a > 2.14 sitting around.Thanks. My usual measure for this stuff is Debian. It seems Debian Lenny (current stable, just about) has 2.18, Etch (previous stable) has 2.17 and Sarge (one before that) has 2.15. I think we can simply make the use of this option unconditional. Ian. # HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1296555650 0 # Node ID e4c9925852a021a3ccdc769f04fdaa99b05cffa0 # Parent 5b6663ba2bb2c54e8fa6745afa16297ebe43328d tools: disable linker --as-needed option. The Xen build system is not currently compatible with the --as-needed linker option. The proper fix for this is turning out to be rather invasive to the build system so simply disable for now with the intention of revisiting for the 4.2 release. The --no-as-needed option is available at least since binutils 2.15 (released in May 2004) and hence I think can be unconditionally relied on. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Reported/Tested-by: Nathan March <nathan@gt.net> diff -r 5b6663ba2bb2 -r e4c9925852a0 tools/Rules.mk --- a/tools/Rules.mk Mon Jan 31 09:14:52 2011 +0000 +++ b/tools/Rules.mk Tue Feb 01 10:20:50 2011 +0000 @@ -55,6 +55,9 @@ LDFLAGS += $(shell getconf LFS_LDFLAGS) LDFLAGS += $(shell getconf LFS_LDFLAGS) endif +# Xen tools build is currently incompatible with ld --as-needed +LDFLAGS += -Wl,--no-as-needed + # 32-bit x86 does not perform well with -ve segment accesses on Xen. CFLAGS-$(CONFIG_X86_32) += $(call cc-option,$(CC),-mno-tls-direct-seg-refs) CFLAGS += $(CFLAGS-y) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-Feb-01 19:23 UTC
Re: [Xen-devel] [PATCH] tools: disable linker --as-needed option
Ian Campbell writes ("Re: [Xen-devel] [PATCH] tools: disable linker --as-needed option"):> My usual measure for this stuff is Debian. It seems Debian Lenny > (current stable, just about) has 2.18, Etch (previous stable) has 2.17 > and Sarge (one before that) has 2.15. I think we can simply make the use > of this option unconditional.Right, thanks, applied. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel