2

I'm using Mediatek X20 dev board and gcc-linaro-6.3.1-2017.05 version for benchmark aarch64 vs aarch32.

So I want to build binaries as 2 types of aarch32 abi : lp64, ilp32.

From gcc manual, (@ [toolchain_path]/share/doc/gcc/AArch64-Options.html)

It says I can choose ilp32 and lp64 with -mabi option.

But when I use -mabi=lp64 or -mabi=ilp32, gcc makes error like below.

armv8l-linux-gnueabihf-gcc: error: unrecognized argument in option \u2018-mabi=lp64\u2019
armv8l-linux-gnueabihf-gcc: note: valid arguments to \u2018-mabi=\u2019 are: aapcs aapcs-linux apcs-gnu atpcs iwmmxt

How can I make ilp32 and lp64 formated binary?

And How can I check the binary's format?

Thanks for your reply :)

Mathieu
  • 8,840
  • 7
  • 32
  • 45
soongk
  • 259
  • 3
  • 17
  • 1) The path of CROSS_COMPILE and ARCH correct ?? 2) Do you have enough permission to the kernel source path ?? – ntshetty Jun 20 '17 at 08:52
  • my answers :) 1, 2) I just build test.c. So I build with below command. "armv8l-linux-gnueabihf-gcc test.c -o -march=armv8-a+crc -mabi=lp64" – soongk Jun 20 '17 at 09:01

2 Answers2

1

ILP32 and ILP64 are both AArch64, just one of them is limited to 32-bit addresses, but instruction encoding is the same. For that you will need to use a special toolchain. I have not tried this, but you should Google for "AArch64 ILP32 toolchain". Looks like it's not actively maintained though. If you want AArch32, that is just ARMv7 and you need the regular arm toolchain (arm-linux-gnueabihf). https://wiki.linaro.org/Platform/arm64-ilp32

alexst
  • 591
  • 2
  • 6
0

There is now a cross-toolchain for amd64 targetting arm64ilp32 for Debian stable here: https://people.linaro.org/~wookey/ilp32/

It's very new, but seems to work fine. Note that this targets arm64ilp32 only. If you want to also target normal arm64 (LP64) then you need to also install the aarch64-linux-gnu crosscompiler that is already in the archive.

Feedback is very welcome. The g++ cross-complier is not yet installable because there is no corresponding libstdc++:arm64ilp32 available.

Update (sept 2017). This repo now contains a debootstrappable arm64ilp32 set of packages for Debian stable.

Wookey
  • 104
  • 1
  • 2