mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 23:56:05 +00:00
Revert "[lld][WebAssembly] Fix for weak undefined functions in -pie mode"
This reverts commit ac2be2b6a366c05c01b8228fd804ba6ed52d320b. This causes a whole much of emscripten tests to fail due to newly undefined symbols appearing. Will investigate and look into re-landing later.
This commit is contained in:
parent
8dd6dd947c
commit
e1617d23ff
@ -22,7 +22,6 @@ get_foo_addr:
|
||||
_start:
|
||||
.functype _start () -> ()
|
||||
call get_foo_addr
|
||||
call foo
|
||||
end_function
|
||||
|
||||
.weak foo
|
||||
@ -69,15 +68,11 @@ _start:
|
||||
# CHECK-NEXT: - Index: 1
|
||||
# CHECK-NEXT: Name: 'GOT.func.internal.undefined_weak:foo'
|
||||
|
||||
# With `-pie + + --unresolved-symbols=import-functions` or `-shared` the
|
||||
# resolution should be deferred to the dynamic linker and the function address
|
||||
# should be imported as GOT.func.foo.
|
||||
# With `-pie` or `-shared` the resolution should be deferred to the dynamic
|
||||
# linker and the function address should be imported as GOT.func.foo.
|
||||
#
|
||||
# RUN: wasm-ld --experimental-pic -shared %t.o -o %t3.wasm
|
||||
# RUN: wasm-ld --experimental-pic -pie %t.o -o %t3.wasm
|
||||
# RUN: obj2yaml %t3.wasm | FileCheck %s --check-prefix=IMPORT
|
||||
#
|
||||
# RUN: wasm-ld --experimental-pic -pie --unresolved-symbols=import-functions %t.o -o %t4.wasm
|
||||
# RUN: obj2yaml %t4.wasm | FileCheck %s --check-prefix=IMPORT
|
||||
|
||||
# IMPORT: - Type: IMPORT
|
||||
# IMPORT: - Module: GOT.func
|
||||
@ -93,12 +88,3 @@ _start:
|
||||
# IMPORT-NEXT: Name: __table_base
|
||||
# IMPORT-NEXT: - Index: 2
|
||||
# IMPORT-NEXT: Name: foo
|
||||
|
||||
# With just `-pie` (which does not default to import-functions) there shoule be
|
||||
# no import at all.
|
||||
#
|
||||
# RUN: wasm-ld --experimental-pic -pie %t.o -o %t5.wasm
|
||||
# RUN: obj2yaml %t5.wasm | FileCheck %s --check-prefix=NO-IMPORT
|
||||
|
||||
# NO-IMPORT: Name: 'undefined_weak:foo'
|
||||
# NO-IMPORT-NOT: Name: foo
|
||||
|
@ -1016,8 +1016,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
|
||||
sym->forceExport = true;
|
||||
}
|
||||
|
||||
if (!config->relocatable &&
|
||||
config->unresolvedSymbols != UnresolvedPolicy::ImportFuncs) {
|
||||
if (!config->relocatable && !config->isPic) {
|
||||
// Add synthetic dummies for weak undefined functions. Must happen
|
||||
// after LTO otherwise functions may not yet have signatures.
|
||||
symtab->handleWeakUndefines();
|
||||
|
@ -569,6 +569,8 @@ void Writer::calculateImports() {
|
||||
for (Symbol *sym : symtab->getSymbols()) {
|
||||
if (!sym->isUndefined())
|
||||
continue;
|
||||
if (sym->isWeak() && !config->relocatable)
|
||||
continue;
|
||||
if (!sym->isLive())
|
||||
continue;
|
||||
if (!sym->isUsedInRegularObj)
|
||||
|
Loading…
x
Reference in New Issue
Block a user