Use PHDR to override where the program headers physaddr is and to remove interp.

This commit is contained in:
Ali Mashtizadeh 2023-11-20 23:11:30 -05:00
parent a32ba94b9f
commit bd157a12f5

View File

@ -4,6 +4,16 @@
OUTPUT_ARCH(arm:arm64)
ENTRY(_start)
PHDRS
{
headers PT_PHDR PHDRS AT(0x00400040);
headers PT_LOAD FILEHDR PHDRS AT(0x00400000);
text PT_LOAD;
rodata PT_LOAD;
data PT_LOAD;
}
SECTIONS
{
/* Read-only sections, merged into text segment: */
@ -19,7 +29,7 @@ SECTIONS
*(.text.hot .text.hot.*)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
}
} :text
.plt : { *(.plt) *(.iplt) }
.init :
{
@ -32,7 +42,7 @@ SECTIONS
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } :rodata
.rodata1 : { *(.rodata1) }
.interp : { *(.interp) }
.note.gnu.build-id : { *(.note.gnu.build-id) }
@ -141,7 +151,7 @@ SECTIONS
{
*(.data .data.* .gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
}
} :data
.data1 : { *(.data1) }
/* Kernel Debugger */
.kdbgcmd ALIGN(CONSTANT(COMMONPAGESIZE)) :