Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved]Linux 5.9 arm64: ld.bfd: warning: -z norelro ignored
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1932

PostPosted: Fri Oct 16, 2020 11:31 pm    Post subject: [solved]Linux 5.9 arm64: ld.bfd: warning: -z norelro ignored Reply with quote

Anyone know what's causing this warning when I compile the Linux 5.9 kernel? I don't think I've seen it previously. This is vanilla-sources-5.9.0.

Code:
make LD=ld.bfd -j4
...
  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.bfd: warning: -z norelro ignored
  KSYM    .tmp_vmlinux.kallsyms1.o
  LD      .tmp_vmlinux.kallsyms2
ld.bfd: warning: -z norelro ignored
  KSYM    .tmp_vmlinux.kallsyms2.o
  LD      vmlinux
ld.bfd: warning: -z norelro ignored
  SORTTAB vmlinux
  SYSMAP  System.map
  OBJCOPY arch/arm64/boot/Image
  GZIP    arch/arm64/boot/Image.gz


Last edited by Etal on Sun Nov 15, 2020 3:54 pm; edited 1 time in total
Back to top
View user's profile Send private message
erm67
l33t
l33t


Joined: 01 Nov 2005
Posts: 653
Location: EU

PostPosted: Sat Oct 17, 2020 4:52 pm    Post subject: Reply with quote

for me vanilla 5.9.1 & gcc 10.2.0 compiles flawlessly.
_________________
Ok boomer
True ignorance is not the absence of knowledge, but the refusal to acquire it.
Ab esse ad posse valet, a posse ad esse non valet consequentia

My fediverse account: @erm67@erm67.dynu.net
Back to top
View user's profile Send private message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1932

PostPosted: Sat Oct 17, 2020 7:36 pm    Post subject: Reply with quote

Thanks for confirming. Do you have CONFIG_RELOCATABLE on?

Yesterday I ended up cross-compiling with clang/lld (CC=clang LLVM=1) which built without issues.

But if I switch CONFIG_RELOCATABLE off, it builds fine with gcc as well.

I probably don't need it. I think it's only useful for CONFIG_RANDOMIZE_BASE but my bootloader doesn't provide entropy so I can't use it.
Back to top
View user's profile Send private message
erm67
l33t
l33t


Joined: 01 Nov 2005
Posts: 653
Location: EU

PostPosted: Sat Oct 17, 2020 8:49 pm    Post subject: Reply with quote

Code:
CONFIG_RELOCATABLE=y
CONFIG_RANDOMIZE_BASE=y


Code:
 ld.bfd -v
GNU ld (GNU Binutils) 2.35
 gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-unknown-linux-gnu/10.2.0/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://github.com/archlinuxarm/PKGBUILDs/issues --enable-languages=c,c++,fortran,go,lto,objc,obj-c++,d --with-isl --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id --enable-lto --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-libunwind-exceptions --disable-multilib --disable-werror --host=aarch64-unknown-linux-gnu --build=aarch64-unknown-linux-gnu --with-arch=armv8-a --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419 gdc_include_dir=/usr/include/dlang/gdc
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.0 (GCC)


Probably the -zrelro conflicts with relocatable but where does it come from?
_________________
Ok boomer
True ignorance is not the absence of knowledge, but the refusal to acquire it.
Ab esse ad posse valet, a posse ad esse non valet consequentia

My fediverse account: @erm67@erm67.dynu.net
Back to top
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2852

PostPosted: Sat Oct 17, 2020 9:02 pm    Post subject: Reply with quote

erm67 wrote:
Probably the -zrelro conflicts with relocatable but where does it come from?
Not familiar with arm to know what is happening here but binutils in gentoo is built with --enable-relro which makes it default for ELF targets.
Back to top
View user's profile Send private message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1932

PostPosted: Sat Oct 17, 2020 10:14 pm    Post subject: Reply with quote

Mine's slightly newer:

Code:
$ ld.bfd -v
GNU ld (Gentoo 2.35.1 p1) 2.35.1
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-unknown-linux-gnu/10.2.0/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-10.2.0-r2/work/gcc-10.2.0/configure --host=aarch64-unknown-linux-gnu --target=aarch64-unknown-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/aarch64-unknown-linux-gnu/gcc-bin/10.2.0 --includedir=/usr/lib/gcc/aarch64-unknown-linux-gnu/10.2.0/include --datadir=/usr/share/gcc-data/aarch64-unknown-linux-gnu/10.2.0 --mandir=/usr/share/gcc-data/aarch64-unknown-linux-gnu/10.2.0/man --infodir=/usr/share/gcc-data/aarch64-unknown-linux-gnu/10.2.0/info --with-gxx-include-dir=/usr/lib/gcc/aarch64-unknown-linux-gnu/10.2.0/include/g++-v10 --with-python-dir=/share/gcc-data/aarch64-unknown-linux-gnu/10.2.0/python --enable-languages=c,c++ --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --disable-nls --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 10.2.0-r2 p3' --disable-esp --enable-libstdcxx-time --with-build-config=bootstrap-lto --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --disable-fixed-point --enable-libgomp --disable-libssp --disable-libada --disable-systemtap --enable-vtable-verify --without-zstd --enable-lto --without-isl --enable-default-pie --enable-default-ssp
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (Gentoo 10.2.0-r2 p3)


The "-z norelro" comes from a kernel Makefile:
Code:
/usr/src/linux-5.9.0/arch/arm64/Makefile-ifeq ($(CONFIG_RELOCATABLE), y)
/usr/src/linux-5.9.0/arch/arm64/Makefile-# Pass --no-apply-dynamic-relocs to restore pre-binutils-2.27 behaviour
/usr/src/linux-5.9.0/arch/arm64/Makefile-# for relative relocs, since this leads to better Image compression
/usr/src/linux-5.9.0/arch/arm64/Makefile-# with the relocation offsets always being zero.
/usr/src/linux-5.9.0/arch/arm64/Makefile:LDFLAGS_vmlinux      += -shared -Bsymbolic -z notext -z norelro \
/usr/src/linux-5.9.0/arch/arm64/Makefile-         $(call ld-option, --no-apply-dynamic-relocs)
/usr/src/linux-5.9.0/arch/arm64/Makefile-endif
Back to top
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2852

PostPosted: Mon Nov 02, 2020 11:47 am    Post subject: Reply with quote

Seem 5.9.3 changed something regarding this:
Code:
arm64: link with -z norelro regardless of CONFIG_RELOCATABLE
Back to top
View user's profile Send private message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1932

PostPosted: Tue Nov 03, 2020 3:48 am    Post subject: Reply with quote

Now with 5.9.3 it shows the warning even if CONFIG_RELOCATABLE is off, because that patch made it so that, uh, it links "with -z norelro regardless of CONFIG_RELOCATABLE" :lol:

https://lore.kernel.org/linux-arm-kernel/20201016175339.2429280-1-ndesaulniers@google.com

Quote:
ld.lld defaults to -z relro while ld.bfd defaults to -z norelro. This
was previously fixed, but only for CONFIG_RELOCATABLE=y.

Does that mean the warning just says it's ignored because it's the default?
Back to top
View user's profile Send private message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1932

PostPosted: Sun Nov 15, 2020 3:53 pm    Post subject: Reply with quote

I updated to 5.9.8 and everything was fine despite the warnings, so marking as solved.
Back to top
View user's profile Send private message
erm67
l33t
l33t


Joined: 01 Nov 2005
Posts: 653
Location: EU

PostPosted: Sun Nov 15, 2020 6:28 pm    Post subject: Reply with quote

I think I should compile a kernel :-)

BTW I got the warning with one of the 5.10-rcs some time ago.
_________________
Ok boomer
True ignorance is not the absence of knowledge, but the refusal to acquire it.
Ab esse ad posse valet, a posse ad esse non valet consequentia

My fediverse account: @erm67@erm67.dynu.net
Back to top
View user's profile Send private message
mDup
Apprentice
Apprentice


Joined: 14 Apr 2006
Posts: 212

PostPosted: Tue Dec 15, 2020 2:06 pm    Post subject: Reply with quote

Etal wrote:
I updated to 5.9.8 and everything was fine despite the warnings, so marking as solved.


for when the warning was seen, did the kernel boot or not ?
Back to top
View user's profile Send private message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1932

PostPosted: Tue Dec 15, 2020 2:58 pm    Post subject: Reply with quote

mDup wrote:
Etal wrote:
I updated to 5.9.8 and everything was fine despite the warnings, so marking as solved.


for when the warning was seen, did the kernel boot or not ?


There were warnings and yes it booted.
Back to top
View user's profile Send private message
mDup
Apprentice
Apprentice


Joined: 14 Apr 2006
Posts: 212

PostPosted: Tue Dec 15, 2020 11:38 pm    Post subject: Reply with quote

Etal wrote:
mDup wrote:
Etal wrote:
I updated to 5.9.8 and everything was fine despite the warnings, so marking as solved.


for when the warning was seen, did the kernel boot or not ?


There were warnings and yes it booted.


OK same here :!:
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum