PPCELFObjectWriter.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. //===-- PPCELFObjectWriter.cpp - PPC ELF Writer ---------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #include "MCTargetDesc/PPCFixupKinds.h"
  9. #include "MCTargetDesc/PPCMCExpr.h"
  10. #include "MCTargetDesc/PPCMCTargetDesc.h"
  11. #include "llvm/ADT/STLExtras.h"
  12. #include "llvm/MC/MCELFObjectWriter.h"
  13. #include "llvm/MC/MCExpr.h"
  14. #include "llvm/MC/MCObjectWriter.h"
  15. #include "llvm/MC/MCSymbolELF.h"
  16. #include "llvm/MC/MCValue.h"
  17. #include "llvm/Support/ErrorHandling.h"
  18. using namespace llvm;
  19. namespace {
  20. class PPCELFObjectWriter : public MCELFObjectTargetWriter {
  21. public:
  22. PPCELFObjectWriter(bool Is64Bit, uint8_t OSABI);
  23. protected:
  24. unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
  25. const MCFixup &Fixup, bool IsPCRel) const override;
  26. bool needsRelocateWithSymbol(const MCSymbol &Sym,
  27. unsigned Type) const override;
  28. };
  29. }
  30. PPCELFObjectWriter::PPCELFObjectWriter(bool Is64Bit, uint8_t OSABI)
  31. : MCELFObjectTargetWriter(Is64Bit, OSABI,
  32. Is64Bit ? ELF::EM_PPC64 : ELF::EM_PPC,
  33. /*HasRelocationAddend*/ true) {}
  34. static MCSymbolRefExpr::VariantKind getAccessVariant(const MCValue &Target,
  35. const MCFixup &Fixup) {
  36. const MCExpr *Expr = Fixup.getValue();
  37. if (Expr->getKind() != MCExpr::Target)
  38. return Target.getAccessVariant();
  39. switch (cast<PPCMCExpr>(Expr)->getKind()) {
  40. case PPCMCExpr::VK_PPC_None:
  41. return MCSymbolRefExpr::VK_None;
  42. case PPCMCExpr::VK_PPC_LO:
  43. return MCSymbolRefExpr::VK_PPC_LO;
  44. case PPCMCExpr::VK_PPC_HI:
  45. return MCSymbolRefExpr::VK_PPC_HI;
  46. case PPCMCExpr::VK_PPC_HA:
  47. return MCSymbolRefExpr::VK_PPC_HA;
  48. case PPCMCExpr::VK_PPC_HIGH:
  49. return MCSymbolRefExpr::VK_PPC_HIGH;
  50. case PPCMCExpr::VK_PPC_HIGHA:
  51. return MCSymbolRefExpr::VK_PPC_HIGHA;
  52. case PPCMCExpr::VK_PPC_HIGHERA:
  53. return MCSymbolRefExpr::VK_PPC_HIGHERA;
  54. case PPCMCExpr::VK_PPC_HIGHER:
  55. return MCSymbolRefExpr::VK_PPC_HIGHER;
  56. case PPCMCExpr::VK_PPC_HIGHEST:
  57. return MCSymbolRefExpr::VK_PPC_HIGHEST;
  58. case PPCMCExpr::VK_PPC_HIGHESTA:
  59. return MCSymbolRefExpr::VK_PPC_HIGHESTA;
  60. }
  61. llvm_unreachable("unknown PPCMCExpr kind");
  62. }
  63. unsigned PPCELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target,
  64. const MCFixup &Fixup,
  65. bool IsPCRel) const {
  66. MCFixupKind Kind = Fixup.getKind();
  67. if (Kind >= FirstLiteralRelocationKind)
  68. return Kind - FirstLiteralRelocationKind;
  69. MCSymbolRefExpr::VariantKind Modifier = getAccessVariant(Target, Fixup);
  70. // determine the type of the relocation
  71. unsigned Type;
  72. if (IsPCRel) {
  73. switch (Fixup.getTargetKind()) {
  74. default:
  75. llvm_unreachable("Unimplemented");
  76. case PPC::fixup_ppc_br24:
  77. case PPC::fixup_ppc_br24abs:
  78. case PPC::fixup_ppc_br24_notoc:
  79. switch (Modifier) {
  80. default: llvm_unreachable("Unsupported Modifier");
  81. case MCSymbolRefExpr::VK_None:
  82. Type = ELF::R_PPC_REL24;
  83. break;
  84. case MCSymbolRefExpr::VK_PLT:
  85. Type = ELF::R_PPC_PLTREL24;
  86. break;
  87. case MCSymbolRefExpr::VK_PPC_LOCAL:
  88. Type = ELF::R_PPC_LOCAL24PC;
  89. break;
  90. case MCSymbolRefExpr::VK_PPC_NOTOC:
  91. Type = ELF::R_PPC64_REL24_NOTOC;
  92. break;
  93. }
  94. break;
  95. case PPC::fixup_ppc_brcond14:
  96. case PPC::fixup_ppc_brcond14abs:
  97. Type = ELF::R_PPC_REL14;
  98. break;
  99. case PPC::fixup_ppc_half16:
  100. switch (Modifier) {
  101. default: llvm_unreachable("Unsupported Modifier");
  102. case MCSymbolRefExpr::VK_None:
  103. Type = ELF::R_PPC_REL16;
  104. break;
  105. case MCSymbolRefExpr::VK_PPC_LO:
  106. Type = ELF::R_PPC_REL16_LO;
  107. break;
  108. case MCSymbolRefExpr::VK_PPC_HI:
  109. Type = ELF::R_PPC_REL16_HI;
  110. break;
  111. case MCSymbolRefExpr::VK_PPC_HA:
  112. Type = ELF::R_PPC_REL16_HA;
  113. break;
  114. }
  115. break;
  116. case PPC::fixup_ppc_half16ds:
  117. case PPC::fixup_ppc_half16dq:
  118. Target.print(errs());
  119. errs() << '\n';
  120. report_fatal_error("Invalid PC-relative half16ds relocation");
  121. case PPC::fixup_ppc_pcrel34:
  122. switch (Modifier) {
  123. default:
  124. llvm_unreachable("Unsupported Modifier for fixup_ppc_pcrel34");
  125. case MCSymbolRefExpr::VK_PCREL:
  126. Type = ELF::R_PPC64_PCREL34;
  127. break;
  128. case MCSymbolRefExpr::VK_PPC_GOT_PCREL:
  129. Type = ELF::R_PPC64_GOT_PCREL34;
  130. break;
  131. case MCSymbolRefExpr::VK_PPC_GOT_TLSGD_PCREL:
  132. Type = ELF::R_PPC64_GOT_TLSGD_PCREL34;
  133. break;
  134. case MCSymbolRefExpr::VK_PPC_GOT_TLSLD_PCREL:
  135. Type = ELF::R_PPC64_GOT_TLSLD_PCREL34;
  136. break;
  137. case MCSymbolRefExpr::VK_PPC_GOT_TPREL_PCREL:
  138. Type = ELF::R_PPC64_GOT_TPREL_PCREL34;
  139. break;
  140. }
  141. break;
  142. case FK_Data_4:
  143. case FK_PCRel_4:
  144. Type = ELF::R_PPC_REL32;
  145. break;
  146. case FK_Data_8:
  147. case FK_PCRel_8:
  148. Type = ELF::R_PPC64_REL64;
  149. break;
  150. }
  151. } else {
  152. switch (Fixup.getTargetKind()) {
  153. default: llvm_unreachable("invalid fixup kind!");
  154. case PPC::fixup_ppc_br24abs:
  155. Type = ELF::R_PPC_ADDR24;
  156. break;
  157. case PPC::fixup_ppc_brcond14abs:
  158. Type = ELF::R_PPC_ADDR14; // XXX: or BRNTAKEN?_
  159. break;
  160. case PPC::fixup_ppc_half16:
  161. switch (Modifier) {
  162. default: llvm_unreachable("Unsupported Modifier");
  163. case MCSymbolRefExpr::VK_None:
  164. Type = ELF::R_PPC_ADDR16;
  165. break;
  166. case MCSymbolRefExpr::VK_PPC_LO:
  167. Type = ELF::R_PPC_ADDR16_LO;
  168. break;
  169. case MCSymbolRefExpr::VK_PPC_HI:
  170. Type = ELF::R_PPC_ADDR16_HI;
  171. break;
  172. case MCSymbolRefExpr::VK_PPC_HA:
  173. Type = ELF::R_PPC_ADDR16_HA;
  174. break;
  175. case MCSymbolRefExpr::VK_PPC_HIGH:
  176. Type = ELF::R_PPC64_ADDR16_HIGH;
  177. break;
  178. case MCSymbolRefExpr::VK_PPC_HIGHA:
  179. Type = ELF::R_PPC64_ADDR16_HIGHA;
  180. break;
  181. case MCSymbolRefExpr::VK_PPC_HIGHER:
  182. Type = ELF::R_PPC64_ADDR16_HIGHER;
  183. break;
  184. case MCSymbolRefExpr::VK_PPC_HIGHERA:
  185. Type = ELF::R_PPC64_ADDR16_HIGHERA;
  186. break;
  187. case MCSymbolRefExpr::VK_PPC_HIGHEST:
  188. Type = ELF::R_PPC64_ADDR16_HIGHEST;
  189. break;
  190. case MCSymbolRefExpr::VK_PPC_HIGHESTA:
  191. Type = ELF::R_PPC64_ADDR16_HIGHESTA;
  192. break;
  193. case MCSymbolRefExpr::VK_GOT:
  194. Type = ELF::R_PPC_GOT16;
  195. break;
  196. case MCSymbolRefExpr::VK_PPC_GOT_LO:
  197. Type = ELF::R_PPC_GOT16_LO;
  198. break;
  199. case MCSymbolRefExpr::VK_PPC_GOT_HI:
  200. Type = ELF::R_PPC_GOT16_HI;
  201. break;
  202. case MCSymbolRefExpr::VK_PPC_GOT_HA:
  203. Type = ELF::R_PPC_GOT16_HA;
  204. break;
  205. case MCSymbolRefExpr::VK_PPC_TOC:
  206. Type = ELF::R_PPC64_TOC16;
  207. break;
  208. case MCSymbolRefExpr::VK_PPC_TOC_LO:
  209. Type = ELF::R_PPC64_TOC16_LO;
  210. break;
  211. case MCSymbolRefExpr::VK_PPC_TOC_HI:
  212. Type = ELF::R_PPC64_TOC16_HI;
  213. break;
  214. case MCSymbolRefExpr::VK_PPC_TOC_HA:
  215. Type = ELF::R_PPC64_TOC16_HA;
  216. break;
  217. case MCSymbolRefExpr::VK_TPREL:
  218. Type = ELF::R_PPC_TPREL16;
  219. break;
  220. case MCSymbolRefExpr::VK_PPC_TPREL_LO:
  221. Type = ELF::R_PPC_TPREL16_LO;
  222. break;
  223. case MCSymbolRefExpr::VK_PPC_TPREL_HI:
  224. Type = ELF::R_PPC_TPREL16_HI;
  225. break;
  226. case MCSymbolRefExpr::VK_PPC_TPREL_HA:
  227. Type = ELF::R_PPC_TPREL16_HA;
  228. break;
  229. case MCSymbolRefExpr::VK_PPC_TPREL_HIGH:
  230. Type = ELF::R_PPC64_TPREL16_HIGH;
  231. break;
  232. case MCSymbolRefExpr::VK_PPC_TPREL_HIGHA:
  233. Type = ELF::R_PPC64_TPREL16_HIGHA;
  234. break;
  235. case MCSymbolRefExpr::VK_PPC_TPREL_HIGHER:
  236. Type = ELF::R_PPC64_TPREL16_HIGHER;
  237. break;
  238. case MCSymbolRefExpr::VK_PPC_TPREL_HIGHERA:
  239. Type = ELF::R_PPC64_TPREL16_HIGHERA;
  240. break;
  241. case MCSymbolRefExpr::VK_PPC_TPREL_HIGHEST:
  242. Type = ELF::R_PPC64_TPREL16_HIGHEST;
  243. break;
  244. case MCSymbolRefExpr::VK_PPC_TPREL_HIGHESTA:
  245. Type = ELF::R_PPC64_TPREL16_HIGHESTA;
  246. break;
  247. case MCSymbolRefExpr::VK_DTPREL:
  248. Type = ELF::R_PPC64_DTPREL16;
  249. break;
  250. case MCSymbolRefExpr::VK_PPC_DTPREL_LO:
  251. Type = ELF::R_PPC64_DTPREL16_LO;
  252. break;
  253. case MCSymbolRefExpr::VK_PPC_DTPREL_HI:
  254. Type = ELF::R_PPC64_DTPREL16_HI;
  255. break;
  256. case MCSymbolRefExpr::VK_PPC_DTPREL_HA:
  257. Type = ELF::R_PPC64_DTPREL16_HA;
  258. break;
  259. case MCSymbolRefExpr::VK_PPC_DTPREL_HIGH:
  260. Type = ELF::R_PPC64_DTPREL16_HIGH;
  261. break;
  262. case MCSymbolRefExpr::VK_PPC_DTPREL_HIGHA:
  263. Type = ELF::R_PPC64_DTPREL16_HIGHA;
  264. break;
  265. case MCSymbolRefExpr::VK_PPC_DTPREL_HIGHER:
  266. Type = ELF::R_PPC64_DTPREL16_HIGHER;
  267. break;
  268. case MCSymbolRefExpr::VK_PPC_DTPREL_HIGHERA:
  269. Type = ELF::R_PPC64_DTPREL16_HIGHERA;
  270. break;
  271. case MCSymbolRefExpr::VK_PPC_DTPREL_HIGHEST:
  272. Type = ELF::R_PPC64_DTPREL16_HIGHEST;
  273. break;
  274. case MCSymbolRefExpr::VK_PPC_DTPREL_HIGHESTA:
  275. Type = ELF::R_PPC64_DTPREL16_HIGHESTA;
  276. break;
  277. case MCSymbolRefExpr::VK_PPC_GOT_TLSGD:
  278. if (is64Bit())
  279. Type = ELF::R_PPC64_GOT_TLSGD16;
  280. else
  281. Type = ELF::R_PPC_GOT_TLSGD16;
  282. break;
  283. case MCSymbolRefExpr::VK_PPC_GOT_TLSGD_LO:
  284. Type = ELF::R_PPC64_GOT_TLSGD16_LO;
  285. break;
  286. case MCSymbolRefExpr::VK_PPC_GOT_TLSGD_HI:
  287. Type = ELF::R_PPC64_GOT_TLSGD16_HI;
  288. break;
  289. case MCSymbolRefExpr::VK_PPC_GOT_TLSGD_HA:
  290. Type = ELF::R_PPC64_GOT_TLSGD16_HA;
  291. break;
  292. case MCSymbolRefExpr::VK_PPC_GOT_TLSLD:
  293. if (is64Bit())
  294. Type = ELF::R_PPC64_GOT_TLSLD16;
  295. else
  296. Type = ELF::R_PPC_GOT_TLSLD16;
  297. break;
  298. case MCSymbolRefExpr::VK_PPC_GOT_TLSLD_LO:
  299. Type = ELF::R_PPC64_GOT_TLSLD16_LO;
  300. break;
  301. case MCSymbolRefExpr::VK_PPC_GOT_TLSLD_HI:
  302. Type = ELF::R_PPC64_GOT_TLSLD16_HI;
  303. break;
  304. case MCSymbolRefExpr::VK_PPC_GOT_TLSLD_HA:
  305. Type = ELF::R_PPC64_GOT_TLSLD16_HA;
  306. break;
  307. case MCSymbolRefExpr::VK_PPC_GOT_TPREL:
  308. /* We don't have R_PPC64_GOT_TPREL16, but since GOT offsets
  309. are always 4-aligned, we can use R_PPC64_GOT_TPREL16_DS. */
  310. Type = ELF::R_PPC64_GOT_TPREL16_DS;
  311. break;
  312. case MCSymbolRefExpr::VK_PPC_GOT_TPREL_LO:
  313. /* We don't have R_PPC64_GOT_TPREL16_LO, but since GOT offsets
  314. are always 4-aligned, we can use R_PPC64_GOT_TPREL16_LO_DS. */
  315. Type = ELF::R_PPC64_GOT_TPREL16_LO_DS;
  316. break;
  317. case MCSymbolRefExpr::VK_PPC_GOT_TPREL_HI:
  318. Type = ELF::R_PPC64_GOT_TPREL16_HI;
  319. break;
  320. case MCSymbolRefExpr::VK_PPC_GOT_DTPREL:
  321. /* We don't have R_PPC64_GOT_DTPREL16, but since GOT offsets
  322. are always 4-aligned, we can use R_PPC64_GOT_DTPREL16_DS. */
  323. Type = ELF::R_PPC64_GOT_DTPREL16_DS;
  324. break;
  325. case MCSymbolRefExpr::VK_PPC_GOT_DTPREL_LO:
  326. /* We don't have R_PPC64_GOT_DTPREL16_LO, but since GOT offsets
  327. are always 4-aligned, we can use R_PPC64_GOT_DTPREL16_LO_DS. */
  328. Type = ELF::R_PPC64_GOT_DTPREL16_LO_DS;
  329. break;
  330. case MCSymbolRefExpr::VK_PPC_GOT_TPREL_HA:
  331. Type = ELF::R_PPC64_GOT_TPREL16_HA;
  332. break;
  333. case MCSymbolRefExpr::VK_PPC_GOT_DTPREL_HI:
  334. Type = ELF::R_PPC64_GOT_DTPREL16_HI;
  335. break;
  336. case MCSymbolRefExpr::VK_PPC_GOT_DTPREL_HA:
  337. Type = ELF::R_PPC64_GOT_DTPREL16_HA;
  338. break;
  339. }
  340. break;
  341. case PPC::fixup_ppc_half16ds:
  342. case PPC::fixup_ppc_half16dq:
  343. switch (Modifier) {
  344. default: llvm_unreachable("Unsupported Modifier");
  345. case MCSymbolRefExpr::VK_None:
  346. Type = ELF::R_PPC64_ADDR16_DS;
  347. break;
  348. case MCSymbolRefExpr::VK_PPC_LO:
  349. Type = ELF::R_PPC64_ADDR16_LO_DS;
  350. break;
  351. case MCSymbolRefExpr::VK_GOT:
  352. Type = ELF::R_PPC64_GOT16_DS;
  353. break;
  354. case MCSymbolRefExpr::VK_PPC_GOT_LO:
  355. Type = ELF::R_PPC64_GOT16_LO_DS;
  356. break;
  357. case MCSymbolRefExpr::VK_PPC_TOC:
  358. Type = ELF::R_PPC64_TOC16_DS;
  359. break;
  360. case MCSymbolRefExpr::VK_PPC_TOC_LO:
  361. Type = ELF::R_PPC64_TOC16_LO_DS;
  362. break;
  363. case MCSymbolRefExpr::VK_TPREL:
  364. Type = ELF::R_PPC64_TPREL16_DS;
  365. break;
  366. case MCSymbolRefExpr::VK_PPC_TPREL_LO:
  367. Type = ELF::R_PPC64_TPREL16_LO_DS;
  368. break;
  369. case MCSymbolRefExpr::VK_DTPREL:
  370. Type = ELF::R_PPC64_DTPREL16_DS;
  371. break;
  372. case MCSymbolRefExpr::VK_PPC_DTPREL_LO:
  373. Type = ELF::R_PPC64_DTPREL16_LO_DS;
  374. break;
  375. case MCSymbolRefExpr::VK_PPC_GOT_TPREL:
  376. Type = ELF::R_PPC64_GOT_TPREL16_DS;
  377. break;
  378. case MCSymbolRefExpr::VK_PPC_GOT_TPREL_LO:
  379. Type = ELF::R_PPC64_GOT_TPREL16_LO_DS;
  380. break;
  381. case MCSymbolRefExpr::VK_PPC_GOT_DTPREL:
  382. Type = ELF::R_PPC64_GOT_DTPREL16_DS;
  383. break;
  384. case MCSymbolRefExpr::VK_PPC_GOT_DTPREL_LO:
  385. Type = ELF::R_PPC64_GOT_DTPREL16_LO_DS;
  386. break;
  387. }
  388. break;
  389. case PPC::fixup_ppc_nofixup:
  390. switch (Modifier) {
  391. default: llvm_unreachable("Unsupported Modifier");
  392. case MCSymbolRefExpr::VK_PPC_TLSGD:
  393. if (is64Bit())
  394. Type = ELF::R_PPC64_TLSGD;
  395. else
  396. Type = ELF::R_PPC_TLSGD;
  397. break;
  398. case MCSymbolRefExpr::VK_PPC_TLSLD:
  399. if (is64Bit())
  400. Type = ELF::R_PPC64_TLSLD;
  401. else
  402. Type = ELF::R_PPC_TLSLD;
  403. break;
  404. case MCSymbolRefExpr::VK_PPC_TLS:
  405. if (is64Bit())
  406. Type = ELF::R_PPC64_TLS;
  407. else
  408. Type = ELF::R_PPC_TLS;
  409. break;
  410. case MCSymbolRefExpr::VK_PPC_TLS_PCREL:
  411. Type = ELF::R_PPC64_TLS;
  412. break;
  413. }
  414. break;
  415. case PPC::fixup_ppc_imm34:
  416. switch (Modifier) {
  417. default:
  418. report_fatal_error("Unsupported Modifier for fixup_ppc_imm34.");
  419. case MCSymbolRefExpr::VK_DTPREL:
  420. Type = ELF::R_PPC64_DTPREL34;
  421. break;
  422. case MCSymbolRefExpr::VK_TPREL:
  423. Type = ELF::R_PPC64_TPREL34;
  424. break;
  425. }
  426. break;
  427. case FK_Data_8:
  428. switch (Modifier) {
  429. default: llvm_unreachable("Unsupported Modifier");
  430. case MCSymbolRefExpr::VK_PPC_TOCBASE:
  431. Type = ELF::R_PPC64_TOC;
  432. break;
  433. case MCSymbolRefExpr::VK_None:
  434. Type = ELF::R_PPC64_ADDR64;
  435. break;
  436. case MCSymbolRefExpr::VK_PPC_DTPMOD:
  437. Type = ELF::R_PPC64_DTPMOD64;
  438. break;
  439. case MCSymbolRefExpr::VK_TPREL:
  440. Type = ELF::R_PPC64_TPREL64;
  441. break;
  442. case MCSymbolRefExpr::VK_DTPREL:
  443. Type = ELF::R_PPC64_DTPREL64;
  444. break;
  445. }
  446. break;
  447. case FK_Data_4:
  448. Type = ELF::R_PPC_ADDR32;
  449. break;
  450. case FK_Data_2:
  451. Type = ELF::R_PPC_ADDR16;
  452. break;
  453. }
  454. }
  455. return Type;
  456. }
  457. bool PPCELFObjectWriter::needsRelocateWithSymbol(const MCSymbol &Sym,
  458. unsigned Type) const {
  459. switch (Type) {
  460. default:
  461. return false;
  462. case ELF::R_PPC_REL24:
  463. case ELF::R_PPC64_REL24_NOTOC:
  464. // If the target symbol has a local entry point, we must keep the
  465. // target symbol to preserve that information for the linker.
  466. // The "other" values are stored in the last 6 bits of the second byte.
  467. // The traditional defines for STO values assume the full byte and thus
  468. // the shift to pack it.
  469. unsigned Other = cast<MCSymbolELF>(Sym).getOther() << 2;
  470. return (Other & ELF::STO_PPC64_LOCAL_MASK) != 0;
  471. }
  472. }
  473. std::unique_ptr<MCObjectTargetWriter>
  474. llvm::createPPCELFObjectWriter(bool Is64Bit, uint8_t OSABI) {
  475. return std::make_unique<PPCELFObjectWriter>(Is64Bit, OSABI);
  476. }