[RFT PATCH] arm64: relocatable: build the kernel as a proper shared library

Will Deacon will.deacon at arm.com
Mon Dec 3 09:08:54 PST 2018

Hi Ard,

On Sat, Dec 01, 2018 at 12:53:24PM +0100, Ard Biesheuvel wrote:
> readelf complains about the section layout of vmlinux when building
>   readelf: Warning: [21]: Link field (0) should index a symtab section.
>   readelf: Warning: [21]: Info field (0) should index a relocatable section.
> Also, it seems that our use of '-pie -shared' is contradictory, and
> thus ambiguous. In general, the way KASLR is wired up at the moment
> is highly tailored to how ld.bfd happens to implement (and conflate)
> PIE executables and shared libraries, so given the current effort to
> support other toolchains, let's fix some of these issues as well.
> - Drop the -pie linker argument and just leave -shared. In ld.bfd,
>   the differences between them are unclear (except for the ELF type
>   of the produced image [0]) but lld chokes on seeing both at the
>   same time.
> - Rename the .rela output section to .rela.dyn, as is customary for
>   shared libraries and PIE executables.
> - Don't discard the .dynamic, .dynsym, .dynstr and .hash sections.
>   Instead, make sure that they are [mostly] empty by marking all
>   symbols as local, and emit them into the .init segment.

These second two changes seem fairly arbitrary to me: is lld unhappy without
them? My concern is that we'll make some other change in the future and run
into more arbitrary breakage. Is there any build bots hooked up with lld so
help us catch regressions quickly? (i.e nightly builds of mainline and next)


More information about the linux-arm-kernel mailing list