Skip to content

Commit b2b5d37

Browse files
sravnborgLinus Torvalds
authored andcommitted
alpha: beautify vmlinux.lds
Introduced a consistent style in vmlinux.lds and it now matches the soon-to-be common style for all arch's vmlinux.lds files. In addition: - Replaced hardcoded constant with PAGE_SIZE - Fix page.h so PAGE_SIZE can be used from assembler and in lds files - Move a few labels inside brackets so linker alignment will not make label point ot a too low address - Replaced DWARF and STABS sections with definitions from asm-generic Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Richard Henderson <rth@twiddle.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent a5f833f commit b2b5d37

2 files changed

Lines changed: 136 additions & 127 deletions

File tree

‎arch/alpha/kernel/vmlinux.lds.S‎

Lines changed: 134 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <asm-generic/vmlinux.lds.h>
2+
#include <asm/page.h>
23

34
OUTPUT_FORMAT("elf64-alpha")
45
OUTPUT_ARCH(alpha)
@@ -8,138 +9,145 @@ jiffies = jiffies_64;
89
SECTIONS
910
{
1011
#ifdef CONFIG_ALPHA_LEGACY_START_ADDRESS
11-
. = 0xfffffc0000310000;
12+
. = 0xfffffc0000310000;
1213
#else
13-
. = 0xfffffc0001010000;
14+
. = 0xfffffc0001010000;
1415
#endif
1516

16-
_text = .; /* Text and read-only data */
17-
.text : {
17+
_text = .; /* Text and read-only data */
18+
.text : {
1819
*(.text.head)
19-
TEXT_TEXT
20-
SCHED_TEXT
21-
LOCK_TEXT
22-
*(.fixup)
23-
*(.gnu.warning)
24-
} :kernel
25-
_etext = .; /* End of text section */
26-
27-
. = ALIGN(16);
28-
__start___ex_table = .; /* Exception table */
29-
__ex_table : { *(__ex_table) }
30-
__stop___ex_table = .;
31-
32-
NOTES :kernel :note
33-
.dummy : { *(.dummy) } :kernel
34-
35-
RODATA
36-
37-
/* Will be freed after init */
38-
. = ALIGN(8192); /* Init code and data */
39-
__init_begin = .;
40-
.init.text : {
41-
_sinittext = .;
42-
*(.init.text)
43-
_einittext = .;
44-
}
45-
.init.data : { *(.init.data) }
46-
47-
. = ALIGN(16);
48-
__setup_start = .;
49-
.init.setup : { *(.init.setup) }
50-
__setup_end = .;
51-
52-
. = ALIGN(8);
53-
__initcall_start = .;
54-
.initcall.init : {
55-
INITCALLS
56-
}
57-
__initcall_end = .;
20+
TEXT_TEXT
21+
SCHED_TEXT
22+
LOCK_TEXT
23+
*(.fixup)
24+
*(.gnu.warning)
25+
} :kernel
26+
_etext = .; /* End of text section */
27+
28+
/* Exception table */
29+
. = ALIGN(16);
30+
__ex_table : {
31+
__start___ex_table = .;
32+
*(__ex_table)
33+
__stop___ex_table = .;
34+
}
35+
36+
NOTES :kernel :note
37+
.dummy : {
38+
*(.dummy)
39+
} :kernel
40+
41+
RODATA
42+
43+
/* Will be freed after init */
44+
. = ALIGN(PAGE_SIZE);
45+
/* Init code and data */
46+
__init_begin = .;
47+
.init.text : {
48+
_sinittext = .;
49+
*(.init.text)
50+
_einittext = .;
51+
}
52+
.init.data : {
53+
*(.init.data)
54+
}
55+
56+
. = ALIGN(16);
57+
.init.setup : {
58+
__setup_start = .;
59+
*(.init.setup)
60+
__setup_end = .;
61+
}
62+
63+
. = ALIGN(8);
64+
.initcall.init : {
65+
__initcall_start = .;
66+
INITCALLS
67+
__initcall_end = .;
68+
}
5869

5970
#ifdef CONFIG_BLK_DEV_INITRD
60-
. = ALIGN(8192);
61-
__initramfs_start = .;
62-
.init.ramfs : { *(.init.ramfs) }
63-
__initramfs_end = .;
71+
. = ALIGN(PAGE_SIZE);
72+
.init.ramfs : {
73+
__initramfs_start = .;
74+
*(.init.ramfs)
75+
__initramfs_end = .;
76+
}
6477
#endif
6578

66-
. = ALIGN(8);
67-
.con_initcall.init : {
68-
__con_initcall_start = .;
69-
*(.con_initcall.init)
70-
__con_initcall_end = .;
71-
}
72-
73-
. = ALIGN(8);
74-
SECURITY_INIT
75-
76-
PERCPU(8192)
77-
78-
. = ALIGN(2*8192);
79-
__init_end = .;
80-
/* Freed after init ends here */
81-
82-
/* Note 2 page alignment above. */
83-
.data.init_thread : { *(.data.init_thread) }
84-
85-
. = ALIGN(8192);
86-
.data.page_aligned : { *(.data.page_aligned) }
87-
88-
. = ALIGN(64);
89-
.data.cacheline_aligned : { *(.data.cacheline_aligned) }
90-
91-
_data = .;
92-
.data : { /* Data */
93-
DATA_DATA
94-
CONSTRUCTORS
95-
}
96-
97-
.got : { *(.got) }
98-
.sdata : { *(.sdata) }
99-
100-
_edata = .; /* End of data section */
101-
102-
__bss_start = .;
103-
.sbss : { *(.sbss) *(.scommon) }
104-
.bss : { *(.bss) *(COMMON) }
105-
__bss_stop = .;
106-
107-
_end = .;
108-
109-
/* Sections to be discarded */
110-
/DISCARD/ : { *(.exit.text) *(.exit.data) *(.exitcall.exit) }
111-
112-
.mdebug 0 : { *(.mdebug) }
113-
.note 0 : { *(.note) }
114-
.comment 0 : { *(.comment) }
115-
116-
/* Stabs debugging sections */
117-
.stab 0 : { *(.stab) }
118-
.stabstr 0 : { *(.stabstr) }
119-
.stab.excl 0 : { *(.stab.excl) }
120-
.stab.exclstr 0 : { *(.stab.exclstr) }
121-
.stab.index 0 : { *(.stab.index) }
122-
.stab.indexstr 0 : { *(.stab.indexstr) }
123-
/* DWARF 1 */
124-
.debug 0 : { *(.debug) }
125-
.line 0 : { *(.line) }
126-
/* GNU DWARF 1 extensions */
127-
.debug_srcinfo 0 : { *(.debug_srcinfo) }
128-
.debug_sfnames 0 : { *(.debug_sfnames) }
129-
/* DWARF 1.1 and DWARF 2 */
130-
.debug_aranges 0 : { *(.debug_aranges) }
131-
.debug_pubnames 0 : { *(.debug_pubnames) }
132-
/* DWARF 2 */
133-
.debug_info 0 : { *(.debug_info) }
134-
.debug_abbrev 0 : { *(.debug_abbrev) }
135-
.debug_line 0 : { *(.debug_line) }
136-
.debug_frame 0 : { *(.debug_frame) }
137-
.debug_str 0 : { *(.debug_str) }
138-
.debug_loc 0 : { *(.debug_loc) }
139-
.debug_macinfo 0 : { *(.debug_macinfo) }
140-
/* SGI/MIPS DWARF 2 extensions */
141-
.debug_weaknames 0 : { *(.debug_weaknames) }
142-
.debug_funcnames 0 : { *(.debug_funcnames) }
143-
.debug_typenames 0 : { *(.debug_typenames) }
144-
.debug_varnames 0 : { *(.debug_varnames) }
79+
. = ALIGN(8);
80+
.con_initcall.init : {
81+
__con_initcall_start = .;
82+
*(.con_initcall.init)
83+
__con_initcall_end = .;
84+
}
85+
86+
. = ALIGN(8);
87+
SECURITY_INIT
88+
89+
PERCPU(PAGE_SIZE)
90+
91+
. = ALIGN(2 * PAGE_SIZE);
92+
__init_end = .;
93+
/* Freed after init ends here */
94+
95+
/* Note 2 page alignment above. */
96+
.data.init_thread : {
97+
*(.data.init_thread)
98+
}
99+
100+
. = ALIGN(PAGE_SIZE);
101+
.data.page_aligned : {
102+
*(.data.page_aligned)
103+
}
104+
105+
. = ALIGN(64);
106+
.data.cacheline_aligned : {
107+
*(.data.cacheline_aligned)
108+
}
109+
110+
_data = .;
111+
/* Data */
112+
.data : {
113+
DATA_DATA
114+
CONSTRUCTORS
115+
}
116+
117+
.got : {
118+
*(.got)
119+
}
120+
.sdata : {
121+
*(.sdata)
122+
}
123+
_edata = .; /* End of data section */
124+
125+
__bss_start = .;
126+
.sbss : {
127+
*(.sbss)
128+
*(.scommon)
129+
}
130+
.bss : {
131+
*(.bss)
132+
*(COMMON)
133+
}
134+
__bss_stop = .;
135+
_end = .;
136+
137+
/* Sections to be discarded */
138+
/DISCARD/ : {
139+
*(.exit.text)
140+
*(.exit.data)
141+
*(.exitcall.exit)
142+
}
143+
144+
.mdebug 0 : {
145+
*(.mdebug)
146+
}
147+
.note 0 : {
148+
*(.note)
149+
}
150+
151+
STABS_DEBUG
152+
DWARF_DEBUG
145153
}

‎include/asm-alpha/page.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33

44
#ifdef __KERNEL__
55

6+
#include <linux/const.h>
67
#include <asm/pal.h>
78

89
/* PAGE_SHIFT determines the page size */
910
#define PAGE_SHIFT 13
10-
#define PAGE_SIZE (1UL << PAGE_SHIFT)
11+
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
1112
#define PAGE_MASK (~(PAGE_SIZE-1))
1213

1314
#ifndef __ASSEMBLY__

0 commit comments

Comments
 (0)