aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2004-06-24 15:07:02 +0000
committerH.J. Lu <hjl.tools@gmail.com>2004-06-24 15:07:02 +0000
commit6610a52d39fac7deb85d94b6050bfbc2a2b8da6e (patch)
tree74f1949c35578bbf955393098c114754955c6450 /bfd
parentfb7b006ea9c3b6c6dd29ca4e3f47007083c8c0e1 (diff)
downloadgdb-6610a52d39fac7deb85d94b6050bfbc2a2b8da6e.zip
gdb-6610a52d39fac7deb85d94b6050bfbc2a2b8da6e.tar.gz
gdb-6610a52d39fac7deb85d94b6050bfbc2a2b8da6e.tar.bz2
2004-06-24 H.J. Lu <hongjiu.lu@intel.com>
* elf64-x86-64.c (elf64_x86_64_check_relocs): Warn overflow relocation symbol. (elf64_x86_64_relocate_section): Issue an error for R_X86_64_PC8, R_X86_64_PC16 and R_X86_64_PC32 relocations against global symbols when building shared library.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/elf64-x86-64.c25
2 files changed, 29 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 112d4c7..7aebb9f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2004-06-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf64-x86-64.c (elf64_x86_64_check_relocs): Warn overflow
+ relocation symbol.
+ (elf64_x86_64_relocate_section): Issue an error for
+ R_X86_64_PC8, R_X86_64_PC16 and R_X86_64_PC32 relocations
+ against global symbols when building shared library.
+
2004-06-24 Alan Modra <amodra@bigpond.net.au>
* section.c (struct sec): Rename "_cooked_size" to "size".
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index a24616b..72b0652 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -663,9 +663,10 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
if (info->shared)
{
(*_bfd_error_handler)
- (_("%s: relocation %s can not be used when making a shared object; recompile with -fPIC"),
+ (_("%s: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"),
bfd_archive_filename (abfd),
- x86_64_elf_howto_table[r_type].name);
+ x86_64_elf_howto_table[r_type].name,
+ (h) ? h->root.root.string : "a local symbol");
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
@@ -788,9 +789,10 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
&& (sec->flags & SEC_READONLY) != 0)
{
(*_bfd_error_handler)
- (_("%s: relocation %s can not be used when making a shared object; recompile with -fPIC"),
+ (_("%s: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"),
bfd_archive_filename (abfd),
- x86_64_elf_howto_table[r_type].name);
+ x86_64_elf_howto_table[r_type].name,
+ (h) ? h->root.root.string : "a local symbol");
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
@@ -1946,6 +1948,21 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
case R_X86_64_PC8:
case R_X86_64_PC16:
case R_X86_64_PC32:
+ if (info->shared
+ && !SYMBOL_REFERENCES_LOCAL (info, h)
+ && (sec->flags & SEC_ALLOC) != 0
+ && (sec->flags & SEC_READONLY) != 0)
+ {
+ (*_bfd_error_handler)
+ (_("%s: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"),
+ bfd_archive_filename (input_bfd),
+ x86_64_elf_howto_table[r_type].name,
+ (h) ? h->root.root.string : "a local symbol");
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ /* Fall through. */
+
case R_X86_64_8:
case R_X86_64_16:
case R_X86_64_32: