diff options
author | Andreas Jaeger <aj@suse.de> | 2002-07-01 06:42:27 +0000 |
---|---|---|
committer | Andreas Jaeger <aj@suse.de> | 2002-07-01 06:42:27 +0000 |
commit | 1b71fb54e3e35320be7bab3268041064b38168cf (patch) | |
tree | 0b2fe973c9f2d215e4eec9365fa72698613c76c3 /bfd | |
parent | 6fee999aa28a46791cca2515b5b609afcdb16639 (diff) | |
download | gdb-1b71fb54e3e35320be7bab3268041064b38168cf.zip gdb-1b71fb54e3e35320be7bab3268041064b38168cf.tar.gz gdb-1b71fb54e3e35320be7bab3268041064b38168cf.tar.bz2 |
* elf64-x86-64.c (elf64_x86_64_check_relocs): Certain relocations
are not allowed in shared libs code, enforce -fPIC.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/elf64-x86-64.c | 19 |
2 files changed, 23 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index a72dffb..5e45aa5 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2002-07-01 Andreas Jaeger <aj@suse.de> + + * elf64-x86-64.c (elf64_x86_64_check_relocs): Certain relocations + are not allowed in shared libs code, enforce -fPIC. + 2002-06-29 Hans-Peter Nilsson <hp@bitrange.com> * mmo.c (mmo_write_loc_chunk): Don't eliminate leading and diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 0ec6392..314b070 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -660,11 +660,28 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs) case R_X86_64_8: case R_X86_64_16: case R_X86_64_32: - case R_X86_64_64: case R_X86_64_32S: + /* Let's help debug shared library creation. These relocs + cannot be used in shared libs. Don't error out for + sections we don't care about, such as debug sections or + non-constant sections. */ + if (info->shared + && (sec->flags & SEC_ALLOC) != 0 + && (sec->flags & SEC_READONLY) != 0) + { + (*_bfd_error_handler) + (_("%s: relocation %s can not be used when making a shared object; recompile with -fPIC"), + bfd_archive_filename (abfd), + x86_64_elf_howto_table[ELF64_R_TYPE (rel->r_info)].name); + bfd_set_error (bfd_error_bad_value); + return false; + } + /* Fall through. */ + case R_X86_64_PC8: case R_X86_64_PC16: case R_X86_64_PC32: + case R_X86_64_64: if (h != NULL && !info->shared) { /* If this reloc is in a read-only section, we might |