diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-07-01 13:24:45 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-07-01 13:24:45 +0000 |
| commit | 0317860f00ca8e821989c92c8a6cc461fd5f2009 (patch) | |
| tree | ba31f275eb4dfa527c0cd564ba6c5016e2318b16 /ELF/Symbols.cpp | |
| parent | 4ea16835ba66f2240d050ffcaee44cee6c97cab9 (diff) | |
Notes
Diffstat (limited to 'ELF/Symbols.cpp')
| -rw-r--r-- | ELF/Symbols.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ELF/Symbols.cpp b/ELF/Symbols.cpp index 5dce71a32c9c..e8cd662c69ac 100644 --- a/ELF/Symbols.cpp +++ b/ELF/Symbols.cpp @@ -159,6 +159,21 @@ bool SymbolBody::isPreemptible() const { return true; } +// Overwrites all attributes except symbol name with Other's so that +// this symbol becomes an alias to Other. This is useful for handling +// some options such as --wrap. +// +// The reason why we want to keep the symbol name is because, if we +// copy symbol names, we'll end up having symbol tables in resulting +// executables or DSOs containing two or more identical symbols, which +// is just inconvenient. +void SymbolBody::copy(SymbolBody *Other) { + StringRef S = Name; + memcpy(symbol()->Body.buffer, Other->symbol()->Body.buffer, + sizeof(Symbol::Body)); + Name = S; +} + uint64_t SymbolBody::getVA(int64_t Addend) const { uint64_t OutVA = getSymVA(*this, Addend); return OutVA + Addend; |
