xref: /openbsd-src/libexec/ld.so/amd64/ld.script (revision 805b87ea74e0d6b0f6f35a146ae727de198ab801)
1c0197e40SguentherPHDRS
2c0197e40Sguenther{
3c0197e40Sguenther	rodata	PT_LOAD FILEHDR PHDRS FLAGS (4);
4a5c19628Sderaadt	btext	PT_LOAD FLAGS (0x08000005);
5*805b87eaSderaadt	text	PT_LOAD FLAGS (1);
6c0197e40Sguenther	data	PT_LOAD;
7c0197e40Sguenther	random	PT_OPENBSD_RANDOMIZE;
883762a71Sderaadt	syscalls PT_OPENBSD_SYSCALLS;
9c0197e40Sguenther	relro	PT_GNU_RELRO;
10c0197e40Sguenther	dynamic	PT_DYNAMIC;
11c0197e40Sguenther	note	PT_NOTE;
12c0197e40Sguenther}
13c0197e40Sguenther
14c0197e40SguentherSECTIONS
15c0197e40Sguenther{
16c0197e40Sguenther    . = 0 + SIZEOF_HEADERS;
17c0197e40Sguenther    /* RODATA */
18c0197e40Sguenther    .gnu.hash	: { *(.gnu.hash) } :rodata
19c0197e40Sguenther    .dynsym	: { *(.dynsym) } :rodata
20c0197e40Sguenther    .dynstr	: { *(.dynstr) } :rodata
21c0197e40Sguenther    .rodata	: { *(.rodata .rodata.*) } :rodata
22c0197e40Sguenther    .eh_frame	: { *(.eh_frame) } :rodata
23c0197e40Sguenther
24c0197e40Sguenther    /* TEXT */
25a5c19628Sderaadt    . = ALIGN(0x1000);
26c0197e40Sguenther    .boot.text	:
27c0197e40Sguenther    {
28a5c19628Sderaadt	. = ALIGN(0x1000);
29c0197e40Sguenther	boot_text_start = .;
30c0197e40Sguenther	*(.boot.text)
31c0197e40Sguenther	. = ALIGN(0x1000);
32a5c19628Sderaadt	boot_text_end = .;
33a5c19628Sderaadt    } :btext =0xcccccccc
34c0197e40Sguenther    .text	: { *(.text .text.*) } :text =0xcccccccc
35c0197e40Sguenther
36c0197e40Sguenther    /* RELRO DATA */
37c0197e40Sguenther    . = DATA_SEGMENT_ALIGN (0x100000, 0x1000);
38c0197e40Sguenther    .openbsd.randomdata :
39c0197e40Sguenther    {
40c0197e40Sguenther	*(.openbsd.randomdata .openbsd.randomdata.*)
41c0197e40Sguenther    } :data :relro :random
42c0197e40Sguenther    .data.rel.ro : { *(.data.rel.ro.local*) *(.data.rel.ro*) } :data :relro
43c0197e40Sguenther    .dynamic	: { *(.dynamic) } :data :relro :dynamic
44c0197e40Sguenther    .got	: { *(.got.plt) *(.got) } :data :relro
45c0197e40Sguenther    . = DATA_SEGMENT_RELRO_END (0, .);
46c0197e40Sguenther
4783762a71Sderaadt    .openbsd.syscalls :
4883762a71Sderaadt    {
4983762a71Sderaadt	*(.openbsd.syscalls .openbsd.syscalls.*)
5083762a71Sderaadt    } :syscalls
5183762a71Sderaadt
52c0197e40Sguenther    /* BOOTDATA */
53c0197e40Sguenther    . = ALIGN(0x1000);
54c0197e40Sguenther    boot_data_start = .;
55c0197e40Sguenther    .rela.dyn       :
56c0197e40Sguenther    {
57c0197e40Sguenther	*(.rela.text .rela.text.*)
58c0197e40Sguenther	*(.rela.rodata .rela.rodata.*)
59c0197e40Sguenther	*(.rela.data .rela.data.*)
60c0197e40Sguenther	*(.rela.got)
61c0197e40Sguenther	*(.rela.bss .rela.bss.*)
62c0197e40Sguenther    } :data
63c0197e40Sguenther/* XXX .rela.plt is unused but cannot delete: ld.bfd zeros DT_RELASZ then! */
64c0197e40Sguenther    .rela.plt	: { *(.rela.plt) } :data
65c0197e40Sguenther    .note	: { *(.note.openbsd.*) } :data :note
66c0197e40Sguenther    .hash	: { *(.hash) } :data
67c0197e40Sguenther    .boot.data	: { *(.boot.data .boot.data.*) } :data
68c0197e40Sguenther    boot_data_end = .;
69c0197e40Sguenther
70c0197e40Sguenther    /* DATA */
71c0197e40Sguenther    . = ALIGN(0x1000);
72c0197e40Sguenther    .data	: { *(.data .data.*) } :data
73c0197e40Sguenther    .bss	: { *(.dynbss) *(.bss .bss.*) *(COMMON) } :data
74c0197e40Sguenther    . = DATA_SEGMENT_END (.);
75c0197e40Sguenther
76c0197e40Sguenther    /DISCARD/	: { *(.note.GNU-stack) }
77c0197e40Sguenther}
78