llvm-project/compiler-rt
Sergey Kosukhin 9f1d90bf91 [compiler-rt] Fix false positive detection of a target in compile-only mode
When `compiler-rt` is configured as a runtime, the configure-time target
detection for builtins is done in compile-only mode, which is basically a
test of whether the newly-built `clang` can compile a simple program with
an additional flag (`-m32` and `-m64` in my case). The problem is that on
my Debian system `clang` can compile `int foo(int x, int y) { return x + y; }`
with `-m32` but fails to include `limits.h` (or any other target-specific
header) for the `i386` target:
```
$ /path/to/build/./bin/clang --target=x86_64-unknown-linux-gnu -DVISIBILITY_HIDDEN  -O3 -DNDEBUG  -m32 -std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer -MD -MT CMakeFiles/clang_rt.builtins-i386.dir/absvdi2.c.o -MF CMakeFiles/clang_rt.builtins-i386.dir/absvdi2.c.o.d -o CMakeFiles/clang_rt.builtins-i386.dir/absvdi2.c.o -c /path/to/src/compiler-rt/lib/builtins/absvdi2.c
In file included from /path/to/src/compiler-rt/lib/builtins/absvdi2.c:13:
In file included from /path/to/src/compiler-rt/lib/builtins/int_lib.h:93:
In file included from /path/to/build/lib/clang/15.0.0/include/limits.h:21:
In file included from /usr/include/limits.h:25:
/usr/include/features.h:364:12: fatal error: 'sys/cdefs.h' file not found
           ^~~~~~~~~~~~~
1 error generated.
```

This is an attempt to make the target detection more robust: extend the test
program with `#include <limits.h>`.

Differential Revision: https://reviews.llvm.org/D127975
2022-06-23 15:11:39 +03:00
..
cmake [compiler-rt] Fix false positive detection of a target in compile-only mode 2022-06-23 15:11:39 +03:00
docs Prepare Compiler-RT for GnuInstallDirs, matching libcxx, document all 2021-07-13 15:21:41 +00:00
include [ORC-RT] Make the ORC runtime C API public. 2022-06-16 19:02:23 -07:00
lib [ORC-RT] Make the ORC runtime C API public. 2022-06-16 19:02:23 -07:00
test [ASan][Darwin] XFAIL test; atos does not show line numbers for globals 2022-06-22 18:19:31 -07:00
tools [GWP-ASan] Add inbuilt options parser. 2021-01-15 12:57:05 -08:00
unittests [Darwin] Limit parallelism for sanitizer tests that use shadow memory on AS 2022-03-31 14:43:28 -07:00
utils [compiler-rt] NFC: Fix trivial typo 2021-09-04 14:12:58 +05:30
www [compiler-rt] Remove forgotten mention of SVN modules, LLVM now uses Git. 2022-03-23 15:29:30 +01:00
.clang-tidy NFC: .clang-tidy: Inherit configs from parents to improve maintainability 2021-06-08 08:25:59 -07:00
.gitignore
CMakeLists.txt [CMake][compiler-rt] Provide a dedicated option for LLVM unwinder 2022-06-14 17:26:25 +00:00
CODE_OWNERS.TXT CODE_OWNERS: update information for builtins 2022-04-25 15:36:52 +00:00
CREDITS.TXT
LICENSE.TXT
README.txt

README.txt

Compiler-RT
================================

This directory and its subdirectories contain source code for the compiler
support routines.

Compiler-RT is open source software. You may freely distribute it under the
terms of the license agreement found in LICENSE.txt.

================================