forked from OSchip/llvm-project
[MSP430] Use R_MSP430_16_BYTE type for FK_Data_2 fixup
Linker fails to link example like this (simplified case from newlib sources): $ cat test.c extern const char _ctype_b[]; struct _t { char *ptr; }; struct _t T = { ((char *) _ctype_b + 3) }; $ cat ctype.c char _ctype_b[4] = { 0, 0, 0, 0 }; LD: test.o:(.data+0x0): warning: internal error: unsupported relocation error We also follow gnu toolchain here, where 2-byte relocation mapped to R_MSP430_16_BYTE, instead of R_MSP430_16. Patch by Kristina Bessonova! Differential Revision: https://reviews.llvm.org/D54620 llvm-svn: 347074
This commit is contained in:
parent
74f5fd4e32
commit
883c70959d
|
@ -34,7 +34,7 @@ protected:
|
|||
// Translate fixup kind to ELF relocation type.
|
||||
switch ((unsigned)Fixup.getKind()) {
|
||||
case FK_Data_1: return ELF::R_MSP430_8;
|
||||
case FK_Data_2: return ELF::R_MSP430_16;
|
||||
case FK_Data_2: return ELF::R_MSP430_16_BYTE;
|
||||
case FK_Data_4: return ELF::R_MSP430_32;
|
||||
case MSP430::fixup_32: return ELF::R_MSP430_32;
|
||||
case MSP430::fixup_10_pcrel: return ELF::R_MSP430_10_PCREL;
|
||||
|
|
|
@ -20,3 +20,8 @@
|
|||
jmp foo
|
||||
; CHECK: jmp foo ; encoding: [A,0b001111AA]
|
||||
; CHECK: ; fixup A - offset: 0, value: foo, kind: fixup_10_pcrel
|
||||
|
||||
; RUN: llvm-mc -filetype=obj -triple msp430 < %s | llvm-readobj -r \
|
||||
; RUN: | FileCheck -check-prefix=RELOC %s
|
||||
.short _ctype+3
|
||||
; RELOC: R_MSP430_16_BYTE _ctype 0x3
|
||||
|
|
Loading…
Reference in New Issue