Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R

Pavel Pisa ppisa4lists at
Thu Jul 3 00:16:43 UTC 2014

Hello everybody,

we have stubled on next problem with GCC-4.9.0 and Newlib-2.1 when linking
RTEMS 4.11 code (but issue is generic for Newlib use for each Cortex-R
optimized multilib on any OS)

COLLECT_GCC_OPTIONS='-v' '-qrtems' '-B'  
'../tms570ls3137_hdk_sdram/lib/' '-specs=bsp_specs'  
'-march=armv7-r' '-mthumb' '-mbig-endian' '-O2' '-ggdb3' '-D' 'NDEBUG'  
'-Wall' '-Wmissing-prototypes' '-Wimplicit-function-declaration'  
'-Wstrict-prototypes' '-Wnested-externs' '-march=armv7-r' '-mthumb'  
'-mbig-endian' '-o' 'capture.exe'
-dc -dp -N -EB -o capture.exe  
.../thumb/armv7-r/eb/crti.o .../thumb/armv7-r/eb/crtbegin.o -e 
_start -L.../thumb/armv7-r/eb -L.../arm-rtems4.11/lib/thumb/armv7-r/eb -L../tms570ls3137_hdk_sdram/lib -L... -L/usr/arm-rtems4.11/gcc/4.9.0/bin/../lib/gcc -L.../arm-rtems4.11/lib 
test1.o --start-group -lgcc --start-group -lrtemsbsp -lrtemscpu -lc -lgcc --end-group -T ../tms570ls3137_hdk_sdram/lib/linkcmds --end-group .../thumb/armv7-r/eb/crtend.o  
.../arm-rtems4.11/bin/ld: error: .../arm-rtems4.11/lib/thumb/armv7-r/eb/libc.a(lib_a-memchr.o): Conflicting architecture profiles A/R
.../arm-rtems4.11/bin/ld: failed to merge target 

Most of the paths shortened - prefixes replaced by "...".

I have checked even current GIT Newlib sources and problem seems
to be present there as well.

One way to correct the problem is attached simple change.
Other option is to remove .arch line altogether and trust
correct options used when memchr.S build is invoked.

Proposed patch checked by readelf on
Check of RTEMS build by new toolchain (Sebastian thanks),
is expected on Friday.

Best wishes,


 newlib/libc/machine/arm/memchr.S |    4 ++++
 1 file changed, 4 insertions(+)

Index: newlib-2.1/newlib/libc/machine/arm/memchr.S
--- newlib-2.1.orig/newlib/libc/machine/arm/memchr.S    2011-10-18 13:35:17.000000000 +0200
+++ newlib-2.1/newlib/libc/machine/arm/memchr.S 2014-07-03 00:38:47.598049234 +0200
@@ -46,7 +46,11 @@
 @    tidy

        .syntax unified
+#ifdef __ARM_ARCH_7R__
+       .arch armv7-r
        .arch armv7-a

 #include "arm_asm.h"

More information about the devel mailing list