Re: [PATCH 1/1] x86/purgatory: Change compiler flags to avoid relocation errors.
From: Nick Desaulniers
Date: Thu Sep 05 2019 - 14:20:11 EST
On Wed, Sep 4, 2019 at 10:34 PM Andreas Smas <andreas@xxxxxxxxxxxxxxx> wrote:
>
> On Wed, Sep 4, 2019 at 3:19 PM Nick Desaulniers <ndesaulniers@xxxxxxxxxx> wrote:
> > Thanks for confirming the fix. While it sounds like -mcmodel=large is
> > the only necessary change, I don't object to -ffreestanding of
> > -fno-zero-initialized-in-bss being readded, especially since I think
> > what you've done with PURGATORY_CFLAGS_REMOVE is more concise.
>
> Without -ffreestanding this results in undefined symbols (as before this patch)
Thanks for the report and sorry for the breakage. Can you test
Steve's patch and send your tested by tag? Steve will likely respin
the final patch today with Boris' feedback, so now is the time to get
on the train.
>
> $ readelf -a arch/x86/purgatory/purgatory.ro|grep UND
> 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
^ what's that? A <strikethrough>horse</strikethrough> symbol with no name?
> 51: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __stack_chk_fail
^ so I would have expected the stackprotector changes in my and Steve
commits to prevent compiler emission of that runtime-implemented
symbol. ie. that `-ffreestanding` affects that and not removing the
stackprotector flags begs another question. Without `-ffreestanding`
and `-fstack-protector` (or `-fstack-protector-strong`), why would the
compiler emit references to __stack_chk_fail? Which .o file that
composes the .ro file did we fail to remove the `-fstack-protector*`
flag from? `-ffreestanding` seems to be covering that up.
>
> I just bumped into this issue as I discovered that kexec() no longer works after
> the x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS -commit
> was merged.
--
Thanks,
~Nick Desaulniers