Skip to content

Commit

Permalink
Fix building on x86_64 with binutils 2.41
Browse files Browse the repository at this point in the history
Newer versions of the GNU assembler (observed with binutils 2.41) will
complain about the ".arch i386" in files assembled with "as --64",
with the message "Error: 64bit mode not supported on 'i386'".

Fix by moving ".arch i386" below the relevant ".code32" directive, so
that the assembler is no longer expecting 64-bit instructions to be used
by the time that the ".arch i386" directive is encountered.

Based on similar iPXE fix:
ipxe/ipxe@6ca597eee

Signed-off-by: Michel Lind <[email protected]>
Signed-off-by: Simon Horman <[email protected]>
  • Loading branch information
michel-slm authored and horms committed Feb 2, 2024
1 parent 94fbe64 commit 328de8e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion purgatory/arch/i386/entry32-16-debug.S
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
.globl entry16_debug_pre32
.globl entry16_debug_first32
.globl entry16_debug_old_first32
.arch i386
.balign 16
entry16_debug:
.code32
.arch i386
/* Compute where I am running at (assumes esp valid) */
call 1f
1: popl %ebx
Expand Down
2 changes: 1 addition & 1 deletion purgatory/arch/i386/entry32-16.S
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
#undef i386
.text
.globl entry16, entry16_regs
.arch i386
.balign 16
entry16:
.code32
.arch i386
/* Compute where I am running at (assumes esp valid) */
call 1f
1: popl %ebx
Expand Down
2 changes: 1 addition & 1 deletion purgatory/arch/i386/entry32.S
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
#undef i386

.text
.arch i386
.globl entry32, entry32_regs
entry32:
.code32
.arch i386

/* Setup a gdt that should that is generally usefully */
lgdt %cs:gdt
Expand Down
2 changes: 1 addition & 1 deletion purgatory/arch/i386/setup-x86.S
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
#undef i386

.text
.arch i386
.globl purgatory_start
purgatory_start:
.code32
.arch i386

/* Load a gdt so I know what the segment registers are */
lgdt %cs:gdt
Expand Down

0 comments on commit 328de8e

Please sign in to comment.