Summary: | fails to build with march=all on arm | ||
---|---|---|---|
Product: | binutils | Reporter: | Arnaud Patard <arnaud.patard> |
Component: | gas | Assignee: | unassigned |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | nickc, zhenqiang.chen |
Priority: | P2 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: | ||
Attachments: | failed case |
Description
Arnaud Patard
2011-04-24 22:20:50 UTC
CVSROOT: /cvs/src Module name: src Changes by: nickc@sourceware.org 2011-06-03 14:42:48 Modified files: gas : ChangeLog gas/config : tc-arm.c Log message: PR gas/12698 * config/tc-arm.c (parse_psr): Set m_profile to false when assembling for any architecture. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&r1=1.4499&r2=1.4500 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-arm.c.diff?cvsroot=src&r1=1.490&r2=1.491 Hi Arnaud, Thanks for reporting this problem and providing a patch. Your solution works, so I have checked it in, with a slightly tweaked comment. Cheers Nick Created attachment 6435 [details]
failed case
Assembler fail.
The attached case is from kernel. We still get fail: head2.s: Assembler messages: head2.s:60: Error: selected processor does not support requested special purpose register -- `mrs r2,cpsr' head2.s:67: Error: selected processor does not support requested special purpose register -- `mrs r2,cpsr' head2.s:69: Error: selected processor does not support requested special purpose register -- `msr cpsr_c,r2' The fault occurs in 2.22 and current trunk. To reproduce it: arm-linux-gnueabi-as --gdwarf2 -EL -march=armv7-a -mfloat-abi=soft -mfpu=vfpv3-d16 -meabi=5 -mimplicit-it=always -mno-warn-deprecated -mthumb -march=all -o head.o head2.s Here is a reference patch based on your previous one. Both function do_t_mrs and do_t_msr need update. diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 6ff64a6..7f69ffa 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -11201,8 +11201,14 @@ do_t_mrs (void) int flags = inst.operands[1].imm & (PSR_c|PSR_x|PSR_s|PSR_f|SPSR_BIT); if (ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_m)) - constraint (flags != 0, _("selected processor does not support " - "requested special purpose register")); + { + /* PR gas/12698: The constraint is only applied for m_profile. + If the user has specified -march=all, we want to ignore it as + we are building for any CPU type, including non-m variants. */ + bfd_boolean m_profile = selected_cpu.core != arm_arch_any.core; + constraint ((flags != 0) && m_profile, _("selected processor does " + "not support requested special purpose register")); + } else /* mrs only accepts APSR/CPSR/SPSR/CPSR_all/SPSR_all (for non-M profile devices). */ @@ -11235,11 +11241,14 @@ do_t_msr (void) if (ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_m)) { int bits = inst.operands[0].imm & (PSR_c|PSR_x|PSR_s|PSR_f|SPSR_BIT); - - constraint ((ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v6_dsp) + /* PR gas/12698: The constraint is only applied for m_profile. + If the user has specified -march=all, we want to ignore it as + we are building for any CPU type, including non-m variants. */ + bfd_boolean m_profile = selected_cpu.core != arm_arch_any.core; + constraint (((ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v6_dsp) && (bits & ~(PSR_s | PSR_f)) != 0) || (!ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v6_dsp) - && bits != PSR_f), + && bits != PSR_f)) && m_profile, _("selected processor does not support requested special " "purpose register")); } CVSROOT: /cvs/src Module name: src Changes by: nickc@sourceware.org 2012-06-13 14:19:00 Modified files: gas : ChangeLog gas/config : tc-arm.c Log message: PR gas/12698 * config/tc-arm.c (do_t_mrs): Do not require an m-profile architecure when assembling for all archiectures. (do_t_msr): Likewise. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&r1=1.4752&r2=1.4753 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-arm.c.diff?cvsroot=src&r1=1.519&r2=1.520 Hi Chen, Thanks for the patch - I have applied it to the mainline sources. Cheers Nick |