https://mail.gnu.org/archive/html/qemu-devel/2025-02/msg04327.html

Refreshed for QEMU 11.0.0 where LDFLAGS line now includes -m,elf_i386.

From eca5286f01652fd5801ba89b7752a7895620a852 Mon Sep 17 00:00:00 2001
Message-ID: <eca5286f01652fd5801ba89b7752a7895620a852.1740071281.git.sam@gentoo.org>
From: Sam James <sam@gentoo.org>
Date: Thu, 20 Feb 2025 17:05:59 +0000
Subject: [PATCH] optionrom: pass -Wl,--no-error-rwx-segments

If GNU Binutils is configured with --enable-error-rwx-segments=yes, one
gets the following for optionrom:
```
.../bin/ld: error: pvh.img has a LOAD segment with RWX permissions
.../bin/ld: final link faile
```

Pass -Wl,--no-error-rwx-segments to suppress that.
---
 pc-bios/optionrom/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index abcdef1234..1234abcdef 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -37,6 +37,7 @@ config-cc.mak: Makefile
 -include config-cc.mak

 override LDFLAGS = -nostdlib -Wl,--build-id=none,-T,$(SRC_DIR)/flat.lds,-m,elf_i386
+override LDFLAGS += -Wl,--no-error-rwx-segments

 pvh.img: pvh.o pvh_main.o

