OSDN Git Service

Don't pass the code model to MC
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 2 Aug 2017 20:32:26 +0000 (20:32 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 2 Aug 2017 20:32:26 +0000 (20:32 +0000)
commit2600a677c98dad00a83b0bc04bdde4fe9ac88296
tree4fd0cfda682a7ca052b4d67be833000166ea4d1b
parent43b62b6cb88b87a7e1d734ce37ca65e604b54e1c
Don't pass the code model to MC

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309884 91177308-0d34-0410-b5e6-96231b3b80d8
17 files changed:
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