Fix of _LDST64_ABS_LO12_NC relocation

This commit is contained in:
Nicolas Kruse 2025-11-03 22:29:49 +01:00 committed by Nicolas Kruse
parent 358838cb33
commit b7e2ab1fbd
2 changed files with 6 additions and 5 deletions

View File

@ -119,6 +119,7 @@ jobs:
build-arm64: build-arm64:
needs: [build_stencils] needs: [build_stencils]
runs-on: ubuntu-latest runs-on: ubuntu-latest
continue-on-error: true
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4

View File

@ -53,7 +53,7 @@ def strip_function(func: elf_symbol) -> bytes:
def get_stencil_position(func: elf_symbol) -> tuple[int, int]: def get_stencil_position(func: elf_symbol) -> tuple[int, int]:
start_index = 0 # TODO: Only for "naked" functions start_index = 0 # There must be no prolog
end_index = get_last_call_in_function(func) end_index = get_last_call_in_function(func)
return start_index, end_index return start_index, end_index
@ -193,22 +193,22 @@ class stencil_database():
mask = 0 # Handled by runner mask = 0 # Handled by runner
patch_value = symbol_address + pr.fields['r_addend'] patch_value = symbol_address + pr.fields['r_addend']
scale = 4096 scale = 4096
symbol_type = symbol_type + 0x01 symbol_type = symbol_type + 0x01 # HI21
#print(f" *> {patch_value=} {symbol_address=} {pr.fields['r_addend']=}, {function_offset=}") #print(f" *> {patch_value=} {symbol_address=} {pr.fields['r_addend']=}, {function_offset=}")
elif pr.type.endswith('_LDST32_ABS_LO12_NC'): elif pr.type.endswith('_LDST32_ABS_LO12_NC'):
# (S + A) & 0xFFF # (S + A) & 0xFFF
mask = 0b11_1111_1111_1100_0000_0000 mask = 0b11_1111_1111_1100_0000_0000
patch_value = (symbol_address + pr.fields['r_addend']) patch_value = (symbol_address + pr.fields['r_addend'])
symbol_type = symbol_type + 0x02 symbol_type = symbol_type + 0x02 # Absolut value
scale = 4 scale = 4
#print(f" *> {patch_value=} {symbol_address=} {pr.fields['r_addend']=}, {function_offset=}") #print(f" *> {patch_value=} {symbol_address=} {pr.fields['r_addend']=}, {function_offset=}")
elif pr.type.endswith('_LDST64_ABS_LO12_NC'): elif pr.type.endswith('_LDST64_ABS_LO12_NC'):
# (S + A) & 0xFFF # (S + A) & 0xFFF
mask = 0b11_1111_1111_1100_0000_0000 mask = 0b11_1111_1111_1100_0000_0000
patch_value = (symbol_address + pr.fields['r_addend']) >> 3 patch_value = (symbol_address + pr.fields['r_addend'])
symbol_type = symbol_type + 0x02 symbol_type = symbol_type + 0x02 # Absolut value
scale = 8 scale = 8
#print(f" *> {patch_value=} {symbol_address=} {pr.fields['r_addend']=}, {function_offset=}") #print(f" *> {patch_value=} {symbol_address=} {pr.fields['r_addend']=}, {function_offset=}")