source: mainline/kernel/arch/riscv64/_link.ld.in

Last change on this file was 6677acb, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 19 months ago

Emit .text/.data/.eh_frame sections in kernel ELF files

Gives tools like objdump an easier time interpreting contents of
the file, and allows kernel to find .eh_frame_hdr since the linker
emits a program header for it when it's present under the standard
name.

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2 * RISC-V 64 linker script
3 *
4 * kernel text
5 * kernel data
6 *
7 */
8
9OUTPUT_ARCH(riscv)
10ENTRY(kernel_image_start)
11
12#include <arch/boot/boot.h>
13#include <arch/mm/page.h>
14
15SECTIONS {
16 kernel_load_address = PA2KA(BOOT_OFFSET);
17
18 .text (PA2KA(BOOT_OFFSET) + SIZEOF_HEADERS) : AT (BOOT_OFFSET + SIZEOF_HEADERS) {
19 ktext_start = .;
20 KEEP(*(K_TEXT_START));
21 *(.text .text.*);
22 ktext_end = .;
23 }
24
25 /* stack unwinding data */
26 .eh_frame_hdr : {
27 eh_frame_hdr_start = .;
28 *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*);
29 eh_frame_hdr_end = .;
30 }
31
32 .eh_frame : {
33 eh_frame_start = .;
34 KEEP(*(.eh_frame .eh_frame.*));
35 eh_frame_end = .;
36 }
37
38 .data : {
39 kdata_start = .;
40 *(.data .data.*); /* initialized data */
41 *(.rodata .rodata.*);
42 *(.sdata .sdata.*);
43 *(.sbss .sbss.*);
44 *(.scommon .scommon.*);
45 *(.bss .bss.*); /* uninitialized static variables */
46 *(COMMON); /* global variables */
47 kdata_end = .;
48 }
49
50 .comment 0 : { *(.comment); }
51 .debug_abbrev 0 : { *(.debug_abbrev); }
52 .debug_abbrev.dwo 0 : { *( .debug_abbrev.dwo); }
53 .debug_addr 0 : { *(.debug_addr); }
54 .debug_aranges 0 : { *(.debug_aranges); }
55 .debug_cu_index 0 : { *(.debug_cu_index); }
56 .debug_frame 0 : { *(.debug_frame); }
57 .debug_frame_hdr 0 : { *(.debug_frame_hdr); }
58 .debug_info 0 : { *(.debug_info); }
59 .debug_info.dwo 0 : { *(.debug_info.dwo); }
60 .debug_line 0 : { *(.debug_line); }
61 .debug_line.dwo 0 : { *(.debug_line.dwo); }
62 .debug_line_str 0 : { *(.debug_line_str); }
63 .debug_loc 0 : { *(.debug_loc); }
64 .debug_loclists 0 : { *(.debug_loclists); }
65 .debug_loclists.dwo 0 : { *(.debug_loclists.dwo); }
66 .debug_macinfo 0 : { *(.debug_macinfo); }
67 .debug_macro 0 : { *(.debug_macro); }
68 .debug_macro.dwo 0 : { *(.debug_macro.dwo); }
69 .debug_names 0 : { *(.debug_names); }
70 .debug_pubnames 0 : { *(.debug_pubnames); }
71 .debug_pubtypes 0 : { *(.debug_pubtypes); }
72 .debug_ranges 0 : { *(.debug_ranges); }
73 .debug_rnglists 0 : { *(.debug_rnglists); }
74 .debug_str 0 : { *(.debug_str); }
75 .debug_str.dwo 0 : { *(.debug_str.dwo); }
76 .debug_str_offsets 0 : { *(.debug_str_offsets); }
77 .debug_str_offsets.dwo 0 : { *(.debug_str_offsets.dwo); }
78 .debug_tu_index 0 : { *(.debug_tu_index); }
79 .debug_types 0 : { *(.debug_types); }
80
81 /DISCARD/ : {
82 *(.mdebug*);
83 *(.pdr);
84 *(.comment);
85 *(.note);
86 }
87}
Note: See TracBrowser for help on using the repository browser.