llvm.org GIT mirror llvm / b2d99dd
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@got@tprel@ha lwz 3, tsd_tls@got@tprel@l(3) add 3, 3, tsd_tls@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 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_90@371059 91177308-0d34-0410-b5e6-96231b3b80d8 Hans Wennborg 1 year, 2 months ago
2 changed file(s) with 6 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
865865 const GlobalValue *GValue = MO.getGlobal();
866866 MCSymbol *MOSymbol = getSymbol(GValue);
867867 const MCExpr *Exp =
868 MCSymbolRefExpr::create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TPREL_LO,
869 OutContext);
868 MCSymbolRefExpr::create(MOSymbol,
869 isPPC64 ? MCSymbolRefExpr::VK_PPC_GOT_TPREL_LO
870 : MCSymbolRefExpr::VK_PPC_GOT_TPREL,
871 OutContext);
870872 TmpInst.getOperand(1) = MCOperand::createExpr(Exp);
871873 EmitToStreamer(*OutStreamer, TmpInst);
872874 return;
4242 ;OPT0-PPC32-LABEL: main2:
4343 ;OPT0-PPC32: li [[REG1:[0-9]+]], _GLOBAL_OFFSET_TABLE_@l
4444 ;OPT0-PPC32: addis [[REG1]], [[REG1]], _GLOBAL_OFFSET_TABLE_@ha
45 ;OPT0-PPC32: lwz [[REG2:[0-9]+]], a2@got@tprel@l([[REG1]])
45 ;OPT0-PPC32: lwz [[REG2:[0-9]+]], a2@got@tprel([[REG1]])
4646 ;OPT0-PPC32: add 3, [[REG2]], a2@tls
4747
4848 ;OPT0-PPC32-PIC-LABEL: main2:
5050 ;OPT0-PPC32-PIC-NOT: li {{[0-9]+}}, _GLOBAL_OFFSET_TABLE_@l
5151 ;OPT0-PPC32-PIC-NOT: addis {{[0-9]+}}, {{[0-9+]}}, _GLOBAL_OFFSET_TABLE_@ha
5252 ;OPT0-PPC32-PIC-NOT: bl __tls_get_addr(a2@tlsgd)@PLT
53 ;OPT0-PPC32-PIC: lwz {{[0-9]+}}, a2@got@tprel@l({{[0-9]+}})
53 ;OPT0-PPC32-PIC: lwz {{[0-9]+}}, a2@got@tprel({{[0-9]+}})