This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] TIC6X __c6xabi_DSBT_BASE
- From: Alan Modra <amodra at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 6 Jun 2018 23:49:10 -0000
- Subject: [binutils-gdb] TIC6X __c6xabi_DSBT_BASE
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=527278f3360dde3e5439b8d10f3f635155b35aca
commit 527278f3360dde3e5439b8d10f3f635155b35aca
Author: Alan Modra <amodra@gmail.com>
Date: Sat Jun 2 18:05:24 2018 +0930
TIC6X __c6xabi_DSBT_BASE
Adding an undefined __c6xabi_DSBT_BASE via an EXTERN in the linker
script isn't ideal, as the symbol is not always needed. This patch
adds the undefined symbol on encountering relocations where it is
implicitly referenced.
bfd/
* elf32-tic6x.c (elf32_tic6x_check_relocs): Reference
__c6xabi_DSBT_BASE explicitly for R_C6000_SBR_* relocs.
ld/
* emulparams/elf32_tic6x_le.sh (EXECUTABLE_SYMBOLS): Don't define.
Diff:
---
bfd/ChangeLog | 5 +++++
bfd/elf32-tic6x.c | 13 +++++++++++++
ld/ChangeLog | 4 ++++
ld/emulparams/elf32_tic6x_le.sh | 1 -
4 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8b14491..c7e28b8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2018-06-07 Alan Modra <amodra@gmail.com>
+
+ * elf32-tic6x.c (elf32_tic6x_check_relocs): Reference
+ __c6xabi_DSBT_BASE explicitly for R_C6000_SBR_* relocs.
+
2018-06-05 Alan Modra <amodra@gmail.com>
* bfd.c (struct bfd): Update comment on "where" usage.
diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
index 96965b3..768bfb8 100644
--- a/bfd/elf32-tic6x.c
+++ b/bfd/elf32-tic6x.c
@@ -2972,6 +2972,19 @@ elf32_tic6x_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_C6000_SBR_H16_B:
case R_C6000_SBR_H16_H:
case R_C6000_SBR_H16_W:
+ {
+ /* These relocations implicitly reference __c6xabi_DSBT_BASE.
+ Add an explicit reference so that the symbol will be
+ provided by a linker script. */
+ struct bfd_link_hash_entry *bh = NULL;
+ if (!_bfd_generic_link_add_one_symbol (info, abfd,
+ "__c6xabi_DSBT_BASE",
+ BSF_GLOBAL,
+ bfd_und_section_ptr, 0,
+ NULL, FALSE, FALSE, &bh))
+ return FALSE;
+ ((struct elf_link_hash_entry *) bh)->non_elf = 0;
+ }
if (h != NULL && bfd_link_executable (info))
{
/* For B14-relative addresses, we might need a copy
diff --git a/ld/ChangeLog b/ld/ChangeLog
index e750941..f12b6bd 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,7 @@
+2018-06-07 Alan Modra <amodra@gmail.com>
+
+ * emulparams/elf32_tic6x_le.sh (EXECUTABLE_SYMBOLS): Don't define.
+
2018-06-06 Alan Modra <amodra@gmail.com>
* Makefile.am (earmelf_fbsd.c): Correct dependencies.
diff --git a/ld/emulparams/elf32_tic6x_le.sh b/ld/emulparams/elf32_tic6x_le.sh
index efd7b24..d9ebe58 100644
--- a/ld/emulparams/elf32_tic6x_le.sh
+++ b/ld/emulparams/elf32_tic6x_le.sh
@@ -22,7 +22,6 @@ case ${target} in
esac
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
ARCH=tic6x
-EXECUTABLE_SYMBOLS="EXTERN (__c6xabi_DSBT_BASE);"
OTHER_GOT_SYMBOLS="PROVIDE_HIDDEN (__c6xabi_DSBT_BASE = .);"
# ".bss" is near (small) BSS, ".far" is far (normal) BSS, ".const" is
# far read-only data, ".rodata" is near read-only data. ".neardata"