soongk
soongk

Reputation: 279

How can I build ARMv8 aarch32 binary?

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 :)

Upvotes: 2

Views: 2463

Answers (2)

Wookey
Wookey

Reputation: 204

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.

Upvotes: 0

alexst
alexst

Reputation: 631

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

Upvotes: 1

Related Questions