aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfxx-x86.h
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-10-06 00:29:16 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-10-06 00:32:43 -0700
commitf70656b2604eff12cea2e9bef27c1e00a3077f30 (patch)
tree7af723e29d43739bfa8ade510660da0c24f337ba /bfd/elfxx-x86.h
parent1f92404c505db7ca2255dad73647889234013a0a (diff)
downloadgdb-f70656b2604eff12cea2e9bef27c1e00a3077f30.zip
gdb-f70656b2604eff12cea2e9bef27c1e00a3077f30.tar.gz
gdb-f70656b2604eff12cea2e9bef27c1e00a3077f30.tar.bz2
x86: Add GENERATE_RELATIVE_RELOC_P
Add GENERATE_RELATIVE_RELOC_P which returns TRUE if dynamic relative relocation should be generated. * elfxx-x86.h (GENERATE_RELATIVE_RELOC_P): New. * elf32-i386.c (elf_i386_relocate_section): Use it. * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
Diffstat (limited to 'bfd/elfxx-x86.h')
-rw-r--r--bfd/elfxx-x86.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/bfd/elfxx-x86.h b/bfd/elfxx-x86.h
index 317c86e..02a388a 100644
--- a/bfd/elfxx-x86.h
+++ b/bfd/elfxx-x86.h
@@ -124,6 +124,18 @@
|| (ELF_ST_VISIBILITY ((H)->other) \
&& (H)->root.type == bfd_link_hash_undefweak))
+/* TRUE if relative relocation should be generated. GOT reference to
+ global symbol in PIC will lead to dynamic symbol. It becomes a
+ problem when "time" or "times" is defined as a variable in an
+ executable, clashing with functions of the same name in libc. If a
+ symbol isn't undefined weak symbol, don't make it dynamic in PIC and
+ generate relative relocation. */
+#define GENERATE_RELATIVE_RELOC_P(INFO, H) \
+ ((H)->dynindx == -1 \
+ && !(H)->forced_local \
+ && (H)->root.type != bfd_link_hash_undefweak \
+ && bfd_link_pic (INFO))
+
/* TRUE if TLS IE->LE transition is OK. */
#define TLS_TRANSITION_IE_TO_LE_P(INFO, H, TLS_TYPE) \
(bfd_link_executable (INFO) \