Page MenuHomePhabricator

First-pass at ARM hard/soft-float multilib driver (NOT WORKING YET)
Needs ReviewPublic

Authored by kelledin on Sep 30 2018, 2:50 PM.

Details

Summary
This is my first crack at implementing working ARM EABI multilib support
(where multilib support is between hard/soft float ONLY, not between 32-bit
and 64-bit).  This is currently NOT suitable for merging; I'm only posting
it for guidance as to what exactly I'm missing.  Specifically, for the
default-hardfloat target (arm-linux-gnueabihf), clang selects the correct
GCC suffix (/sf vs /hf) but consistently selects /usr/lib/arm-linux-gnueabihf
as the library directory, even if soft-float flags are passed.  This leaves
binutils trying to mix hard-float/soft-float objects, which of course fails
miserably.  AIUI the multilib driver *should* trigger the selection of
/usr/lib/arm-linux-gnueabi instead.

I can produce verbose output from clang's behavior upon request.  Be aware
that this changeset depends on https://reviews.llvm.org/D52149 for compiler-rt.

Diff Detail

Event Timeline

kelledin created this revision.Sep 30 2018, 2:50 PM
kristina added subscribers: rsmith, kristina.

Accepted blocking differential D52149, updated reviewers to include ARM code owner and @rsmith.

I think that you may be better off posting a RFC to llvm-dev to get discussion on the best approach here. It would also be good to step back a bit and consider the requirements, as it stands it looks like this might be a solution for just one particular multilib layout and we might be able to get some input on some other use cases that others may have. I personally would like to enable clang to be able to query a gcc installation to find out (and potentially cache) its multlib directories as I've been told for the Arm embedded toolchain that the directory structure is not fixed and may change at any point in the future.

Another unrelated thing that may be worth doing is to check for other places where the target might affect the code-generation independently of -mfloat-abi, I'm thinking in particular of builtin functions as this has changed a bit over the past few years.

lib/Driver/ToolChains/Gnu.cpp
1441

When I saw EABIMultilibs I first thought of multilib support for arm-none-eabi , I think that this may be worth renaming to something like ArmLinuxGNUEABI as this could be specific to Linux Distributions.

1451

AltTriple doesn't seem to be used anywhere in the rest of the function?

1454

Another place where this is used, and clang can't yet handle, is the GCC Embedded toolchain arm-none-eabi which includes both hard and soft float abi libraries. These have a different structure to the one presented here though.

1458

I definitely agree here. It seems to me to be quite fragile to hard-code in directory structures of gcc toolchains or linux distributions that can, and do, vary over time.