[ipxe-devel] [PATCH v2] [gdb] fix compilation error with new gnu as

Christian Ehrhardt christian.ehrhardt at canonical.com
Thu Sep 19 09:25:08 UTC 2019


When building the x86_64 gdbidt with newer gcc it fails recognizing
the segment registers FS/GS being too short for pushq/popq in .code64
sections.
  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'

This is due to [1] changed in bintutils. All the time the pushq/popq in
 .code64 only generated opcodes matching just what a basic pop/push
would do. Therefore switch to push/pop to match the old opcodes
we already had, but get the build to work again with new gnu as.

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

Signed-off-by: Christian Ehrhardt <christian.ehrhardt at canonical.com>
---
 src/arch/x86_64/core/gdbidt.S | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/arch/x86_64/core/gdbidt.S b/src/arch/x86_64/core/gdbidt.S
index 89280bf8..a4b0965f 100644
--- a/src/arch/x86_64/core/gdbidt.S
+++ b/src/arch/x86_64/core/gdbidt.S
@@ -106,8 +106,8 @@ gdbmach_sigill:
 gdbmach_interrupt:
 
 	/* Create register dump */
-	pushq	%gs
-	pushq	%fs
+	push	%gs
+	push	%fs
 	pushq	$0		/* %es unused in long mode */
 	pushq	$0		/* %ds unused in long mode */
 	pushq	( frame_ss	- regs_ss	- SIZEOF_REG )(%rsp)
@@ -158,8 +158,8 @@ gdbmach_interrupt:
 	popq	( frame_cs	- regs_cs	- SIZEOF_REG )(%rsp)
 	popq	( frame_ss	- regs_ss	- SIZEOF_REG )(%rsp)
 	addq	$( regs_fs - regs_ds ), %rsp	/* skip %ds, %es */
-	popq	%fs
-	popq	%gs
+	pop		%fs
+	pop		%gs
 
 	/* Skip code */
 	addq	$( gdb_end - gdb_code ), %rsp	/* skip code */
-- 
2.23.0




More information about the ipxe-devel mailing list