From 5aa6ff7ca4d5209dece43cf89fa5750f5dcaa033 Mon Sep 17 00:00:00 2001 From: Andrew Stubbs Date: Mon, 19 Jan 2009 12:14:05 +0000 Subject: 2009-01-19 Andrew Stubbs bfd/ * elf-attrs.c (vendor_set_obj_attr_contents): Support tag ordering. * elf-bfd.h (elf_backend_data): Add obj_attrs_order. * elf32-arm.c (elf32_arm_obj_attrs_order): New function. (elf_backend_obj_attrs_order): New define. * elfxx-target.h (elf_backend_obj_attrs_order): New define. (elfNN_bed): Add elf_backend_obj_attrs_order. gas/testsuite/ * gas/arm/attr-order.d: New file. * gas/arm/attr-order.s: New file. --- bfd/elf32-arm.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'bfd/elf32-arm.c') diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index bf1f06f..5fdd138 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -8149,6 +8149,24 @@ elf32_arm_obj_attrs_arg_type (int tag) return (tag & 1) != 0 ? ATTR_TYPE_FLAG_STR_VAL : ATTR_TYPE_FLAG_INT_VAL; } +/* The ABI defines that Tag_conformance should be emitted first, and that + Tag_nodefaults should be second (if either is defined). This sets those + two positions, and bumps up the position of all the remaining tags to + compensate. */ +static int +elf32_arm_obj_attrs_order (int num) +{ + if (num == 4) + return Tag_conformance; + if (num == 5) + return Tag_nodefaults; + if ((num - 2) < Tag_nodefaults) + return num - 2; + if ((num - 1) < Tag_conformance) + return num - 1; + return num; +} + /* Read the architecture from the Tag_also_compatible_with attribute, if any. Returns -1 if no architecture could be read. */ @@ -12292,6 +12310,7 @@ const struct elf_size_info elf32_arm_size_info = #define elf_backend_obj_attrs_arg_type elf32_arm_obj_attrs_arg_type #undef elf_backend_obj_attrs_section_type #define elf_backend_obj_attrs_section_type SHT_ARM_ATTRIBUTES +#define elf_backend_obj_attrs_order elf32_arm_obj_attrs_order #include "elf32-target.h" -- cgit v1.1