Take the following two test files:

@ test1.s
        .syntax unified
        .thumb
        .global foo
foo:
        bx lr
@ end of test1.s

@ test2.s
        .syntax unified
        .thumb
        .cpu cortex-m0

bar:
        bl foo
@ end of test2.s

Build as follows:
arm-none-eabi-as test1.s -o test1.o
arm-none-eabi-as test2.s -o test2.o
arm-none-eabi-objcopy -R '.ARM.attributes' test1.o test1.stripped.o
arm-non-ld test1.stripped.o test2.o -o test.axf

ld reports:

.../arm-none-eabi-ld: error: test2.o: Conflicting CPU architectures 0/11

The ABI is silent on the behaviour expected in this case but to ensure backwards
compatibility we should allow such objects to link together.

The basic issue seems to be that we are treating an object with no
.ARM.attributes section as one where all the attributes take their default value
(0 or "") and not one which has all the attributes set to undefined (as if a
TAG_nodefaults attribute was present), and hence compatible with all other 
objects.

-- 
           Summary: Linking of objects with and without attributes sections
                    is incorrect
           Product: binutils
           Version: 2.21 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: mgretton at sourceware dot org
                CC: bug-binutils at gnu dot org
GCC target triplet: arm-none-eabi


http://sourceware.org/bugzilla/show_bug.cgi?id=11897

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to