Make the linker return an error status if it fails to merge ARM binaries with

different architecture tags.  Add a test case to make sure that this works,
and update readelf so that it will not seg-fault when trying to display the
attributes of binaries with invalid architecture tags.

	* elf32-arm.c (elf32_arm_merge_eabi_attributes): Return false if
	failed to merge.

	* ld-arm/attr-merge-arch-2.d: New test case.
	* ld-arm/attr-merge-arch-2a.s: New test case source file.
	* ld-arm/attr-merge-arch-2b.s: Likewise.
	* ld-arm/arm-elf.exp: Run new test case.

	* readelf.c (display_arm_attribute): Use unsigned int type for
	tag, val and type variables.
This commit is contained in:
Terry Guo
2014-09-16 13:08:22 +01:00
committed by Nick Clifton
parent 428b16bd5a
commit 70e99720f9
9 changed files with 68 additions and 10 deletions

View File

@@ -11548,10 +11548,10 @@ display_tag_value (int tag,
/* ARM EABI attributes section. */
typedef struct
{
int tag;
unsigned int tag;
const char * name;
/* 0 = special, 1 = string, 2 = uleb123, > 0x80 == table lookup. */
int type;
unsigned int type;
const char ** table;
} arm_attr_public_tag;
@@ -11669,12 +11669,12 @@ static unsigned char *
display_arm_attribute (unsigned char * p,
const unsigned char * const end)
{
int tag;
unsigned int tag;
unsigned int len;
int val;
unsigned int val;
arm_attr_public_tag * attr;
unsigned i;
int type;
unsigned int type;
tag = read_uleb128 (p, &len, end);
p += len;