forked from ldc-developers/ldc
-
Notifications
You must be signed in to change notification settings - Fork 0
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 ldc-developers#4748 from kinke/fix3589
ELF: Emit (most) instantiated symbols in COMDATs
- Loading branch information
Showing
6 changed files
with
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// UNSUPPORTED: Windows || Darwin | ||
|
||
// emit duplicate instantiated globals into two object files: | ||
// RUN: %ldc -c %S/inputs/gh3589_a.d -I%S/inputs -of=%t_a.o | ||
// RUN: %ldc -c %S/inputs/gh3589_b.d -I%S/inputs -of=%t_b.o | ||
|
||
// link & run: | ||
// RUN: %ldc -I%S/inputs %t_a.o %t_b.o -run %s | ||
|
||
extern extern(C) __gshared { | ||
// magic linker symbols to refer to the start and end of test_section | ||
byte __start_test_section; | ||
byte __stop_test_section; | ||
} | ||
|
||
void main() { | ||
import gh3589_a, gh3589_b; | ||
assert(a_info == b_info); | ||
|
||
const sectionSize = cast(size_t) (&__stop_test_section - &__start_test_section); | ||
assert(sectionSize == 4); | ||
} |
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,2 @@ | ||
import gh3589_templ; | ||
shared a_info = &getInfo!0; |
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,2 @@ | ||
import gh3589_templ; | ||
shared b_info = &getInfo!0; |
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,4 @@ | ||
import ldc.attributes; | ||
template getInfo(int I) { | ||
@(section("test_section")) @assumeUsed shared int getInfo = I; | ||
} |