lkml.org 
[lkml]   [2020]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] x86/tools/relocs: Add _etext and __end_of_kernel_reserve to S_REL
On Sat, Jan 11, 2020 at 02:02:43PM +0100, Borislav Petkov wrote:
> On Fri, Jan 10, 2020 at 03:50:29PM -0500, Arvind Sankar wrote:
> > On Fri, Jan 10, 2020 at 09:38:28PM +0100, Borislav Petkov wrote:
> > > On Fri, Jan 10, 2020 at 03:23:49PM -0500, Arvind Sankar wrote:
> > > > Pre-2.23 binutils makes symbols defined outside sections absolute, so
> > > > these two symbols break the build on old linkers.
> > >
> > > -ENOTENOUGHINFO
> > >
> > > Which old linkers, how exactly do they break the build, etc etc?
> > >
> > > Please give exact reproduction steps.
> > >
> > > Thx.
> > >
> >
> > binutils-2.21 and -2.22. An x86-64 defconfig will fail with
> > Invalid absolute R_X86_64_32S relocation: _etext
> > and after fixing that one, with
> > Invalid absolute R_X86_64_32S relocation: __end_of_kernel_reserve
>
> I'm still not clear as to why this happens. I tried reproducing on
> openSUSE 12.1 which has
>
> Repository: openSUSE-12.1-Oss
> Name: binutils
> Version: 2.21.1-12.1.4
>
> and the build there fails with:
>
> objdump: arch/x86/lib/clear_page_64.o: File format not recognized
> objdump: arch/x86/lib/cmdline.o: File format not recognized
> objdump: arch/x86/lib/cmpxchg16b_emu.o: File format not recognized
> objdump: arch/x86/lib/copy_page_64.o: File format not recognized
> objdump: arch/x86/lib/copy_user_64.o: File format not recognized
> objdump: arch/x86/lib/cpu.o: File format not recognized
> ...
>
> and objdump is part of binutils.
>
> Now, this looks like another symptom of what you're reporting but what
> we're missing is the rootcause about *why* this happens.
>
> Because if the issue is hard to fix or similar, then we probably should
> raise the minimum supported binutils version from 2.21 to something
> newer and not do this fix.
>
> But before we do that, we need a proper analysis as to why it happens.
>
> Also, what distro are you using to reproduce it on?
>
> Thx.
>

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).

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

[1] https://lore.kernel.org/lkml/20200110215005.2164353-1-nivedita@alum.mit.edu/

\
 
 \ /
  Last update: 2020-01-11 18:21    [W:0.099 / U:15.604 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site