All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: remove no-op -p linker flag
@ 2018-11-27 19:15 ndesaulniers
  2018-11-28 16:07 ` Sasha Levin
  0 siblings, 1 reply; 8+ messages in thread
From: ndesaulniers @ 2018-11-27 19:15 UTC (permalink / raw)
  To: gregkh
  Cc: stable, Greg Hackmann, Will Deacon, Nick Desaulniers,
	Greg Hackmann, Catalin Marinas

From: Greg Hackmann <ghackmann@android.com>

(commit 1a381d4a0a9a0f999a13faaba22bf6b3fc80dcb9 upstream)

Linking the ARM64 defconfig kernel with LLVM lld fails with the error:

  ld.lld: error: unknown argument: -p
  Makefile:1015: recipe for target 'vmlinux' failed

Without this flag, the ARM64 defconfig kernel successfully links with
lld and boots on Dragonboard 410c.

After digging through binutils source and changelogs, it turns out that
-p is only relevant to ancient binutils installations targeting 32-bit
ARM.  binutils accepts -p for AArch64 too, but it's always been
undocumented and silently ignored.  A comment in
ld/emultempl/aarch64elf.em explains that it's "Only here for backwards
compatibility".

Since this flag is a no-op on ARM64, we can safely drop it.

Acked-by: Will Deacon <will.deacon@arm.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
This is needed for linking arm64 kernels with LLVM's LLD linker.  I'm
most interested in this for 4.14 and know it applies cleanly there, but
would like it in 4.9 and 4.4 if possible. The upstream patch first
landed in v4.18-rc4.

 arch/arm64/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 48158c550110..7976d2d242fa 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -10,7 +10,7 @@
 #
 # Copyright (C) 1995-2001 by Russell King
 
-LDFLAGS_vmlinux	:=-p --no-undefined -X
+LDFLAGS_vmlinux	:=--no-undefined -X
 CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
 GZFLAGS		:=-9
 
-- 
2.20.0.rc0.387.gc7a69e6b6c-goog

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] arm64: remove no-op -p linker flag
  2018-11-27 19:15 [PATCH] arm64: remove no-op -p linker flag ndesaulniers
@ 2018-11-28 16:07 ` Sasha Levin
  0 siblings, 0 replies; 8+ messages in thread
From: Sasha Levin @ 2018-11-28 16:07 UTC (permalink / raw)
  To: ndesaulniers
  Cc: gregkh, stable, Greg Hackmann, Will Deacon, Greg Hackmann,
	Catalin Marinas

On Tue, Nov 27, 2018 at 11:15:20AM -0800, ndesaulniers@google.com wrote:
>From: Greg Hackmann <ghackmann@android.com>
>
>(commit 1a381d4a0a9a0f999a13faaba22bf6b3fc80dcb9 upstream)
>
>Linking the ARM64 defconfig kernel with LLVM lld fails with the error:
>
>  ld.lld: error: unknown argument: -p
>  Makefile:1015: recipe for target 'vmlinux' failed
>
>Without this flag, the ARM64 defconfig kernel successfully links with
>lld and boots on Dragonboard 410c.
>
>After digging through binutils source and changelogs, it turns out that
>-p is only relevant to ancient binutils installations targeting 32-bit
>ARM.  binutils accepts -p for AArch64 too, but it's always been
>undocumented and silently ignored.  A comment in
>ld/emultempl/aarch64elf.em explains that it's "Only here for backwards
>compatibility".
>
>Since this flag is a no-op on ARM64, we can safely drop it.
>
>Acked-by: Will Deacon <will.deacon@arm.com>
>Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>Signed-off-by: Greg Hackmann <ghackmann@google.com>
>Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
>Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
>---
>This is needed for linking arm64 kernels with LLVM's LLD linker.  I'm
>most interested in this for 4.14 and know it applies cleanly there, but
>would like it in 4.9 and 4.4 if possible. The upstream patch first
>landed in v4.18-rc4.

I've queued it for 4.14, 4.9, 4.4 and 3.18.

--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] arm64: remove no-op -p linker flag
  2018-06-28  9:39   ` Will Deacon
@ 2018-06-28 12:40     ` Nick Desaulniers
  -1 siblings, 0 replies; 8+ messages in thread
From: Nick Desaulniers @ 2018-06-28 12:40 UTC (permalink / raw)
  To: Will Deacon
  Cc: ghackmann, Catalin Marinas, linux-arm-kernel, LKML,
	Matthias Kaehlcke, Greg Hackmann

On Thu, Jun 28, 2018 at 5:38 AM Will Deacon <will.deacon@arm.com> wrote:
>
> On Wed, Jun 27, 2018 at 12:46:14PM -0700, Greg Hackmann wrote:
> > Linking the ARM64 defconfig kernel with LLVM lld fails with the error:
> >
> >   ld.lld: error: unknown argument: -p
> >   Makefile:1015: recipe for target 'vmlinux' failed
> >
> > Without this flag, the ARM64 defconfig kernel successfully links with
> > lld and boots on Dragonboard 410c.

Ha! Just one single unknown linker flag, to link and boot? That's not too bad.

> > After digging through binutils source and changelogs, it turns out that
> > -p is only relevant to ancient binutils installations targeting 32-bit
> > ARM.  binutils accepts -p for AArch64 too, but it's always been
> > undocumented and silently ignored.

Nothing in the man pages for ld in regards to -p.  Seems like it was
shortform for "--no-pipeline-knowledge: Stop the linker knowing about
the pipeline length".

Looks like it was added to binutils via this commit in 1999:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=7ca69e9e10ef290eb3dd62a1e6bebbe4c87fa202

And removed in 2004:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=dea514f51da1051f9f3cd7a746e3b68085aa1a72

arch/arm/Makefile has -p as a LD_FLAGS.  Is it actually needed there
too, or can it be removed from there?  I assume we'll want to use lld
for arm32 at some point.

> > A comment in
> > ld/emultempl/aarch64elf.em explains that it's "Only here for backwards
> > compatibility".

Yep: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=ld/emultempl/aarch64elf.em;h=edc548f65298e563481bdd9d547fcb9c6b13da04;hb=HEAD#l405

armelf.em also has that comment.

Looks like -p has been in arch/arm64/Makefile since the initial commit
that added that file. So likely copy+pasted from arch/arm/Makefile.

commit 8c2c3df31e3b ("arm64: Build infrastructure"):
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/arm64/Makefile?id=8c2c3df31e3b87cb5348e48776c366ebd1dc5a7a

And it looks like arch/arm/Makefile has has -p since the move to git
for Linux 2.6:

commit 1da177e4c3f4 ("Linux-2.6.12-rc2")
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/arm/Makefile?id=1da177e4c3f41524e886b7f1b8a0c1fc7321cac2

So nothing in the kernel commit history to hint at what it was ever used for.

As long as you have a version of binutils that not 14 years old, you
should be good.

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] arm64: remove no-op -p linker flag
@ 2018-06-28 12:40     ` Nick Desaulniers
  0 siblings, 0 replies; 8+ messages in thread
From: Nick Desaulniers @ 2018-06-28 12:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jun 28, 2018 at 5:38 AM Will Deacon <will.deacon@arm.com> wrote:
>
> On Wed, Jun 27, 2018 at 12:46:14PM -0700, Greg Hackmann wrote:
> > Linking the ARM64 defconfig kernel with LLVM lld fails with the error:
> >
> >   ld.lld: error: unknown argument: -p
> >   Makefile:1015: recipe for target 'vmlinux' failed
> >
> > Without this flag, the ARM64 defconfig kernel successfully links with
> > lld and boots on Dragonboard 410c.

Ha! Just one single unknown linker flag, to link and boot? That's not too bad.

> > After digging through binutils source and changelogs, it turns out that
> > -p is only relevant to ancient binutils installations targeting 32-bit
> > ARM.  binutils accepts -p for AArch64 too, but it's always been
> > undocumented and silently ignored.

Nothing in the man pages for ld in regards to -p.  Seems like it was
shortform for "--no-pipeline-knowledge: Stop the linker knowing about
the pipeline length".

Looks like it was added to binutils via this commit in 1999:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=7ca69e9e10ef290eb3dd62a1e6bebbe4c87fa202

And removed in 2004:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=dea514f51da1051f9f3cd7a746e3b68085aa1a72

arch/arm/Makefile has -p as a LD_FLAGS.  Is it actually needed there
too, or can it be removed from there?  I assume we'll want to use lld
for arm32 at some point.

> > A comment in
> > ld/emultempl/aarch64elf.em explains that it's "Only here for backwards
> > compatibility".

Yep: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=ld/emultempl/aarch64elf.em;h=edc548f65298e563481bdd9d547fcb9c6b13da04;hb=HEAD#l405

armelf.em also has that comment.

Looks like -p has been in arch/arm64/Makefile since the initial commit
that added that file. So likely copy+pasted from arch/arm/Makefile.

commit 8c2c3df31e3b ("arm64: Build infrastructure"):
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/arm64/Makefile?id=8c2c3df31e3b87cb5348e48776c366ebd1dc5a7a

And it looks like arch/arm/Makefile has has -p since the move to git
for Linux 2.6:

commit 1da177e4c3f4 ("Linux-2.6.12-rc2")
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/arm/Makefile?id=1da177e4c3f41524e886b7f1b8a0c1fc7321cac2

So nothing in the kernel commit history to hint at what it was ever used for.

As long as you have a version of binutils that not 14 years old, you
should be good.

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] arm64: remove no-op -p linker flag
  2018-06-27 19:46 ` Greg Hackmann
@ 2018-06-28  9:39   ` Will Deacon
  -1 siblings, 0 replies; 8+ messages in thread
From: Will Deacon @ 2018-06-28  9:39 UTC (permalink / raw)
  To: Greg Hackmann
  Cc: Catalin Marinas, linux-arm-kernel, linux-kernel, ndesaulniers,
	mka, Greg Hackmann

On Wed, Jun 27, 2018 at 12:46:14PM -0700, Greg Hackmann wrote:
> Linking the ARM64 defconfig kernel with LLVM lld fails with the error:
> 
>   ld.lld: error: unknown argument: -p
>   Makefile:1015: recipe for target 'vmlinux' failed
> 
> Without this flag, the ARM64 defconfig kernel successfully links with
> lld and boots on Dragonboard 410c.
> 
> After digging through binutils source and changelogs, it turns out that
> -p is only relevant to ancient binutils installations targeting 32-bit
> ARM.  binutils accepts -p for AArch64 too, but it's always been
> undocumented and silently ignored.  A comment in
> ld/emultempl/aarch64elf.em explains that it's "Only here for backwards
> compatibility".
> 
> Since this flag is a no-op on ARM64, we can safely drop it.

Makes sense:

Acked-by: Will Deacon <will.deacon@arm.com>

Will

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] arm64: remove no-op -p linker flag
@ 2018-06-28  9:39   ` Will Deacon
  0 siblings, 0 replies; 8+ messages in thread
From: Will Deacon @ 2018-06-28  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 27, 2018 at 12:46:14PM -0700, Greg Hackmann wrote:
> Linking the ARM64 defconfig kernel with LLVM lld fails with the error:
> 
>   ld.lld: error: unknown argument: -p
>   Makefile:1015: recipe for target 'vmlinux' failed
> 
> Without this flag, the ARM64 defconfig kernel successfully links with
> lld and boots on Dragonboard 410c.
> 
> After digging through binutils source and changelogs, it turns out that
> -p is only relevant to ancient binutils installations targeting 32-bit
> ARM.  binutils accepts -p for AArch64 too, but it's always been
> undocumented and silently ignored.  A comment in
> ld/emultempl/aarch64elf.em explains that it's "Only here for backwards
> compatibility".
> 
> Since this flag is a no-op on ARM64, we can safely drop it.

Makes sense:

Acked-by: Will Deacon <will.deacon@arm.com>

Will

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] arm64: remove no-op -p linker flag
@ 2018-06-27 19:46 ` Greg Hackmann
  0 siblings, 0 replies; 8+ messages in thread
From: Greg Hackmann @ 2018-06-27 19:46 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon
  Cc: linux-arm-kernel, linux-kernel, ndesaulniers, mka, Greg Hackmann

Linking the ARM64 defconfig kernel with LLVM lld fails with the error:

  ld.lld: error: unknown argument: -p
  Makefile:1015: recipe for target 'vmlinux' failed

Without this flag, the ARM64 defconfig kernel successfully links with
lld and boots on Dragonboard 410c.

After digging through binutils source and changelogs, it turns out that
-p is only relevant to ancient binutils installations targeting 32-bit
ARM.  binutils accepts -p for AArch64 too, but it's always been
undocumented and silently ignored.  A comment in
ld/emultempl/aarch64elf.em explains that it's "Only here for backwards
compatibility".

Since this flag is a no-op on ARM64, we can safely drop it.

Signed-off-by: Greg Hackmann <ghackmann@google.com>
---
 arch/arm64/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 45272266dafb..79bd701071de 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -10,7 +10,7 @@
 #
 # Copyright (C) 1995-2001 by Russell King
 
-LDFLAGS_vmlinux	:=-p --no-undefined -X
+LDFLAGS_vmlinux	:=--no-undefined -X
 CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
 GZFLAGS		:=-9
 
-- 
2.18.0.rc2.346.g013aa6912e-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] arm64: remove no-op -p linker flag
@ 2018-06-27 19:46 ` Greg Hackmann
  0 siblings, 0 replies; 8+ messages in thread
From: Greg Hackmann @ 2018-06-27 19:46 UTC (permalink / raw)
  To: linux-arm-kernel

Linking the ARM64 defconfig kernel with LLVM lld fails with the error:

  ld.lld: error: unknown argument: -p
  Makefile:1015: recipe for target 'vmlinux' failed

Without this flag, the ARM64 defconfig kernel successfully links with
lld and boots on Dragonboard 410c.

After digging through binutils source and changelogs, it turns out that
-p is only relevant to ancient binutils installations targeting 32-bit
ARM.  binutils accepts -p for AArch64 too, but it's always been
undocumented and silently ignored.  A comment in
ld/emultempl/aarch64elf.em explains that it's "Only here for backwards
compatibility".

Since this flag is a no-op on ARM64, we can safely drop it.

Signed-off-by: Greg Hackmann <ghackmann@google.com>
---
 arch/arm64/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 45272266dafb..79bd701071de 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -10,7 +10,7 @@
 #
 # Copyright (C) 1995-2001 by Russell King
 
-LDFLAGS_vmlinux	:=-p --no-undefined -X
+LDFLAGS_vmlinux	:=--no-undefined -X
 CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
 GZFLAGS		:=-9
 
-- 
2.18.0.rc2.346.g013aa6912e-goog

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-11-29  3:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-27 19:15 [PATCH] arm64: remove no-op -p linker flag ndesaulniers
2018-11-28 16:07 ` Sasha Levin
  -- strict thread matches above, loose matches on Subject: below --
2018-06-27 19:46 Greg Hackmann
2018-06-27 19:46 ` Greg Hackmann
2018-06-28  9:39 ` Will Deacon
2018-06-28  9:39   ` Will Deacon
2018-06-28 12:40   ` Nick Desaulniers
2018-06-28 12:40     ` Nick Desaulniers

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.