-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LinkerScript: Add parsing of the EXTERN command
This patch implements parsing of the GNU ld EXTERN command [1]. Evaluation will be added at a later point in time. [1] https://sourceware.org/binutils/docs/ld/Miscellaneous-Commands.html#Miscellaneous-Commands llvm-svn: 232110
- Loading branch information
Showing
5 changed files
with
148 additions
and
0 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
RUN: linker-script-test %s 2> %t | FileCheck %s | ||
RUN: FileCheck -input-file %t -check-prefix=CHECK-ERR %s | ||
*/ | ||
|
||
|
||
EXTERN(a b 3) | ||
/* | ||
CHECK-ERR: [[@LINE-2]]:12: error: expected symbol in EXTERN. | ||
CHECK-ERR-NEXT: {{^EXTERN\(a b 3\)}} | ||
CHECK-ERR-NEXT: {{^ \^}} | ||
*/ | ||
|
||
/* | ||
CHECK: kw_extern: EXTERN | ||
CHECK: l_paren: ( | ||
CHECK: identifier: a | ||
CHECK: identifier: b | ||
CHECK: number: 3 | ||
CHECK: r_paren: ) | ||
CHECK: eof: | ||
*/ |
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,19 @@ | ||
/* | ||
RUN: linker-script-test %s 2> %t | FileCheck %s | ||
RUN: FileCheck -input-file %t -check-prefix=CHECK-ERR %s | ||
*/ | ||
|
||
|
||
EXTERN() | ||
/* | ||
CHECK-ERR: [[@LINE-2]]:8: error: expected one or more symbols in EXTERN. | ||
CHECK-ERR-NEXT: {{^EXTERN()}} | ||
CHECK-ERR-NEXT: {{^ \^}} | ||
*/ | ||
|
||
/* | ||
CHECK: kw_extern: EXTERN | ||
CHECK: l_paren: ( | ||
CHECK: r_paren: ) | ||
CHECK: eof: | ||
*/ |
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,29 @@ | ||
/* | ||
RUN: linker-script-test %s | FileCheck %s | ||
*/ | ||
|
||
EXTERN(a) | ||
EXTERN(a b) | ||
EXTERN(_foo _bar _baz) | ||
|
||
/* | ||
CHECK: kw_extern: EXTERN | ||
CHECK: l_paren: ( | ||
CHECK: identifier: a | ||
CHECK: r_paren: ) | ||
CHECK: kw_extern: EXTERN | ||
CHECK: l_paren: ( | ||
CHECK: identifier: a | ||
CHECK: identifier: b | ||
CHECK: r_paren: ) | ||
CHECK: kw_extern: EXTERN | ||
CHECK: l_paren: ( | ||
CHECK: identifier: _foo | ||
CHECK: identifier: _bar | ||
CHECK: identifier: _baz | ||
CHECK: r_paren: ) | ||
CHECK: eof: | ||
CHECK: EXTERN(a) | ||
CHECK: EXTERN(a b) | ||
CHECK: EXTERN(_foo _bar _baz) | ||
*/ |