94 Commits

Author SHA1 Message Date
vanhauser-thc
cafcb343b1 enable llvm 21 2025-05-27 13:35:04 +02:00
vanhauser-thc
b1730d99b6 new LLVM defaults! 2025-05-05 17:46:01 +02:00
vanhauser-thc
6c70d68783 update make flags 2025-04-28 22:09:58 +02:00
fanquake
0d286c9e19
build: improve lld version parsing
Currently, if LLD is in a weird location and has a version string like:
```bash
Ubuntu LLD 18.1.3 (compatible with GNU linkers)
```
or
```bash
Homebrew LLD 20.1.2 (compatible with GNU linkers)
```

The version comparison will fail:
```bash
GNUmakefile.llvm:247: ld.lld found in a weird location (/opt/homebrew/bin/ld.lld) and its of a different version than LLMV (LLD vs. 20.1.2) - cannot enable LTO mode
```

Fix that by replacing the usage of awk, with the same sed command used
to retrieve the version of Clang, which fixes the issue:
```bash
GNUmakefile.llvm:245: ld.lld found in a weird location (/opt/homebrew/bin/ld.lld), but its the same version as LLVM so we will allow it
```
2025-04-16 13:37:15 +01:00
Vincent Andrae
0e3c82e2ea
Merge branch 'dev' into ios 2025-02-26 17:59:07 +01:00
Vincent Andrae
0cd932c4b5 Add support for iOS builds
- Define IS_IOS variable and add conditional compilation flags for iOS
- Enable binary signing with ldid for iOS builds
2025-02-25 11:58:06 +01:00
vanhauser-thc
a635aa8cba potential macos fix 2025-02-23 13:22:44 +01:00
Martin Nyhus
ea2f112016
Fix debug prefix for afl-cc, llvm-rt
After the llvm_mode directory was removed in 996986bed5 and compilation
started happening from the root, adding llvm_mode to the debug path is
incorrect and causes source file lookups to fail when debugging e.g.
afl-cc or the llvm pass.
2025-02-14 12:19:36 +01:00
vanhauser-thc
30861b5d54 llvm 20 support 2025-01-16 15:32:58 +01:00
vanhauser-thc
50e2f9d46c loose file and shared memory permissions on Android and iPhone 2024-12-11 10:36:31 +01:00
vanhauser-thc
f5a672f9d8 update makefile for llvm 2024-12-04 08:45:54 +01:00
Oliver Schneider
10883b1392
Bumping the upper version boundary for LLVM to 20, which is currently available in prerelease, 19 being latest stable 2024-12-03 15:57:50 +00:00
Abhinav Garg
0e3157375b Unsetting AFL_LLVM_ALLOWLIST and AFL_LLVM_DENYLIST environment variables 2024-11-11 01:24:11 -08:00
hexcoder-
f39cf57eac enhance backward compatibility and portability 2024-11-09 22:31:07 +01:00
vanhauser-thc
20c46c0ed6 nits 2024-10-15 15:18:51 +02:00
Carlo Cabrera
cb5a61d8a1
Update macOS linker flags in GNUmakefile.llvm
`-flat_namespace` is effectively deprecated and doesn't really work as
expected these days. Omitting the `-flat_namespace` means that binaries
are built with a two-level namespace, which don't support
`-undefined suppress`.

The idiomatic way of telling the linker to look up undefined symbols at
runtime is using `-undefined dynamic_lookup`, which is supported by a
two-level namespace.

See also:
ocaml/ocaml#10723
mono/mono#21257
2024-10-02 17:56:43 +08:00
Thomas Hebb
256bc6ab42 Fix "/bin/sh:" errors when building without LLVM
In GNUmakefile.llvm, several variables are unconditionally populated
by expanding $(LLVMVER) and $(LLVM_CONFIG) inside shell commands.
However, when LLVM is not present, both those variables are empty,
meaning that the shell commands end up malformed and emit harmless, but
noisy, errors like this one:

  /bin/sh: --: invalid option
  Usage:	/bin/sh [GNU long option] [option] ...
  	/bin/sh [GNU long option] [option] script-file ...
  GNU long options:
  	--debug
  	--debugger
  	--dump-po-strings
  	--dump-strings
  	--help
  	--init-file
  	--login
  	--noediting
  	--noprofile
  	--norc
  	--posix
  	--pretty-print
  	--rcfile
  	--rpm-requires
  	--restricted
  	--verbose
  	--version
  Shell options:
  	-ilrsD or -c command or -O shopt_option		(invocation only)
  	-abefhkmnptuvxBCHP or -o option
  /bin/sh: line 1: test: -gt: unary operator expected
  /bin/sh: line 1: test: -lt: unary operator expected
  /bin/sh: line 1: test: -ge: unary operator expected
  /bin/sh: line 1: test: -ge: unary operator expected

Fix the problem by only populating the "downstream" variables if the
upstream ones have values.
2024-08-06 11:27:01 -07:00
Dominik Maier
31a1fbae33 Fix LLVM mode build on MacOS 2024-07-23 14:06:19 +02:00
Oliver Schneider
88e2affe73
Fixing change from PR#2152, misspelled variable names 2024-07-13 21:29:41 +00:00
Oliver Schneider
835a4b6497
Some fixups to the GNUmakefile.llvm
* rely less on the shell and more on GNU make to parse the versions
* fixed retrieval of minor version (for 18.1.8 it gave 8 instead of 1!)
* auto-detection of llvm-config within the supported version range
* replaced backticks by `$(...)` syntax
* tested against `busybox static-sh`, `bash`, `dash` and `csh`
2024-07-10 07:55:37 +00:00
vanhauser-thc
938edab25f consider llvm 18 stable 2024-05-14 12:45:09 +02:00
=
ee07fc9f6d fix rc minor version parsing 2024-03-12 08:20:08 +00:00
=
2300088446 support parsing of llvm rc minor version 2024-03-11 10:12:53 +00:00
vanhauser-thc
5ba66a8860 final touches for skipdet 2024-02-01 15:22:51 +01:00
vanhauser-thc
db65dc5a0b lto llvm 12+ 2024-01-09 16:50:57 +01:00
vanhauser-thc
1fc1b32db2 initial simple injection detection support 2023-12-27 13:53:11 +01:00
vanhauser-thc
d97c7e4258 nits 2023-10-03 11:14:59 +02:00
David Carlier
5b55cf84c1 disable exceptions on LLVM/GCC plugins, decreasing further the libraries's binaries size in the process. 2023-08-05 14:21:56 +01:00
Jesse Schwartzentruber
82635dc656 Use CPPFLAGS for C++ too. 2023-07-31 11:50:33 -04:00
vanhauser-thc
705cdf45fc temp cmplog fixes 2023-07-23 13:05:10 +02:00
vanhauser-thc
f37c4c8662 update llvm recommendations 2023-07-05 13:03:17 +02:00
fanquake
234d55ccd5
build: adjust LLVM development version check
Adjust version check to only warn for LLVM 17.x and newer, which are the
development versions. Otherwise we'll get:
```bash
make LLVM_CONFIG=llvm-config-15 CC=clang-15 CXX=clang++-15
<snip>
GNUmakefile.llvm:69: you are using an in-development llvm version - this might break llvm_mode!
```

for versions that are supported, and not in development.
2023-06-06 10:29:54 +01:00
vanhauser-thc
9324f3f628 rewrote PCGUARD 2023-06-01 12:19:45 +02:00
Christian Holler (:decoder)
e956f23a77
Source Code Coverage support for Nyx (Part 1) (#1720)
* Additional source code reformatting in afl-compiler-rt

* Add source code coverage support to afl-compiler-rt (for use with Nyx)
2023-04-28 11:35:22 +02:00
vanhauser-thc
3e84d6a2ae afl++ -> AFL++ 2023-04-27 11:49:00 +02:00
vanhauser-thc
120d009e7d wasm support 2023-04-15 11:36:58 +02:00
David Carlier
afd2ea90df LLVM plugin 16+ support proposal.
- Lifting the standard to C++17.
- Beyond the cosmetic changes, it boils down to BasicBlock::getInstList being
  no longer available (and reading the header it is no accident).
2023-01-20 22:12:35 +00:00
David Carlier
e02753fd7d Silent more deprecation warning for clang 15 and onwards 2022-12-07 19:48:20 +00:00
vanhauser-thc
4b7126c46c nits 2022-11-17 10:58:20 +01:00
vanhauser-thc
b2f12c3712 llvm debug 2022-11-10 16:12:37 +01:00
vanhauser-thc
9a77a6fa92 nits 2022-10-19 08:50:17 +02:00
quinox
680e6e91a1 Support building LTO on Gentoo 2022-10-08 09:51:26 +02:00
Nikita Popov
9b6ad933cd Allow building LTO component with LLVM 15 2022-09-14 11:35:55 +02:00
vanhauser-thc
0fe39e4768 egrep -> grep -e 2022-09-05 13:57:32 +02:00
vanhauser-thc
6dfc9aaab0 disable LTO for llvm 15 :-( 2022-05-23 10:52:34 +02:00
HexRabbit
4c0281adc8
Fix missing dependency
add `instrumentation/afl-llvm-common.o` to `SanitizerCoverageLTO.so`'s
dependency list
2022-05-16 16:10:07 +08:00
Richard W.M. Jones
7f56a93f5d GNUmakefile.llvm: Avoid creating circular links
Building into a DESTDIR gives circular links such as:

lrwxrwxrwx. 1 rjones rjones 17 Mar 31 18:09 /home/rjones/rpmbuild/BUILDROOT/american-fuzzy-lop-4.00c-3.git285a5cb3.fc37.x86_64/usr/lib64/afl/afl-compiler-rt.o -> afl-compiler-rt.o

I have to admit I've no idea what the original link command is trying
to achieve, but it's clearly wrong and deleting it fixes the problem.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
2022-03-31 18:20:43 +01:00
vanhauser-thc
fa2b040476 fix LTO with cmplog and laf 2022-03-18 15:00:24 +01:00
vanhauser-thc
e4f201707f make LTO pass work too plus some fixes 2022-03-17 14:35:15 +01:00
vanhauser-thc
db360332c4 make llvm 14-dev working. again. 2021-12-09 14:33:56 +01:00