In some cases it is useful to explicitly set symbol's st_name value.
For example, I am using it in a patch for LLD to remove the broken
binary from a test case and replace it with a YAML test.
Details
- Reviewers
jhenderson - Commits
- rZORG26b8968a70b1: [yaml2obj] - Allow setting st_value explicitly for Symbol.
rZORG9bed1fa7e018: [yaml2obj] - Allow setting st_value explicitly for Symbol.
rG26b8968a70b1: [yaml2obj] - Allow setting st_value explicitly for Symbol.
rG9bed1fa7e018: [yaml2obj] - Allow setting st_value explicitly for Symbol.
rG0974688a42c9: [yaml2obj] - Allow setting st_value explicitly for Symbol.
rL360137: [yaml2obj] - Allow setting st_value explicitly for Symbol.
Diff Detail
Event Timeline
I have a slight concern here, in that the approach prevents us using a name that is actually a number, and that might be confusing. I think we might want to have a different field (e.g. "NameIndex" or similar) explicitly for this situation. One and only one of the two fields can then be specified.
What do you think?
I thought that it is impossible to have a symbol name that is a number. Because valid C name must begin with a letter of the alphabet or an underscore.
I.e. I am not sure we should care about this case. At least now. Should we?
Maybe not in C, but there's nothing in ELF that requires this, and I believe it might be possible to name them like that in assembly using double quotes.
Ok. Planning changes. Will take some time since I will be off starting from tomorrow by EOW because of holidays here.
Some comment nits, otherwise LGTM.
test/tools/yaml2obj/symbol-name.yaml | ||
---|---|---|
1 | FWIW, I liked what you did in other tests with the double '#' symbols to indicate comments. I wouldn't object to you doing it here either. | |
tools/yaml2obj/yaml2elf.cpp | ||
472 | name index containing offset -> NameIndex, which contains the name offset, | |
473 | It is -> This is |
FWIW, I liked what you did in other tests with the double '#' symbols to indicate comments. I wouldn't object to you doing it here either.