build kernel for arm64 - linker ld ignored -z relro
Milan Buška
milan.buska@gmail.com
Mon Oct 5 06:15:56 GMT 2020
Hello.
ne 13. 9. 2020 v 8:05 odesílatel Alan Modra <amodra@gmail.com> napsal:
>
> On Sat, Sep 12, 2020 at 06:35:58PM +0200, Milan Buška wrote:
> > so 12. 9. 2020 v 8:30 odesílatel Alan Modra <amodra@gmail.com> napsal:
> > >
> > > On Sun, Sep 06, 2020 at 04:45:52PM +0000, Milan Buška via Binutils wrote:
> > > > Hello.
> > > > I'm compiling the kernel v.5.8.7 on arm64.
> > > > This is a compilation in a native environment.
> > > > Toolchain:
> > > > glibc v. 2.32
> > > > binutils v. 2.35
> > > > gcc v. 10.2.0
> > > >
> > > > This is the last part of the output after make Image.
> > > [snip]
> > > > LD .tmp_vmlinux.kallsyms1
> > > > ld: warning: -z norelro ignored
> > >
> > > I suspect you are not configuring binutils correctly for
> > > aarch64-linux. A target of aarch64-elf for example won't give you a
> > > toolchain supporting relro.
> > >
> >
> > I compiled binutils according to this configuration
> >
> > --prefix=/usr \
> > --build=aarch64-unknown-linux-gnu \
> > --host=aarch64-unknown-linux-gnu \
> > --with-lib-path=/usr/lib:/usr/local/lib \
> > --with-bugurl=https://github.com/archlinuxarm/PKGBUILDs/issues \
> > --enable-deterministic-archives \
> > --enable-gold \
> > --enable-ld=default \
> > --enable-lto \
> > --enable-plugins \
> > --enable-relro \
> > --enable-shared \
> > --enable-threads \
> > --disable-gdb \
> > --disable-werror \
> > --with-debuginfod \
> > --with-pic \
> > --with-system-zlib \
> > --disable-sim
> >
> > Best regards
> >
> > Milan Buska
>
> Hmm, I don't see anything much wrong with that, and it looks like
> archlinux doesn't make any patches to binutils that might cause the
> problem you're seeing. I suggested it might be an aarch64-elf config
> because the only reasons to see "-z norelro ignored" are
> GENERATE_SHLIB_SCRIPT not being "yes" or COMMONPAGESIZE not being
> set. The latter happens with an aarch64-elf toolchain. See the
> relevant ld/emulparams/ files and ld/emultempl/elf.em.
>
> --
> Alan Modra
> Australia Development Lab, IBM
Binutils is fine.
The problem is in the linux kernel code.
The error is caused by arm/arm64/Makefile.
line 105: KBUILD_LDFLAGS + = -EL $ (call ld-option, -maarch64elf,
-maarch64linux)
Solution:
KBUILD_LDFLAGS + = -EL $ (call ld-option, -maarch64linux, -maarch64elf)
Thank you for your support.
Milan
--
Remember, no question is too stupid and no problem too small
-- We've all been beginners
More information about the Binutils
mailing list