This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GENERATE_SHLIB_SCRIPT vs. EMBEDDED


On Thu, Nov 07, 2019 at 06:13:30PM +1030, Alan Modra wrote:
> On Thu, Nov 07, 2019 at 12:37:00AM -0700, Nathan Chancellor wrote:
> > For what it's worth, this breaks building the Linux kernel for me:
> > 
> > aarch64-linux-ld: -shared not supported
> 
> An aarch64-linux ld will use emulparams/aarch64linux.sh, which does
> have shared support.  If you're trying to use binutils configured for
> aarch64-elf on Linux, well, good luck with that.
> 
> -- 
> Alan Modra
> Australia Development Lab, IBM

As it turns out, this error is related to the arm64 Linux kernel using
the ELF emulation mode by default, falling back to the Linux one if it
is not supported. See the following commits:

https://git.kernel.org/linus/38fc4248677552ce35efc09902fdcb06b61d7ef9
https://git.kernel.org/linus/96f95a17c1cfe65a002e525114d96616e91a8f2d
https://git.kernel.org/linus/c931d34ea0853d41349e93f871bd3f17f1c03a6b

I can probably send the below diff to fix this, not sure if that is how
you would recommend proceeding or if the change to the elf targets in ld
should be reverted.

diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 2c0238ce0551..5594043e0f05 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -76,16 +76,13 @@ ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
 KBUILD_CPPFLAGS        += -mbig-endian
 CHECKFLAGS     += -D__AARCH64EB__
 AS             += -EB
-# Prefer the baremetal ELF build target, but not all toolchains include
-# it so fall back to the standard linux version if needed.
-KBUILD_LDFLAGS += -EB $(call ld-option, -maarch64elfb, -maarch64linuxb)
+KBUILD_LDFLAGS += -EB -maarch64linuxb
 UTS_MACHINE    := aarch64_be
 else
 KBUILD_CPPFLAGS        += -mlittle-endian
 CHECKFLAGS     += -D__AARCH64EL__
 AS             += -EL
-# Same as above, prefer ELF but fall back to linux target if needed.
-KBUILD_LDFLAGS += -EL $(call ld-option, -maarch64elf, -maarch64linux)
+KBUILD_LDFLAGS += -EL -maarch64linux
 UTS_MACHINE    := aarch64
 endif
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]