diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-10-25 12:02:03 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-10-25 12:02:03 +0000 |
commit | 050bf6c22b464c136bad841f65c7fe205a8e7d6e (patch) | |
tree | b7fc1a0504f54c1819c4e2ddd92663e95cc41d72 /tools/gold | |
parent | 797783eda8e482b1076bab4b146ccf331f04479f (diff) |
Make the LTO comdat api more symbol table friendly.
In an IR symbol table I would expect the comdats to be represented as:
- A table of strings, one for each comdat name.
- Each symbol has an optional index into that table.
The natural api for accessing that would be
InputFile:
ArrayRef<StringRef> getComdatTable() const;
Symbol:
int getComdatIndex() const;
This patch implements an API as close to that as possible. The
implementation on top of the current IRObjectFile is a bit hackish,
but should map just fine over a symbol table and is very convenient to
use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285061 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/gold')
-rw-r--r-- | tools/gold/gold-plugin.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index 1366c0f77fd0..7c5d48144b2a 100644 --- a/tools/gold/gold-plugin.cpp +++ b/tools/gold/gold-plugin.cpp @@ -526,9 +526,11 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file, sym.size = 0; sym.comdat_key = nullptr; - StringRef C = check(Sym.getComdat()); - if (!C.empty()) + int CI = check(Sym.getComdatIndex()); + if (CI != -1) { + StringRef C = Obj->getComdatTable()[CI]; sym.comdat_key = strdup(C.str().c_str()); + } sym.resolution = LDPR_UNKNOWN; } |