Service Indicator: Add error call trampoline to avoid delocator issue #2920
+14
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Service Indicator: Add error call trampoline to avoid delocator issue
Problem
On AArch64, the delocator can patch up PC-relative addressing only if the references can be computed with a PC-relative offset in the range (-1MB, 1MB).
For the
OPENSSL_PUT_ERRORmacro calls incrypto/fipsmodule/service_indicator/service_indicator.c, the__FILE__string literal references were exceeding the ARM64 ADR instruction's ±1MB range limit as the FIPS module grew larger. This manifested as build failures in ARM64 FIPS builds:The error originated from string literals being placed too far from their usage sites (e.g., string at line ~365493, first use at line ~2597 in bcm-delocated.S).
Solution
This commit fixes the issue by adding a non-inlined trampoline function for error calls:
This ensures the
__FILE__string literal stays close to its usage site and can be addressed using a PC-relative offset within the allowed range.Key Distinction from Function Pointer Trampolines
This fix differs from previous function pointer trampolines (e.g., #2165), which wrapped assembly functions and used branch instructions to call them. Here, the pointer is not to a function but to a string literal (
__FILE__from error macros), so instead we wrap the function that uses the pointer to keep the string reference close to its usage. Thenoinlinedirective is critical - without it, the compiler will inline the function, placing the__FILE__reference back at the original call sites and recreating the distance problem.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.