We need 32bit relocations for code and 64bit for debug info. Introduce a new macro R_DATA_PTR to distinguish the two usages.
Unified · Split
| @@ -163,6 +163,7 @@ static CType float_type, double_type, func_float_type, func_double_type; · 162 unmodified lines | ||
| 163 | 163 | |
| 164 | 164 | /* relocation type for 32 bit data relocation */ |
| 165 | 165 | #define R_DATA_32 R_ARM_ABS32 |
| 166 | +#define R_DATA_PTR R_ARM_ABS32 | |
| 166 | 167 | #define R_JMP_SLOT R_ARM_JUMP_SLOT |
| 167 | 168 | #define R_COPY R_ARM_COPY |
| 168 | 169 | |
| @@ -163,6 +163,7 @@ int TotalBytesPushedOnStack; · 162 unmodified lines | ||
| 163 | 163 | |
| 164 | 164 | /* relocation type for 32 bit data relocation */ |
| 165 | 165 | #define R_DATA_32 R_C60_32 |
| 166 | +#define R_DATA_PTR R_C60_32 | |
| 166 | 167 | #define R_JMP_SLOT R_C60_JMP_SLOT |
| 167 | 168 | #define R_COPY R_C60_COPY |
| 168 | 169 | |
| @@ -77,6 +77,7 @@ const int reg_classes[NB_REGS] = { · 76 unmodified lines | ||
| 77 | 77 | |
| 78 | 78 | /* relocation type for 32 bit data relocation */ |
| 79 | 79 | #define R_DATA_32 R_386_32 |
| 80 | +#define R_DATA_PTR R_386_32 | |
| 80 | 81 | #define R_JMP_SLOT R_386_JMP_SLOT |
| 81 | 82 | #define R_COPY R_386_COPY |
| 82 | 83 | |
| @@ -4346,7 +4346,7 @@ static void init_putv(CType *type, Section *sec, unsigned long c, · 4345 unmodified lines | ||
| 4346 | 4346 | break; |
| 4347 | 4347 | default: |
| 4348 | 4348 | if (vtop->r & VT_SYM) { |
| 4349 | − greloc(sec, vtop->sym, c, R_DATA_32); | |
| 4349 | + greloc(sec, vtop->sym, c, R_DATA_PTR); | |
| 4350 | 4350 | } |
| 4351 | 4351 | *(int *)ptr |= (vtop->c.i & bit_mask) << bit_pos; |
| 4352 | 4352 | break; |
| @@ -4796,7 +4796,7 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, · 443 unmodified lines | ||
| 4796 | 4796 | if (tcc_state->do_bounds_check) { |
| 4797 | 4797 | unsigned long *bounds_ptr; |
| 4798 | 4798 | |
| 4799 | − greloc(bounds_section, sym, bounds_section->data_offset, R_DATA_32); | |
| 4799 | + greloc(bounds_section, sym, bounds_section->data_offset, R_DATA_PTR); | |
| 4800 | 4800 | /* then add global bound info */ |
| 4801 | 4801 | bounds_ptr = section_ptr_add(bounds_section, 2 * sizeof(long)); |
| 4802 | 4802 | bounds_ptr[0] = 0; /* relocated */ |
| @@ -91,7 +91,8 @@ const int reg_classes[NB_REGS] = { · 90 unmodified lines | ||
| 91 | 91 | #define EM_TCC_TARGET EM_X86_64 |
| 92 | 92 | |
| 93 | 93 | /* relocation type for 32 bit data relocation */ |
| 94 | −#define R_DATA_32 R_X86_64_64 | |
| 94 | +#define R_DATA_32 R_X86_64_32 | |
| 95 | +#define R_DATA_PTR R_X86_64_64 | |
| 95 | 96 | #define R_JMP_SLOT R_X86_64_JUMP_SLOT |
| 96 | 97 | #define R_COPY R_X86_64_COPY |
| 97 | 98 | |