From fee6f17caf68b1cd2d3e3db8c546d14b082db1e1 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Sat, 8 May 2004 06:25:06 +0000 Subject: [PATCH] explicit PHDRS to control number of Elf32_Phdr: no PT_GNU_STACK l_lx_elf86.lds l_lx_exec86.lds l_lx_sep86.lds l_lx_sh86.lds committer: jreiser 1083997506 +0000 --- src/stub/l_lx_exec86.lds | 8 ++++++-- src/stub/l_lx_sep86.lds | 9 +++++++-- src/stub/l_lx_sh86.lds | 13 ++++++------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/stub/l_lx_exec86.lds b/src/stub/l_lx_exec86.lds index 37512a5a..ec9fcd58 100644 --- a/src/stub/l_lx_exec86.lds +++ b/src/stub/l_lx_exec86.lds @@ -31,6 +31,11 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386) /*ENTRY(_start)*/ +PHDRS /* force exactly 1 ELF32_Phdr: in particular, no PT_GNU_STACK */ +{ + phdr0 PT_LOAD FILEHDR PHDRS FLAGS(7); +} + SECTIONS { /* 0x00401000: l_lx_exec86.asm assumes 1 page up from 64KB boundary */ @@ -41,6 +46,5 @@ SECTIONS *(.data) *(.bss) *(COMMON) - } - /* save other Phdr for the overlay */ + } : phdr0 } diff --git a/src/stub/l_lx_sep86.lds b/src/stub/l_lx_sep86.lds index a3c2d818..15e372a0 100644 --- a/src/stub/l_lx_sep86.lds +++ b/src/stub/l_lx_sep86.lds @@ -31,15 +31,20 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386) ENTRY(_start) +PHDRS /* force exactly 2 ELF32_Phdr: in particular, no PT_GNU_STACK */ +{ + phdr0 PT_LOAD FILEHDR PHDRS FLAGS(7); + phdr1 PT_LOAD; +} SECTIONS { . = 0x00400000 + SIZEOF_HEADERS; .text : { *(.text) *(.data) - } + } : phdr0 /* 0x08048000: customary Linux/x86 Elf .text start */ . = 0x08048000 + (0xfff & .); .data : { - } + } : phdr1 } diff --git a/src/stub/l_lx_sh86.lds b/src/stub/l_lx_sh86.lds index 103a1739..b3d551b8 100644 --- a/src/stub/l_lx_sh86.lds +++ b/src/stub/l_lx_sh86.lds @@ -31,22 +31,21 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386) /*ENTRY(_start)*/ +PHDRS /* force exactly 1 ELF32_Phdr: in particular, no PT_GNU_STACK */ +{ + phdr0 PT_LOAD FILEHDR PHDRS FLAGS(7); +} + SECTIONS { /* 0x00800000: avoid 0x00400000 for shell itself being compressed */ . = 0x00800000 + SIZEOF_HEADERS; . = ALIGN(0x80); -/* - .text : { - *(.text) - *(.data) - } -*/ .data : { /* put everything together in one Phdr */ *(.text) *(.rodata) *(.data) *(.bss) *(COMMON) - } + } : phdr0 }