Bug 1219733 - qemu ipxe roms will stop compiling with binutils update
Summary: qemu ipxe roms will stop compiling with binutils update
Status: RESOLVED FIXED
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Virtualization:Tools (show other bugs)
Version: Current
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: E-mail List
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-08 13:18 UTC by Michael Matz
Modified: 2024-02-29 18:50 UTC (History)
4 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
patch for assembly files (10.87 KB, text/plain)
2024-02-08 13:19 UTC, Michael Matz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Matz 2024-02-08 13:18:15 UTC
We're preparing a binutils update to version 2.42 in openSUSE:Factory:Staging:A
( https://build.opensuse.org/request/show/1144349 ), and qemu-ipxe assembly
sources hit a problem there:

[ 3712s] gcc -E -DARCH=x86_64 -DPLATFORM=efi -DSECUREBOOT=0 -fstrength-reduce -fomit-frame-pointer -falign-jumps=1 -falign-loops=1 -falign-functions=1 -m64 -mno-mmx -mno-sse -fshort-wchar -Ui386 -Ulinux -DNVALGRIND -fpie -mno-red-zone -fstack-protector-strong  -mstack-protector-guard=global -Iinclude -I. -Iarch/x86/include -Iarch/x86_64/include -Iarch/x86_64/include/efi -Os -g -ffreestanding -fcommon -Wall -W -Wformat-nonliteral -fno-dwarf2-cfi-asm -fno-exceptions  -fno-unwind-tables -fno-asynchronous-unwind-tables -Wno-address -Wno-stringop-truncation -Wno-address-of-packed-member -Wno-array-bounds -Wno-dangling-pointer  -Werror -ffunction-sections  -include include/compiler.h -DASM_TCHAR='@' -DASM_TCHAR_OPS='@' -DCONFIG=qemu -DLOCAL_CONFIG=qemu -DASSEMBLY  -DOBJECT=stack arch/x86/core/stack.S | as --64 --divide  --fatal-warnings -o bin-x86_64-efi/stack.o
[ 3712s] arch/x86/core/stack.S: Assembler messages:
[ 3712s] arch/x86/core/stack.S:3: Warning: 64bit mode not supported on `i386' (consider swapping .arch and .code directives).
[ 3712s] {standard input}: Error: 1 warning, treating warnings as errors

The problem (see below) is newly diagnosed, from upstream it's an error.  I made
binutils only emit a warning for this (as also other packages hit this), but
unfortunately qemu iPXE sources are built with --fatal-warnings, so the demotion
to warnings doesn't help here.

The problem is the following.  Assembly files using the '.arch i386' directive
need to have their code-size set _beforehand_ to either 32bit or 16bit.  The
'--64' cmdline argument sets it to 64bit resulting in the error message.  You
cannot get rid of this cmdline argument (or replace it with --32) because then
a different kind of ELF object file would be generated.

So, what needs to happen is for such code:

   .arch i386
   ... other directives ...
   .code16  # or .code32

to move (or add) the .codeXX directive in front of the .arch directive.

I will momentarily attach a patch to do that in all files from the roms/ipxe
subdir.  I've verified that this fixes the error message and lets qemu 8.2.0
build with the new binutils.  Tumbleweed (or at least the Staging:A) still
uses qemu 8.1.something, but as the iPXE repo gets virtually no changes at all
the patch should also apply to that tree as is.

(The build-test happens in home:matz2:branches:Virtualization/qemu/15.5 )

Can I convince someone from the qemu team to please integrate this patch into
the qemu package for at least tumbleweed?
Comment 1 Michael Matz 2024-02-08 13:19:46 UTC
Created attachment 872588 [details]
patch for assembly files

This is the patch fixing things for new binutils
Comment 3 Michael Matz 2024-02-08 13:30:37 UTC
Huh, after creating this bug report I became aware of
  https://bugzilla.suse.com/show_bug.cgi?id=1219722
about the same issue refering an upstream iPXE commit.  So maybe use rather that.
Comment 5 Dario Faggioli 2024-02-14 09:58:55 UTC
(In reply to Michael Matz from comment #3)
> Huh, after creating this bug report I became aware of
>   https://bugzilla.suse.com/show_bug.cgi?id=1219722
> about the same issue refering an upstream iPXE commit.  So maybe use rather
> that.

Working on this here:
- https://github.com/openSUSE/qemu/pull/54
- https://build.opensuse.org/package/show/Virtualization:Staging:PRs:openSUSE:qemu:PR-54/qemu
Comment 6 OBSbugzilla Bot 2024-02-17 00:55:05 UTC
This is an autogenerated message for OBS integration:
This bug (1219733) was mentioned in
https://build.opensuse.org/request/show/1147249 Factory / qemu
Comment 8 Dario Faggioli 2024-02-19 16:00:20 UTC
Hey Michael, the fix should be in Factory(although, maybe not released in an actual TW snapshot yet... I didn't check). Let me know if you have a chance to test it and if things now work
Comment 9 Dominique Leuenberger 2024-02-19 16:20:30 UTC
(In reply to Dario Faggioli from comment #8)
> Hey Michael, the fix should be in Factory(although, maybe not released in an
> actual TW snapshot yet... I didn't check). Let me know if you have a chance
> to test it and if things now work

Was checked in to snapshot 0418 (switching GCC libs to gcc14 - will take a while to settle the builds)
Comment 11 Michael Matz 2024-02-20 13:26:57 UTC
Factory and friends look good from binutils plus qemu perspective.  So, you can
close this whenever you please :-)  Thanks Dario.
Comment 13 Dario Faggioli 2024-02-28 14:43:56 UTC
As per comment 11. Thanks everyone!