[llvm-branch-commits] [llvm-branch] r355311 - Merging r352465:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Mar 4 04:44:42 PST 2019
Author: hans
Date: Mon Mar 4 04:44:42 2019
New Revision: 355311
URL: http://llvm.org/viewvc/llvm-project?rev=355311&view=rev
Log:
Merging r352465:
------------------------------------------------------------------------
r352465 | mstorsjo | 2019-01-29 10:36:48 +0100 (Tue, 29 Jan 2019) | 17 lines
[COFF, ARM64] Don't put jump table into a separate COFF section for EK_LabelDifference32
Windows ARM64 has PIC relocation model and uses jump table kind
EK_LabelDifference32. This produces jump table entry as
".word LBB123 - LJTI1_2" which represents the distance between the block
and jump table.
A new relocation type (IMAGE_REL_ARM64_REL32) is needed to do the fixup
correctly if they are in different COFF section.
This change saves the jump table to the same COFF section as the
associated code. An ideal fix could be utilizing IMAGE_REL_ARM64_REL32
relocation type.
Patch by Tom Tan!
Differential Revision: https://reviews.llvm.org/D57277
------------------------------------------------------------------------
Added:
llvm/branches/release_80/test/CodeGen/AArch64/win64-jumptable.ll
- copied unchanged from r352465, llvm/trunk/test/CodeGen/AArch64/win64-jumptable.ll
Modified:
llvm/branches/release_80/ (props changed)
llvm/branches/release_80/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/branches/release_80/lib/Target/AArch64/AArch64TargetMachine.cpp
Propchange: llvm/branches/release_80/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar 4 04:44:42 2019
@@ -1,3 +1,3 @@
/llvm/branches/Apple/Pertwee:110850,110961
/llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,351322,351325,351344-351345,351349,351351,351370,351381,351387,351421,351426,351436,351475,351485,351753-351754,351765,351910,351930,351932,352034,352204,352246,352374,352555,352607-352608,352707,352714,352770,352886,352889,352892,352895,352908,352917,352935,352945,353015,353061,353082,353138,353141,353155,353213,353218,353304,353308,353334,353367,353374,353383,353463,353480,353489,353551,353733,353758,353809,353907,354034,354117,354128,354131,354144,354207,354497,354505,354733,354756,354764,355116-355117
+/llvm/trunk:155241,351322,351325,351344-351345,351349,351351,351370,351381,351387,351421,351426,351436,351475,351485,351753-351754,351765,351910,351930,351932,352034,352204,352246,352374,352465,352555,352607-352608,352707,352714,352770,352886,352889,352892,352895,352908,352917,352935,352945,353015,353061,353082,353138,353141,353155,353213,353218,353304,353308,353334,353367,353374,353383,353463,353480,353489,353551,353733,353758,353809,353907,354034,354117,354128,354131,354144,354207,354497,354505,354733,354756,354764,355116-355117
Modified: llvm/branches/release_80/lib/Target/AArch64/AArch64AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_80/lib/Target/AArch64/AArch64AsmPrinter.cpp?rev=355311&r1=355310&r2=355311&view=diff
==============================================================================
--- llvm/branches/release_80/lib/Target/AArch64/AArch64AsmPrinter.cpp (original)
+++ llvm/branches/release_80/lib/Target/AArch64/AArch64AsmPrinter.cpp Mon Mar 4 04:44:42 2019
@@ -471,9 +471,18 @@ void AArch64AsmPrinter::EmitJumpTableInf
const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
if (JT.empty()) return;
+ const Function &F = MF->getFunction();
const TargetLoweringObjectFile &TLOF = getObjFileLowering();
- MCSection *ReadOnlySec = TLOF.getSectionForJumpTable(MF->getFunction(), TM);
- OutStreamer->SwitchSection(ReadOnlySec);
+ bool JTInDiffSection =
+ !STI->isTargetCOFF() ||
+ !TLOF.shouldPutJumpTableInFunctionSection(
+ MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32,
+ F);
+ if (JTInDiffSection) {
+ // Drop it in the readonly section.
+ MCSection *ReadOnlySec = TLOF.getSectionForJumpTable(F, TM);
+ OutStreamer->SwitchSection(ReadOnlySec);
+ }
auto AFI = MF->getInfo<AArch64FunctionInfo>();
for (unsigned JTI = 0, e = JT.size(); JTI != e; ++JTI) {
Modified: llvm/branches/release_80/lib/Target/AArch64/AArch64TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_80/lib/Target/AArch64/AArch64TargetMachine.cpp?rev=355311&r1=355310&r2=355311&view=diff
==============================================================================
--- llvm/branches/release_80/lib/Target/AArch64/AArch64TargetMachine.cpp (original)
+++ llvm/branches/release_80/lib/Target/AArch64/AArch64TargetMachine.cpp Mon Mar 4 04:44:42 2019
@@ -209,8 +209,8 @@ static std::string computeDataLayout(con
static Reloc::Model getEffectiveRelocModel(const Triple &TT,
Optional<Reloc::Model> RM) {
- // AArch64 Darwin is always PIC.
- if (TT.isOSDarwin())
+ // AArch64 Darwin and Windows are always PIC.
+ if (TT.isOSDarwin() || TT.isOSWindows())
return Reloc::PIC_;
// On ELF platforms the default static relocation model has a smart enough
// linker to cope with referencing external symbols defined in a shared
More information about the llvm-branch-commits
mailing list