1
0
mirror of https://github.com/wolfSSL/wolfssl.git synced 2026-10-24 04:09:07 +03:00

linuxkm: normalize R_386_32 and R_386_PC32 relocations

This commit is contained in:
kaleb-himes
2026-10-09 08:21:16 -06:00
parent fa3cff8dd4
commit 26b4d1e44a
3 changed files with 12 additions and 2 deletions

View File

@@ -207,7 +207,7 @@ GENERATE_RELOC_TAB := $(AWK) ' \
next; \
} \
/^0/ { \
if ($$3 !~ "^(R_X86_.*|R_AARCH64_.*|R_ARM.*)$$") { \
if ($$3 !~ "^(R_X86_.*|R_386_(32|PC32)|R_AARCH64_.*|R_ARM.*)$$") { \
print "Unexpected relocation type in " cur_seg ":\n" $$0 >"/dev/stderr"; \
++bad_relocs; \
} \

View File

@@ -52,6 +52,8 @@ static const struct reloc_layout_ent {
[WC_R_X86_64_64] = { "R_X86_64_64", ~0UL, 64, .is_signed = 0, .is_relative = 0 },
[WC_R_X86_64_PC32] = { "R_X86_64_PC32", ~0UL, 32, .is_signed = 1, .is_relative = 1 },
[WC_R_X86_64_PLT32] = { "R_X86_64_PLT32", ~0UL, 32, .is_signed = 1, .is_relative = 1 },
[WC_R_386_32] = { "R_386_32", ~0UL, 32, .is_signed = 0, .is_relative = 0 },
[WC_R_386_PC32] = { "R_386_PC32", ~0UL, 32, .is_signed = 1, .is_relative = 1 },
[WC_R_AARCH64_ABS32] = { "R_AARCH64_ABS32", ~0UL, 32, .is_signed = 1, .is_relative = 0, .is_pages = 0, .is_pair_lo = 0, .is_pair_hi = 0 },
[WC_R_AARCH64_ABS64] = { "R_AARCH64_ABS64", ~0UL, 64, .is_signed = 1, .is_relative = 0, .is_pages = 0, .is_pair_lo = 0, .is_pair_hi = 0 },
[WC_R_AARCH64_ADD_ABS_LO12_NC] = { "R_AARCH64_ADD_ABS_LO12_NC", 0b00000000001111111111110000000000, 32, .is_signed = 0, .is_relative = 0, .is_pages = 0, .is_pair_lo = 1, .is_pair_hi = 0 },
@@ -416,6 +418,12 @@ ssize_t wc_reloc_normalize_segment(
break;
case WC_R_386_32:
case WC_R_386_PC32:
/* i386 is REL: its addend lives in the field, not in reloc_tab. */
reloc_buf = 0;
break;
case WC_R_ARM_ABS32:
case WC_R_ARM_CALL:
case WC_R_ARM_JUMP24:

View File

@@ -60,7 +60,9 @@ enum wc_reloc_type {
WC_R_ARM_THM_JUMP11,
WC_R_ARM_THM_JUMP24,
WC_R_ARM_THM_MOVT_ABS,
WC_R_ARM_THM_MOVW_ABS_NC
WC_R_ARM_THM_MOVW_ABS_NC,
WC_R_386_32,
WC_R_386_PC32
};
/* This structure is accessed natively by kernel module glue logic, and also