summaryrefslogtreecommitdiffstats
path: root/llvm/tools/yaml2obj/yaml2coff.cpp
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2019-01-07 20:55:33 +0000
committerMartin Storsjo <martin@martin.st>2019-01-07 20:55:33 +0000
commit93a7137c0aca17d5d21392c985bf412deea53df9 (patch)
tree87e6cbdef296bcebce9e9ecc73200bb789387498 /llvm/tools/yaml2obj/yaml2coff.cpp
parente25db17104bc4d1cbc9f4aa0d073d33c74b34848 (diff)
downloadbcm5719-llvm-93a7137c0aca17d5d21392c985bf412deea53df9.tar.gz
bcm5719-llvm-93a7137c0aca17d5d21392c985bf412deea53df9.zip
[ObjectYAML] [COFF] Support multiple symbols with the same name
Differential Revision: https://reviews.llvm.org/D56294 llvm-svn: 350566
Diffstat (limited to 'llvm/tools/yaml2obj/yaml2coff.cpp')
-rw-r--r--llvm/tools/yaml2obj/yaml2coff.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/tools/yaml2obj/yaml2coff.cpp b/llvm/tools/yaml2obj/yaml2coff.cpp
index f9d255e1ad2..4fe9ab09041 100644
--- a/llvm/tools/yaml2obj/yaml2coff.cpp
+++ b/llvm/tools/yaml2obj/yaml2coff.cpp
@@ -24,6 +24,7 @@
#include "llvm/Support/Endian.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
+#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"
#include <vector>
@@ -520,7 +521,15 @@ static bool writeCOFF(COFFParser &CP, raw_ostream &OS) {
assert(S.Header.SizeOfRawData >= S.SectionData.binary_size());
OS << num_zeros(S.Header.SizeOfRawData - S.SectionData.binary_size());
for (const COFFYAML::Relocation &R : S.Relocations) {
- uint32_t SymbolTableIndex = SymbolTableIndexMap[R.SymbolName];
+ uint32_t SymbolTableIndex;
+ if (R.SymbolTableIndex) {
+ if (!R.SymbolName.empty())
+ WithColor::error()
+ << "Both SymbolName and SymbolTableIndex specified\n";
+ SymbolTableIndex = *R.SymbolTableIndex;
+ } else {
+ SymbolTableIndex = SymbolTableIndexMap[R.SymbolName];
+ }
OS << binary_le(R.VirtualAddress)
<< binary_le(SymbolTableIndex)
<< binary_le(R.Type);
OpenPOWER on IntegriCloud