Created attachment 5760 [details] Patch with the proposed change When compiling code with gcc-4.6.0 for cpu "cortex-m4" it generates code for ARM7EM. The gold 2.21 linker tells: "unknown CPU architecture". The error is in line 10006 of gold/arm.cc: if (oldtag >= elfcpp::MAX_TAG_CPU_ARCH || newtag >= elfcpp::MAX_TAG_CPU_ARCH) This detects an error in the architecture, but if the oldtag or newtag is just the same as elfcpp::MAX_TAG_CPU_ARCH, it detects it incorrectly as unknown CPU. Line 242 of elfcpp/arm.h: MAX_TAG_CPU_ARCH = TAG_CPU_ARCH_V7E_M So it is as simple to fix as changing previous line by: if (oldtag > elfcpp::MAX_TAG_CPU_ARCH || newtag > elfcpp::MAX_TAG_CPU_ARCH) So the value TAG_CPU_ARCH_V7E_M is not detected as an unknown CPU. Included patch for easy applying.
CVSROOT: /cvs/src Module name: src Changes by: dougkwan@sourceware.org 2011-06-01 19:59:42 Modified files: gold : ChangeLog arm.cc gold/testsuite : Makefile.am Makefile.in Added files: gold/testsuite : pr12826.sh pr12826_1.s pr12826_2.s Log message: 2011-05-31 Doug Kwan <dougkwan@google.com> Asier Llano PR gold/12826 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of arch value that equals to elfcpp::MAX_TAG_CPU_ARCH. * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove redundant arm_exidx_test.so. * testsuite/Makefile.in: Regenerate. (check_SCRIPTS): Add pr12826.sh (check_DATA): Add pr12826.stdout (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules. * testsuite/pr12826.sh: New file. * testsuite/pr12826_1.s: Ditto. * testsuite/pr12826_1.s: Ditto. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.742&r2=1.743 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/arm.cc.diff?cvsroot=src&r1=1.132&r2=1.133 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/testsuite/pr12826.sh.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/testsuite/pr12826_1.s.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/testsuite/pr12826_2.s.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/testsuite/Makefile.am.diff?cvsroot=src&r1=1.161&r2=1.162 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/testsuite/Makefile.in.diff?cvsroot=src&r1=1.170&r2=1.171
This is fixed in trunk.