diff options
author | George Rimar <grimar@accesssoftek.com> | 2016-07-08 06:47:28 +0000 |
---|---|---|
committer | George Rimar <grimar@accesssoftek.com> | 2016-07-08 06:47:28 +0000 |
commit | c61bcd80af7d8c0f527aa94f5e4eb4ca63d36f0c (patch) | |
tree | fbf3b5a3c81bc2d7c925dc7e5e62518774eaa2f7 /lld/ELF/SymbolTable.cpp | |
parent | f7bf6de0afc88a919742f8131210526fef3fb19a (diff) | |
download | bcm5719-llvm-c61bcd80af7d8c0f527aa94f5e4eb4ca63d36f0c.tar.gz bcm5719-llvm-c61bcd80af7d8c0f527aa94f5e4eb4ca63d36f0c.zip |
[ELF] - Do not error out when version declaration not found when building executable.
When building executable usually version script is absent.
Before this patch error was shown in the case when
symbol name contained version and there was no script to match it.
Instead of error out patch allows
to create new version declaration in this case and use it.
gnu linkers do the same.
That is PR28359.
Differential revision: http://reviews.llvm.org/D21890
llvm-svn: 274828
Diffstat (limited to 'lld/ELF/SymbolTable.cpp')
-rw-r--r-- | lld/ELF/SymbolTable.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp index a0ebb0257c5..f01bc94c703 100644 --- a/lld/ELF/SymbolTable.cpp +++ b/lld/ELF/SymbolTable.cpp @@ -186,6 +186,16 @@ static uint16_t getVersionId(Symbol *Sym, StringRef Name) { return Default ? I : (I | VERSYM_HIDDEN); ++I; } + + // If we are not building shared and version script + // is not specified, then it is not a error, it is + // in common not to use script for linking executables. + // In this case we just create new version. + if (!Config->Shared && !Config->HasVersionScript) { + Config->SymbolVersions.push_back(elf::Version(Version)); + return Default ? I : (I | VERSYM_HIDDEN); + } + error("symbol " + Name + " has undefined version " + Version); return 0; } |