https://sourceware.org/bugzilla/show_bug.cgi?id=22423
--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to Paul Pluzhnikov from comment #1) > > It was reasonable 20 years ago. > > Normally PT_PHDR overlaps with the first PT_LOAD. > > If you keep that, the flags on PT_PHDR don't matter (the first PT_LOAD will > have PF_X). > > If you don't keep the overlap, you'll waste an entire page for 64-byte > PT_PHDR. > > Also, a lot of programs assume that the first PT_LOAD "covers" PT_PHDR and > starts with ElfW(Ehdr). It's not guaranteed, but it has been true for the > last 20 years. You'll break all such programs. My patch does't change the first PT_LOAD permission. We just have: Elf file type is EXEC (Executable file) Entry point 0x8048310 There are 9 program headers, starting at offset 52 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align PHDR 0x000034 0x08048034 0x08048034 0x00120 0x00120 R 0x4 INTERP 0x000154 0x08048154 0x08048154 0x00013 0x00013 R 0x1 [Requesting program interpreter: /lib/ld-linux.so.2] LOAD 0x000000 0x08048000 0x08048000 0x005d0 0x005d0 R E 0x1000 LOAD 0x000f0c 0x08049f0c 0x08049f0c 0x0010c 0x00110 RW 0x1000 Nothing will break. I am working on -z readonly, which is equivalent to --rosegment for gold. With -z readonly, I got Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align PHDR 0x000034 0x00400034 0x00400034 0x00160 0x00160 R 0x4 INTERP 0x000194 0x00400194 0x00400194 0x0001a 0x0001a R 0x1 [Requesting program interpreter: /libx32/ld-linux-x32.so.2] LOAD 0x000000 0x00400000 0x00400000 0x0037c 0x0037c R 0x200000 LOAD 0x000e68 0x00600e68 0x00600e68 0x00195 0x00195 R E 0x200000 LOAD 0x001000 0x00601000 0x00601000 0x0011c 0x0011c R 0x200000 LOAD 0x200ef0 0x00800ef0 0x00800ef0 0x00134 0x00138 RW 0x200000 It makes permission of PHDR segment the same as the first LOAD segment. Again, nothing should break. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils