File tree Expand file tree Collapse file tree 4 files changed +12
-11
lines changed Expand file tree Collapse file tree 4 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 13
13
}
14
14
15
15
; UNDEF: undefined symbol: data_external
16
- ; BADRELOC: undefined-data.ll.tmp.o: relocation of type R_WASM_MEMORY_ADDR_* against undefined data symbol: data_external
16
+ ; BADRELOC: undefined-data.ll.tmp.o: relocation R_WASM_MEMORY_ADDR_LEB cannot be used againt symbol data_external; recompile with -fPIC
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ using namespace llvm::support::endian;
22
22
using namespace lld ;
23
23
using namespace lld ::wasm;
24
24
25
- static StringRef reloctTypeToString (uint8_t RelocType) {
25
+ StringRef lld::relocTypeToString (uint8_t RelocType) {
26
26
switch (RelocType) {
27
27
#define WASM_RELOC (NAME, REL ) \
28
28
case REL: \
@@ -78,7 +78,7 @@ void InputChunk::verifyRelocTargets() const {
78
78
if (Rel.Type != R_WASM_GLOBAL_INDEX_LEB) {
79
79
uint32_t ExpectedValue = File->calcExpectedValue (Rel);
80
80
if (ExpectedValue != ExistingValue)
81
- warn (" unexpected existing value for " + reloctTypeToString (Rel.Type ) +
81
+ warn (" unexpected existing value for " + relocTypeToString (Rel.Type ) +
82
82
" : existing=" + Twine (ExistingValue) +
83
83
" expected=" + Twine (ExpectedValue));
84
84
}
@@ -105,7 +105,7 @@ void InputChunk::writeTo(uint8_t *Buf) const {
105
105
for (const WasmRelocation &Rel : Relocations) {
106
106
uint8_t *Loc = Buf + Rel.Offset + Off;
107
107
uint32_t Value = File->calcNewValue (Rel);
108
- LLVM_DEBUG (dbgs () << " apply reloc: type=" << reloctTypeToString (Rel.Type )
108
+ LLVM_DEBUG (dbgs () << " apply reloc: type=" << relocTypeToString (Rel.Type )
109
109
<< " addend=" << Rel.Addend << " index=" << Rel.Index
110
110
<< " value=" << Value << " offset=" << Rel.Offset
111
111
<< " \n " );
Original file line number Diff line number Diff line change @@ -218,6 +218,8 @@ class InputSection : public InputChunk {
218
218
} // namespace wasm
219
219
220
220
std::string toString (const wasm::InputChunk *);
221
+ StringRef relocTypeToString (uint8_t RelocType);
222
+
221
223
} // namespace lld
222
224
223
225
#endif // LLD_WASM_INPUT_CHUNKS_H
Original file line number Diff line number Diff line change @@ -1152,13 +1152,12 @@ void Writer::processRelocations(InputChunk *Chunk) {
1152
1152
case R_WASM_MEMORY_ADDR_SLEB:
1153
1153
case R_WASM_MEMORY_ADDR_I32:
1154
1154
case R_WASM_MEMORY_ADDR_LEB: {
1155
- DataSymbol *DataSym = File->getDataSymbol (Reloc.Index );
1156
- if (!Config->Relocatable && !isa<DefinedData>(DataSym) &&
1157
- !DataSym->isWeak ())
1158
- error (File->getName () +
1159
- " : relocation of type R_WASM_MEMORY_ADDR_* "
1160
- " against undefined data symbol: " +
1161
- DataSym->getName ());
1155
+ DataSymbol *Sym = File->getDataSymbol (Reloc.Index );
1156
+ if (!Config->Relocatable && !isa<DefinedData>(Sym) && !Sym->isWeak ())
1157
+ error (File->getName () + " : relocation " +
1158
+ relocTypeToString (Reloc.Type ) + " cannot be used againt symbol " +
1159
+ Sym->getName () + " ; recompile with -fPIC" );
1160
+
1162
1161
break ;
1163
1162
}
1164
1163
case R_WASM_GLOBAL_INDEX_LEB: {
You can’t perform that action at this time.
0 commit comments