Message ID | alpine.DEB.2.21.1907161434260.1767@nanos.tec.linutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | kbuild: Fail if gold linker is detected | expand |
On Tue, Jul 16, 2019 at 02:47:56PM +0200, Thomas Gleixner wrote: > The gold linker has known issues of failing the build in random and > predictible ways. H.J. stated: > > "Since building a workable kernel for different kernel configurations > isn't a requirement for gold, I don't recommend gold for kernel." > > So instead of dealing with attempts to duct tape gold support without > understanding the root cause, fail the build when gold is detected. > > Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Right, life is too short to fight toolchains that aren't interested in working. Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> > --- > scripts/Kconfig.include | 3 +++ > 1 file changed, 3 insertions(+) > > --- a/scripts/Kconfig.include > +++ b/scripts/Kconfig.include > @@ -35,5 +35,8 @@ ld-option = $(success,$(LD) -v $(1)) > $(error-if,$(failure,command -v $(CC)),compiler '$(CC)' not found) > $(error-if,$(failure,command -v $(LD)),linker '$(LD)' not found) > > +# Fail if the linker is gold as it's not capable of linking the kernel proper > +$(error-if,$(success, command -v $(LD) -v | grep -q gold), gold linker '$(LD)' not supported) > + > # gcc version including patch level > gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC))
* Thomas Gleixner <tglx@linutronix.de> wrote: > The gold linker has known issues of failing the build in random and > predictible ways. H.J. stated: s/predictable/unpredictable? Acked-by: Ingo Molnar <mingo@kernel.org> Thanks, Ingo
On Tue, 16 Jul 2019, Ingo Molnar wrote: > > * Thomas Gleixner <tglx@linutronix.de> wrote: > > > The gold linker has known issues of failing the build in random and > > predictible ways. H.J. stated: > > s/predictable/unpredictable? No. It fails randomly, but also predictable. Enable X32 support on 64bit and it fails the VDSO build. That's been the case for years. Thanks, tglx
On Tue, Jul 16, 2019 at 02:47:56PM +0200, Thomas Gleixner wrote: > The gold linker has known issues of failing the build in random and > predictible ways. H.J. stated: > > "Since building a workable kernel for different kernel configurations > isn't a requirement for gold, I don't recommend gold for kernel." > > So instead of dealing with attempts to duct tape gold support without > understanding the root cause, fail the build when gold is detected. > > Signed-off-by: Thomas Gleixner <tglx@linutronix.de> > Link: https://lore.kernel.org/r/CAMe9rOqMqkQ0LNpm25yE_Yt0FKp05WmHOrwc0aRDb53miFKM+w@mail.gmail.com > --- > scripts/Kconfig.include | 3 +++ > 1 file changed, 3 insertions(+) > > --- a/scripts/Kconfig.include > +++ b/scripts/Kconfig.include > @@ -35,5 +35,8 @@ ld-option = $(success,$(LD) -v $(1)) > $(error-if,$(failure,command -v $(CC)),compiler '$(CC)' not found) > $(error-if,$(failure,command -v $(LD)),linker '$(LD)' not found) > > +# Fail if the linker is gold as it's not capable of linking the kernel proper > +$(error-if,$(success, command -v $(LD) -v | grep -q gold), gold linker '$(LD)' not supported) Why are there two '-v' flags here? The second one is ignored since command -v just prints out the path of the binary that is being used, which would work in most cases but not if gold is the default system linker. $ command -v ld.gold -v /usr/bin/ld.gold $ command -v ld.gold /usr/bin/ld.gold $ command ld.gold -v GNU gold (GNU Binutils 2.32) 1.16 Thus, wouldn't it be better to just call $(LD) directly, like CC_IS_GCC and CC_IS_CLANG in init/Kconfig? $(success, $(LD) -v | grep -q gold) Cheers, Nathan
* Thomas Gleixner <tglx@linutronix.de> wrote: > On Tue, 16 Jul 2019, Ingo Molnar wrote: > > > > > * Thomas Gleixner <tglx@linutronix.de> wrote: > > > > > The gold linker has known issues of failing the build in random and > > > predictible ways. H.J. stated: > > > > s/predictable/unpredictable? > > No. It fails randomly, but also predictable. Enable X32 support on 64bit > and it fails the VDSO build. That's been the case for years. Then please make this a bit more apparent, such as: "The gold linker has known issues of failing the build in random but also in more predictible ways." or so? Thanks, Ingo
On Tue, Jul 16, 2019 at 11:13 AM Ingo Molnar <mingo@kernel.org> wrote: > > Then please make this a bit more apparent, such as: > > "The gold linker has known issues of failing the build in random > but also in more predictible ways." Maybe even mention a couple of particular known failure cases. Just in case somebody decides to start up active gold development again, and actually look at cases it fails at... Linus
On Tue, Jul 16, 2019 at 08:13:24PM +0200, Ingo Molnar wrote: > > * Thomas Gleixner <tglx@linutronix.de> wrote: > > > On Tue, 16 Jul 2019, Ingo Molnar wrote: > > > > > > > > * Thomas Gleixner <tglx@linutronix.de> wrote: > > > > > > > The gold linker has known issues of failing the build in random and > > > > predictible ways. H.J. stated: > > > > > > s/predictable/unpredictable? > > > > No. It fails randomly, but also predictable. Enable X32 support on 64bit > > and it fails the VDSO build. That's been the case for years. > > Then please make this a bit more apparent, such as: > > "The gold linker has known issues of failing the build in random > but also in more predictible ways." <bikeshedding> How about: The gold linker has known issues of failing for certain configurations. </bikeshedding> - Ted
On Tue, 16 Jul 2019, Nathan Chancellor wrote: > On Tue, Jul 16, 2019 at 02:47:56PM +0200, Thomas Gleixner wrote: > > The gold linker has known issues of failing the build in random and > > predictible ways. H.J. stated: > > > > "Since building a workable kernel for different kernel configurations > > isn't a requirement for gold, I don't recommend gold for kernel." > > > > So instead of dealing with attempts to duct tape gold support without > > understanding the root cause, fail the build when gold is detected. > > > > Signed-off-by: Thomas Gleixner <tglx@linutronix.de> > > Link: https://lore.kernel.org/r/CAMe9rOqMqkQ0LNpm25yE_Yt0FKp05WmHOrwc0aRDb53miFKM+w@mail.gmail.com > > --- > > scripts/Kconfig.include | 3 +++ > > 1 file changed, 3 insertions(+) > > > > --- a/scripts/Kconfig.include > > +++ b/scripts/Kconfig.include > > @@ -35,5 +35,8 @@ ld-option = $(success,$(LD) -v $(1)) > > $(error-if,$(failure,command -v $(CC)),compiler '$(CC)' not found) > > $(error-if,$(failure,command -v $(LD)),linker '$(LD)' not found) > > > > +# Fail if the linker is gold as it's not capable of linking the kernel proper > > +$(error-if,$(success, command -v $(LD) -v | grep -q gold), gold linker '$(LD)' not supported) > > Why are there two '-v' flags here? The second one is ignored since > command -v just prints out the path of the binary that is being used, > which would work in most cases but not if gold is the default system > linker. > > $ command -v ld.gold -v > /usr/bin/ld.gold > > $ command -v ld.gold > /usr/bin/ld.gold > > $ command ld.gold -v > GNU gold (GNU Binutils 2.32) 1.16 > > Thus, wouldn't it be better to just call $(LD) directly, like > CC_IS_GCC and CC_IS_CLANG in init/Kconfig? > > $(success, $(LD) -v | grep -q gold) Right you are. Copy and paste without brain ....
Hi all! On 16/07/2019 17:59, Thomas Gleixner wrote: [...] > No. It fails randomly, but also predictable. Enable X32 support on 64bit > and it fails the VDSO build. That's been the case for years. FWIW "GNU gold (GNU Binutils for Ubuntu 2.30) 1.15" segfaults for userspace x32 binaries now and then (in unpredictable ways) too. MfG, Bernd-- "I dislike type abstraction if it has no real reason. And saving on typing is not a good reason - if your typing speed is the main issue when you're coding, you're doing something seriously wrong." - Linus Torvalds
--- a/scripts/Kconfig.include +++ b/scripts/Kconfig.include @@ -35,5 +35,8 @@ ld-option = $(success,$(LD) -v $(1)) $(error-if,$(failure,command -v $(CC)),compiler '$(CC)' not found) $(error-if,$(failure,command -v $(LD)),linker '$(LD)' not found) +# Fail if the linker is gold as it's not capable of linking the kernel proper +$(error-if,$(success, command -v $(LD) -v | grep -q gold), gold linker '$(LD)' not supported) + # gcc version including patch level gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC))
The gold linker has known issues of failing the build in random and predictible ways. H.J. stated: "Since building a workable kernel for different kernel configurations isn't a requirement for gold, I don't recommend gold for kernel." So instead of dealing with attempts to duct tape gold support without understanding the root cause, fail the build when gold is detected. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/CAMe9rOqMqkQ0LNpm25yE_Yt0FKp05WmHOrwc0aRDb53miFKM+w@mail.gmail.com --- scripts/Kconfig.include | 3 +++ 1 file changed, 3 insertions(+)