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

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 30d07026c7..4d3ce75af3 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
+override LDFLAGS += -Wl,--no-error-rwx-segments
 
 pvh.img: pvh.o pvh_main.o
 

base-commit: 40efe733e10cc00e4fb4f9f5790a28e744e63c62
-- 
2.48.1

