This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Fix another ARM attribute merging bug
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: binutils at sourceware dot org
- Date: Fri, 29 Jun 2007 00:42:26 +0000 (UTC)
- Subject: Fix another ARM attribute merging bug
This patch fixes a bug in the ARM-specific object attribute merging; it is
independent of my generic attributes patch.
When an attribute is merged from a second or subsequent input file to the
output, the type field must be set so that the merged attribute gets
copied to the output. (For example, a first file that doesn't use wchar_t
and a second that specifies a wchar_t size - not a case GCC will generate
since it doesn't know how to check whether wchar_t is used in a public
interface.)
Tested with cross to arm-none-eabi. OK to commit?
bfd:
2007-06-29 Joseph Myers <joseph@codesourcery.com>
* elf32-arm.c (elf32_arm_merge_eabi_attributes): Copy type from
input attributes if value has been copied.
ld/testsuite:
2007-06-29 Joseph Myers <joseph@codesourcery.com>
* ld-arm/attr-merge-2a.s, ld-arm/attr-merge-2b.s,
ld-arm/attr-merge-2.attr: New.
* ld-arm/arm-elf.exp (armelftests): Add new test.
Index: bfd/elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.119
diff -u -r1.119 elf32-arm.c
--- bfd/elf32-arm.c 26 Jun 2007 13:55:04 -0000 1.119
+++ bfd/elf32-arm.c 29 Jun 2007 00:35:08 -0000
@@ -7279,6 +7279,23 @@
default: /* All known attributes should be explicitly covered. */
abort ();
}
+
+ if (in_attr[i].type && !out_attr[i].type)
+ switch (in_attr[i].type)
+ {
+ case 1:
+ if (out_attr[i].i)
+ out_attr[i].type = 1;
+ break;
+
+ case 2:
+ if (out_attr[i].s)
+ out_attr[i].type = 2;
+ break;
+
+ default:
+ abort ();
+ }
}
in_list = elf32_arm_tdata (ibfd)->other_eabi_attributes;
Index: ld/testsuite/ld-arm/arm-elf.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-arm/arm-elf.exp,v
retrieving revision 1.27
diff -u -r1.27 arm-elf.exp
--- ld/testsuite/ld-arm/arm-elf.exp 26 Jun 2007 13:55:04 -0000 1.27
+++ ld/testsuite/ld-arm/arm-elf.exp 29 Jun 2007 00:35:09 -0000
@@ -170,6 +170,9 @@
{"EABI attribute merging" "-r" "" {attr-merge.s attr-merge.s}
{{readelf -A attr-merge.attr}}
"attr-merge"}
+ {"EABI attribute merging 2" "-r" "" {attr-merge-2a.s attr-merge-2b.s}
+ {{readelf -A attr-merge-2.attr}}
+ "attr-merge-2"}
}
run_ld_link_tests $armelftests
Index: ld/testsuite/ld-arm/attr-merge-2.attr
===================================================================
RCS file: ld/testsuite/ld-arm/attr-merge-2.attr
diff -N ld/testsuite/ld-arm/attr-merge-2.attr
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-arm/attr-merge-2.attr 29 Jun 2007 00:35:09 -0000
@@ -0,0 +1,12 @@
+Attribute Section: aeabi
+File Attributes
+ Tag_CPU_name: "ARM7TDMI"
+ Tag_CPU_arch: v4T
+ Tag_ABI_PCS_wchar_t: 4
+ Tag_ABI_FP_denormal: Needed
+ Tag_ABI_FP_exceptions: Needed
+ Tag_ABI_FP_number_model: IEEE 754
+ Tag_ABI_align8_needed: Yes
+ Tag_ABI_align8_preserved: Yes, except leaf SP
+ Tag_ABI_enum_size: small
+ Tag_ABI_optimization_goals: Aggressive Debug
Index: ld/testsuite/ld-arm/attr-merge-2a.s
===================================================================
RCS file: ld/testsuite/ld-arm/attr-merge-2a.s
diff -N ld/testsuite/ld-arm/attr-merge-2a.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-arm/attr-merge-2a.s 29 Jun 2007 00:35:09 -0000
@@ -0,0 +1,10 @@
+ .cpu arm7tdmi
+ .fpu softvfp
+ .eabi_attribute 20, 1
+ .eabi_attribute 21, 1
+ .eabi_attribute 23, 3
+ .eabi_attribute 24, 1
+ .eabi_attribute 25, 1
+ .eabi_attribute 26, 1
+ .eabi_attribute 30, 6
+ .file "attr-merge-1a.s"
Index: ld/testsuite/ld-arm/attr-merge-2b.s
===================================================================
RCS file: ld/testsuite/ld-arm/attr-merge-2b.s
diff -N ld/testsuite/ld-arm/attr-merge-2b.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-arm/attr-merge-2b.s 29 Jun 2007 00:35:09 -0000
@@ -0,0 +1,11 @@
+ .cpu arm7tdmi
+ .fpu softvfp
+ .eabi_attribute 20, 1
+ .eabi_attribute 21, 1
+ .eabi_attribute 23, 3
+ .eabi_attribute 24, 1
+ .eabi_attribute 25, 1
+ .eabi_attribute 26, 1
+ .eabi_attribute 30, 6
+ .eabi_attribute 18, 4
+ .file "attr-merge-1b.s"
--
Joseph S. Myers
joseph@codesourcery.com