-
-
Notifications
You must be signed in to change notification settings - Fork 105
fix: COMMON/ABS symbols are now defined in .dynsym #1685
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can simply write this test as an assembly file (there are other test files with
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assembly tests that also run on RISC-V must enclose comments in |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| //#LinkArgs:-shared -z now | ||
| //#RunEnabled:false | ||
| //#DiffIgnore:section.got | ||
| //#ExpectSym:abs_sym address=0xCAFECAFE | ||
| //#ExpectDynSym:abs_sym address=0xCAFECAFE | ||
|
|
||
| // TODO: checkout those differences later | ||
| //#DiffIgnore:segment.RISCV_ATTRIBUTES.alignment | ||
| //#DiffIgnore:segment.RISCV_ATTRIBUTES.flags | ||
| //#DiffIgnore:riscv_attributes..riscv.attributes | ||
| //#DiffIgnore:riscv_attributes.arch | ||
| //#DiffIgnore:riscv_attributes.stack_align | ||
|
|
||
| .global abs_sym | ||
| .set abs_sym, 0xCAFECAFE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| extern int data[]; | ||
| int data[100]; | ||
|
|
||
| extern __thread int tvar[]; | ||
| __thread int tvar[100] __attribute__((common)); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| //#CompArgs:-fcommon | ||
| //#Object:common-shared-1.c | ||
| //#LinkArgs:-shared -z now | ||
| //#RunEnabled:false | ||
| //#DiffIgnore:section.got | ||
| //#ExpectSym:data section=".bss",size=400 | ||
| //#ExpectDynSym:data section=".bss",size=400 | ||
| //#ExpectSym:tvar section=".tbss",size=400,address=0 | ||
| //#ExpectDynSym:tvar section=".tbss",size=400,address=0 | ||
|
|
||
| extern int data[]; | ||
| int data[10]; | ||
|
|
||
| extern __thread int tvar[]; | ||
| __thread int tvar[10] __attribute__((common)); |
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.
This branch seems to duplicate a lot of code from
write_symbols. Would it be possible to extract common parts?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.
Hmm, this refactoring looked a bit tricky for me. I attempted it here: ostylk@00abc82 . I tried extracting the section_id/symbol_value resolution logic.
Do you think this approach looks good? I am currently a bit unsure (as some special case logic is now also applied for COMMON symbols but that may be desirable?) so I didn't include that commit in this PR.
At least the unit tests pass.
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.
It seems to me that there's probably already a bit of duplication between writing of dynamic symbols and writing of debug symbols even prior to this PR. Given that, if we're going to attempt to deduplicate it, it'd probably make sense to do that as a separate PR. So it's fine with me to leave this bit as-is for now.
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.
Thanks for the attempt. Since this proves hard we can do it separately.