-
Notifications
You must be signed in to change notification settings - Fork 620
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3365 from masatake/macro-expansion--ldscript
LdScript: expand C preprocessor macros
- Loading branch information
Showing
8 changed files
with
240 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--sort=no | ||
--param-CPreProcessor._expand=1 | ||
--fields=+{signature}{roles} | ||
--fields-CPreProcessor=+{macrodef} | ||
--extras=+r |
10 changes: 10 additions & 0 deletions
10
Units/parser-ldscript.r/lds-macro-expansion.d/expected.tags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
MEM_DISCARD input.lds.S /^#define MEM_DISCARD(/;" d file: signature:(sec) roles:def macrodef:*(.mem##sec) | ||
INIT_TEXT input.lds.S /^#define INIT_TEXT(/;" d file: signature:(X,A) roles:def macrodef:*A *X MEM_DISCARD(init.text*) | ||
INIT_TEXT_SECTION input.lds.S /^#define INIT_TEXT_SECTION(/;" d file: signature:(inittext_align,Y,B) roles:def macrodef:. = ALIGN(inittext_align); .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { _sinittext = .; INIT_TEXT(Y,B) _einittext = .; } | ||
.init.text input.lds.S /^ INIT_TEXT_SECTION(PAGE_SIZE,(.text.startup),(.init.text .init.text.*))$/;" S roles:def | ||
_sinittext input.lds.S /^ INIT_TEXT_SECTION(PAGE_SIZE,(.text.startup),(.init.text .init.text.*))$/;" s section:.init.text roles:def | ||
.init.text input.lds.S /^ INIT_TEXT_SECTION(PAGE_SIZE,(.text.startup),(.init.text .init.text.*))$/;" i section:.init.text roles:mapped | ||
.init.text. input.lds.S /^ INIT_TEXT_SECTION(PAGE_SIZE,(.text.startup),(.init.text .init.text.*))$/;" i section:.init.text roles:mapped | ||
.text.startup input.lds.S /^ INIT_TEXT_SECTION(PAGE_SIZE,(.text.startup),(.init.text .init.text.*))$/;" i section:.init.text roles:mapped | ||
.meminit.text input.lds.S /^ INIT_TEXT_SECTION(PAGE_SIZE,(.text.startup),(.init.text .init.text.*))$/;" i section:.init.text roles:mapped | ||
_einittext input.lds.S /^ INIT_TEXT_SECTION(PAGE_SIZE,(.text.startup),(.init.text .init.text.*))$/;" s section:.init.text roles:def |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* Based on linux/include/asm-generic/vmlinux.lds.h and | ||
* linux/arch/x86/kernel/vmlinux.lds.S */ | ||
|
||
#define MEM_DISCARD(sec) *(.mem##sec) | ||
|
||
#define INIT_TEXT(X,A) \ | ||
*A \ | ||
*X \ | ||
MEM_DISCARD(init.text*) | ||
|
||
#define INIT_TEXT_SECTION(inittext_align,Y,B) \ | ||
. = ALIGN(inittext_align); \ | ||
.init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { \ | ||
_sinittext = .; \ | ||
INIT_TEXT(Y,B) \ | ||
_einittext = .; \ | ||
} | ||
|
||
|
||
SECTIONS | ||
{ | ||
INIT_TEXT_SECTION(PAGE_SIZE,(.text.startup),(.init.text .init.text.*)) | ||
#ifdef CONFIG_X86_64 | ||
:init | ||
#endif | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.