[all-commits] [llvm/llvm-project] fe5937: [llc] Initialize TargetLoweringObjectFile for MIR ...

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Mar 20 11:18:46 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: fe5937cb33b7753ff95edbe7cbd3be549961b733
      https://github.com/llvm/llvm-project/commit/fe5937cb33b7753ff95edbe7cbd3be549961b733
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-03-20 (Fri, 20 Mar 2020)

  Changed paths:
    M llvm/tools/llc/llc.cpp

  Log Message:
  -----------
  [llc] Initialize TargetLoweringObjectFile for MIR input

MIRParser uses MC and transitively calls MCObjectFileInfo::getObjectFileType().
TargetLoweringObjectFile::Initialize should be called beforehand to
initialize MCObjectFileInfo::Env.

This manifested as a -fsanitize=undefined
test/CodeGen/MIR/X86/instr-symbols-and-mcsymbol-operands.mir failure
when D71360/aa5ee8f244441a8ea103a7e0ed8b6f3e74454516 was committed.


  Commit: 7899fe9da8d8df6f19ddcbbb877ea124d711c54b
      https://github.com/llvm/llvm-project/commit/7899fe9da8d8df6f19ddcbbb877ea124d711c54b
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-03-20 (Fri, 20 Mar 2020)

  Changed paths:
    M llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    M llvm/lib/Target/AArch64/AArch64TargetObjectFile.cpp
    M llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
    M llvm/lib/Target/Lanai/LanaiTargetObjectFile.cpp
    M llvm/lib/Target/Mips/MipsTargetObjectFile.cpp
    M llvm/lib/Target/PowerPC/PPCTargetObjectFile.cpp
    M llvm/lib/Target/RISCV/RISCVTargetObjectFile.cpp
    M llvm/lib/Target/Sparc/SparcTargetObjectFile.cpp
    M llvm/lib/Target/X86/X86TargetMachine.cpp
    M llvm/lib/Target/X86/X86TargetObjectFile.cpp
    M llvm/lib/Target/X86/X86TargetObjectFile.h
    M llvm/test/CodeGen/X86/constructor.ll
    M llvm/test/CodeGen/X86/init-priority.ll

  Log Message:
  -----------
  [X86] Reland D71360 Clean up UseInitArray initialization for X86ELFTargetObjectFile

UseInitArray is now the CC1 default but TargetLoweringObjectFileELF::UseInitArray still defaults to false.
The following two unknown OS target triples continue using .ctors/.dtors because InitializeELF is not called.

clang -target i386 -c a.c
clang -target x86_64 -c a.c

This cleanup fixes this as a bonus.

Differential Revision: https://reviews.llvm.org/D71360


Compare: https://github.com/llvm/llvm-project/compare/636665331bbd...7899fe9da8d8


More information about the All-commits mailing list