[AArch64] ILP32 Backend Relocation Support
Needs ReviewPublic

Authored by joelkevinjones on Thu, Apr 13, 9:01 PM.

Details

Summary
Remove "_NC" suffix and semantics from TLSDESC_LD{64,32}_LO12 and
  TLSDESC_LD{64,32}_ADD12 relocations
Rearrange ordering in AArch64.def to following relocation encoding
Fix name from R_AARCH64_P32_LD64_GOT_LO12_NC to
   R_AARCH64_P32_LD64_GOT_LO12_NC
Add support for several "TLS", "TLSGD", and "TLSLD" relocations for
  ILP32
Fix return values from isNonILP32reloc
Add support for
  R_AARCH64_ADR_PREL_PG_HI21_NC, R_AARCH64_P32_LD32_GOT_LO12_NC,
  R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC,
  R_AARCH64_P32_TLSDESC_LD32_LO12, R_AARCH64_LD64_GOT_LO12_NC,
  *TLSLD_LDST128_DTPREL_LO12, *TLSLD_LDST128_DTPREL_LO12_NC,
  *TLSLE_LDST128_TPREL_LO12, *TLSLE_LDST128_TPREL_LO12_NC
Modify error messages to give name of equivalent relocation in the
  ABI not being used, along with better checking for non-existent
  requested relocations.
Added assembler support for "pg_hi21_nc", but not for output.

Diff Detail

joelkevinjones created this revision.Thu, Apr 13, 9:01 PM

I've spotted what I think is one mistake, R_AARCH64_P32_TLSDESC_ADR_PREL19 should be R_AARCH64_P32_TLSDESC_ADR_PREL21. I've put some suggestions for some missing test cases as well. Other than that I can't spot any obvious problems.

include/llvm/Support/ELFRelocs/AArch64.def
205

I think this should be R_AARCH64_P32_TLSDESC_ADR_PREL21
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0056c/IHI0056C_beta_aaelf64.pdf has this as
R_<CLS>_TLSDESC_ADR_PREL21 (search for 123)

lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
22

It isn't obvious from the changes why this is needed, just checking if it has been left in by mistake?

test/MC/AArch64/arm32-tls-relocs.s
127

I think that there are also the R_AARCH64_P32_TLSLE_LD128_TPREL_LO12 and LO12_NC, I see that there is a test case in arm32-elf-relocs.s, but it would be nice to do the additional checks here.

235

Is it worth a test case for R_AARCH64_P32_TLSLD_LDST128_DTPREL_LO12 and R_AARCH64_P32_TLSLD_LDST128_LO12_NC forms?

245

I think that there is a missing test needed to generate the R_AARCH64_TLSDESC_ADR_PREL21 relocation, this is the one I pointed out earlier had been given the code R_AARCH64_TLSDESC_ADR_PREL19

270

The general dynamic forms are missing tests:
R_AARCH64_P32_TLSGD_ADR_PREL21
R_AARCH64_P32_TLSGD_ADR_PAGE21
R_AARCH64_P32_TLSGD_ADD_LO12_NC