[Questions] clang cross compilation and SimpleScalar simulation

Hello,

I want to compile MiBench by clang, and the target-ISA is armv4. The code generated using llvm-2.9, clang-2.9, and arm-linux-gcc (gcc version 2.95.2), simulator is sim-panalyzer 2.0.3 .

I use these commends:

$ clang -O3 -o hello.ll -c -emit-llvm hello.c
$ llc -O3 -o hello.s -march=arm -mcpu=strongarm1100 hello.ll

$ arm-linux-gcc -O3 -march=armv4 -mcpu=strongarm1100 -static -mfloat-abi=soft hello.s -o hello

Unfortunately, I get some error messages:

hello.s: Assembler messages:
hello.s:1: Error: Unknown pseudo-op: .syntax' hello.s:2: Error: Unknown pseudo-op: .eabi_attribute’
hello.s:3: Error: Unknown pseudo-op: .eabi_attribute' hello.s:4: Error: Unknown pseudo-op: .eabi_attribute’
hello.s:5: Error: Unknown pseudo-op: .eabi_attribute' hello.s:6: Error: Unknown pseudo-op: .eabi_attribute’
make: *** [all] Error 1

I want to know my cross-compiling commends is right?
Is there any open source ARM simulator (can emulate power consumption) that I can use with clang?

P.S. Because I got error when I use arm-linux-gcc (gcc version 3.X or 4.X), I use officially recommended version 2.95,2 .

Best regards, :slight_smile:

Yi-Mei Chen

generated using llvm-2.9, clang-2.9, and arm-linux-gcc (gcc version 2.95.2),
simulator is sim-panalyzer 2.0.3 .

  LLVM/Clang 2.9 is too old. Please use LLVM/Clang 3.1 release or svn.

Regards,
chenwj

I tried llvm/clang-3.1 previously. It was not work, so I use version 2.9 now.

Best regards,

Yi Mei Chen

2012/9/25 陳韋任 (Wei-Ren Chen) <chenwj@iis.sinica.edu.tw>

^^^^^^^^^^^^^^^
  What the problem you have? Have you tried svn instead? I think
it's better to use svn head and report any problem you have, since
people *only* care about the latest version. Anyway, try commands
below:

$ clang -ccc-host-triple armv4-none-linux-gnueabi -c hello.c -emit-llvm -o hello.bc
$ llc -O3 -o hello.s -march=arm -mcpu=strongarm1100 hello.bc
$ arm-unknown-linux-gnueabi-gcc -mcpu=strongarm1100 hello.s -static -O3 -o hello

Do you use the same C libraray for Clang and GCC?

Regards,
chenwj

These errors are from the assembler, not LLVM. Specifically, your binutils is too old. Given that it doesn’t even recognize the “.syntax” directive, they’re very much too old. You need to upgrade.
-Jim

Hi Jim,

These errors are from the assembler, not LLVM. Specifically, your binutils is
too old. Given that it doesn't even recognize the ".syntax" directive, they're
*very* much too old. You need to upgrade.
-Jim

  She said in her previous mail,

    P.S. Because I got error when I use arm-linux-gcc (gcc version 3.X or 4.X),
    I use officially recommended version 2.95,2.

  I don't know what's her problem while using newer toolchain. :confused:

  奕梅,you should use latest toolchain if possible, and post your problem here
to see if it comes from LLVM/Clang or other place. Also, where do you read that
version is recommended?

Regards,
chenwj

Dear all

I use arm-linux-gcc 2.95.2, because the code generated by version 3.X and 4.X can not run on SimpleScalar.
So I use the arm-linux-gcc 2.95.2 only, the version is recommended by SimpleScalar.
The code generated by arm-linux-gcc 2.95.2 can run on SimpleScalar.
Now I want to use llvm/clang to generate ARM assembly code and arm-linux-gcc 2.95.2 to be assembler.
Unfortunately, I got some error messages below :

hello.s: Assembler messages:
hello.s:1: Error: Unknown pseudo-op: .syntax' hello.s:2: Error: Unknown pseudo-op: .eabi_attribute’
hello.s:3: Error: Unknown pseudo-op: .eabi_attribute' hello.s:4: Error: Unknown pseudo-op: .eabi_attribute’
hello.s:5: Error: Unknown pseudo-op: .eabi_attribute' hello.s:6: Error: Unknown pseudo-op: .eabi_attribute’
make: *** [all] Error 1

Then I try commends :
$ clang -ccc-host-triple armv4-none-linux-gnueabi -c hello.c -emit-llvm -o hello.bc
$ llc -O3 -o hello.s -march=arm -mcpu=strongarm1100 hello.bc

$ arm-linux-gcc -mcpu=strongarm1100 hello.s -static -O3 -o hello

I got some error messages:

hello.s: Assembler messages:
hello.s:1: Error: Unknown pseudo-op: .syntax' hello.s:2: Error: Unknown pseudo-op: .eabi_attribute’
hello.s:3: Error: Unknown pseudo-op: .eabi_attribute' hello.s:4: Error: Unknown pseudo-op: .eabi_attribute’
hello.s:5: Error: Unknown pseudo-op: .eabi_attribute' hello.s:6: Error: Unknown pseudo-op: .eabi_attribute’
hello.s:14: Error: bad instruction push {r11,lr}' hello.s:18: Error: bad instruction pop {r11,lr}’
hello.s:28: Warning: Unrecognized .section attribute: want a,w,x
hello.s:28: Warning: Unrecognized .section attribute: want a,w,x
hello.s:28: Error: Rest of line ignored. First ignored character is `,’

P.S.
The version recommended by SimpleScalar :
gcc 2.95.2
binutils 2.10
glibc 2.1.3

Thanks a lot !

Best regards, :slight_smile:

Yi-Mei Chen

2012/9/26 陳韋任 (Wei-Ren Chen) <chenwj@iis.sinica.edu.tw>

Simplescalar is not compatible with llvm because the binutils simplescalar is based on is ancient.

Jim

The version recommended by SimpleScalar :
gcc 2.95.2
binutils 2.10
glibc 2.1.3

These versions are ancient: at least 12 years old. Surely they do no
support the unified ARM assembler syntax. So, you're out of luck here
- you need to use much newer versions of tools.

Dear all

The reason for using SimpleScalar is that the project, Sim-panalyzer, based on SimpleScalar can estimate power consumption.
If anybody know the other simulators that can estimate power consumption, please contact to me ! Thanks a lot.

Best regards, :slight_smile:

Yi-Mei Chen

2012/9/26 Jim Grosbach <grosbach@apple.com>