This is an archive of the discontinued LLVM Phabricator instance.

Explicitly Craft a Path to Compiler-RT Builtins on Bare Metal Targets
Needs ReviewPublic

Authored by CodaFi on Mar 15 2019, 11:54 AM.

Details

Summary

D33259 hard-coded a linker flag relative to a linker library search path that should have allowed it to find libclang_rt.builtins-$ARCH.a under the resource directory automatically. Unfortunately, both the flag and the search path are incorrect, which leads to workarounds like double-suffixes in linker invocations.

The bare metal toolchain now uses a more standard hook to get the right arch-specific compiler-rt, and constructs a full path relative to the resource directory for the linker input.

Diff Detail

Repository
rC Clang

Event Timeline

CodaFi created this revision.Mar 15 2019, 11:54 AM
CodaFi added a subscriber: phosek.

+@phosek Who seems to be the last significant contributor to this file.

phosek added inline comments.Apr 12 2019, 2:52 PM
clang/lib/Driver/ToolChains/BareMetal.cpp
173

Would it be possible to support the per-target runtimes directory layout as well?

CodaFi marked an inline comment as done.Apr 15 2019, 6:36 AM
CodaFi added inline comments.
clang/lib/Driver/ToolChains/BareMetal.cpp
173

Does that make sense in the context of bare metal triples? My understanding of the layout of the resource directory for these targets is hazy, but I was under the impression that each target architecture having its own namespaced copy of compiler-rt in <RESOURCE_DIR>/lib *is* how we do per-target runtimes.

phosek added inline comments.Nov 5 2019, 11:13 AM
clang/lib/Driver/ToolChains/BareMetal.cpp
173

The per-target runtimes directory layout always expects a triple, i.e. <RESOURCE_DIR>/lib/<triple>. In case of bare metal, the triple would be e.g. armv6m-none-eabi.