Bug 27530 - gas: Support .reloc ., 0, target
Summary: gas: Support .reloc ., 0, target
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-06 03:09 UTC by Fangrui Song
Modified: 2021-03-16 16:46 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fangrui Song 2021-03-06 03:09:51 UTC
R_*_NONE relocation types do not modify the location but can be used to indicate a dependency between two sections. For example, ARM EHABI uses R_ARM_NONE from an exception handling table section to the required personality routine.

In assembly, we have to spell the relocation type name. So to support multiple architectures, we have to dispatch on architecture macros, e.g.

#if defined(__x86_64__)
asm(".reloc ., R_X86_64_NONE, target");
#elif defined(__aarch64__)
asm(".reloc ., R_AARCH64_NONE, target");
#elif defined(__ppc64__)
asm(".reloc ., R_PPC64_NONE, target");
#endif

Note that R_*_NONE is always 0 (if an arch does not do this, it is probably finding itself trouble), so if gas support `.reloc ., 0, target`, such dispatching will be unnecessary.
Comment 2 Nick Clifton 2021-03-16 16:46:30 UTC
Closing since a solution is available.