blob: 0360ec5d8083513656e432ceb47f84b7c6b5aa15 [file] [log] [blame] [view]
Lorenz Brun605efbe2021-09-28 14:01:01 +02001llvm-efi
2========
3
Leopoldbc93c2b2023-01-14 13:12:23 +01004llvm-efi is a Bazel cc toolchain that uses the sandbox sysroot LLVM/clang with flags targeting freestanding EFI.
Lorenz Brun605efbe2021-09-28 14:01:01 +02005EFI headers are not shipped as part of the toolchain, but are available as a cc_library from `@gnuefi//:gnuefi`.
6
Lorenz Brun605efbe2021-09-28 14:01:01 +02007Usage
8-----
9
Leopold Schabel0ea448a2022-03-16 13:49:32 +010010To use this toolchain explicitly while building a `cc_binary`, do:
Lorenz Brun605efbe2021-09-28 14:01:01 +020011
Leopoldbc93c2b2023-01-14 13:12:23 +010012 bazel build --platforms=//build/platforms:efi_amd64 //foo/bar
Lorenz Brun605efbe2021-09-28 14:01:01 +020013
Leopoldbc93c2b2023-01-14 13:12:23 +010014During an actual build however, the right toolchain should be selected using transitions
15or other configuration mechanisms.
Lorenz Brun605efbe2021-09-28 14:01:01 +020016
17fltused
18-------
19
20This is a special symbol emitted by MSVC-compatible compilers. In an EFI environment it can be ignored, but it needs to
21be defined. See fltused.c for more information on the symbol. Since we cannot build an object file with Bazel and
22building things for toolchains isn't a thing anyways, this file is prebuilt. If this ever needs to be rebuilt (which
23will probably never happen since there is only one static symbol in there) this can be done with the following clang
24invocation:
25
26 clang -target x86_64-unknown-windows -fno-ms-compatibility -fno-ms-extensions -ffreestanding -o fltused.o .o -c fltused.c
27