Skip to content

[bolt][aarch64] Add R_AARCH64_P32_ABS16/32 relocations #143773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions bolt/lib/Core/Relocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ static bool isSupportedAArch64(uint32_t Type) {
case ELF::R_AARCH64_PREL32:
case ELF::R_AARCH64_PREL64:
case ELF::R_AARCH64_ABS16:
case ELF::R_AARCH64_P32_ABS16:
case ELF::R_AARCH64_ABS32:
case ELF::R_AARCH64_P32_ABS32:
case ELF::R_AARCH64_ABS64:
case ELF::R_AARCH64_MOVW_UABS_G0:
case ELF::R_AARCH64_MOVW_UABS_G0_NC:
Expand Down Expand Up @@ -167,6 +169,7 @@ static size_t getSizeForTypeAArch64(uint32_t Type) {
errs() << object::getELFRelocationTypeName(ELF::EM_AARCH64, Type) << '\n';
llvm_unreachable("unsupported relocation type");
case ELF::R_AARCH64_ABS16:
case ELF::R_AARCH64_P32_ABS16:
case ELF::R_AARCH64_PREL16:
return 2;
case ELF::R_AARCH64_CALL26:
Expand Down Expand Up @@ -204,6 +207,7 @@ static size_t getSizeForTypeAArch64(uint32_t Type) {
case ELF::R_AARCH64_MOVW_UABS_G2_NC:
case ELF::R_AARCH64_MOVW_UABS_G3:
case ELF::R_AARCH64_ABS32:
case ELF::R_AARCH64_P32_ABS32:
case ELF::R_AARCH64_PLT32:
return 4;
case ELF::R_AARCH64_ABS64:
Expand Down Expand Up @@ -290,7 +294,9 @@ static uint64_t encodeValueAArch64(uint32_t Type, uint64_t Value, uint64_t PC) {
default:
llvm_unreachable("unsupported relocation");
case ELF::R_AARCH64_ABS16:
case ELF::R_AARCH64_P32_ABS16:
case ELF::R_AARCH64_ABS32:
case ELF::R_AARCH64_P32_ABS32:
case ELF::R_AARCH64_ABS64:
break;
case ELF::R_AARCH64_PREL16:
Expand Down Expand Up @@ -352,7 +358,9 @@ static uint64_t extractValueAArch64(uint32_t Type, uint64_t Contents,
errs() << object::getELFRelocationTypeName(ELF::EM_AARCH64, Type) << '\n';
llvm_unreachable("unsupported relocation type");
case ELF::R_AARCH64_ABS16:
case ELF::R_AARCH64_P32_ABS16:
case ELF::R_AARCH64_ABS32:
case ELF::R_AARCH64_P32_ABS32:
case ELF::R_AARCH64_ABS64:
return Contents;
case ELF::R_AARCH64_PREL16:
Expand Down Expand Up @@ -643,7 +651,9 @@ static bool isPCRelativeAArch64(uint32_t Type) {
default:
llvm_unreachable("Unknown relocation type");
case ELF::R_AARCH64_ABS16:
case ELF::R_AARCH64_P32_ABS16:
case ELF::R_AARCH64_ABS32:
case ELF::R_AARCH64_P32_ABS32:
case ELF::R_AARCH64_ABS64:
case ELF::R_AARCH64_LDST64_ABS_LO12_NC:
case ELF::R_AARCH64_ADD_ABS_LO12_NC:
Expand Down
2 changes: 2 additions & 0 deletions bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2244,7 +2244,9 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
switch (RelType) {
case ELF::R_AARCH64_ABS64:
case ELF::R_AARCH64_ABS32:
case ELF::R_AARCH64_P32_ABS32:
case ELF::R_AARCH64_ABS16:
case ELF::R_AARCH64_P32_ABS16:
case ELF::R_AARCH64_ADD_ABS_LO12_NC:
case ELF::R_AARCH64_ADR_GOT_PAGE:
case ELF::R_AARCH64_ADR_PREL_LO21:
Expand Down
Loading