This is a mechanical rewrite of replaceSymbol(A, B) to A->replace(B).
I also added a comment to Symbol::replace().
Technically this change is not necessary, but this change makes code a
bit more concise.
Paths
| Differential D62117
Make replaceSymbol a member function of Symbol. ClosedPublic Authored by ruiu on May 19 2019, 7:24 PM.
Details
Summary This is a mechanical rewrite of replaceSymbol(A, B) to A->replace(B). Technically this change is not necessary, but this change makes code a
Diff Detail
Event TimelineThis revision is now accepted and ready to land.May 19 2019, 7:33 PM
Closed by commit rL361123: Make replaceSymbol a member function of Symbol. (authored by ruiu). · Explain WhyMay 19 2019, 8:34 PM This revision was automatically updated to reflect the committed changes. smeenai added inline comments.
Revision Contents
Diff 200202 lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/LTO.cpp
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/ELF/Relocations.cpp
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/Symbols.h
|
Sorry for commenting on an old diff.
I'm trying to understand this comment and if it's still true. As far as I can tell, [replace()](https://github.com/llvm/llvm-project/blob/204d301bb1921431a853c0bfba32007c018df1d5/lld/ELF/Symbols.h#L529) is just doing a memcpy from the new symbol into the old symbol, and the binding field isn't restored afterwards, so replace will in fact overwrite the binding, right?
I imagine this comment is from a time when the behavior was different (particularly when SymbolBody used to be distinct from Symbol and the binding was part of Symbol and not SymbolBody), but it doesn't seem to be accurate anymore, as far as I can tell.