comparison lld/wasm/Symbols.cpp @ 252:1f2b6ac9f198 llvm-original

LLVM16-1
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 18 Aug 2023 09:04:13 +0900
parents c4bab56944e8
children
comparison
equal deleted inserted replaced
237:c80f45b162ad 252:1f2b6ac9f198
33 // WebAssembly requires caller and callee signatures to match, so we mangle 33 // WebAssembly requires caller and callee signatures to match, so we mangle
34 // `main` in the case where we need to pass it arguments. 34 // `main` in the case where we need to pass it arguments.
35 if (name == "__main_argc_argv") 35 if (name == "__main_argc_argv")
36 return "main"; 36 return "main";
37 if (wasm::config->demangle) 37 if (wasm::config->demangle)
38 return demangle(name.str()); 38 return demangle(name);
39 return name.str(); 39 return name.str();
40 } 40 }
41 41
42 std::string toString(wasm::Symbol::Kind kind) { 42 std::string toString(wasm::Symbol::Kind kind) {
43 switch (kind) { 43 switch (kind) {
75 DefinedFunction *WasmSym::callCtors; 75 DefinedFunction *WasmSym::callCtors;
76 DefinedFunction *WasmSym::callDtors; 76 DefinedFunction *WasmSym::callDtors;
77 DefinedFunction *WasmSym::initMemory; 77 DefinedFunction *WasmSym::initMemory;
78 DefinedFunction *WasmSym::applyDataRelocs; 78 DefinedFunction *WasmSym::applyDataRelocs;
79 DefinedFunction *WasmSym::applyGlobalRelocs; 79 DefinedFunction *WasmSym::applyGlobalRelocs;
80 DefinedFunction *WasmSym::applyTLSRelocs;
80 DefinedFunction *WasmSym::applyGlobalTLSRelocs; 81 DefinedFunction *WasmSym::applyGlobalTLSRelocs;
81 DefinedFunction *WasmSym::initTLS; 82 DefinedFunction *WasmSym::initTLS;
82 DefinedFunction *WasmSym::startFunction; 83 DefinedFunction *WasmSym::startFunction;
83 DefinedData *WasmSym::dsoHandle; 84 DefinedData *WasmSym::dsoHandle;
84 DefinedData *WasmSym::dataEnd; 85 DefinedData *WasmSym::dataEnd;
218 flags |= WASM_SYMBOL_VISIBILITY_HIDDEN; 219 flags |= WASM_SYMBOL_VISIBILITY_HIDDEN;
219 else 220 else
220 flags |= WASM_SYMBOL_VISIBILITY_DEFAULT; 221 flags |= WASM_SYMBOL_VISIBILITY_DEFAULT;
221 } 222 }
222 223
224 bool Symbol::isImported() const {
225 return isUndefined() && (importName.has_value() || forceImport);
226 }
227
223 bool Symbol::isExported() const { 228 bool Symbol::isExported() const {
224 if (!isDefined() || isLocal()) 229 if (!isDefined() || isLocal())
225 return false; 230 return false;
226 231
227 // Shared libraries must export all weakly defined symbols 232 // Shared libraries must export all weakly defined symbols
306 LLVM_DEBUG(dbgs() << "getVA: " << getName() << "\n"); 311 LLVM_DEBUG(dbgs() << "getVA: " << getName() << "\n");
307 // In the shared memory case, TLS symbols are relative to the start of the TLS 312 // In the shared memory case, TLS symbols are relative to the start of the TLS
308 // output segment (__tls_base). When building without shared memory, TLS 313 // output segment (__tls_base). When building without shared memory, TLS
309 // symbols absolute, just like non-TLS. 314 // symbols absolute, just like non-TLS.
310 if (isTLS() && config->sharedMemory) 315 if (isTLS() && config->sharedMemory)
311 return getOutputSegmentOffset() + value; 316 return getOutputSegmentOffset();
312 if (segment) 317 if (segment)
313 return segment->getVA(value); 318 return segment->getVA(value);
314 return value; 319 return value;
315 } 320 }
316 321