mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-21 01:12:32 +08:00
bfd:
* elf32-ppc.c (ppc_elf_merge_obj_attributes): New. (ppc_elf_merge_private_bfd_data): Call it. binutils: * readelf.c (display_power_gnu_attribute, process_power_specific): New. (process_arch_specific): Call process_power_specific. include/elf: * ppc.h (Tag_GNU_Power_ABI_FP): Define. ld/testsuite: * ld-powerpc/attr-gnu-4-0.s, ld-powerpc/attr-gnu-4-00.d, ld-powerpc/attr-gnu-4-01.d, ld-powerpc/attr-gnu-4-02.d, ld-powerpc/attr-gnu-4-1.s, ld-powerpc/attr-gnu-4-10.d, ld-powerpc/attr-gnu-4-11.d, ld-powerpc/attr-gnu-4-12.d, ld-powerpc/attr-gnu-4-13.d, ld-powerpc/attr-gnu-4-2.s, ld-powerpc/attr-gnu-4-20.d, ld-powerpc/attr-gnu-4-21.d, ld-powerpc/attr-gnu-4-22.d, ld-powerpc/attr-gnu-4-3.s, ld-powerpc/attr-gnu-4-31.d: New. * ld-powerpc/powerpc.exp: Run these new tests.
This commit is contained in:
parent
89ebe69733
commit
34c8bcbae2
@ -1,3 +1,8 @@
|
||||
2007-06-29 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* elf32-ppc.c (ppc_elf_merge_obj_attributes): New.
|
||||
(ppc_elf_merge_private_bfd_data): Call it.
|
||||
|
||||
2007-06-29 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* elfxx-mips.c (mips_elf_merge_obj_attributes): New.
|
||||
|
@ -3594,6 +3594,62 @@ ppc_elf_check_relocs (bfd *abfd,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* Merge object attributes from IBFD into OBFD. Raise an error if
|
||||
there are conflicting attributes. */
|
||||
static bfd_boolean
|
||||
ppc_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
|
||||
{
|
||||
obj_attribute *in_attr;
|
||||
obj_attribute *out_attr;
|
||||
|
||||
if (!elf_known_obj_attributes_proc (obfd)[0].i)
|
||||
{
|
||||
/* This is the first object. Copy the attributes. */
|
||||
_bfd_elf_copy_obj_attributes (ibfd, obfd);
|
||||
|
||||
/* Use the Tag_null value to indicate the attributes have been
|
||||
initialized. */
|
||||
elf_known_obj_attributes_proc (obfd)[0].i = 1;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Check for conflicting Tag_GNU_Power_ABI_FP attributes and merge
|
||||
non-conflicting ones. */
|
||||
in_attr = elf_known_obj_attributes (ibfd)[OBJ_ATTR_GNU];
|
||||
out_attr = elf_known_obj_attributes (obfd)[OBJ_ATTR_GNU];
|
||||
if (in_attr[Tag_GNU_Power_ABI_FP].i != out_attr[Tag_GNU_Power_ABI_FP].i)
|
||||
{
|
||||
out_attr[Tag_GNU_Power_ABI_FP].type = 1;
|
||||
if (out_attr[Tag_GNU_Power_ABI_FP].i == 0)
|
||||
out_attr[Tag_GNU_Power_ABI_FP].i = in_attr[Tag_GNU_Power_ABI_FP].i;
|
||||
else if (in_attr[Tag_GNU_Power_ABI_FP].i == 0)
|
||||
;
|
||||
else if (out_attr[Tag_GNU_Power_ABI_FP].i == 1
|
||||
&& in_attr[Tag_GNU_Power_ABI_FP].i == 2)
|
||||
_bfd_error_handler
|
||||
(_("Warning: %B uses hard float, %B uses soft float"), obfd, ibfd);
|
||||
else if (out_attr[Tag_GNU_Power_ABI_FP].i == 2
|
||||
&& in_attr[Tag_GNU_Power_ABI_FP].i == 1)
|
||||
_bfd_error_handler
|
||||
(_("Warning: %B uses hard float, %B uses soft float"), ibfd, obfd);
|
||||
else if (in_attr[Tag_GNU_Power_ABI_FP].i > 2)
|
||||
_bfd_error_handler
|
||||
(_("Warning: %B uses unknown floating point ABI %d"), ibfd,
|
||||
in_attr[Tag_GNU_Power_ABI_FP].i);
|
||||
else
|
||||
_bfd_error_handler
|
||||
(_("Warning: %B uses unknown floating point ABI %d"), obfd,
|
||||
out_attr[Tag_GNU_Power_ABI_FP].i);
|
||||
}
|
||||
|
||||
/* Merge Tag_compatibility attributes and any common GNU ones. */
|
||||
_bfd_elf_merge_object_attributes (ibfd, obfd);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Merge backend specific data from an object file to the output
|
||||
object file when linking. */
|
||||
|
||||
@ -3612,6 +3668,9 @@ ppc_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
|
||||
if (! _bfd_generic_verify_endian_match (ibfd, obfd))
|
||||
return FALSE;
|
||||
|
||||
if (!ppc_elf_merge_obj_attributes (ibfd, obfd))
|
||||
return FALSE;
|
||||
|
||||
new_flags = elf_elfheader (ibfd)->e_flags;
|
||||
old_flags = elf_elfheader (obfd)->e_flags;
|
||||
if (!elf_flags_init (obfd))
|
||||
|
@ -1,3 +1,9 @@
|
||||
2007-06-29 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* readelf.c (display_power_gnu_attribute, process_power_specific):
|
||||
New.
|
||||
(process_arch_specific): Call process_power_specific.
|
||||
|
||||
2007-06-29 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* readelf.c (display_mips_gnu_attribute): New.
|
||||
|
@ -8346,6 +8346,57 @@ display_gnu_attribute (unsigned char *p,
|
||||
return p;
|
||||
}
|
||||
|
||||
static unsigned char *
|
||||
display_power_gnu_attribute (unsigned char *p, int tag)
|
||||
{
|
||||
int type;
|
||||
unsigned int len;
|
||||
int val;
|
||||
|
||||
if (tag == Tag_GNU_Power_ABI_FP)
|
||||
{
|
||||
val = read_uleb128 (p, &len);
|
||||
p += len;
|
||||
printf (" Tag_GNU_Power_ABI_FP: ");
|
||||
switch (val)
|
||||
{
|
||||
case 0:
|
||||
printf ("Hard or soft float\n");
|
||||
break;
|
||||
case 1:
|
||||
printf ("Hard float\n");
|
||||
break;
|
||||
case 2:
|
||||
printf ("Soft float\n");
|
||||
break;
|
||||
default:
|
||||
printf ("??? (%d)\n", val);
|
||||
break;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
if (tag & 1)
|
||||
type = 1; /* String. */
|
||||
else
|
||||
type = 2; /* uleb128. */
|
||||
printf (" Tag_unknown_%d: ", tag);
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
printf ("\"%s\"\n", p);
|
||||
p += strlen ((char *)p) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
val = read_uleb128 (p, &len);
|
||||
p += len;
|
||||
printf ("%d (0x%x)\n", val, val);
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
static unsigned char *
|
||||
display_mips_gnu_attribute (unsigned char *p, int tag)
|
||||
{
|
||||
@ -8539,6 +8590,13 @@ process_arm_specific (FILE *file)
|
||||
display_arm_attribute, NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
process_power_specific (FILE *file)
|
||||
{
|
||||
return process_attributes (file, NULL, SHT_GNU_ATTRIBUTES, NULL,
|
||||
display_power_gnu_attribute);
|
||||
}
|
||||
|
||||
static int
|
||||
process_mips_specific (FILE *file)
|
||||
{
|
||||
@ -9317,6 +9375,9 @@ process_arch_specific (FILE *file)
|
||||
case EM_MIPS_RS3_LE:
|
||||
return process_mips_specific (file);
|
||||
break;
|
||||
case EM_PPC:
|
||||
return process_power_specific (file);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
2007-06-29 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* ppc.h (Tag_GNU_Power_ABI_FP): Define.
|
||||
|
||||
2007-06-29 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* mips.h (Tag_GNU_MIPS_ABI_FP): Define.
|
||||
|
@ -171,4 +171,15 @@ END_RELOC_NUMBERS (R_PPC_max)
|
||||
builds when those objects \
|
||||
are not to be furhter \
|
||||
relocated. */
|
||||
|
||||
/* Object attribute tags. */
|
||||
enum
|
||||
{
|
||||
/* 0-3 are generic. */
|
||||
Tag_GNU_Power_ABI_FP = 4, /* Value 1 for hard-float, 2 for
|
||||
soft-float; 0 for not tagged or not
|
||||
using any ABIs affected by the
|
||||
differences. */
|
||||
};
|
||||
|
||||
#endif /* _ELF_PPC_H */
|
||||
|
@ -1,3 +1,15 @@
|
||||
2007-06-29 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* ld-powerpc/attr-gnu-4-0.s, ld-powerpc/attr-gnu-4-00.d,
|
||||
ld-powerpc/attr-gnu-4-01.d, ld-powerpc/attr-gnu-4-02.d,
|
||||
ld-powerpc/attr-gnu-4-1.s, ld-powerpc/attr-gnu-4-10.d,
|
||||
ld-powerpc/attr-gnu-4-11.d, ld-powerpc/attr-gnu-4-12.d,
|
||||
ld-powerpc/attr-gnu-4-13.d, ld-powerpc/attr-gnu-4-2.s,
|
||||
ld-powerpc/attr-gnu-4-20.d, ld-powerpc/attr-gnu-4-21.d,
|
||||
ld-powerpc/attr-gnu-4-22.d, ld-powerpc/attr-gnu-4-3.s,
|
||||
ld-powerpc/attr-gnu-4-31.d: New.
|
||||
* ld-powerpc/powerpc.exp: Run these new tests.
|
||||
|
||||
2007-06-29 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* ld-mips-elf/attr-gnu-4-0.s, ld-mips-elf/attr-gnu-4-00.d,
|
||||
|
1
ld/testsuite/ld-powerpc/attr-gnu-4-0.s
Normal file
1
ld/testsuite/ld-powerpc/attr-gnu-4-0.s
Normal file
@ -0,0 +1 @@
|
||||
.gnu_attribute 4,0
|
7
ld/testsuite/ld-powerpc/attr-gnu-4-00.d
Normal file
7
ld/testsuite/ld-powerpc/attr-gnu-4-00.d
Normal file
@ -0,0 +1,7 @@
|
||||
#source: attr-gnu-4-0.s
|
||||
#source: attr-gnu-4-0.s
|
||||
#as: -a32
|
||||
#ld: -r -melf32ppc
|
||||
#readelf: -A
|
||||
#target: powerpc*-*-*
|
||||
|
10
ld/testsuite/ld-powerpc/attr-gnu-4-01.d
Normal file
10
ld/testsuite/ld-powerpc/attr-gnu-4-01.d
Normal file
@ -0,0 +1,10 @@
|
||||
#source: attr-gnu-4-0.s
|
||||
#source: attr-gnu-4-1.s
|
||||
#as: -a32
|
||||
#ld: -r -melf32ppc
|
||||
#readelf: -A
|
||||
#target: powerpc*-*-*
|
||||
|
||||
Attribute Section: gnu
|
||||
File Attributes
|
||||
Tag_GNU_Power_ABI_FP: Hard float
|
10
ld/testsuite/ld-powerpc/attr-gnu-4-02.d
Normal file
10
ld/testsuite/ld-powerpc/attr-gnu-4-02.d
Normal file
@ -0,0 +1,10 @@
|
||||
#source: attr-gnu-4-0.s
|
||||
#source: attr-gnu-4-2.s
|
||||
#as: -a32
|
||||
#ld: -r -melf32ppc
|
||||
#readelf: -A
|
||||
#target: powerpc*-*-*
|
||||
|
||||
Attribute Section: gnu
|
||||
File Attributes
|
||||
Tag_GNU_Power_ABI_FP: Soft float
|
1
ld/testsuite/ld-powerpc/attr-gnu-4-1.s
Normal file
1
ld/testsuite/ld-powerpc/attr-gnu-4-1.s
Normal file
@ -0,0 +1 @@
|
||||
.gnu_attribute 4,1
|
10
ld/testsuite/ld-powerpc/attr-gnu-4-10.d
Normal file
10
ld/testsuite/ld-powerpc/attr-gnu-4-10.d
Normal file
@ -0,0 +1,10 @@
|
||||
#source: attr-gnu-4-1.s
|
||||
#source: attr-gnu-4-0.s
|
||||
#as: -a32
|
||||
#ld: -r -melf32ppc
|
||||
#readelf: -A
|
||||
#target: powerpc*-*-*
|
||||
|
||||
Attribute Section: gnu
|
||||
File Attributes
|
||||
Tag_GNU_Power_ABI_FP: Hard float
|
10
ld/testsuite/ld-powerpc/attr-gnu-4-11.d
Normal file
10
ld/testsuite/ld-powerpc/attr-gnu-4-11.d
Normal file
@ -0,0 +1,10 @@
|
||||
#source: attr-gnu-4-1.s
|
||||
#source: attr-gnu-4-1.s
|
||||
#as: -a32
|
||||
#ld: -r -melf32ppc
|
||||
#readelf: -A
|
||||
#target: powerpc*-*-*
|
||||
|
||||
Attribute Section: gnu
|
||||
File Attributes
|
||||
Tag_GNU_Power_ABI_FP: Hard float
|
6
ld/testsuite/ld-powerpc/attr-gnu-4-12.d
Normal file
6
ld/testsuite/ld-powerpc/attr-gnu-4-12.d
Normal file
@ -0,0 +1,6 @@
|
||||
#source: attr-gnu-4-1.s
|
||||
#source: attr-gnu-4-2.s
|
||||
#as: -a32
|
||||
#ld: -r -melf32ppc
|
||||
#warning: Warning: .* uses hard float, .* uses soft float
|
||||
#target: powerpc*-*-*
|
6
ld/testsuite/ld-powerpc/attr-gnu-4-13.d
Normal file
6
ld/testsuite/ld-powerpc/attr-gnu-4-13.d
Normal file
@ -0,0 +1,6 @@
|
||||
#source: attr-gnu-4-1.s
|
||||
#source: attr-gnu-4-3.s
|
||||
#as: -a32
|
||||
#ld: -r -melf32ppc
|
||||
#warning: Warning: .* uses unknown floating point ABI 3
|
||||
#target: powerpc*-*-*
|
1
ld/testsuite/ld-powerpc/attr-gnu-4-2.s
Normal file
1
ld/testsuite/ld-powerpc/attr-gnu-4-2.s
Normal file
@ -0,0 +1 @@
|
||||
.gnu_attribute 4,2
|
10
ld/testsuite/ld-powerpc/attr-gnu-4-20.d
Normal file
10
ld/testsuite/ld-powerpc/attr-gnu-4-20.d
Normal file
@ -0,0 +1,10 @@
|
||||
#source: attr-gnu-4-2.s
|
||||
#source: attr-gnu-4-0.s
|
||||
#as: -a32
|
||||
#ld: -r -melf32ppc
|
||||
#readelf: -A
|
||||
#target: powerpc*-*-*
|
||||
|
||||
Attribute Section: gnu
|
||||
File Attributes
|
||||
Tag_GNU_Power_ABI_FP: Soft float
|
6
ld/testsuite/ld-powerpc/attr-gnu-4-21.d
Normal file
6
ld/testsuite/ld-powerpc/attr-gnu-4-21.d
Normal file
@ -0,0 +1,6 @@
|
||||
#source: attr-gnu-4-2.s
|
||||
#source: attr-gnu-4-1.s
|
||||
#as: -a32
|
||||
#ld: -r -melf32ppc
|
||||
#warning: Warning: .* uses hard float, .* uses soft float
|
||||
#target: powerpc*-*-*
|
10
ld/testsuite/ld-powerpc/attr-gnu-4-22.d
Normal file
10
ld/testsuite/ld-powerpc/attr-gnu-4-22.d
Normal file
@ -0,0 +1,10 @@
|
||||
#source: attr-gnu-4-2.s
|
||||
#source: attr-gnu-4-2.s
|
||||
#as: -a32
|
||||
#ld: -r -melf32ppc
|
||||
#readelf: -A
|
||||
#target: powerpc*-*-*
|
||||
|
||||
Attribute Section: gnu
|
||||
File Attributes
|
||||
Tag_GNU_Power_ABI_FP: Soft float
|
1
ld/testsuite/ld-powerpc/attr-gnu-4-3.s
Normal file
1
ld/testsuite/ld-powerpc/attr-gnu-4-3.s
Normal file
@ -0,0 +1 @@
|
||||
.gnu_attribute 4,3
|
6
ld/testsuite/ld-powerpc/attr-gnu-4-31.d
Normal file
6
ld/testsuite/ld-powerpc/attr-gnu-4-31.d
Normal file
@ -0,0 +1,6 @@
|
||||
#source: attr-gnu-4-3.s
|
||||
#source: attr-gnu-4-1.s
|
||||
#as: -a32
|
||||
#ld: -r -melf32ppc
|
||||
#warning: Warning: .* uses unknown floating point ABI 3
|
||||
#target: powerpc*-*-*
|
@ -147,3 +147,15 @@ if [ supports_ppc64 ] then {
|
||||
}
|
||||
|
||||
run_dump_test "plt1"
|
||||
|
||||
run_dump_test "attr-gnu-4-00"
|
||||
run_dump_test "attr-gnu-4-01"
|
||||
run_dump_test "attr-gnu-4-02"
|
||||
run_dump_test "attr-gnu-4-10"
|
||||
run_dump_test "attr-gnu-4-11"
|
||||
run_dump_test "attr-gnu-4-12"
|
||||
run_dump_test "attr-gnu-4-13"
|
||||
run_dump_test "attr-gnu-4-20"
|
||||
run_dump_test "attr-gnu-4-21"
|
||||
run_dump_test "attr-gnu-4-22"
|
||||
run_dump_test "attr-gnu-4-31"
|
||||
|
Loading…
Reference in New Issue
Block a user