2021年总结
2021-12-31 16:0:0 Author: maskray.me(查看原文) 阅读量:85 收藏

llvm-project

今年800+ commits,灌水很多,挑出一些值得一提的。

LLVM

  • Deleted remnant PowerPC Darwin code.
  • [XRay] Support DW_TAG_call_site and delete unneeded PATCHABLE_EVENT_CALL/PATCHABLE_TYPED_EVENT_CALL lowering
  • [ThinLTO] Add Visibility bits to GlobalValueSummary::GVFlags
  • [yaml2obj/obj2yaml/llvm-readobj] Support SHF_GNU_RETAIN
  • [MC] Support SHF_GNU_RETAIN as section flag 'R'
  • Support .reloc *, BFD_RELOC_{NONE,16,32,64}, * for a number of targets
  • Support .symver *, *, remove
  • Switched llvm-readelf/llvm-strings/llvm-nm/etc from llvm::cl to OptTable, modernizing the command line option syntax
  • [RISCV] Support machine constraint "S"
  • [LTO] Add SelectionKind to IRSymtab and use it in ld.lld/LLVMgold
  • [InstrProfiling][ELF] Make __profd_ private if the function does not use value profiling makes PGO/coverage instrumentation smaller
  • [InstrProfiling] Make CountersPtr in __profd_ relative greatly decreases the number of dynamic relocations
  • [X86] Default to -x86-pad-for-align=false to drop assembler difference with or w/o -g
  • [MC] Set SHF_INFO_LINK on SHT_REL/SHT_RELA sections
  • [llvm-objdump/llvm-readobj/obj2yaml/yaml2obj] Support STO_RISCV_VARIANT_CC and DT_RISCV_VARIANT_CC
  • Resolve {GlobalValue,GloalIndirectSymol}::getBaseObject confusion
  • [LangRef] Update ifunc syntax
  • [llvm-objdump] -p: Dump PE header for PE/COFF
  • [MachineOutliner] Don't outline functions starting with PATCHABLE_FUNCTION_ENTER/FENTRL_CALL

Clang

  • Add -f[no-]direct-access-external-data to supersede -mpie-copy-relocations
  • Add GNU attribute 'retain'
  • Define __GCC_HAVE_DWARF2_CFI_ASM if applicable
  • Fixed a number of cross-compiling issues in lib/Driver. Properly supported cross-compiling using g++ files (both normal and Debian-flavored)
  • [Driver] Add CLANG_DEFAULT_PIE_ON_LINUX to emulate GCC --enable-default-pie
  • -gsplit-dwarf semantics fix
  • -fasynchronous-unwind-tables semantics fix
  • Record -fasynchronous-unwind-tables and CC1 -mframe-pointer={non-leaf,all} in module flags metadata to affect synthesized functions
  • Implement -falign-loops=N
  • Minor CGDebugInfo cleanup
  • Add -fbinutils-version= to gate ELF features on the specified binutils version

lld

  • [ELF] Special case --shuffle-sections=-1 to reverse input sections
  • [ELF] Change --shuffle-sections=<seed> to --shuffle-sections=<section-glob>=<seed>
  • [ELF] Add OVERWRITE_SECTIONS command
  • [ELF] Add -Bsymbolic-non-weak-functions
  • [ELF] Support copy relocation on non-default version symbols for glibc
  • [ELF] Add --why-extract= to query why archive members/lazy object files are extracted
  • [ELF] Implement TLSDESC for x86-32
  • [ELF] Split scanRelocations into scanRelocations/postScanRelocations
  • [ELF] Replace LazyObjFile with lazy ObjFile/BitcodeFile
  • [ELF][PPC32] Support .got2 in an output section description may benefit someone writing WiiU in Rust
  • [ELF][LTO] Call madvise(MADV_DONTNEED) on MemoryBuffer instances

Pushed a number of commits to improve performance.

ld.lld, 13.0.1 vs 2021 year-end

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
clang -DCMAKE_BUILD_TYPE=Release

'numactl -C 20-20 /tmp/out/custom2/bin/ld.lld @response.txt --threads=1 -o lld.8' ran
1.15 ± 0.02 times faster than 'numactl -C 20-20 /tmp/llvm-13/out/release/bin/ld.lld @response.txt --threads=1 -o lld.8'
'numactl -C 20-23 /tmp/out/custom2/bin/ld.lld @response.txt --threads=4 -o lld.8' ran
1.09 ± 0.02 times faster than 'numactl -C 20-23 /tmp/llvm-13/out/release/bin/ld.lld @response.txt --threads=4 -o lld.8'
'numactl -C 20-27 /tmp/out/custom2/bin/ld.lld @response.txt --threads=8 -o lld.8' ran
1.08 ± 0.02 times faster than 'numactl -C 20-27 /tmp/llvm-13/out/release/bin/ld.lld @response.txt --threads=8 -o lld.8'

clang -DCMAKE_BUILD_TYPE=RelWithDebInfo

'numactl -C 20-20 /tmp/out/custom2/bin/ld.lld @response.txt --threads=1 -o lld.8' ran
1.16 ± 0.01 times faster than 'numactl -C 20-20 /tmp/llvm-13/out/release/bin/ld.lld @response.txt --threads=1 -o lld.8'
'numactl -C 20-23 /tmp/out/custom2/bin/ld.lld @response.txt --threads=4 -o lld.8' ran
1.26 ± 0.02 times faster than 'numactl -C 20-23 /tmp/llvm-13/out/release/bin/ld.lld @response.txt --threads=4 -o lld.8'
'numactl -C 20-27 /tmp/out/custom2/bin/ld.lld @response.txt --threads=8 -o lld.8' ran
1.31 ± 0.01 times faster than 'numactl -C 20-27 /tmp/llvm-13/out/release/bin/ld.lld @response.txt --threads=8 -o lld.8'

Pushed a number of commits to make lld executable smaller. The executable supports several binary formats (PE/COFF, Mach-O, WebAssembly) and contains large chunk of LLVM code due to LTO. If LTO and other ports were removed, the ELF port just needed ~3MiB in 2020.

In a -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=X86 build on Linux x86-64, the size of the lld executable:

  • main branch with lld/ELF restored to 13.0.1: 58129888
  • main branch: 57726440

Nearly 400KiB smaller.

LLDB

  • Makefile.rules: Avoid redundant .d generation (make restart) and inline archive rule to the only test
  • [lldb] Add -Wl,-rpath to make tests run with fresh built libc++

compiler-rt

  • [sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detection and support musl
  • [sanitizer] Fall back to fast unwinder
  • [sanitizer] Improve accuracy of GetTls on x86/s390
  • [lsan] Bump the thread limit from 1<<13 to 1<<22
  • [InstrProfiling] Use llvm.compiler.used if applicable for Mach-O

Misc

  • [libunwind] Add UNW_AARCH64_* beside UNW_ARM64_*
  • [libc++abi] Simplify __gxx_personality_v0

binutils

Reported many bugs and feature requests:

  • i386: Emit R_386_PLT32 instead of R_386_PC32 for call/jmp foo Ouch, a design flaw led to a WONTFIX
  • [objcopy --localize-hidden/--keep-global-symbol: drop GRP_COMDAT if the signature symbol becomes local?(https://sourceware.org/PR27931)
  • [ld: relocation R_X86_64_PC32 against undefined protected symbol__start_xx' can not be used when making a shared object`(https://sourceware.org/PR27491)
  • [binutils/testsuite/lib/binutils-common.exp: Support free-form shell commands and check patterns(https://sourceware.org/PR28602)
  • [gold: Support DT_RELR relative relocation format(https://sourceware.org/PR28601)
  • [ld: unknown phdr typePT_GNU_RELRO' (try integer literal)`(https://sourceware.org/PR28452)
  • [ld riscv: R_RISCV_JAL referencing a preemptible symbol should be rejected(https://sourceware.org/PR28509)
  • [ld: Support DT_RELR relative relocation format(https://sourceware.org/PR27923)
  • [ld arm: R_ARM_GOTOFF32 referencing a preemptible symbol should be disallowed(https://sourceware.org/PR28501)
  • [ld: Move R_*_TLSDESC to .rela.dyn(https://sourceware.org/PR28387)
  • [aarch64: relocation R_AARCH64_ADR_PREL_PG_HI21 against STT_GNU_IFUNC symbolifunc' isn't handled by elf64_aarch64_final_link_relocate`(https://sourceware.org/PR28370)
  • [ld: Assigning a non-default symbol to a different version node should warn(https://sourceware.org/PR28243)
  • [gas: .symver *, *@*, remove cannot be used in relocation(https://sourceware.org/PR28157)
  • [nm: Have a way to suppress 'no symbols'(https://sourceware.org/PR27408)
  • [ld: Support # as linker script comment marker(https://sourceware.org/PR28198)
  • [gold: Don't produce two output sections __llvm_prf_names(https://sourceware.org/PR27490)
  • [gold: if .symtab order is: __free_hook, [email protected]_2.2.5, version script incorrectly makes the symbol default versioned(https://sourceware.org/PR28196)
  • [gold: Spurious "warning: wildcard match appears in both version"(https://sourceware.org/PR28195)
  • [ld: Make special sections in a section group GCable(https://sourceware.org/PR28124)
  • [objcopy/strip: Don't convert SHT_REL to SHT_RELA(https://sourceware.org/PR28035)
  • [ld x86: Allow direct access to protected function symbols(https://sourceware.org/PR27973)
  • [aarch64: Internal error in ldst_lo12_determine_real_reloc_type at ../../../gas/config/tc-aarch64.c:5657(https://sourceware.org/PR27904)
  • [ld --trace: Print the symbol which leads to archive extraction(https://sourceware.org/PR27990)
  • [ld: Disallow ET_DYN DF_1_PIE linker input?(https://sourceware.org/PR27952)
  • [ld: Add -Bsymbolic-non-weak-functions which only applies to STB_GLOBAL STT_FUNC(https://sourceware.org/PR27871)
  • [ld: Add -Bno-symbolic to cancel -Bsymbolic/-Bsymbolic-functions(https://sourceware.org/PR27834)
  • [ld: -z unique-symbol behavior when .1 exists(https://sourceware.org/PR27825)
  • [x86-64: Omit _GLOBAL_OFFSET_TABLE_ for call [email protected](https://sourceware.org/PR27178)
  • [nm riscv: Suppress empty name symbols unless --special-syms?(https://sourceware.org/PR27584)
  • [addr2line riscv: Skip empty name symbols?(https://sourceware.org/PR27585)
  • [gas: Support .reloc ., 0, target(https://sourceware.org/PR27530)
  • [addr2line: JSON output(https://sourceware.org/PR27497)
  • [nm: Add --just-symbol-name(https://sourceware.org/PR27487)
  • [ld: Support input section description keyword: REVERSE(https://sourceware.org/PR27565)
  • [ld: Should SHF_GNU_RETAIN/STT_GNU_IFUNC/STB_GNU_UNIQUE work for ELFOSABI_NONE object files?(https://sourceware.org/PR27282)
  • [ld riscv: Add _fbsd emulations and riscv*-*-freebsd* triples(https://sourceware.org/PR27296)
  • [objcopy --weaken-symbol does not weaken undefined symbols(https://sourceware.org/PR27493)
  • [ld: Provide a way to make C identifier name sections GCable under __start_/__stop_ references(https://sourceware.org/PR27451)
  • [Add --trace-symbols-from-file?(https://sourceware.org/PR27407)
  • [gas: Suppress "CFI instruction used without previous .cfi_startproc" if .cfi_sections is empty(https://sourceware.org/PR27472)
  • [ld: Support compressing arbitrary sections (generalized --compress-debug-sections=)(https://sourceware.org/PR27452)
  • [ld: Support SHF_LINK_ORDER self-link(https://sourceware.org/PR27259)
  • [readelf: SHF_GNU_RETAIN ('R') is not listed inKey to Flags:``(https://sourceware.org/PR27281)
  • [ld: Add DWARF v5 sections and .debug_types to ld/scripttempl/DWARF.sc(https://sourceware.org/PR27230)
  • [ld: Don't suppress foo if [email protected] is defined(https://sourceware.org/PR27210) Ouch, a design flaw led to a NOTABUG
  • [ld ppc: Emit R_PPC64_IRELATIVE instead of R_PPC64_JMP_SLOT for non-preemptible ifunc referenced by a DSO(https://sourceware.org/PR27203)
  • [ld: Should an unversioned undefined symbol use VER_NDX_GLOBAL instead of VER_NDX_LOCAL?(https://sourceware.org/PR26002)

My commits:

  • Add some more DWARF-5 sections
  • nm: Add --quiet to suppress "no symbols" diagnostic
  • ld: Add -Bno-symbolic
  • gold: Add -Bno-symbolic
  • ld: Add -no-pie
  • ld: Add ChangeLog entry for -no-pie
  • gold: --export-dynamic-symbol: don't imply -u
  • readelf: Make DT_PREINIT_ARRAYSZ's output style match DT_INIT_ARRAYSZ
  • readelf: Support RELR in -S and -d and output
  • readelf: Support SHT_RELR/DT_RELR for -r
  • bfd_section_from_shdr: Support SHT_RELR sections

GCC

Reported bugs and feature requests:

glibc

Reported bugs and feature requests:

Linux kernel

  • module: Ignore _GLOBAL_OFFSET_TABLE_ when warning for undefined symbols
  • x86/build: Treat R_386_PLT32 relocation as R_386_PC32
  • firmware_loader: align .builtin_fw to 8
  • powerpc: Add "-z notext" flag to disable diagnostic

Others

Wrote 28 blog posts (including this one). Quite a few discuss linkers.


文章来源: https://maskray.me/blog/2021-12-31-summary
如有侵权请联系:admin#unsafe.sh