https://bugs.llvm.org/show_bug.cgi?id=41353
I'm new to LLVM and C++ so please do not hesitate to iterate with me on this fix.
Differential D61117
Fix Bug 41353 - unique symbols printed as D instead of u mmpozulp on Apr 25 2019, 12:10 AM. Authored by
Details https://bugs.llvm.org/show_bug.cgi?id=41353 I'm new to LLVM and C++ so please do not hesitate to iterate with me on this fix.
Diff Detail
Event TimelineComment Actions Adding zbrid since she has context already. I'll take a look in a bit too. Thanks for the patch! Comment Actions (Also sorry for the delay; I was out last week and am doing a very slow job of un-burying myself from what's piled up) Comment Actions Looks like support was recently added in rL359380, though without any tests, and was accidentally reverted. The approach there (checking SymI->getOther() >> 4 == ELF::STB_GNU_UNIQUE) is a bit opaque, but I think with a comment might look better than the dyn_cast chain. Can you see if that works? Also +grimar who has been adding GNU_UNIQUE support elsewhere
Comment Actions I think it just had a bug. Binding is st_info >> 4, not st_other >> 4:
Comment Actions Inline the check for gnu unique symbol as per suggestion by @grimar. Use yaml2obj instead of llvm-mc in unique.test.
Comment Actions I think you can afford to have all the test cases for unique symbols in one test file. I'd also name the sections and symbols to illustrate the cases, rather than calling them all .data/foo. Comment Actions Squish tests together into one file and use more descriptive section/symbol names. Thanks @jhenderson :)
Comment Actions BTW, I think STB_GNU_UNIQUE is a misfeature (no clear specification, only (complex) implementation is in glibc, interaction with STB_WEAK/STB_GLOBAL is unclear..).. this feature will highlight the problem :) Comment Actions @MaskRay, it sounds like you know a lot more than I do about this feature :). Do you know what purpose is served by "unique" global symbols? man nm shows
but without an example I don't understand why this feature is useful. If you, @MaskRay, don't know of an example, then @rupprecht, who asked for this feature, or other knowledgeable people like @grimar and @jhenderson may know of one. Thanks :)
Comment Actions Update test to make sure that we print 'U' for a unique symbol without a section. Thanks, @jhenderson, for suggesting this.
|
I would write in plain English what this test checks (instead of adding a link).
This is s more common way to describe what is going on in test and much more convenient for readers.