Possible GCC Bug, e6500 Freescale 4.9.2

cancel
Showing results for 
Search instead for 
Did you mean: 

Possible GCC Bug, e6500 Freescale 4.9.2

195 Views
C0490FDB
Contributor I

Sorry if this is the wrong forum for this question.  It regards a version of GCC supplied with Eclipse by Freescale.  I am using e6500 64 bit mode.  (I'm not exactly clear on the role of Freescale versus NXP, the datasheets are all from the latter while the compiler appears to be the former.)

Compiler: powerpc-aeabi-gcc-4.9.2.exe

Version: powerpc-aeabi-gcc-4.9.2.exe (GCC) 4.9.2 20141030 (Mon Nov 16 18:12:40 CST 2015 build.sh rev=1267 s=F492 ELe6500 -V release_r1267_build_Fed_ELe6500)
Copyright (C) 2014 Free Software Foundation, Inc.

I know claims of compiler bug are almost always wrong, the following small snippet looks like there's a off-by-one problem.  I'm searching a string for a letter, in this case 'e'.  It loads string address into R10 and grabs a character from that address +1 into R9 for comparison.  Depending on optimization level I've seen a preceding decrement on the address pointer but not always.  The following code was compiled with -O2.

C: (This is part of my XXXprintf implementation.)

const int nfmtstr = 19;
const char *fmtstr = "diouxXfFeEgGaAcspPn";
int j;
for(j=0;j<nfmtstr;j++)
         if (fmtstr[j]=='e')
                 break;

 

Emitted:

mflr r0
ld r10,0(r2)                # Address updated during load via relocation record, points to 19 char string.
std r0,16(r1)
li r9,19
stdu r1,-112(r1)
li r3,0
mtctr r9
nop
lbzu r9,1(r10)             # Skips first char.
addi r8,r3,1
cmpwi cr7,r9,101

Any direction would be greatly appreciated.

0 Kudos
13 Replies

117 Views
C0490FDB
Contributor I

I have installed the QorIQ Linux SDK 2.0 Linux edition Toolchain and evaluating it.  If I link with -r the linker errors, unable to find libgcc_s.a.

0 Kudos

104 Views
yipingwang
NXP TechSupport
NXP TechSupport

$ powerpc-fsl-linux-ld --sysroot="/opt/fsl-qoriq/2.0/sysroots/ppce6500-fsl-linux"

0 Kudos

93 Views
C0490FDB
Contributor I

Thanks, but no help.  Build log:

 

powerpc64-fsl-linux-gcc -mhard-float -m64 -mcpu=e6500 --sysroot=/opt/fsl-qoriq/2.0/sysroots/ppc64e6500-fsl-linux -O2 -pipe -g -feliminate-unused-debug-types -c -o test.o test.c
powerpc64-fsl-linux-gcc -mhard-float -m64 -mcpu=e6500 --sysroot=/opt/fsl-qoriq/2.0/sysroots/ppc64e6500-fsl-linux -Wl,-Map=test.map test.o -r -o test.elf
/opt/fsl-qoriq/2.0/sysroots/i686-fslsdk-linux/usr/libexec/powerpc64-fsl-linux/gcc/powerpc64-fsl-linux/4.9.2/real-ld: cannot find -lgcc_s
/opt/fsl-qoriq/2.0/sysroots/i686-fslsdk-linux/usr/libexec/powerpc64-fsl-linux/gcc/powerpc64-fsl-linux/4.9.2/real-ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
make: *** [makefile:8: test.elf] Error 1

0 Kudos

86 Views
yipingwang
NXP TechSupport
NXP TechSupport

Would you please provide your test.c and test.map  files?

0 Kudos

79 Views
C0490FDB
Contributor I

Sure, included the makefile as well.

Thanks.

0 Kudos

67 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please modify Makefile

test.elf: test.o
$(CC) -Wl,-Map=test.map $^ $(LFLAGS) -r -o $@

Modify to=>

test.elf: test.o
$(LD) $^ $(LFLAGS) -r -o $@

Then execute the following command.

$ source /opt/fsl-qoriq/2.0/environment-setup-ppce6500-fsl-linux

$ make

0 Kudos

167 Views
C0490FDB
Contributor I

See below.

0 Kudos

148 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please download "QorIQ Linux SDK v2.0 PPCE6500 IMAGE.iso" or "QorIQ Linux SDK v2.0 PPC64E6500 IMAGE.iso“ from "https://www.nxp.com/design/software/embedded-software/linux-software-and-development-tools/linux-sdk....

Then mount the ISO, and run script in fsl-toolchain folder to install the toolchain.

I assume that you have installed toolchain in /opt/fsl-qoriq/2.0/ folder, please execute the following command to set up toolchain environment.

$ source /opt/fsl-qoriq/2.0/environment-setup-ppce6500-fsl-linux

Please compile your program with the following command.

${CC} hello.c -o hello

0 Kudos

140 Views
C0490FDB
Contributor I

I've installed the SDK on my Ubuntu system but can't get by the following build error:

/opt/fsl-qoriq/2.0/sysroots/i686-fslsdk-linux/usr/libexec/powerpc64-fsl-linux/gcc/powerpc64-fsl-linux/4.9.2/real-ld: cannot find -lgcc_s

0 Kudos

130 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please execute the following command to build your program.

$ source /opt/fsl-qoriq/2.0/environment-setup-ppce6500-fsl-linux

Please compile your program with the following command.

${CC} hello.c -o hello

If your problem remains, please attach your whole build log.

0 Kudos

186 Views
C0490FDB
Contributor I

Clarification: the version of GCC I'm using installed with Freescale's CodeWarrior Development Studio.

Does NXP have a GCC for compiling e6500 32 and 64 bit?

0 Kudos

174 Views
yipingwang
NXP TechSupport
NXP TechSupport

CodeWarrior also provides Toolchain PA GCC 4.8.2-r963, you could download and install it in C:\Freescale\CW_PA_v10.5.1\Cross_Tools folder.

Please open CodeWarrior IDE, click Help->Install New Software->Available Software Sites, please check "FSL PA Build Tools". At "Work with:" drop download list, please select "FSL PA Build Tools - http://freescale.com/lgfiles/updates/Eclipse/PA10_5_1/com.freescale.pa.buildtools_win"

Then under  "PA GCC 4.8.2-r963 Build Tools Service Packs", please select " Service Pack for Windows GccE6500Aeabi Build Tool version 4.8.2-r963 4.8.2", then follow the installation wizards to download and install this version Toolchain step by step.

In addition, QorIQ Linux SDK 2.0 provides Linux edition Toolchain, I will guide you how to install it if you need it.

0 Kudos

158 Views
C0490FDB
Contributor I

I installed 4.8.2-r963 but it exhibits the same behavior.

Please provide instructions to install the Linux edition.

Thank you

0 Kudos