From 760024bde9722399781fae46e015d1f0169bcef8 Mon Sep 17 00:00:00 2001 From: Christian Jullien Date: Wed, 6 Jan 2021 07:02:19 +0100 Subject: [PATCH] NetBSD: Trying to fix reloc error 38 on arm - WIP --- arm-link.c | 5 ++++- elf.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arm-link.c b/arm-link.c index 51882eab..5360fd28 100644 --- a/arm-link.c +++ b/arm-link.c @@ -45,6 +45,7 @@ int code_reloc (int reloc_type) case R_ARM_COPY: case R_ARM_GLOB_DAT: case R_ARM_NONE: + case R_ARM_TARGET1: return 0; case R_ARM_PC24: @@ -87,6 +88,7 @@ int gotplt_entry_type (int reloc_type) case R_ARM_ABS32: case R_ARM_REL32: case R_ARM_V4BX: + case R_ARM_TARGET1: return AUTO_GOTPLT_ENTRY; case R_ARM_GOTPC: @@ -359,11 +361,12 @@ void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr, addr_t (*(int *)ptr) |= x & 0x7fffffff; } case R_ARM_ABS32: + // case R_ARM_TARGET1: /* ??? as seen on NetBSD - FIXME! */ if (s1->output_type == TCC_OUTPUT_DLL) { esym_index = get_sym_attr(s1, sym_index, 0)->dyn_index; qrel->r_offset = rel->r_offset; if (esym_index) { - qrel->r_info = ELFW(R_INFO)(esym_index, R_ARM_ABS32); + qrel->r_info = ELFW(R_INFO)(esym_index, type); qrel++; return; } else { diff --git a/elf.h b/elf.h index 426108d8..cb131330 100644 --- a/elf.h +++ b/elf.h @@ -2501,6 +2501,7 @@ typedef Elf32_Addr Elf32_Conflict; #define R_ARM_LDR_SBREL_11_0 35 #define R_ARM_ALU_SBREL_19_12 36 #define R_ARM_ALU_SBREL_27_20 37 +#define R_ARM_TARGET1 38 #define R_ARM_V4BX 40 #define R_ARM_PREL31 42 #define R_ARM_MOVW_ABS_NC 43