Re: [PATCH] x86/tools/relocs: Add _etext and __end_of_kernel_reserve to S_REL

From: Borislav Petkov
Date: Mon Jan 13 2020 - 08:43:18 EST


On Sat, Jan 11, 2020 at 12:20:48PM -0500, Arvind Sankar wrote:
> I'm not sure if that's the same issue. The root cause for the one I
> reported is described in more detail in [1], and the change that makes
> these symbols no longer absolute is commit d2667025dd30 in binutils-gdb
> (sourceware.org seems to be taking too long to respond from here so I
> don't have the web link).

My binutils guy says that the proper fix should be to make those two
symbols section-relative, i.e., move _etext at the end of the .text
section and so on.

Please check whether this fixes the build issue too because if it does,
it would be The RightThing(tm).

> I'm running gentoo, but building the kernel using binutils-2.21.1
> compiled from the GNU source tarball, and gcc-4.6.4 again compiled from
> source. (It's not something I normally need but I was investigating
> something else to see what exactly happens with older toolchains.)
>
> I used the below to compile the kernel (I added in
> readelf/objdump/objcopy just now, and it does build until the relocs
> error). The config is x86-64 defconfig with CONFIG_RETPOLINE overridden
> to n (since gcc 4.6.4 doesn't support retpoline).
>
> make O=~/kernel64 -j LD=~/old/bin/ld AS=~/old/bin/as READELF=~/old/bin/readelf \
> OBJDUMP=~/old/bin/objdump OBJCOPY=~/old/bin/objcopy GCC=~/old/bin/gcc

Make this all part of your commit message because it explains in detail
how exactly you've triggered it so that anyone else reading this can
reproduce her/himself.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette