|
Revision tags: llvmorg-20.1.0, llvmorg-20.1.0-rc3, llvmorg-20.1.0-rc2, llvmorg-20.1.0-rc1, llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init |
|
| #
e690137d |
| 13-Jul-2022 |
Fangrui Song <[email protected]> |
[Support] Change compression::zlib::{compress,uncompress} to use uint8_t *
It's more natural to use uint8_t * (std::byte needs C++17 and llvm has too much uint8_t *) and most callers use uint8_t * i
[Support] Change compression::zlib::{compress,uncompress} to use uint8_t *
It's more natural to use uint8_t * (std::byte needs C++17 and llvm has too much uint8_t *) and most callers use uint8_t * instead of char *. The functions are recently moved into `llvm::compression::zlib::`, so downstream projects need to make adaption anyway.
show more ...
|
| #
dd74d311 |
| 08-Jul-2022 |
Fangrui Song <[email protected]> |
[ELF] Refactor ELFCOMPRESS_ZLIB handling and improve diagnostics
And add some tests.
|
| #
ea61750c |
| 08-Jul-2022 |
Cole Kissane <[email protected]> |
[NFC] Refactor llvm::zlib namespace
* Refactor compression namespaces across the project, making way for a possible introduction of alternatives to zlib compression. Changes are as follows: *
[NFC] Refactor llvm::zlib namespace
* Refactor compression namespaces across the project, making way for a possible introduction of alternatives to zlib compression. Changes are as follows: * Relocate the `llvm::zlib` namespace to `llvm::compression::zlib`.
Reviewed By: MaskRay, leonardchan, phosek
Differential Revision: https://reviews.llvm.org/D128953
show more ...
|
| #
6611d58f |
| 07-Jul-2022 |
Fangrui Song <[email protected]> |
[ELF] Relax R_RISCV_ALIGN
Alternative to D125036. Implement R_RISCV_ALIGN relaxation so that we can handle -mrelax object files (i.e. -mno-relax is no longer needed) and creates a framework for futu
[ELF] Relax R_RISCV_ALIGN
Alternative to D125036. Implement R_RISCV_ALIGN relaxation so that we can handle -mrelax object files (i.e. -mno-relax is no longer needed) and creates a framework for future relaxation.
`relaxAux` is placed in a union with InputSectionBase::jumpInstrMod, storing auxiliary information for relaxation. In the first pass, `relaxAux` is allocated. The main data structure is `relocDeltas`: when referencing `relocations[i]`, the actual offset is `r_offset - (i ? relocDeltas[i-1] : 0)`.
`relaxOnce` performs one relaxation pass. It computes `relocDeltas` for all text section. Then, adjust st_value/st_size for symbols relative to this section based on `SymbolAnchor`. `bytesDropped` is set so that `assignAddresses` knows that the size has changed.
Run `relaxOnce` in the `finalizeAddressDependentContent` loop to wait for convergence of text sections and other address dependent sections (e.g. SHT_RELR). Note: extrating `relaxOnce` into a separate loop works for many cases but has issues in some linker script edge cases.
After convergence, compute section contents: shrink the NOP sequence of each R_RISCV_ALIGN as appropriate. Instead of deleting bytes, we run a sequence of memcpy on the content delimitered by relocation locations. For R_RISCV_ALIGN let the next memcpy skip the desired number of bytes. Section content computation is parallelizable, but let's ensure the implementation is mature before optimizations. Technically we can save a copy if we interleave some code with `OutputSection::writeTo`, but let's not pollute the generic code (we don't have templated relocation resolving, so using conditions can impose overhead to non-RISCV.)
Tested: `make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- LLVM=1 defconfig all` built Linux kernel using -mrelax is bootable. FreeBSD RISCV64 system using -mrelax is bootable. bash/curl/firefox/libevent/vim/tmux using -mrelax works.
Differential Revision: https://reviews.llvm.org/D127581
show more ...
|
|
Revision tags: llvmorg-14.0.6 |
|
| #
16ca490f |
| 13-Jun-2022 |
Fangrui Song <[email protected]> |
[ELF] Change getRISCVPCRelHi20 error to conventional errorOrWarn
|
|
Revision tags: llvmorg-14.0.5 |
|
| #
e09f77d3 |
| 02-Jun-2022 |
Fangrui Song <[email protected]> |
[ELF] Remove support for legacy .zdebug sections
.zdebug is unlikely used any longer: gcc -gz switched from legacy .zdebug to SHF_COMPRESSED with binutils 2.26 (2016), which has been several years.
[ELF] Remove support for legacy .zdebug sections
.zdebug is unlikely used any longer: gcc -gz switched from legacy .zdebug to SHF_COMPRESSED with binutils 2.26 (2016), which has been several years. clang 14 dropped -gz=zlib-gnu support. According to Debian Code Search (`gz=zlib-gnu`), no project uses -gz=zlib-gnu.
Remove .zdebug support to (a) simplify code and (b) allow removal of llvm-mc's --compress-debug-sections=zlib-gnu.
In case the old object file `a.o` uses .zdebug, run `objcopy --decompress-debug-sections a.o`
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D126793
show more ...
|
| #
c78c00dc |
| 26-May-2022 |
Andrew Ng <[email protected]> |
[LLD][ELF] Drop the string null terminator from the hash in splitStrings
Differential Revision: https://reviews.llvm.org/D126484
|
|
Revision tags: llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2 |
|
| #
02eab528 |
| 14-Apr-2022 |
Fangrui Song <[email protected]> |
[ELF][AArch64] Fix unneeded thunk for branches to hidden undefined weak
Similar to D119787 for PPC64.
A hidden undefined weak may change its binding to local before some `isUndefinedWeak` code, so
[ELF][AArch64] Fix unneeded thunk for branches to hidden undefined weak
Similar to D119787 for PPC64.
A hidden undefined weak may change its binding to local before some `isUndefinedWeak` code, so some `isUndefinedWeak` code needs to be changed to `isUndefined`. The undefined non-weak case has been errored, so just using `isUndefined` is fine.
The Linux kernel recently has a usage that a branch from 0xffff800008491ee0 references a hidden undefined weak symbol `vfio_group_set_kvm`. It relies on the behavior that a branch to undefined weak resolving to the next instruction, otherwise it'd see spurious relocation out of range errors.
Fixes https://github.com/ClangBuiltLinux/linux/issues/1624
Differential Revision: https://reviews.llvm.org/D123750
show more ...
|
|
Revision tags: llvmorg-14.0.1 |
|
| #
46453119 |
| 29-Mar-2022 |
Fangrui Song <[email protected]> |
[ELF] --emit-relocs: adjust offsets of .rel[a].eh_frame relocations
Two code paths may reach the EHFrame case in SectionBase::getOffset:
* .eh_frame reference * relocation copy for --emit-relocs
T
[ELF] --emit-relocs: adjust offsets of .rel[a].eh_frame relocations
Two code paths may reach the EHFrame case in SectionBase::getOffset:
* .eh_frame reference * relocation copy for --emit-relocs
The first may be used by clang_rt.crtbegin.o and GCC crtbeginT.o to get the start address of the output .eh_frame. The relocation has an offset of 0 or (x86-64 PC-relative leaq for clang_rt.crtbegin.o) -4. The current code just returns `offset`, which handles this case well.
The second is related to InputSection::copyRelocations on .eh_frame (used by --emit-relocs). .eh_frame pieces may be dropped due to GC/ICF, so we should convert the input offset to the output offset. Use the same way as MergeInputSection with a special case handling outSecOff==-1 for an invalid piece (see eh-frame-marker.s).
This exposes an issue in mips64-eh-abs-reloc.s that we don't reliably handle anyway. Just add --no-check-dynamic-relocations to paper over it.
Differential Revision: https://reviews.llvm.org/D122459
show more ...
|
| #
48e251b1 |
| 29-Mar-2022 |
Fangrui Song <[email protected]> |
Revert D122459 "[ELF] --emit-relocs: adjust offsets of .rel[a].eh_frame relocations"
This reverts commit 6faba31e0d88ce71e87567ddb51d2444524b8a81.
It may cause "offset is outside the section".
|
| #
6faba31e |
| 28-Mar-2022 |
Fangrui Song <[email protected]> |
[ELF] --emit-relocs: adjust offsets of .rel[a].eh_frame relocations
.eh_frame pieces may be dropped due to GC/ICF. When --emit-relocs adds relocations against .eh_frame, the offsets need to be adjus
[ELF] --emit-relocs: adjust offsets of .rel[a].eh_frame relocations
.eh_frame pieces may be dropped due to GC/ICF. When --emit-relocs adds relocations against .eh_frame, the offsets need to be adjusted. Use the same way as MergeInputSection with a special case handling outSecOff==-1 for an invalid piece (see eh-frame-marker.s).
This exposes an issue in mips64-eh-abs-reloc.s that we don't reliably handle anyway. Just add --no-check-dynamic-relocations to paper over it.
Original patch by Ayrton Muñoz
Differential Revision: https://reviews.llvm.org/D122459
show more ...
|
| #
8565a87f |
| 28-Mar-2022 |
Fangrui Song <[email protected]> |
[ELF] Simplify MergeInputSection::getParentOffset. NFC
and remove overly verbose comments.
|
|
Revision tags: llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3 |
|
| #
72bedf46 |
| 08-Mar-2022 |
Fangrui Song <[email protected]> |
[ELF] Inline InputSection::getParent. NFC
Combined with the previous change, lld executable is ~2K smaller and some code paths using InputSection::getParent are more efficient.
The fragmented heade
[ELF] Inline InputSection::getParent. NFC
Combined with the previous change, lld executable is ~2K smaller and some code paths using InputSection::getParent are more efficient.
The fragmented headers lead to a design limitation that OutputSection has to be incomplete, so we cannot use static_cast.
show more ...
|
| #
a815424c |
| 05-Mar-2022 |
Fangrui Song <[email protected]> |
Reland D119909 [ELF] Parallelize initializeLocalSymbols
ObjFile::parse combines symbol initialization and resolution. Many tasks unrelated to symbol resolution can be postponed and parallelized. Thi
Reland D119909 [ELF] Parallelize initializeLocalSymbols
ObjFile::parse combines symbol initialization and resolution. Many tasks unrelated to symbol resolution can be postponed and parallelized. This patch extracts local symbol initialization and parallelizes it.
Technically the new function initializeLocalSymbols can be merged into ObjFile::postParse, but functions like getSrcMsg may access the uninitialized (all nullptr) local part of InputFile::symbols.
Linking chrome: 1.02x as fast with glibc malloc, 1.04x as fast with mimalloc
Depends on f456c3ae3f4182b23673929e8fe0aa18bcec4289 and D119908
Reviewed By: ikudrin
Differential Revision: https://reviews.llvm.org/D119909
show more ...
|
| #
449b649f |
| 04-Mar-2022 |
Jorge Gorbe Moya <[email protected]> |
Revert "[ELF] Parallelize initializeLocalSymbols"
This reverts commit 09602d3b47ec83abb2c26efa5a199c13b72c7abf.
|
|
Revision tags: llvmorg-14.0.0-rc2 |
|
| #
bb3eeac7 |
| 28-Feb-2022 |
Fangrui Song <[email protected]> |
[ELF] Make InputSection::classof inline. NFC
|
| #
4976d1fe |
| 28-Feb-2022 |
Fangrui Song <[email protected]> |
[ELF] Move SyntheticSection check from InputSection::writeTo to OutputSection::writeTo. NFC
Simplify code and make the heavyweight operation to the call site so that it is clearer how to improve the
[ELF] Move SyntheticSection check from InputSection::writeTo to OutputSection::writeTo. NFC
Simplify code and make the heavyweight operation to the call site so that it is clearer how to improve the inefficient scheduling in the future.
show more ...
|
| #
09602d3b |
| 25-Feb-2022 |
Fangrui Song <[email protected]> |
[ELF] Parallelize initializeLocalSymbols
ObjFile::parse combines symbol initialization and resolution. Many tasks unrelated to symbol resolution can be postponed and parallelized. This patch extract
[ELF] Parallelize initializeLocalSymbols
ObjFile::parse combines symbol initialization and resolution. Many tasks unrelated to symbol resolution can be postponed and parallelized. This patch extracts local symbol initialization and parallelizes it.
Technically the new function initializeLocalSymbols can be merged into ObjFile::postParse, but functions like getSrcMsg may access the uninitialized (all nullptr) local part of InputFile::symbols.
Linking chrome: 1.02x as fast with glibc malloc, 1.04x as fast with mimalloc
Reviewed By: ikudrin
Differential Revision: https://reviews.llvm.org/D119909
show more ...
|
| #
ae1ba619 |
| 21-Feb-2022 |
Fangrui Song <[email protected]> |
[ELF] Replace uncompressed InputSectionBase::data() with rawData. NFC
In many call sites we know uncompression cannot happen (non-SHF_ALLOC, or the data (even if compressed) must have been uncompres
[ELF] Replace uncompressed InputSectionBase::data() with rawData. NFC
In many call sites we know uncompression cannot happen (non-SHF_ALLOC, or the data (even if compressed) must have been uncompressed by a previous pass). Prefer rawData in these cases. data() increases code size and prevents optimization on rawData.
show more ...
|
|
Revision tags: llvmorg-14.0.0-rc1 |
|
| #
27bb7990 |
| 08-Feb-2022 |
Fangrui Song <[email protected]> |
[ELF] Clean up headers. NFC
|
|
Revision tags: llvmorg-15-init |
|
| #
4450a2a2 |
| 02-Feb-2022 |
Alexander Shaposhnikov <[email protected]> |
[lld][ELF] Add support for ADRP+ADD optimization for AArch64
This diff adds support for ADRP+ADD optimization for AArch64 described in https://github.com/ARM-software/abi-aa/commit/d2ca58c54b8e955cf
[lld][ELF] Add support for ADRP+ADD optimization for AArch64
This diff adds support for ADRP+ADD optimization for AArch64 described in https://github.com/ARM-software/abi-aa/commit/d2ca58c54b8e955cfef25c71822f837ae0439d73 i.e. under appropriate constraints
ADRP x0, symbol ADD x0, x0, :lo12: symbol
can be turned into
NOP ADR x0, symbol
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D117614
show more ...
|
| #
17a39aec |
| 01-Feb-2022 |
Fangrui Song <[email protected]> |
[ELF] Simplify code with invokeELFT. NFC
|
| #
d97749fa |
| 01-Feb-2022 |
Fangrui Song <[email protected]> |
[ELF] Switch split-stack to use SmallVector. NFC
My x86-64 lld executable is 1.1KiB smaller.
|
| #
457273fd |
| 31-Jan-2022 |
Fangrui Song <[email protected]> |
[ELF] splitStrings: replace entSize==1 special case with manual loop unswitch. NFC
My x86-64 lld executable is actually smaller.
|
| #
5a2020d0 |
| 30-Jan-2022 |
Fangrui Song <[email protected]> |
[ELF] copyShtGroup: replace unordered_set<uint32_t> with DenseSet<uint32_t>. NFC
We don't need to support the empty/tombstone key section index.
|