[ipxe-devel] [RFC] [gdb] fix compilation error with gcc 9.2

Christian Ehrhardt christian.ehrhardt at canonical.com
Thu Sep 19 06:28:57 UTC 2019


Hi,
In the meantime I 've had a few people reproducing the issue so it
doesn't seem "just me". Thanks Valentine and Matthias for that.
In addition I reached out to binutils upstream [1] and they confirmed
that the change was not an accident/bug but intentional [2] so I guess
we really should consider adapting the IPXE code to work again.

But as I initially said, I just wrote more or less "something" based
on gut feeling and would appreciate a discussion on the actual
assembly we should use in that snippet.
It is easy to drop the popq to pop(lessthanq) but the question to me
was if gdb insists on the target being of 64 bits - that is wha I
added a bunch of empty pop/push.

Yet due to my analysis (see the binutils bug for details) I found that
the old .code64 pushq/popq generated just the basic opcode (which was
odd, but that is what it is).
So the focus probably better should be to do whatever we need to reach
the same opcode that we had before.
In which was we'd just use push/pop without suffix and no filling as I
have done in my initial patch.
I'm happy to supply a v2 based on that insight, but still would need
someone experienced on that part of the code to feel reassured.

[1]: https://sourceware.org/bugzilla/show_bug.cgi?id=25012
[2]: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=21df382b918888de64749e977f185c4e10a5b838

On Wed, Sep 11, 2019 at 9:15 AM Christian Ehrhardt
<christian.ehrhardt at canonical.com> wrote:
>
> On Tue, Sep 10, 2019 at 12:10 PM Christian Ehrhardt
> <christian.ehrhardt at canonical.com> wrote:
> >
> > When building the x86_64 gdbidt with newer gcc it fails recognizing
> > the segment registers FS/GS being too short for pushq/popq.
> >   arch/x86_64/core/gdbidt.S:109: Error: operand type mismatch for `push'
> >   arch/x86_64/core/gdbidt.S:110: Error: operand type mismatch for `push'
> >   arch/x86_64/core/gdbidt.S:161: Error: operand type mismatch for `pop'
> >   arch/x86_64/core/gdbidt.S:162: Error: operand type mismatch for `pop'
> >
>
> FYI the following seem to be the easiest steps to trigger the issue:
>
> git clone git://git.ipxe.org/ipxe.git
> cd ipxe/src
> make veryclean
> make V=1 bin-x86_64-efi/ipxe.efi
>
> Much easier than changing config headers I'd think.
> And it reliably triggers above issue for me.



-- 
Christian Ehrhardt
Software Engineer, Ubuntu Server
Canonical Ltd



More information about the ipxe-devel mailing list