update embedded LLD to 9.0.0-rc2

upstream commit 67a4a12d61bfb10b2410b53c5a43ef9b4a03de7d
This commit is contained in:
Andrew Kelley 2019-08-20 19:33:58 -04:00
parent c0bd2eb398
commit 37a06f4dcf
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
16 changed files with 321 additions and 181 deletions

View File

@ -37,6 +37,9 @@ OPTION(prefix_2, "Bdynamic", Bdynamic, Flag, INVALID, INVALID, nullptr, 0, 0,
OPTION(prefix_2, "Bstatic", Bstatic, Flag, INVALID, INVALID, nullptr, 0, 0,
"Do not link against shared libraries", nullptr, nullptr)
OPTION(prefix_2, "build-id", anonymous_1, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr)
OPTION(prefix_2, "delayload=", delayload_eq, Joined, INVALID, delayload, nullptr, 0, 0, nullptr, nullptr, nullptr)
OPTION(prefix_2, "delayload", delayload, Separate, INVALID, INVALID, nullptr, 0, 0,
"DLL to load only on demand", nullptr, nullptr)
OPTION(prefix_2, "disable-auto-image-base", anonymous_2, Flag, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr)
OPTION(prefix_2, "dynamicbase", dynamicbase, Flag, INVALID, INVALID, nullptr, 0, 0,
"Enable ASLR", nullptr, nullptr)

View File

@ -184,8 +184,10 @@ void LinkerDriver::addBuffer(std::unique_ptr<MemoryBuffer> mb,
if (wholeArchive) {
std::unique_ptr<Archive> file =
CHECK(Archive::create(mbref), filename + ": failed to parse archive");
Archive *archive = file.get();
make<std::unique_ptr<Archive>>(std::move(file)); // take ownership
for (MemoryBufferRef m : getArchiveMembers(file.get()))
for (MemoryBufferRef m : getArchiveMembers(archive))
addArchiveBuffer(m, "<whole-archive>", filename, 0);
return;
}

View File

@ -1095,6 +1095,13 @@ Optional<coff_symbol16> Writer::createSymbol(Defined *def) {
}
}
// Symbols that are runtime pseudo relocations don't point to the actual
// symbol data itself (as they are imported), but points to the IAT entry
// instead. Avoid emitting them to the symbol table, as they can confuse
// debuggers.
if (def->isRuntimePseudoReloc)
return None;
StringRef name = def->getName();
if (name.size() > COFF::NameSize) {
sym.Name.Offset.Zeroes = 0;

View File

@ -3177,11 +3177,23 @@ static bool isDuplicateArmExidxSec(InputSection *prev, InputSection *cur) {
// The .ARM.exidx table must be sorted in ascending order of the address of the
// functions the table describes. Optionally duplicate adjacent table entries
// can be removed. At the end of the function the ExecutableSections must be
// can be removed. At the end of the function the executableSections must be
// sorted in ascending order of address, Sentinel is set to the InputSection
// with the highest address and any InputSections that have mergeable
// .ARM.exidx table entries are removed from it.
void ARMExidxSyntheticSection::finalizeContents() {
if (script->hasSectionsCommand) {
// The executableSections and exidxSections that we use to derive the
// final contents of this SyntheticSection are populated before the
// linker script assigns InputSections to OutputSections. The linker script
// SECTIONS command may have a /DISCARD/ entry that removes executable
// InputSections and their dependent .ARM.exidx section that we recorded
// earlier.
auto isDiscarded = [](const InputSection *isec) { return !isec->isLive(); };
llvm::erase_if(executableSections, isDiscarded);
llvm::erase_if(exidxSections, isDiscarded);
}
// Sort the executable sections that may or may not have associated
// .ARM.exidx sections by order of ascending address. This requires the
// relative positions of InputSections to be known.

View File

@ -303,6 +303,8 @@ bool mingw::link(ArrayRef<const char *> argsArr, raw_ostream &diag) {
add("-include:" + StringRef(a->getValue()));
for (auto *a : args.filtered(OPT_undefined))
add("-includeoptional:" + StringRef(a->getValue()));
for (auto *a : args.filtered(OPT_delayload))
add("-delayload:" + StringRef(a->getValue()));
std::vector<StringRef> searchPaths;
for (auto *a : args.filtered(OPT_L)) {

View File

@ -80,6 +80,8 @@ def require_defined_eq: J<"require-defined=">, Alias<require_defined>;
def _HASH_HASH_HASH : Flag<["-"], "###">,
HelpText<"Print (but do not run) the commands to run for this compilation">;
def appcontainer: F<"appcontainer">, HelpText<"Set the appcontainer flag in the executable">;
def delayload: S<"delayload">, HelpText<"DLL to load only on demand">;
def delayload_eq: J<"delayload=">, Alias<delayload>;
def mllvm: S<"mllvm">;
def pdb: S<"pdb">, HelpText<"Output PDB debug info file, chosen implicitly if the argument is empty">;
def pdb_eq: J<"pdb=">, Alias<pdb>;

View File

@ -28,6 +28,15 @@ ELF Improvements
``$ ld.lld --call-shared`` now prints
``unknown argument '--call-shared', did you mean '--call_shared'``.
* lld now supports replacing ``JAL`` with ``JALX`` instructions in case
of MIPS - microMIPS cross-mode jumps.
* lld now creates LA25 thunks for MIPS R6 code.
* Put MIPS-specific .reginfo, .MIPS.options, and .MIPS.abiflags sections
into corresponding PT_MIPS_REGINFO, PT_MIPS_OPTIONS, and PT_MIPS_ABIFLAGS
segments.
* ...
COFF Improvements

View File

@ -621,6 +621,7 @@ void ArchHandler_x86_64::applyFixupFinal(
// Fall into llvm_unreachable().
break;
}
llvm_unreachable("invalid x86_64 Reference Kind");
}
void ArchHandler_x86_64::applyFixupRelocatable(const Reference &ref,

View File

@ -0,0 +1,9 @@
.text
.def "?f@@YAHXZ"
.scl 2
.type 32
.endef
.global "?f@@YAHXZ"
"?f@@YAHXZ":
retq $0

View File

@ -7,9 +7,10 @@
# RUN: llvm-ar rcs %t-implib.a %t-dabcdh.o %t-dabcds00000.o %t-dabcdt.o
# RUN: llvm-mc -triple=x86_64-windows-gnu %s -filetype=obj -o %t.obj
# RUN: lld-link -lldmingw -out:%t.exe -entry:main %t.obj %t-implib.a -verbose
# RUN: lld-link -lldmingw -debug:symtab -out:%t.exe -entry:main %t.obj %t-implib.a -verbose
# RUN: llvm-readobj --coff-imports %t.exe | FileCheck -check-prefix=IMPORTS %s
# RUN: llvm-nm %t.exe | FileCheck -check-prefix=SYMBOLS %s
# IMPORTS: Import {
# IMPORTS-NEXT: Name: foo.dll
@ -18,6 +19,10 @@
# IMPORTS-NEXT: Symbol: data (0)
# IMPORTS-NEXT: }
# Check that the automatically imported symbol "data" is not listed in
# the symbol table.
# SYMBOLS-NOT: {{ }}data
.global main
.text
main:

View File

@ -5,11 +5,12 @@
# RUN: lld-link -out:%t-lib.dll -dll -entry:DllMainCRTStartup %t-lib.obj -lldmingw -implib:%t-lib.lib
# RUN: llvm-mc -triple=x86_64-windows-gnu %s -filetype=obj -o %t.obj
# RUN: lld-link -lldmingw -out:%t.exe -entry:main %t.obj %t-lib.lib -verbose
# RUN: lld-link -lldmingw -debug:symtab -out:%t.exe -entry:main %t.obj %t-lib.lib -verbose
# RUN: llvm-readobj --coff-imports %t.exe | FileCheck -check-prefix=IMPORTS %s
# RUN: llvm-objdump -d %t.exe | FileCheck -check-prefix=DISASM %s
# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=CONTENTS %s
# RUN: llvm-nm %t.exe | FileCheck -check-prefix=SYMBOLS %s
# IMPORTS: Import {
# IMPORTS-NEXT: Name: autoimport-x86.s.tmp-lib.dll
@ -20,7 +21,7 @@
# DISASM: Disassembly of section .text:
# DISASM-EMPTY:
# DISASM: .text:
# DISASM: main:
# Relative offset at 0x1002 pointing at the IAT at 0x2080.
# DISASM: 140001000: 8b 05 7a 10 00 00 movl 4218(%rip), %eax
# DISASM: 140001006: c3 retq
@ -41,6 +42,10 @@
# CONTENTS: 140003000 80200040 01000000 00200040 01000000
# CONTENTS: 140003010 24200040 01000000
# Check that the automatically imported symbol "variable" is not listed in
# the symbol table.
# SYMBOLS-NOT: variable
.global main
.text
main:

32
deps/lld/test/COFF/thin-archive.s vendored Normal file
View File

@ -0,0 +1,32 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-windows-msvc -o %t.main.obj %s
# RUN: llvm-mc -filetype=obj -triple=x86_64-windows-msvc -o %t.lib.obj \
# RUN: %S/Inputs/mangled-symbol.s
# RUN: lld-link /lib /out:%t.lib %t.lib.obj
# RUN: lld-link /lib /llvmlibthin /out:%t_thin.lib %t.lib.obj
# RUN: lld-link /entry:main %t.main.obj %t.lib /out:%t.exe 2>&1 | \
# RUN: FileCheck --allow-empty %s
# RUN: lld-link /entry:main %t.main.obj %t_thin.lib /out:%t.exe 2>&1 | \
# RUN: FileCheck --allow-empty %s
# RUN: lld-link /entry:main %t.main.obj /wholearchive:%t_thin.lib /out:%t.exe 2>&1 | \
# RUN: FileCheck --allow-empty %s
# RUN: rm %t.lib.obj
# RUN: lld-link /entry:main %t.main.obj %t.lib /out:%t.exe 2>&1 | \
# RUN: FileCheck --allow-empty %s
# CHECK-NOT: error: could not get the buffer for the member defining
.text
.def main
.scl 2
.type 32
.endef
.global main
main:
call "?f@@YAHXZ"
retq $0

View File

@ -0,0 +1,37 @@
// REQUIRES: arm
// RUN: llvm-mc -filetype=obj -triple arm-gnu-linux-eabi -mcpu cortex-a7 -arm-add-build-attributes %s -o %t.o
// RUN: echo "SECTIONS { . = 0x10000; .text : { *(.text) } /DISCARD/ : { *(.exit.text) } }" > %t.script
// RUN: ld.lld -T %t.script %t.o -o %t.elf
// RUN: llvm-readobj -x .ARM.exidx --sections %t.elf | FileCheck %s
// CHECK-NOT: .exit.text
/// Expect 2 entries both CANTUNWIND as the .ARM.exidx.exit.text
// should have been removed.
// CHECK: Hex dump of section '.ARM.exidx':
// CHECK-NEXT: 0x00010000 10000000 01000000 10000000 01000000
/// The /DISCARD/ is evaluated after sections have been assigned to the
/// .ARM.exidx synthetic section. We must account for the /DISCARD/
.section .exit.text, "ax", %progbits
.globl foo
.type foo, %function
foo:
.fnstart
bx lr
.save {r7, lr}
.setfp r7, sp, #0
.fnend
.text
.globl _start
.type _start, %function
_start:
.fnstart
bx lr
.cantunwind
.fnend
.section .text.__aeabi_unwind_cpp_pr0, "ax", %progbits
.global __aeabi_unwind_cpp_pr0
__aeabi_unwind_cpp_pr0:
bx lr

View File

@ -200,3 +200,7 @@ APPCONTAINER: -appcontainer
# RUN: ld.lld -m i386pep --help 2>&1 | FileCheck -check-prefix=HELP %s
# HELP: USAGE:
# HELP: --enable-auto-import
RUN: ld.lld -### -m i386pep foo.o -delayload user32.dll --delayload shell32.dll | FileCheck -check-prefix DELAYLOAD %s
RUN: ld.lld -### -m i386pep foo.o -delayload=user32.dll --delayload=shell32.dll | FileCheck -check-prefix DELAYLOAD %s
DELAYLOAD: -delayload:user32.dll -delayload:shell32.dll

View File

@ -1,7 +1,12 @@
; RUN: llc -filetype=obj %p/Inputs/hello.ll -o %t.hello.o
; RUN: llc -filetype=obj %s -o %t.o
; RUN: wasm-ld -r -o %t.wasm %t.hello.o %t.o
; RUN: obj2yaml %t.wasm | FileCheck %s
; RUN: obj2yaml %t.wasm | FileCheck %s --check-prefixes CHECK,NORMAL
; RUN: llc -filetype=obj %p/Inputs/hello.ll -o %t.hello.bm.o -mattr=+bulk-memory
; RUN: llc -filetype=obj %s -o %t.bm.o -mattr=+bulk-memory
; RUN: wasm-ld -r -o %t.mt.wasm %t.hello.bm.o %t.bm.o --shared-memory --max-memory=131072
; RUN: obj2yaml %t.mt.wasm | FileCheck %s --check-prefixes CHECK,SHARED
target triple = "wasm32-unknown-unknown"
@ -70,13 +75,18 @@ entry:
; CHECK-NEXT: Maximum: 0x00000004
; CHECK-NEXT: - Type: MEMORY
; CHECK-NEXT: Memories:
; CHECK-NEXT: - Initial: 0x00000001
; NORMAL-NEXT: - Initial: 0x00000001
; SHARED-NEXT: - Flags: [ HAS_MAX, IS_SHARED ]
; SHARED-NEXT: Initial: 0x00000001
; SHARED-NEXT: Maximum: 0x00000002
; CHECK-NEXT: - Type: ELEM
; CHECK-NEXT: Segments:
; CHECK-NEXT: - Offset:
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 1
; CHECK-NEXT: Functions: [ 4, 1, 2 ]
; SHARED-NEXT: - Type: DATACOUNT
; SHARED-NEXT: Count: 6
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Relocations:
; CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_SLEB
@ -104,176 +114,176 @@ entry:
; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 419C808080000B
; CHECK-NEXT: - Type: DATA
; CHECK-NEXT: Relocations:
; CHECK-NEXT: - Type: R_WASM_TABLE_INDEX_I32
; CHECK-NEXT: Index: 3
; CHECK-NEXT: Offset: 0x00000012
; CHECK-NEXT: - Type: R_WASM_TABLE_INDEX_I32
; CHECK-NEXT: Index: 4
; CHECK-NEXT: Offset: 0x0000001B
; CHECK-NEXT: - Type: R_WASM_TABLE_INDEX_I32
; CHECK-NEXT: Index: 5
; CHECK-NEXT: Offset: 0x00000024
; CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_I32
; CHECK-NEXT: Index: 12
; CHECK-NEXT: Offset: 0x0000002D
; CHECK-NEXT: Segments:
; CHECK-NEXT: - SectionOffset: 6
; CHECK-NEXT: InitFlags: 0
; CHECK-NEXT: Offset:
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 0
; CHECK-NEXT: Content: 68656C6C6F0A00
; CHECK-NEXT: - SectionOffset: 18
; CHECK-NEXT: InitFlags: 0
; CHECK-NEXT: Offset:
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 8
; CHECK-NEXT: Content: '01000000'
; CHECK-NEXT: - SectionOffset: 27
; CHECK-NEXT: InitFlags: 0
; CHECK-NEXT: Offset:
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 12
; CHECK-NEXT: Content: '02000000'
; CHECK-NEXT: - SectionOffset: 36
; CHECK-NEXT: InitFlags: 0
; CHECK-NEXT: Offset:
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 16
; CHECK-NEXT: Content: '03000000'
; CHECK-NEXT: - SectionOffset: 45
; CHECK-NEXT: InitFlags: 0
; CHECK-NEXT: Offset:
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 24
; CHECK-NEXT: Content: '00000000'
; CHECK-NEXT: - SectionOffset: 54
; CHECK-NEXT: InitFlags: 0
; CHECK-NEXT: Offset:
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 28
; CHECK-NEXT: Content: '616263'
; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: linking
; CHECK-NEXT: Version: 2
; CHECK-NEXT: SymbolTable:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Kind: FUNCTION
; CHECK-NEXT: Name: hello
; CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ]
; CHECK-NEXT: Function: 3
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Kind: DATA
; CHECK-NEXT: Name: hello_str
; CHECK-NEXT: Flags: [ ]
; CHECK-NEXT: Segment: 0
; CHECK-NEXT: Size: 7
; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Kind: FUNCTION
; CHECK-NEXT: Name: puts
; CHECK-NEXT: Flags: [ UNDEFINED ]
; CHECK-NEXT: Function: 0
; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Kind: FUNCTION
; CHECK-NEXT: Name: my_func
; CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ]
; CHECK-NEXT: Function: 4
; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Kind: FUNCTION
; CHECK-NEXT: Name: foo_import
; CHECK-NEXT: Flags: [ UNDEFINED ]
; CHECK-NEXT: Function: 1
; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Kind: FUNCTION
; CHECK-NEXT: Name: bar_import
; CHECK-NEXT: Flags: [ BINDING_WEAK, UNDEFINED ]
; CHECK-NEXT: Function: 2
; CHECK-NEXT: - Index: 6
; CHECK-NEXT: Kind: FUNCTION
; CHECK-NEXT: Name: func_comdat
; CHECK-NEXT: Flags: [ BINDING_WEAK ]
; CHECK-NEXT: Function: 5
; CHECK-NEXT: - Index: 7
; CHECK-NEXT: Kind: DATA
; CHECK-NEXT: Name: data_comdat
; CHECK-NEXT: Flags: [ BINDING_WEAK ]
; CHECK-NEXT: Segment: 5
; CHECK-NEXT: Size: 3
; CHECK-NEXT: - Index: 8
; CHECK-NEXT: Kind: DATA
; CHECK-NEXT: Name: func_addr1
; CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ]
; CHECK-NEXT: Segment: 1
; CHECK-NEXT: Size: 4
; CHECK-NEXT: - Index: 9
; CHECK-NEXT: Kind: DATA
; CHECK-NEXT: Name: func_addr2
; CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ]
; CHECK-NEXT: Segment: 2
; CHECK-NEXT: Size: 4
; CHECK-NEXT: - Index: 10
; CHECK-NEXT: Kind: DATA
; CHECK-NEXT: Name: func_addr3
; CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ]
; CHECK-NEXT: Segment: 3
; CHECK-NEXT: Size: 4
; CHECK-NEXT: - Index: 11
; CHECK-NEXT: Kind: DATA
; CHECK-NEXT: Name: data_addr1
; CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ]
; CHECK-NEXT: Segment: 4
; CHECK-NEXT: Size: 4
; CHECK-NEXT: - Index: 12
; CHECK-NEXT: Kind: DATA
; CHECK-NEXT: Name: data_import
; CHECK-NEXT: Flags: [ UNDEFINED ]
; CHECK-NEXT: SegmentInfo:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Name: .rodata.hello_str
; CHECK-NEXT: Alignment: 0
; CHECK-NEXT: Flags: [ ]
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: .data.func_addr1
; CHECK-NEXT: Alignment: 2
; CHECK-NEXT: Flags: [ ]
; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Name: .data.func_addr2
; CHECK-NEXT: Alignment: 2
; CHECK-NEXT: Flags: [ ]
; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Name: .data.func_addr3
; CHECK-NEXT: Alignment: 2
; CHECK-NEXT: Flags: [ ]
; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Name: .data.data_addr1
; CHECK-NEXT: Alignment: 3
; CHECK-NEXT: Flags: [ ]
; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Name: .rodata.data_comdat
; CHECK-NEXT: Alignment: 0
; CHECK-NEXT: Flags: [ ]
; CHECK-NEXT: Comdats:
; CHECK-NEXT: - Name: func_comdat
; CHECK-NEXT: Entries:
; CHECK-NEXT: - Kind: FUNCTION
; CHECK-NEXT: Index: 5
; CHECK-NEXT: - Kind: DATA
; CHECK-NEXT: Index: 5
; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Name: puts
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: foo_import
; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Name: bar_import
; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Name: hello
; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Name: my_func
; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Name: func_comdat
; CHECK-NEXT: ...
; NORMAL-NEXT: - Type: DATA
; NORMAL-NEXT: Relocations:
; NORMAL-NEXT: - Type: R_WASM_TABLE_INDEX_I32
; NORMAL-NEXT: Index: 3
; NORMAL-NEXT: Offset: 0x00000012
; NORMAL-NEXT: - Type: R_WASM_TABLE_INDEX_I32
; NORMAL-NEXT: Index: 4
; NORMAL-NEXT: Offset: 0x0000001B
; NORMAL-NEXT: - Type: R_WASM_TABLE_INDEX_I32
; NORMAL-NEXT: Index: 5
; NORMAL-NEXT: Offset: 0x00000024
; NORMAL-NEXT: - Type: R_WASM_MEMORY_ADDR_I32
; NORMAL-NEXT: Index: 12
; NORMAL-NEXT: Offset: 0x0000002D
; NORMAL-NEXT: Segments:
; NORMAL-NEXT: - SectionOffset: 6
; NORMAL-NEXT: InitFlags: 0
; NORMAL-NEXT: Offset:
; NORMAL-NEXT: Opcode: I32_CONST
; NORMAL-NEXT: Value: 0
; NORMAL-NEXT: Content: 68656C6C6F0A00
; NORMAL-NEXT: - SectionOffset: 18
; NORMAL-NEXT: InitFlags: 0
; NORMAL-NEXT: Offset:
; NORMAL-NEXT: Opcode: I32_CONST
; NORMAL-NEXT: Value: 8
; NORMAL-NEXT: Content: '01000000'
; NORMAL-NEXT: - SectionOffset: 27
; NORMAL-NEXT: InitFlags: 0
; NORMAL-NEXT: Offset:
; NORMAL-NEXT: Opcode: I32_CONST
; NORMAL-NEXT: Value: 12
; NORMAL-NEXT: Content: '02000000'
; NORMAL-NEXT: - SectionOffset: 36
; NORMAL-NEXT: InitFlags: 0
; NORMAL-NEXT: Offset:
; NORMAL-NEXT: Opcode: I32_CONST
; NORMAL-NEXT: Value: 16
; NORMAL-NEXT: Content: '03000000'
; NORMAL-NEXT: - SectionOffset: 45
; NORMAL-NEXT: InitFlags: 0
; NORMAL-NEXT: Offset:
; NORMAL-NEXT: Opcode: I32_CONST
; NORMAL-NEXT: Value: 24
; NORMAL-NEXT: Content: '00000000'
; NORMAL-NEXT: - SectionOffset: 54
; NORMAL-NEXT: InitFlags: 0
; NORMAL-NEXT: Offset:
; NORMAL-NEXT: Opcode: I32_CONST
; NORMAL-NEXT: Value: 28
; NORMAL-NEXT: Content: '616263'
; NORMAL-NEXT: - Type: CUSTOM
; NORMAL-NEXT: Name: linking
; NORMAL-NEXT: Version: 2
; NORMAL-NEXT: SymbolTable:
; NORMAL-NEXT: - Index: 0
; NORMAL-NEXT: Kind: FUNCTION
; NORMAL-NEXT: Name: hello
; NORMAL-NEXT: Flags: [ VISIBILITY_HIDDEN ]
; NORMAL-NEXT: Function: 3
; NORMAL-NEXT: - Index: 1
; NORMAL-NEXT: Kind: DATA
; NORMAL-NEXT: Name: hello_str
; NORMAL-NEXT: Flags: [ ]
; NORMAL-NEXT: Segment: 0
; NORMAL-NEXT: Size: 7
; NORMAL-NEXT: - Index: 2
; NORMAL-NEXT: Kind: FUNCTION
; NORMAL-NEXT: Name: puts
; NORMAL-NEXT: Flags: [ UNDEFINED ]
; NORMAL-NEXT: Function: 0
; NORMAL-NEXT: - Index: 3
; NORMAL-NEXT: Kind: FUNCTION
; NORMAL-NEXT: Name: my_func
; NORMAL-NEXT: Flags: [ VISIBILITY_HIDDEN ]
; NORMAL-NEXT: Function: 4
; NORMAL-NEXT: - Index: 4
; NORMAL-NEXT: Kind: FUNCTION
; NORMAL-NEXT: Name: foo_import
; NORMAL-NEXT: Flags: [ UNDEFINED ]
; NORMAL-NEXT: Function: 1
; NORMAL-NEXT: - Index: 5
; NORMAL-NEXT: Kind: FUNCTION
; NORMAL-NEXT: Name: bar_import
; NORMAL-NEXT: Flags: [ BINDING_WEAK, UNDEFINED ]
; NORMAL-NEXT: Function: 2
; NORMAL-NEXT: - Index: 6
; NORMAL-NEXT: Kind: FUNCTION
; NORMAL-NEXT: Name: func_comdat
; NORMAL-NEXT: Flags: [ BINDING_WEAK ]
; NORMAL-NEXT: Function: 5
; NORMAL-NEXT: - Index: 7
; NORMAL-NEXT: Kind: DATA
; NORMAL-NEXT: Name: data_comdat
; NORMAL-NEXT: Flags: [ BINDING_WEAK ]
; NORMAL-NEXT: Segment: 5
; NORMAL-NEXT: Size: 3
; NORMAL-NEXT: - Index: 8
; NORMAL-NEXT: Kind: DATA
; NORMAL-NEXT: Name: func_addr1
; NORMAL-NEXT: Flags: [ VISIBILITY_HIDDEN ]
; NORMAL-NEXT: Segment: 1
; NORMAL-NEXT: Size: 4
; NORMAL-NEXT: - Index: 9
; NORMAL-NEXT: Kind: DATA
; NORMAL-NEXT: Name: func_addr2
; NORMAL-NEXT: Flags: [ VISIBILITY_HIDDEN ]
; NORMAL-NEXT: Segment: 2
; NORMAL-NEXT: Size: 4
; NORMAL-NEXT: - Index: 10
; NORMAL-NEXT: Kind: DATA
; NORMAL-NEXT: Name: func_addr3
; NORMAL-NEXT: Flags: [ VISIBILITY_HIDDEN ]
; NORMAL-NEXT: Segment: 3
; NORMAL-NEXT: Size: 4
; NORMAL-NEXT: - Index: 11
; NORMAL-NEXT: Kind: DATA
; NORMAL-NEXT: Name: data_addr1
; NORMAL-NEXT: Flags: [ VISIBILITY_HIDDEN ]
; NORMAL-NEXT: Segment: 4
; NORMAL-NEXT: Size: 4
; NORMAL-NEXT: - Index: 12
; NORMAL-NEXT: Kind: DATA
; NORMAL-NEXT: Name: data_import
; NORMAL-NEXT: Flags: [ UNDEFINED ]
; NORMAL-NEXT: SegmentInfo:
; NORMAL-NEXT: - Index: 0
; NORMAL-NEXT: Name: .rodata.hello_str
; NORMAL-NEXT: Alignment: 0
; NORMAL-NEXT: Flags: [ ]
; NORMAL-NEXT: - Index: 1
; NORMAL-NEXT: Name: .data.func_addr1
; NORMAL-NEXT: Alignment: 2
; NORMAL-NEXT: Flags: [ ]
; NORMAL-NEXT: - Index: 2
; NORMAL-NEXT: Name: .data.func_addr2
; NORMAL-NEXT: Alignment: 2
; NORMAL-NEXT: Flags: [ ]
; NORMAL-NEXT: - Index: 3
; NORMAL-NEXT: Name: .data.func_addr3
; NORMAL-NEXT: Alignment: 2
; NORMAL-NEXT: Flags: [ ]
; NORMAL-NEXT: - Index: 4
; NORMAL-NEXT: Name: .data.data_addr1
; NORMAL-NEXT: Alignment: 3
; NORMAL-NEXT: Flags: [ ]
; NORMAL-NEXT: - Index: 5
; NORMAL-NEXT: Name: .rodata.data_comdat
; NORMAL-NEXT: Alignment: 0
; NORMAL-NEXT: Flags: [ ]
; NORMAL-NEXT: Comdats:
; NORMAL-NEXT: - Name: func_comdat
; NORMAL-NEXT: Entries:
; NORMAL-NEXT: - Kind: FUNCTION
; NORMAL-NEXT: Index: 5
; NORMAL-NEXT: - Kind: DATA
; NORMAL-NEXT: Index: 5
; NORMAL-NEXT: - Type: CUSTOM
; NORMAL-NEXT: Name: name
; NORMAL-NEXT: FunctionNames:
; NORMAL-NEXT: - Index: 0
; NORMAL-NEXT: Name: puts
; NORMAL-NEXT: - Index: 1
; NORMAL-NEXT: Name: foo_import
; NORMAL-NEXT: - Index: 2
; NORMAL-NEXT: Name: bar_import
; NORMAL-NEXT: - Index: 3
; NORMAL-NEXT: Name: hello
; NORMAL-NEXT: - Index: 4
; NORMAL-NEXT: Name: my_func
; NORMAL-NEXT: - Index: 5
; NORMAL-NEXT: Name: func_comdat
; NORMAL-NEXT:...

View File

@ -898,7 +898,7 @@ void Writer::run() {
createCallCtorsFunction();
}
if (config->sharedMemory && !config->shared)
if (!config->relocatable && config->sharedMemory && !config->shared)
createInitTLSFunction();
if (errorCount())