mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-22 11:00:01 +08:00
Handle R_X86_64_32 like R_X86_64_64 for ILP32.
bfd/ 2011-01-14 H.J. Lu <hongjiu.lu@intel.com> * elf64-x86-64.c (elf_x86_64_link_hash_table): Add pointer_r_type. (elf_x86_64_link_hash_table_create): Set pointer_r_type. (elf_x86_64_check_relocs): Handle R_X86_64_32 like R_X86_64_64 for ILP32. Remove ABI_64_P PIC check for R_X86_64_8, R_X86_64_16, R_X86_64_32 and R_X86_64_32S. (elf_x86_64_relocate_section): Handle R_X86_64_32 like R_X86_64_64 for ILP32. ld/testsuite/ 2011-01-14 H.J. Lu <hongjiu.lu@intel.com> * ld-x86-64/ilp32-5.d: New. * ld-x86-64/ilp32-5.s: Likewise. * ld-x86-64/x86-64.exp: Run ilp32-5.
This commit is contained in:
@ -1,3 +1,13 @@
|
|||||||
|
2011-01-14 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
* elf64-x86-64.c (elf_x86_64_link_hash_table): Add pointer_r_type.
|
||||||
|
(elf_x86_64_link_hash_table_create): Set pointer_r_type.
|
||||||
|
(elf_x86_64_check_relocs): Handle R_X86_64_32 like R_X86_64_64
|
||||||
|
for ILP32. Remove ABI_64_P PIC check for R_X86_64_8,
|
||||||
|
R_X86_64_16, R_X86_64_32 and R_X86_64_32S.
|
||||||
|
(elf_x86_64_relocate_section): Handle R_X86_64_32 like R_X86_64_64
|
||||||
|
for ILP32.
|
||||||
|
|
||||||
2011-01-14 Alan Modra <amodra@gmail.com>
|
2011-01-14 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* bfd.c (bfd_perror): Flush stdout before and stderr after printing
|
* bfd.c (bfd_perror): Flush stdout before and stderr after printing
|
||||||
|
@ -495,6 +495,7 @@ struct elf_x86_64_link_hash_table
|
|||||||
|
|
||||||
bfd_vma (*r_info) (bfd_vma, bfd_vma);
|
bfd_vma (*r_info) (bfd_vma, bfd_vma);
|
||||||
bfd_vma (*r_sym) (bfd_vma);
|
bfd_vma (*r_sym) (bfd_vma);
|
||||||
|
unsigned int pointer_r_type;
|
||||||
const char *dynamic_interpreter;
|
const char *dynamic_interpreter;
|
||||||
int dynamic_interpreter_size;
|
int dynamic_interpreter_size;
|
||||||
|
|
||||||
@ -658,6 +659,7 @@ elf_x86_64_link_hash_table_create (bfd *abfd)
|
|||||||
{
|
{
|
||||||
ret->r_info = elf64_r_info;
|
ret->r_info = elf64_r_info;
|
||||||
ret->r_sym = elf64_r_sym;
|
ret->r_sym = elf64_r_sym;
|
||||||
|
ret->pointer_r_type = R_X86_64_64;
|
||||||
ret->dynamic_interpreter = ELF64_DYNAMIC_INTERPRETER;
|
ret->dynamic_interpreter = ELF64_DYNAMIC_INTERPRETER;
|
||||||
ret->dynamic_interpreter_size = sizeof ELF64_DYNAMIC_INTERPRETER;
|
ret->dynamic_interpreter_size = sizeof ELF64_DYNAMIC_INTERPRETER;
|
||||||
}
|
}
|
||||||
@ -665,6 +667,7 @@ elf_x86_64_link_hash_table_create (bfd *abfd)
|
|||||||
{
|
{
|
||||||
ret->r_info = elf32_r_info;
|
ret->r_info = elf32_r_info;
|
||||||
ret->r_sym = elf32_r_sym;
|
ret->r_sym = elf32_r_sym;
|
||||||
|
ret->pointer_r_type = R_X86_64_32;
|
||||||
ret->dynamic_interpreter = ELF32_DYNAMIC_INTERPRETER;
|
ret->dynamic_interpreter = ELF32_DYNAMIC_INTERPRETER;
|
||||||
ret->dynamic_interpreter_size = sizeof ELF32_DYNAMIC_INTERPRETER;
|
ret->dynamic_interpreter_size = sizeof ELF32_DYNAMIC_INTERPRETER;
|
||||||
}
|
}
|
||||||
@ -1232,6 +1235,9 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
|||||||
bfd_set_error (bfd_error_bad_value);
|
bfd_set_error (bfd_error_bad_value);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
case R_X86_64_32:
|
||||||
|
if (ABI_64_P (abfd))
|
||||||
|
goto not_pointer;
|
||||||
case R_X86_64_64:
|
case R_X86_64_64:
|
||||||
h->non_got_ref = 1;
|
h->non_got_ref = 1;
|
||||||
h->pointer_equality_needed = 1;
|
h->pointer_equality_needed = 1;
|
||||||
@ -1249,9 +1255,9 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case R_X86_64_32S:
|
case R_X86_64_32S:
|
||||||
case R_X86_64_32:
|
|
||||||
case R_X86_64_PC32:
|
case R_X86_64_PC32:
|
||||||
case R_X86_64_PC64:
|
case R_X86_64_PC64:
|
||||||
|
not_pointer:
|
||||||
h->non_got_ref = 1;
|
h->non_got_ref = 1;
|
||||||
if (r_type != R_X86_64_PC32
|
if (r_type != R_X86_64_PC32
|
||||||
&& r_type != R_X86_64_PC64)
|
&& r_type != R_X86_64_PC64)
|
||||||
@ -1448,16 +1454,17 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
|||||||
}
|
}
|
||||||
goto create_got;
|
goto create_got;
|
||||||
|
|
||||||
|
case R_X86_64_32:
|
||||||
|
if (!ABI_64_P (abfd))
|
||||||
|
goto pointer;
|
||||||
case R_X86_64_8:
|
case R_X86_64_8:
|
||||||
case R_X86_64_16:
|
case R_X86_64_16:
|
||||||
case R_X86_64_32:
|
|
||||||
case R_X86_64_32S:
|
case R_X86_64_32S:
|
||||||
/* Let's help debug shared library creation. These relocs
|
/* Let's help debug shared library creation. These relocs
|
||||||
cannot be used in shared libs. Don't error out for
|
cannot be used in shared libs. Don't error out for
|
||||||
sections we don't care about, such as debug sections or
|
sections we don't care about, such as debug sections or
|
||||||
non-constant sections. */
|
non-constant sections. */
|
||||||
if (info->shared
|
if (info->shared
|
||||||
&& ABI_64_P (abfd)
|
|
||||||
&& (sec->flags & SEC_ALLOC) != 0
|
&& (sec->flags & SEC_ALLOC) != 0
|
||||||
&& (sec->flags & SEC_READONLY) != 0)
|
&& (sec->flags & SEC_READONLY) != 0)
|
||||||
{
|
{
|
||||||
@ -1478,6 +1485,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
|||||||
case R_X86_64_PC32:
|
case R_X86_64_PC32:
|
||||||
case R_X86_64_PC64:
|
case R_X86_64_PC64:
|
||||||
case R_X86_64_64:
|
case R_X86_64_64:
|
||||||
|
pointer:
|
||||||
if (h != NULL && info->executable)
|
if (h != NULL && info->executable)
|
||||||
{
|
{
|
||||||
/* If this reloc is in a read-only section, we might
|
/* If this reloc is in a read-only section, we might
|
||||||
@ -2830,6 +2838,9 @@ elf_x86_64_relocate_section (bfd *output_bfd,
|
|||||||
abort ();
|
abort ();
|
||||||
goto do_relocation;
|
goto do_relocation;
|
||||||
|
|
||||||
|
case R_X86_64_32:
|
||||||
|
if (ABI_64_P (output_bfd))
|
||||||
|
goto do_relocation;
|
||||||
case R_X86_64_64:
|
case R_X86_64_64:
|
||||||
if (rel->r_addend != 0)
|
if (rel->r_addend != 0)
|
||||||
{
|
{
|
||||||
@ -2894,7 +2905,6 @@ elf_x86_64_relocate_section (bfd *output_bfd,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
case R_X86_64_32:
|
|
||||||
case R_X86_64_PC32:
|
case R_X86_64_PC32:
|
||||||
case R_X86_64_PC64:
|
case R_X86_64_PC64:
|
||||||
case R_X86_64_PLT32:
|
case R_X86_64_PLT32:
|
||||||
@ -3307,7 +3317,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* This symbol is local, or marked to become local. */
|
/* This symbol is local, or marked to become local. */
|
||||||
if (r_type == R_X86_64_64)
|
if (r_type == htab->pointer_r_type)
|
||||||
{
|
{
|
||||||
relocate = TRUE;
|
relocate = TRUE;
|
||||||
outrel.r_info = htab->r_info (0, R_X86_64_RELATIVE);
|
outrel.r_info = htab->r_info (0, R_X86_64_RELATIVE);
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2011-01-14 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
* ld-x86-64/ilp32-5.d: New.
|
||||||
|
* ld-x86-64/ilp32-5.s: Likewise.
|
||||||
|
|
||||||
|
* ld-x86-64/x86-64.exp: Run ilp32-5.
|
||||||
|
|
||||||
2011-01-13 H.J. Lu <hongjiu.lu@intel.com>
|
2011-01-13 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* ld-x86-64/ilp32-4.d: New.
|
* ld-x86-64/ilp32-4.d: New.
|
||||||
|
8
ld/testsuite/ld-x86-64/ilp32-5.d
Normal file
8
ld/testsuite/ld-x86-64/ilp32-5.d
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#as: --n32
|
||||||
|
#ld: -m elf32_x86_64 -shared
|
||||||
|
#readelf: -r --wide
|
||||||
|
|
||||||
|
#...
|
||||||
|
[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9a-f]+
|
||||||
|
[0-9a-f]+ +[0-9a-f]+ +R_X86_64_PC32 +[0-9a-f]+ +foo - 4
|
||||||
|
[0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +[0-9a-f]+ +foo \+ 0
|
8
ld/testsuite/ld-x86-64/ilp32-5.s
Normal file
8
ld/testsuite/ld-x86-64/ilp32-5.s
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
.globl bar
|
||||||
|
bar:
|
||||||
|
mov foo(%rip), %rax
|
||||||
|
|
||||||
|
.data
|
||||||
|
xxx:
|
||||||
|
.long foo
|
||||||
|
.long xxx
|
@ -176,6 +176,7 @@ run_dump_test "ilp32-1"
|
|||||||
run_dump_test "ilp32-2"
|
run_dump_test "ilp32-2"
|
||||||
run_dump_test "ilp32-3"
|
run_dump_test "ilp32-3"
|
||||||
run_dump_test "ilp32-4"
|
run_dump_test "ilp32-4"
|
||||||
|
run_dump_test "ilp32-5"
|
||||||
run_dump_test "ia32-1"
|
run_dump_test "ia32-1"
|
||||||
run_dump_test "ia32-2"
|
run_dump_test "ia32-2"
|
||||||
run_dump_test "ia32-3"
|
run_dump_test "ia32-3"
|
||||||
|
Reference in New Issue
Block a user