-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compilation: Add driver/frontend support for pic/pie options
- Loading branch information
Showing
9 changed files
with
114 additions
and
1 deletion.
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
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,27 @@ | ||
/// place uninitialized global variables in a common block | ||
common: bool, | ||
/// Place each function into its own section in the output file if the target supports arbitrary sections | ||
func_sections: bool, | ||
/// Place each data item into its own section in the output file if the target supports arbitrary sections | ||
data_sections: bool, | ||
pic_level: PicLevel, | ||
/// Generate position-independent code that can only be linked into executables | ||
is_pie: bool, | ||
|
||
pub const PicLevel = enum(u8) { | ||
/// Do not generate position-independent code | ||
none = 0, | ||
/// Generate position-independent code (PIC) suitable for use in a shared library, if supported for the target machine. | ||
one = 1, | ||
/// If supported for the target machine, emit position-independent code, suitable for dynamic linking and avoiding | ||
/// any limit on the size of the global offset table. | ||
two = 2, | ||
}; | ||
|
||
pub const default: @This() = .{ | ||
.common = false, | ||
.func_sections = false, | ||
.data_sections = false, | ||
.pic_level = .none, | ||
.is_pie = false, | ||
}; |
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,7 @@ | ||
//aro-args --target=x86_64-linux-gnu -fpic | ||
|
||
_Static_assert(__pic__ == 1, ""); | ||
_Static_assert(__PIC__ == 1, ""); | ||
#if defined __pie__ || defined __PIE__ | ||
#error __pie__ and __PIE__ should not be defined | ||
#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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
//aro-args --target=x86_64-linux-gnu -fPIC | ||
|
||
_Static_assert(__pic__ == 2, ""); | ||
_Static_assert(__PIC__ == 2, ""); | ||
#if defined __pie__ || defined __PIE__ | ||
#error __pie__ and __PIE__ should not be defined | ||
#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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//aro-args --target=x86_64-linux-gnu -fpie | ||
|
||
_Static_assert(__pic__ == 1, ""); | ||
_Static_assert(__PIC__ == 1, ""); | ||
_Static_assert(__pie__ == 1, ""); | ||
_Static_assert(__PIE__ == 1, ""); |
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,6 @@ | ||
//aro-args --target=x86_64-linux-gnu -fPIE | ||
|
||
_Static_assert(__pic__ == 2, ""); | ||
_Static_assert(__PIC__ == 2, ""); | ||
_Static_assert(__pie__ == 2, ""); | ||
_Static_assert(__PIE__ == 2, ""); |