[llvm-branch-commits] [llvm-branch] r371059 - Merging r370426:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Sep 5 04:43:42 PDT 2019


Author: hans
Date: Thu Sep  5 04:43:42 2019
New Revision: 371059

URL: http://llvm.org/viewvc/llvm-project?rev=371059&view=rev
Log:
Merging r370426:
------------------------------------------------------------------------
r370426 | maskray | 2019-08-30 04:20:49 +0200 (Fri, 30 Aug 2019) | 26 lines

[PPC32] Emit R_PPC_GOT_TPREL16 instead R_PPC_GOT_TPREL16_LO

Unlike ppc64, which has ADDISgotTprelHA+LDgotTprelL pairs,
ppc32 just uses LDgotTprelL32, so it does not make lots of sense to use
_LO without a paired _HA.

Emit R_PPC_GOT_TPREL16 instead R_PPC_GOT_TPREL16_LO to match GCC, and
get better linker relocation check. Note, R_PPC_GOT_TPREL16_{HA,LO}
don't have good linker support:

(a) lld does not support R_PPC_GOT_TPREL16_{HA,LO}.
(b) Top of tree ld.bfd does not support R_PPC_GOT_REL16_HA Initial-Exec -> Local-Exec relaxation:

  // a.o
  addis 3, 3, tsd_tls at got@tprel at ha
  lwz 3, tsd_tls at got@tprel at l(3)
  add 3, 3, tsd_tls at tls
  // b.o
  .section .tdata,"awT"; .globl tsd_tls; tsd_tls:

  // ld/ld-new a.o b.o
  internal error, aborting at ../../bfd/elf32-ppc.c:7952 in ppc_elf_relocate_section

Reviewed By: adalava

Differential Revision: https://reviews.llvm.org/D66925
------------------------------------------------------------------------

Modified:
    llvm/branches/release_90/   (props changed)
    llvm/branches/release_90/lib/Target/PowerPC/PPCAsmPrinter.cpp
    llvm/branches/release_90/test/CodeGen/PowerPC/tls.ll

Propchange: llvm/branches/release_90/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep  5 04:43:42 2019
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,366431,366447,366481,366487,366527,366570,366660,366868,366925,367019,367030,367062,367084,367124,367215,367292,367304,367306,367314,367340-367341,367394,367396,367398,367403,367412,367417,367429,367580,367662,367750,367753,367846-367847,367898,367941,368004,368164,368230,368300,368315,368324,368477-368478,368517-368519,368554,368572,368873,369011,369026,369084,369095,369097,369168,369199,369310,369426,369443,369886,370036,370176,370204,370271,370355,370404,370430,370720-370721,370753,371048
+/llvm/trunk:155241,366431,366447,366481,366487,366527,366570,366660,366868,366925,367019,367030,367062,367084,367124,367215,367292,367304,367306,367314,367340-367341,367394,367396,367398,367403,367412,367417,367429,367580,367662,367750,367753,367846-367847,367898,367941,368004,368164,368230,368300,368315,368324,368477-368478,368517-368519,368554,368572,368873,369011,369026,369084,369095,369097,369168,369199,369310,369426,369443,369886,370036,370176,370204,370271,370355,370404,370426,370430,370720-370721,370753,371048

Modified: llvm/branches/release_90/lib/Target/PowerPC/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_90/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=371059&r1=371058&r2=371059&view=diff
==============================================================================
--- llvm/branches/release_90/lib/Target/PowerPC/PPCAsmPrinter.cpp (original)
+++ llvm/branches/release_90/lib/Target/PowerPC/PPCAsmPrinter.cpp Thu Sep  5 04:43:42 2019
@@ -866,8 +866,10 @@ void PPCAsmPrinter::EmitInstruction(cons
     const GlobalValue *GValue = MO.getGlobal();
     MCSymbol *MOSymbol = getSymbol(GValue);
     const MCExpr *Exp =
-      MCSymbolRefExpr::create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TPREL_LO,
-                              OutContext);
+        MCSymbolRefExpr::create(MOSymbol,
+                                isPPC64 ? MCSymbolRefExpr::VK_PPC_GOT_TPREL_LO
+                                        : MCSymbolRefExpr::VK_PPC_GOT_TPREL,
+                                OutContext);
     TmpInst.getOperand(1) = MCOperand::createExpr(Exp);
     EmitToStreamer(*OutStreamer, TmpInst);
     return;

Modified: llvm/branches/release_90/test/CodeGen/PowerPC/tls.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_90/test/CodeGen/PowerPC/tls.ll?rev=371059&r1=371058&r2=371059&view=diff
==============================================================================
--- llvm/branches/release_90/test/CodeGen/PowerPC/tls.ll (original)
+++ llvm/branches/release_90/test/CodeGen/PowerPC/tls.ll Thu Sep  5 04:43:42 2019
@@ -43,7 +43,7 @@ entry:
 ;OPT0-PPC32-LABEL:    main2:
 ;OPT0-PPC32:       li [[REG1:[0-9]+]], _GLOBAL_OFFSET_TABLE_ at l
 ;OPT0-PPC32:       addis [[REG1]], [[REG1]], _GLOBAL_OFFSET_TABLE_ at ha
-;OPT0-PPC32:       lwz [[REG2:[0-9]+]], a2 at got@tprel at l([[REG1]])
+;OPT0-PPC32:       lwz [[REG2:[0-9]+]], a2 at got@tprel([[REG1]])
 ;OPT0-PPC32:       add 3, [[REG2]], a2 at tls
 
 ;OPT0-PPC32-PIC-LABEL:  main2:
@@ -51,4 +51,4 @@ entry:
 ;OPT0-PPC32-PIC-NOT:    li {{[0-9]+}}, _GLOBAL_OFFSET_TABLE_ at l
 ;OPT0-PPC32-PIC-NOT:    addis {{[0-9]+}}, {{[0-9+]}}, _GLOBAL_OFFSET_TABLE_ at ha
 ;OPT0-PPC32-PIC-NOT:    bl __tls_get_addr(a2 at tlsgd)@PLT
-;OPT0-PPC32-PIC:        lwz {{[0-9]+}}, a2 at got@tprel at l({{[0-9]+}})
+;OPT0-PPC32-PIC:        lwz {{[0-9]+}}, a2 at got@tprel({{[0-9]+}})




More information about the llvm-branch-commits mailing list