public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* build kernel for arm64 - linker ld ignored -z relro
@ 2020-09-06 16:45 Milan Buška
  2020-09-12  6:30 ` Alan Modra
  0 siblings, 1 reply; 5+ messages in thread
From: Milan Buška @ 2020-09-06 16:45 UTC (permalink / raw)
  To: binutils

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.
  AR drivers / net / ethernet / built-in.a
  AR drivers / net / usb / built-in.a
  CC drivers / net / mii.o
  CC drivers / net / Space.o
  AR drivers / perf / built-in.a
  CC drivers / net / loopback.o
  CC drivers / net / tun.o
  CC drivers / net / virtio_net.o
  AR drivers / tee / built-in.a
  CC drivers / net / xen-netfront.o
  CC drivers / net / net_failover.o
  AR drivers / iio / built-in.a
  AR drivers / net / built-in.a
  AR drivers / built-in.a
  GEN .version
  CHK include / generated / compile.h
  LD vmlinux.o
  MODPOST vmlinux.symvers
  MODINFO modules.builtin.modinfo
  GEN modules.builtin
  LD .tmp_vmlinux.kallsyms1
ld: warning: -z norelro ignored
  KSYM .tmp_vmlinux.kallsyms1.o
  LD .tmp_vmlinux.kallsyms2
ld: warning: -z norelro ignored
  KSYM .tmp_vmlinux.kallsyms2.o
  LD vmlinux
ld: warning: -z norelro ignored
  SORTTAB vmlinux
  SYSMAP System.map
  OBJCOPY arch / arm64 / boot / Image

The file in which the norelro is declared (probably)
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/arm64/Makefile?h=v5.8.7

Tested on archlinuxarm last rootfs.

Best regards
Milan

-- 

Remember, no question is too stupid and no problem too small
       -- We've all been beginners

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

* Re: build kernel for arm64 - linker ld ignored -z relro
  2020-09-06 16:45 build kernel for arm64 - linker ld ignored -z relro Milan Buška
@ 2020-09-12  6:30 ` Alan Modra
       [not found]   ` <CAFCWPPKDhcZEP_3GG=OMg6GRZsoUe-3TXYQQCi9+hScC9+xOBQ@mail.gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Modra @ 2020-09-12  6:30 UTC (permalink / raw)
  To: Milan Buška; +Cc: binutils

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.

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: build kernel for arm64 - linker ld ignored -z relro
       [not found]   ` <CAFCWPPKDhcZEP_3GG=OMg6GRZsoUe-3TXYQQCi9+hScC9+xOBQ@mail.gmail.com>
@ 2020-09-13  6:05     ` Alan Modra
  2020-09-13 14:37       ` Milan Buška
  2020-10-05  6:15       ` Milan Buška
  0 siblings, 2 replies; 5+ messages in thread
From: Alan Modra @ 2020-09-13  6:05 UTC (permalink / raw)
  To: Milan Buška; +Cc: binutils

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

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

* Re: build kernel for arm64 - linker ld ignored -z relro
  2020-09-13  6:05     ` Alan Modra
@ 2020-09-13 14:37       ` Milan Buška
  2020-10-05  6:15       ` Milan Buška
  1 sibling, 0 replies; 5+ messages in thread
From: Milan Buška @ 2020-09-13 14:37 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

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

Result build kernel 5.8.7

Toolchain aarch64:
glibc v. 2.32
binutils v. 2.35
gcc v. 10.2.0
kernel v. 5.8.7
gmp v. 6.2.0
mpfr v. 4.1.0
mpc v. 1.2.0

- toolchain use binutils-2.35 gives the message ignore -z norelro

Toolchain aarch64:
glibc v. 2.32
binutils v. 2.34
gcc v. 10.2.0
kernel v. 5.8.7
gmp v. 6.2.0
mpfr v. 4.1.0
mpc v. 1.2.0

- toolchain use binutils v. 2.34  works well

Best regards

-- 

Remember, no question is too stupid and no problem too small
       -- We've all been beginners

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

* Re: build kernel for arm64 - linker ld ignored -z relro
  2020-09-13  6:05     ` Alan Modra
  2020-09-13 14:37       ` Milan Buška
@ 2020-10-05  6:15       ` Milan Buška
  1 sibling, 0 replies; 5+ messages in thread
From: Milan Buška @ 2020-10-05  6:15 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

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

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

end of thread, other threads:[~2020-10-05  6:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-06 16:45 build kernel for arm64 - linker ld ignored -z relro Milan Buška
2020-09-12  6:30 ` Alan Modra
     [not found]   ` <CAFCWPPKDhcZEP_3GG=OMg6GRZsoUe-3TXYQQCi9+hScC9+xOBQ@mail.gmail.com>
2020-09-13  6:05     ` Alan Modra
2020-09-13 14:37       ` Milan Buška
2020-10-05  6:15       ` Milan Buška

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).