Skip to content

[SPARC] Add llvm-readobj support, update ELF reloc types and dynamic tags. #137916

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

Merged
merged 1 commit into from
May 5, 2025

Conversation

alexrp
Copy link
Member

@alexrp alexrp commented Apr 30, 2025

Values sourced from binutils.

@llvmbot
Copy link
Member

llvmbot commented Apr 30, 2025

@llvm/pr-subscribers-objectyaml

@llvm/pr-subscribers-llvm-binary-utilities

Author: Alex Rønne Petersen (alexrp)

Changes

Sourced from binutils.


Full diff: https://github.com/llvm/llvm-project/pull/137916.diff

1 Files Affected:

  • (modified) llvm/include/llvm/BinaryFormat/ELFRelocs/Sparc.def (+9)
diff --git a/llvm/include/llvm/BinaryFormat/ELFRelocs/Sparc.def b/llvm/include/llvm/BinaryFormat/ELFRelocs/Sparc.def
index 7e01a4a8a0a06..9f10310442fa4 100644
--- a/llvm/include/llvm/BinaryFormat/ELFRelocs/Sparc.def
+++ b/llvm/include/llvm/BinaryFormat/ELFRelocs/Sparc.def
@@ -87,3 +87,12 @@ ELF_RELOC(R_SPARC_GOTDATA_LOX10,  81)
 ELF_RELOC(R_SPARC_GOTDATA_OP_HIX22,  82)
 ELF_RELOC(R_SPARC_GOTDATA_OP_LOX10,  83)
 ELF_RELOC(R_SPARC_GOTDATA_OP,     84)
+ELF_RELOC(R_SPARC_H34,            85)
+ELF_RELOC(R_SPARC_SIZE32,         86)
+ELF_RELOC(R_SPARC_SIZE64,         87)
+ELF_RELOC(R_SPARC_WDISP10,        88)
+ELF_RELOC(R_SPARC_JMP_IREL,       248)
+ELF_RELOC(R_SPARC_IRELATIVE,      249)
+ELF_RELOC(R_SPARC_GNU_VTINHERIT,  250)
+ELF_RELOC(R_SPARC_GNU_VTENTRY,    251)
+ELF_RELOC(R_SPARC_REV32,          252)

@alexrp alexrp force-pushed the sparc-update-relocs branch from 22e4506 to 60eb632 Compare May 3, 2025 03:49
@MaskRay
Copy link
Member

MaskRay commented May 3, 2025

(Still on a trip with limited computer access)

We need a llvm-readobj test. You can git log how I update the ELF relocation types with accompanying test/tools/llvm-readobj tests.

@alexrp
Copy link
Member Author

alexrp commented May 3, 2025

It seems like such a test was never added for SPARC. Would e.g. reloc-types-ppc64.test be a good example to follow?

@alexrp alexrp force-pushed the sparc-update-relocs branch from 60eb632 to 3126e21 Compare May 4, 2025 07:55
@alexrp alexrp changed the title [SPARC] Update the list of ELF relocation types [SPARC] Add llvm-readobj support, update ELF reloc types and dynamic tags. May 4, 2025
@alexrp alexrp requested a review from MaskRay May 4, 2025 07:55
Copy link
Member

@MaskRay MaskRay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Note: the majority of commits do not use a full stop at the end of the subject.

alexrp referenced this pull request May 5, 2025
The simm13 format OR instruction should use one single fixup kind, while
it currently uses a lot more, including %m44/%l44.

This change refactors R_SPARC_H44/R_SPARC_M44/R_SPARC_M44 handling to
remove fixup kinds and specifiers. We utilize the [0,
FirstLiteralRelocationKind) MCFixupKind range to encode raw relocation
types that may be resolved (see the MCAssembler.cpp change).

The `evaluateAsRelocatableImpl` implementation resembles
PPCMCExpr::evaluateAsRelocatableImpl.
@alexrp alexrp merged commit 4418a8e into llvm:main May 5, 2025
12 checks passed
@alexrp alexrp deleted the sparc-update-relocs branch May 5, 2025 15:39
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants