diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/ChangeLog | 11 | ||||
-rw-r--r-- | include/elf/arc-reloc.def | 20 | ||||
-rw-r--r-- | include/opcode/arc-func.h | 16 |
3 files changed, 37 insertions, 10 deletions
diff --git a/include/ChangeLog b/include/ChangeLog index cd1fae3..4195e47 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,14 @@ +2016-01-18 Miranda Cupertino <Cupertino.Miranda@synopsys.com> + Zissulescu Claudiu <Claudiu.Zissulescu@synopsys.com> + + * elf/arc-reloc.def (ARC_32, ARC_GOTPC, ARC_TLS_GD_GOT) + (ARC_TLS_IE_GOT, ARC_TLS_DTPOFF, ARC_TLS_DTPOFF_S9, ARC_TLS_LE_S9) + (ARC_TLS_LE_32): Fixed formula. + (ARC_TLS_GD_LD): Use new special function. + * opcode/arc-func.h: Changed all the replacement + functions to clear the patching bits before doing an or it with the value + argument. + 2016-01-18 Nick Clifton <nickc@redhat.com> PR ld/19440 diff --git a/include/elf/arc-reloc.def b/include/elf/arc-reloc.def index 893291f..96123de 100644 --- a/include/elf/arc-reloc.def +++ b/include/elf/arc-reloc.def @@ -31,7 +31,7 @@ ARC_RELOC_HOWTO(ARC_32, 4, \ 32, \ replace_word32, \ bitfield, \ - ( S + A )) + (NON_ME ( S + A ) )) ARC_RELOC_HOWTO(ARC_N8, 8, \ 0, \ @@ -360,7 +360,7 @@ ARC_RELOC_HOWTO(ARC_GOTPC, 58, \ 32, \ replace_word32, \ signed, \ - ( ( GOT + A ) - P )) + ( GOT_BEGIN - P )) ARC_RELOC_HOWTO(ARC_S21W_PCREL_PLT, 60, \ 2, \ @@ -395,12 +395,12 @@ ARC_RELOC_HOWTO(ARC_TLS_GD_GOT, 69, \ 32, \ replace_word32, \ dont, \ - 0) + ( G + GOT - P)) ARC_RELOC_HOWTO(ARC_TLS_GD_LD, 70, \ 2, \ - 32, \ - replace_word32, \ + 0, \ + replace_none, \ dont, \ 0) @@ -416,35 +416,35 @@ ARC_RELOC_HOWTO(ARC_TLS_IE_GOT, 72, \ 32, \ replace_word32, \ dont, \ - 0) + ( G + GOT - P)) ARC_RELOC_HOWTO(ARC_TLS_DTPOFF, 67, \ 2, \ 32, \ replace_word32, \ dont, \ - 0) + ( S - TLS_REL )) ARC_RELOC_HOWTO(ARC_TLS_DTPOFF_S9, 73, \ 2, \ 32, \ replace_word32, \ dont, \ - 0) + ( S - TLS_REL )) ARC_RELOC_HOWTO(ARC_TLS_LE_S9, 74, \ 2, \ 32, \ replace_word32, \ dont, \ - 0) + ( ( S + TCB_SIZE ) - TLS_REL )) ARC_RELOC_HOWTO(ARC_TLS_LE_32, 75, \ 2, \ 32, \ replace_word32, \ dont, \ - 0) + ( ( S + A + TCB_SIZE ) - TLS_REL )) ARC_RELOC_HOWTO(ARC_S25W_PCREL_PLT, 76, \ 2, \ diff --git a/include/opcode/arc-func.h b/include/opcode/arc-func.h index 9f0ea32..96ffcff 100644 --- a/include/opcode/arc-func.h +++ b/include/opcode/arc-func.h @@ -25,6 +25,7 @@ ATTRIBUTE_UNUSED static unsigned replace_none (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0x00; return insn; } @@ -37,6 +38,7 @@ replace_none (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_bits8 (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0xff; insn |= ((value >> 0) & 0x00ff) << 0; return insn; @@ -50,6 +52,7 @@ replace_bits8 (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_bits16 (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0xffff; insn |= ((value >> 0) & 0xffff) << 0; return insn; @@ -63,6 +66,7 @@ replace_bits16 (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_bits24 (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0xffffff; insn |= ((value >> 0) & 0xffffff) << 0; return insn; @@ -76,6 +80,7 @@ replace_bits24 (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_word32 (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0xffffffff; insn |= ((value >> 0) & 0xffffffff) << 0; return insn; @@ -89,6 +94,7 @@ replace_word32 (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_limm (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0xffffffff; insn |= ((value >> 0) & 0xffffffff) << 0; return insn; @@ -102,6 +108,7 @@ replace_limm (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_limms (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0xffffffff; insn |= ((value >> 0) & 0xffffffff) << 0; return insn; @@ -115,6 +122,7 @@ replace_limms (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_disp21h (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0x7feffc0; insn |= ((value >> 0) & 0x03ff) << 17; insn |= ((value >> 10) & 0x03ff) << 6; @@ -129,6 +137,7 @@ replace_disp21h (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_disp21w (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0x7fcffc0; insn |= ((value >> 0) & 0x01ff) << 18; insn |= ((value >> 9) & 0x03ff) << 6; @@ -143,6 +152,7 @@ replace_disp21w (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_disp25h (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0x7feffcf; insn |= ((value >> 0) & 0x03ff) << 17; insn |= ((value >> 10) & 0x03ff) << 6; insn |= ((value >> 20) & 0x000f) << 0; @@ -158,6 +168,7 @@ replace_disp25h (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_disp25w (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0x7fcffcf; insn |= ((value >> 0) & 0x01ff) << 18; insn |= ((value >> 9) & 0x03ff) << 6; insn |= ((value >> 19) & 0x000f) << 0; @@ -173,6 +184,7 @@ replace_disp25w (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_disp9 (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0x1ff; insn |= ((value >> 0) & 0x01ff) << 0; return insn; @@ -186,6 +198,7 @@ replace_disp9 (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_disp9ls (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0xff8000; insn |= ((value >> 0) & 0x00ff) << 16; insn |= ((value >> 8) & 0x0001) << 15; @@ -200,6 +213,7 @@ replace_disp9ls (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_disp9s (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0x1ff; insn |= ((value >> 0) & 0x01ff) << 0; return insn; @@ -213,6 +227,7 @@ replace_disp9s (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_disp13s (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0x7ff; insn |= ((value >> 0) & 0x07ff) << 0; return insn; @@ -226,6 +241,7 @@ replace_disp13s (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_disp9s1 (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0x7e7; insn |= ((value >> 0) & 0x0007) << 0; insn |= ((value >> 3) & 0x003f) << 5; |