-
Notifications
You must be signed in to change notification settings - Fork 67
Make dynsym order deterministic #1263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
quic-areg
wants to merge
1
commit into
qualcomm:main
Choose a base branch
from
quic-areg:det-dynsym
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
62 changes: 62 additions & 0 deletions
62
test/Common/standalone/DeterministicDynsym/DeterministicDynsym.test
This file contains hidden or 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,62 @@ | ||
| ## Repeated links of the same inputs into a shared library must produce | ||
| ## identical output, even with multithreaded scanning. | ||
|
|
||
| # RUN: rm -rf %t && split-file %s %t | ||
| # RUN: %clang %clangopts -c -fPIC -ffunction-sections -fdata-sections %t/a.c -o %t/a.o | ||
| # RUN: %clang %clangopts -c -fPIC -ffunction-sections -fdata-sections %t/b.c -o %t/b.o | ||
| # RUN: %clang %clangopts -c -fPIC -ffunction-sections -fdata-sections %t/c.c -o %t/c.o | ||
|
|
||
| # RUN: %link %linkopts -shared --threads --enable-threads=all %t/a.o %t/b.o %t/c.o -o %t1.so | ||
| # RUN: %link %linkopts -shared --threads --enable-threads=all %t/a.o %t/b.o %t/c.o -o %t2.so | ||
| # RUN: %link %linkopts -shared --threads --enable-threads=all %t/a.o %t/b.o %t/c.o -o %t3.so | ||
| # RUN: %link %linkopts -shared --threads --enable-threads=all %t/a.o %t/b.o %t/c.o -o %t4.so | ||
| # RUN: %link %linkopts -shared --threads --enable-threads=all %t/a.o %t/b.o %t/c.o -o %t5.so | ||
| # RUN: %link %linkopts -shared --threads --enable-threads=all %t/a.o %t/b.o %t/c.o -o %t6.so | ||
| # RUN: %link %linkopts -shared --threads --enable-threads=all %t/a.o %t/b.o %t/c.o -o %t7.so | ||
| # RUN: %link %linkopts -shared --threads --enable-threads=all %t/a.o %t/b.o %t/c.o -o %t8.so | ||
|
|
||
| # RUN: %readelf -a %t1.so > %t1.dump | ||
| # RUN: %readelf -a %t2.so > %t2.dump | ||
| # RUN: %readelf -a %t3.so > %t3.dump | ||
| # RUN: %readelf -a %t4.so > %t4.dump | ||
| # RUN: %readelf -a %t5.so > %t5.dump | ||
| # RUN: %readelf -a %t6.so > %t6.dump | ||
| # RUN: %readelf -a %t7.so > %t7.dump | ||
| # RUN: %readelf -a %t8.so > %t8.dump | ||
| # RUN: %diff %t1.dump %t2.dump | ||
| # RUN: %diff %t1.dump %t3.dump | ||
| # RUN: %diff %t1.dump %t4.dump | ||
| # RUN: %diff %t1.dump %t5.dump | ||
| # RUN: %diff %t1.dump %t6.dump | ||
| # RUN: %diff %t1.dump %t7.dump | ||
| # RUN: %diff %t1.dump %t8.dump | ||
|
|
||
| #--- a.c | ||
| extern int va1, va2, va3, va4, va5, va6, va7, va8; | ||
| extern void fa1(void), fa2(void), fa3(void), fa4(void); | ||
| int sum_a(void) { | ||
| return va1 + va2 + va3 + va4 + va5 + va6 + va7 + va8; | ||
| } | ||
| void call_a(void) { fa1(); fa2(); fa3(); fa4(); } | ||
| int da1 = 1, da2 = 2, da3 = 3, da4 = 4; | ||
| const char sa1[] = "a1", sa2[] = "a2"; | ||
|
|
||
| #--- b.c | ||
| extern int vb1, vb2, vb3, vb4, vb5, vb6, vb7, vb8; | ||
| extern void fb1(void), fb2(void), fb3(void), fb4(void); | ||
| int sum_b(void) { | ||
| return vb1 + vb2 + vb3 + vb4 + vb5 + vb6 + vb7 + vb8; | ||
| } | ||
| void call_b(void) { fb1(); fb2(); fb3(); fb4(); } | ||
| int db1 = 1, db2 = 2, db3 = 3, db4 = 4; | ||
| const char sb1[] = "b1", sb2[] = "b2"; | ||
|
|
||
| #--- c.c | ||
| extern int vc1, vc2, vc3, vc4, vc5, vc6, vc7, vc8; | ||
| extern void fc1(void), fc2(void), fc3(void), fc4(void); | ||
| int sum_c(void) { | ||
| return vc1 + vc2 + vc3 + vc4 + vc5 + vc6 + vc7 + vc8; | ||
| } | ||
| void call_c(void) { fc1(); fc2(); fc3(); fc4(); } | ||
| int dc1 = 1, dc2 = 2, dc3 = 3, dc4 = 4; | ||
| const char sc1[] = "c1", sc2[] = "c2"; | ||
34 changes: 34 additions & 0 deletions
34
test/Common/standalone/DynsymSortOrder/DynsymSortOrder.test
This file contains hidden or 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,34 @@ | ||
| ## Sort .dynsym: undefined symbols first, then defined symbols, and within | ||
| ## each group by input ordinal, input .symtab index. | ||
|
|
||
| # RUN: rm -rf %t && split-file %s %t | ||
| # RUN: %clang %clangopts -c -fPIC %t/a.c -o %t/a.o | ||
| # RUN: %clang %clangopts -c -fPIC %t/b.c -o %t/b.o | ||
|
|
||
| # RUN: %link %linkopts -shared %t/a.o %t/b.o -o %t.ab.so | ||
| # RUN: %readelf --dyn-syms %t.ab.so | %filecheck --check-prefix=AB %s | ||
|
|
||
| # AB: OBJECT GLOBAL DEFAULT {{.*}} a_z | ||
| # AB-NEXT: OBJECT GLOBAL DEFAULT {{.*}} a_b | ||
| # AB-NEXT: OBJECT GLOBAL DEFAULT {{.*}} a_alpha | ||
| # AB-NEXT: OBJECT GLOBAL DEFAULT {{.*}} b_m | ||
| # AB-NEXT: OBJECT GLOBAL DEFAULT {{.*}} b_n | ||
|
|
||
| ## Reverse the input order and the dynsym blocks follow. | ||
| # RUN: %link %linkopts -shared %t/b.o %t/a.o -o %t.ba.so | ||
| # RUN: %readelf --dyn-syms %t.ba.so | %filecheck --check-prefix=BA %s | ||
|
|
||
| # BA: OBJECT GLOBAL DEFAULT {{.*}} b_m | ||
| # BA-NEXT: OBJECT GLOBAL DEFAULT {{.*}} b_n | ||
| # BA-NEXT: OBJECT GLOBAL DEFAULT {{.*}} a_z | ||
| # BA-NEXT: OBJECT GLOBAL DEFAULT {{.*}} a_b | ||
| # BA-NEXT: OBJECT GLOBAL DEFAULT {{.*}} a_alpha | ||
|
|
||
| #--- a.c | ||
| int a_z = 1; | ||
| int a_b = 2; | ||
| int a_alpha = 3; | ||
|
|
||
| #--- b.c | ||
| int b_m = 4; | ||
| int b_n = 5; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check this on windows too by running the workflow on this PR.