[PATCH] D36228: Don't pass the code model to MC

Rafael Ávila de Espíndola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 10:08:18 PDT 2017


rafael created this revision.
Herald added subscribers: javed.absar, sdardis, emaste.

I was surprised to see the code model being passed to MC. After all, it assembles code, it doesn't create it.

The one place it is used is in the expansion of .cfi directives to handle .eh_frame being more that 2gb away from the code.

As far as I can tell, gnu assembler doesn't even have an option to enable this. Compiling a c file with gcc -mcmodel=large produces a regular looking .eh_frame. This is probably because in practice linker parse and recreate .eh_frames.

In llvm this is used because the JIT can place the code and .eh_frame very far apart. Ideally we would fix the jit and delete this option. This is hard.

Apart from confusion another problem with the current interface is that most callers pass CodeModel::Default, which is bad since MC has no way to map it to the target default if it actually needed to.

This patch then replaces the argument with a boolean with a default value. The vast majority of users don't ever need to look at it. In fact, only CodeGen and llvm-mc use it and llvm-mc just to enable more testing.


https://reviews.llvm.org/D36228

Files:
  include/llvm/MC/MCObjectFileInfo.h
  lib/MC/MCObjectFileInfo.cpp
  lib/Object/ModuleSymbolTable.cpp
  lib/Target/TargetLoweringObjectFile.cpp
  test/ExecutionEngine/RuntimeDyld/AArch64/MachO_ARM64_relocations.s
  test/ExecutionEngine/RuntimeDyld/Mips/ELF_Mips64r2N64_PIC_relocations.s
  test/ExecutionEngine/RuntimeDyld/Mips/ELF_N32_relocations.s
  test/ExecutionEngine/RuntimeDyld/Mips/ELF_N64R6_relocations.s
  test/ExecutionEngine/RuntimeDyld/Mips/ELF_O32R6_relocations.s
  test/ExecutionEngine/RuntimeDyld/Mips/ELF_O32_PIC_relocations.s
  test/ExecutionEngine/RuntimeDyld/X86/ELF_x86-64_PIC-small-relocations.s
  test/MC/ELF/cfi-large-model.s
  tools/dsymutil/DwarfLinker.cpp
  tools/llvm-dwp/llvm-dwp.cpp
  tools/llvm-mc/llvm-mc.cpp
  tools/llvm-objdump/llvm-objdump.cpp
  unittests/DebugInfo/DWARF/DwarfGenerator.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36228.109367.patch
Type: text/x-patch
Size: 18261 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170802/109a1891/attachment.bin>


More information about the llvm-commits mailing list