diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2018-08-18 08:27:24 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2018-08-18 08:27:24 +0000 |
commit | fb11553f98d4c2e5baecfdb11d224fb31ef4ac0d (patch) | |
tree | 38099d0ba9e9e824497f784b61572f4f963275c2 | |
parent | 786d82c29598fe10a2b4888d1d1f426063c8bf7c (diff) |
Notes
-rw-r--r-- | COFF/Driver.cpp | 6 | ||||
-rw-r--r-- | ELF/SyntheticSections.cpp | 4 | ||||
-rw-r--r-- | docs/ReleaseNotes.rst | 8 | ||||
-rw-r--r-- | test/COFF/Inputs/common-replacement.s | 5 | ||||
-rw-r--r-- | test/COFF/common-replacement.s | 35 | ||||
-rw-r--r-- | test/ELF/lto/cache.ll | 2 | ||||
-rw-r--r-- | test/ELF/x86-64-reloc-error2.s | 10 | ||||
-rw-r--r-- | test/mach-o/dependency_info.yaml | 2 | ||||
-rw-r--r-- | test/wasm/lto/cache.ll | 2 |
9 files changed, 63 insertions, 11 deletions
diff --git a/COFF/Driver.cpp b/COFF/Driver.cpp index eefdb48beadd..da7527607ffb 100644 --- a/COFF/Driver.cpp +++ b/COFF/Driver.cpp @@ -1551,11 +1551,11 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) { continue; } + // If the symbol isn't common, it must have been replaced with a regular + // symbol, which will carry its own alignment. auto *DC = dyn_cast<DefinedCommon>(Sym); - if (!DC) { - warn("/aligncomm symbol " + Name + " of wrong kind"); + if (!DC) continue; - } CommonChunk *C = DC->getChunk(); C->Alignment = std::max(C->Alignment, Alignment); diff --git a/ELF/SyntheticSections.cpp b/ELF/SyntheticSections.cpp index ae02434572c2..8b02a14c93c2 100644 --- a/ELF/SyntheticSections.cpp +++ b/ELF/SyntheticSections.cpp @@ -2929,8 +2929,10 @@ void elf::mergeSections() { // We do not want to handle sections that are not alive, so just remove // them instead of trying to merge. - if (!MS->Live) + if (!MS->Live) { + S = nullptr; continue; + } StringRef OutsecName = getOutputSectionName(MS); uint32_t Alignment = std::max<uint32_t>(MS->Alignment, MS->Entsize); diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst index 7ac1f9ce565b..58f47980893a 100644 --- a/docs/ReleaseNotes.rst +++ b/docs/ReleaseNotes.rst @@ -29,7 +29,13 @@ ELF Improvements COFF Improvements ----------------- -* Item 1. +* Improved correctness of exporting mangled stdcall symbols. + +* Completed support for ARM64 relocations. + +* Added support for outputting PDB debug info for MinGW targets. + +* Improved compatibility of output binaries with GNU binutils objcopy/strip. MachO Improvements ------------------ diff --git a/test/COFF/Inputs/common-replacement.s b/test/COFF/Inputs/common-replacement.s new file mode 100644 index 000000000000..eaaeee2a3d36 --- /dev/null +++ b/test/COFF/Inputs/common-replacement.s @@ -0,0 +1,5 @@ + .globl foo + .data + .p2align 2, 0 +foo: + .long 42 diff --git a/test/COFF/common-replacement.s b/test/COFF/common-replacement.s new file mode 100644 index 000000000000..51e31fa167cb --- /dev/null +++ b/test/COFF/common-replacement.s @@ -0,0 +1,35 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -triple=x86_64-windows-gnu %s -filetype=obj -o %t1.obj +# RUN: llvm-mc -triple=x86_64-windows-gnu %S/Inputs/common-replacement.s -filetype=obj -o %t2.obj + +# RUN: lld-link -lldmingw -entry:main %t1.obj %t2.obj -out:%t.exe -verbose 2>&1 \ +# RUN: | FileCheck -check-prefix VERBOSE %s +# RUN: llvm-readobj -s %t.exe | FileCheck -check-prefix SECTIONS %s + +# VERBOSE: -aligncomm:"foo",2 + +# As long as the .comm symbol is replaced with actual data, RawDataSize +# below should be nonzero. + +# SECTIONS: Name: .data (2E 64 61 74 61 00 00 00) +# SECTIONS-NEXT: VirtualSize: 0x8 +# SECTIONS-NEXT: VirtualAddress: 0x2000 +# SECTIONS-NEXT: RawDataSize: 512 + + + .text + .def main; + .scl 2; + .type 32; + .endef + .globl main + .p2align 4, 0x90 +main: + movl foo(%rip), %eax + retq + +# This produces an aligncomm directive, but when linking in +# Inputs/common-replacement.s, this symbol is replaced by a normal defined +# symbol instead. + .comm foo, 4, 2 diff --git a/test/ELF/lto/cache.ll b/test/ELF/lto/cache.ll index 3f2bea9f2cdf..5ab74f5c5457 100644 --- a/test/ELF/lto/cache.ll +++ b/test/ELF/lto/cache.ll @@ -13,7 +13,7 @@ ; RUN: ls %t.cache | count 4 ; Create a file of size 64KB. -; RUN: "%python" -c "print(' ' * 65536)" > %t.cache/llvmcache-foo +; RUN: %python -c "print(' ' * 65536)" > %t.cache/llvmcache-foo ; This should leave the file in place. ; RUN: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy cache_size_bytes=128k:prune_interval=0s -o %t3 %t2.o %t.o diff --git a/test/ELF/x86-64-reloc-error2.s b/test/ELF/x86-64-reloc-error2.s index d49b67522654..81f033f2804c 100644 --- a/test/ELF/x86-64-reloc-error2.s +++ b/test/ELF/x86-64-reloc-error2.s @@ -1,14 +1,18 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o -# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s +# RUN: not ld.lld --entry=func --gc-sections %t.o -o /dev/null 2>&1 | FileCheck %s ## Check we are able to find a function symbol that encloses ## a given location when reporting error messages. # CHECK: {{.*}}.o:(function func): relocation R_X86_64_32S out of range: -281474974609408 is not in [-2147483648, 2147483647] +# This mergeable section will be garbage collected. We had a crash issue in that case. Test it. +.section .rodata.str1,"aMS",@progbits,1 +.asciz "a" + .section .text.func, "ax", %progbits .globl func .type func,@function -.size func, 0x10 func: - movq func - 0x1000000000000, %rdx + movq $func - 0x1000000000000, %rdx +.size func, .-func diff --git a/test/mach-o/dependency_info.yaml b/test/mach-o/dependency_info.yaml index 34d688541b91..06b269ae1680 100644 --- a/test/mach-o/dependency_info.yaml +++ b/test/mach-o/dependency_info.yaml @@ -9,7 +9,7 @@ # RUN: -F/Custom/Frameworks \ # RUN: -framework Bar \ # RUN: -framework Foo -# RUN: '%python' %p/Inputs/DependencyDump.py %t.info | FileCheck %s +# RUN: %python %p/Inputs/DependencyDump.py %t.info | FileCheck %s # CHECK: linker-vers: lld diff --git a/test/wasm/lto/cache.ll b/test/wasm/lto/cache.ll index b0a7820c1e19..9b4aa5d6e2d2 100644 --- a/test/wasm/lto/cache.ll +++ b/test/wasm/lto/cache.ll @@ -11,7 +11,7 @@ ; RUN: ls %t.cache | count 4 ; Create a file of size 64KB. -; RUN: "%python" -c "print(' ' * 65536)" > %t.cache/llvmcache-foo +; RUN: %python -c "print(' ' * 65536)" > %t.cache/llvmcache-foo ; This should leave the file in place. ; RUN: wasm-ld --thinlto-cache-dir=%t.cache --thinlto-cache-policy cache_size_bytes=128k:prune_interval=0s -o %t.wasm %t2.o %t.o |