This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch ARM] Fix that miss DMB instruction for ARMv6-M


On 10/10/12 02:32, Terry Guo wrote:


-----Original Message-----
From: Richard Earnshaw
Sent: Tuesday, October 09, 2012 10:01 PM
To: Terry Guo
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [Patch ARM] Fix that miss DMB instruction for ARMv6-M

On 08/10/12 08:29, Terry Guo wrote:
Hi,

When running libstdc++ regression test on Cortex-M0, the case
49445.cc fails
with error message:

/tmp/ccMqZdgc.o: In function
`std::atomic<float>::load(std::memory_order)
const':^M
/home/build/work/GCC-4-7-build/build-native/gcc-final/arm-none-
eabi/armv6-m/
libstdc++-v3/include/atomic:202: undefined reference to
`__sync_synchronize'^M
/home/build/work/GCC-4-7-build/build-native/gcc-final/arm-none-
eabi/armv6-m/
libstdc++-v3/include/atomic:202: undefined reference to
`__sync_synchronize'^M
/tmp/ccMqZdgc.o: In function
`std::atomic<tacos>::load(std::memory_order)
const':^M
/home/build/work/GCC-4-7-build/build-native/gcc-final/arm-none-
eabi/armv6-m/
libstdc++-v3/include/atomic:202: undefined reference to
`__sync_synchronize'^M
/home/build/work/GCC-4-7-build/build-native/gcc-final/arm-none-
eabi/armv6-m/
libstdc++-v3/include/atomic:202: undefined reference to
`__sync_synchronize'^M
collect2: error: ld returned 1 exit status^M
compiler exited with status 1

After investigation, the reason is current gcc doesn't think armv6-m
has DMB
instruction. While according to ARM manuals, it has. With this wrong
assumption, the expand_mem_thread_fence will generate a call to
library
function __sync_synchronize rather than DMB instruction. While no
code to
implement this library function, so the error generates.

The attached patch intends to fix this issue by letting gcc also
think
armv6-m has DMB instruction. Is it OK to trunk?

BR,
Terry

2012-10-08 Terry Guo <terry.guo@arm.com>

* config/arm/arm.c (arm_arch6m): New variable to denote
armv6-m
architecture.
          * config/arm/arm.h (TARGET_HAVE_DMB): The armv6-m also has
DMB
instruction.



Ok.


R.

Thanks Richard. Is it OK to 4.7?



Well, it's not technically a regression, but I guess it could be argued as a wrong-code bug. So yes, but please let it gestate on trunk for a week first, just in case there's an unforeseen issue.


R.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]