From e8e10743f7b207b21a1efb0cc9e42487080db013 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 13 Jun 2024 15:10:15 +0100 Subject: Add --rosegment option to BFD linker to stop the '-z separate-code' from generating two read-only segments. PR 30907 --- bfd/elf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'bfd') diff --git a/bfd/elf.c b/bfd/elf.c index 74236a6..b0b1e94 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -5335,7 +5335,9 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, thus not executable, and the first section is executable then put the file and program headers in their own PT_LOAD. */ - separate_phdr = true; + if (!info->one_rosegment) + separate_phdr = true; + if ((((phdr_lma + phdr_size - 1) & addr_mask & -maxpagesize) == (sections[0]->lma & addr_mask & -maxpagesize))) { -- cgit v1.1