From 9274e9de160a98d737bb2bd068c22d37ec66d98d Mon Sep 17 00:00:00 2001 From: Terry Guo Date: Thu, 20 Nov 2014 13:54:27 +0800 Subject: Enable to link ARM object file that hasn't attribute section. bfd/ChangeLog 2014-11-20 Terry Guo * elf32-arm.c (elf32_arm_merge_eabi_attributes): Skip if input bfd hasn't attribute section. ld/testsuite/ChangeLog: 2014-11-20 Terry Guo * ld-arm/attr-merge-nosection-1.d: New file. * ld-arm/attr-merge-nosection-1a.s: Likewise. * ld-arm/attr-merge-nosection-1b.s: Likewise. * ld-arm/arm-elf.exp: Include the new test. --- bfd/elf32-arm.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'bfd/elf32-arm.c') diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 49d0f656113..95f59d54878 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -11700,6 +11700,7 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd) static const int order_021[3] = {0, 2, 1}; int i; bfd_boolean result = TRUE; + const char *sec_name = get_elf_backend_data (ibfd)->obj_attrs_section; /* Skip the linker stubs file. This preserves previous behavior of accepting unknown attributes in the first input file - but @@ -11707,6 +11708,12 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd) if (ibfd->flags & BFD_LINKER_CREATED) return TRUE; + /* Skip any input that hasn't attribute section. + This enables to link object files without attribute section with + any others. */ + if (bfd_get_section_by_name (ibfd, sec_name) == NULL) + return TRUE; + if (!elf_known_obj_attributes_proc (obfd)[0].i) { /* This is the first object. Copy the attributes. */ -- cgit v1.2.1