aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2020-08-26 16:26:13 +0100
committerNick Clifton <nickc@redhat.com>2020-08-26 16:26:13 +0100
commiteae0b5c3b2d6b76c3ed80146bc938e0d6b7e9fec (patch)
treea741e096dc5fbcf768bc2c18de93667fd491d11b /bfd
parentb74a6c6086033907f4ea1dbd61166ee63b6f0a99 (diff)
downloadgdb-eae0b5c3b2d6b76c3ed80146bc938e0d6b7e9fec.zip
gdb-eae0b5c3b2d6b76c3ed80146bc938e0d6b7e9fec.tar.gz
gdb-eae0b5c3b2d6b76c3ed80146bc938e0d6b7e9fec.tar.bz2
Fix sanitization problems running the linker testsuite for the alpha-elf target.
PR 26416 * elf64-alpha.c (elf64_alpha_relax_tls_get_addr): Test for and ignore local symbols. (elf64_alpha_relax_got_load): Do not check for local dynamic symbols. (OP_LDA, OP_LDAH, OP_LDQ, OP_BR, OP_BSR): Use unsigned constant values. (INSN_A) Cast the A parameter to unsigned. (INSN_AB): Define in terms of INSN_A. (INSN_ABC): Likewise. (INSN_ABO): Likewise. (INSN_AD): Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog13
-rw-r--r--bfd/elf64-alpha.c25
2 files changed, 27 insertions, 11 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index bae3449..9a59177 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,18 @@
2020-08-26 Nick Clifton <nickc@redhat.com>
+ PR 26416
+ * elf64-alpha.c (elf64_alpha_relax_tls_get_addr): Test for and
+ ignore local symbols.
+ (elf64_alpha_relax_got_load): Do not check for local dynamic
+ symbols.
+ (OP_LDA, OP_LDAH, OP_LDQ, OP_BR, OP_BSR): Use unsigned constant
+ values.
+ (INSN_A) Cast the A parameter to unsigned.
+ (INSN_AB): Define in terms of INSN_A.
+ (INSN_ABC): Likewise.
+ (INSN_ABO): Likewise.
+ (INSN_AD): Likewise.
+
PR 26411
* elfnn-aarch64.c (elfNN_aarch64_relocate_section): Use an
unsigned long constant when creating a mask to test for alignment
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 1976450..fd1f4b2 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -52,11 +52,11 @@
/* Instruction data for plt generation and relaxation. */
-#define OP_LDA 0x08
-#define OP_LDAH 0x09
-#define OP_LDQ 0x29
-#define OP_BR 0x30
-#define OP_BSR 0x34
+#define OP_LDA 0x08U
+#define OP_LDAH 0x09U
+#define OP_LDQ 0x29U
+#define OP_BR 0x30U
+#define OP_BSR 0x34U
#define INSN_LDA (OP_LDA << 26)
#define INSN_LDAH (OP_LDAH << 26)
@@ -73,11 +73,11 @@
#define INSN_JMP 0x68000000
#define INSN_JSR_MASK 0xfc00c000
-#define INSN_A(I,A) (I | (A << 21))
-#define INSN_AB(I,A,B) (I | (A << 21) | (B << 16))
-#define INSN_ABC(I,A,B,C) (I | (A << 21) | (B << 16) | C)
-#define INSN_ABO(I,A,B,O) (I | (A << 21) | (B << 16) | ((O) & 0xffff))
-#define INSN_AD(I,A,D) (I | (A << 21) | (((D) >> 2) & 0x1fffff))
+#define INSN_A(I,A) (I | ((unsigned) A << 21))
+#define INSN_AB(I,A,B) (INSN_A (I, A) | (B << 16))
+#define INSN_ABC(I,A,B,C) (INSN_A (I, A) | (B << 16) | C)
+#define INSN_ABO(I,A,B,O) (INSN_A (I, A) | (B << 16) | ((O) & 0xffff))
+#define INSN_AD(I,A,D) (INSN_A (I, A) | (((D) >> 2) & 0x1fffff))
/* PLT/GOT Stuff */
@@ -2995,7 +2995,8 @@ elf64_alpha_relax_got_load (struct alpha_relax_info *info, bfd_vma symval,
}
/* Can't relax dynamic symbols. */
- if (alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info))
+ if (info->h != NULL
+ && alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info))
return TRUE;
/* Can't use local-exec relocations in shared libraries. */
@@ -3463,6 +3464,8 @@ elf64_alpha_relax_tls_get_addr (struct alpha_relax_info *info, bfd_vma symval,
bfd_boolean dynamic, use_gottprel;
unsigned long new_symndx;
+ if (info->h == NULL)
+ return TRUE; /* FIXME: Should this be return FALSE ? */
dynamic = alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info);
/* If a TLS symbol is accessed using IE at least once, there is no point