.. | .. |
---|
| 1 | +# SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | |
---|
2 | 3 | ifeq ($(src-perf),) |
---|
3 | 4 | src-perf := $(srctree)/tools/perf |
---|
.. | .. |
---|
15 | 16 | detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected) |
---|
16 | 17 | detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) |
---|
17 | 18 | |
---|
18 | | -CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS) |
---|
| 19 | +CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) |
---|
19 | 20 | |
---|
20 | 21 | include $(srctree)/tools/scripts/Makefile.arch |
---|
21 | 22 | |
---|
22 | 23 | $(call detected_var,SRCARCH) |
---|
23 | 24 | |
---|
24 | 25 | NO_PERF_REGS := 1 |
---|
25 | | -NO_SYSCALL_TABLE := 1 |
---|
| 26 | + |
---|
| 27 | +ifneq ($(NO_SYSCALL_TABLE),1) |
---|
| 28 | + NO_SYSCALL_TABLE := 1 |
---|
| 29 | + |
---|
| 30 | + ifeq ($(SRCARCH),x86) |
---|
| 31 | + ifeq (${IS_64_BIT}, 1) |
---|
| 32 | + NO_SYSCALL_TABLE := 0 |
---|
| 33 | + endif |
---|
| 34 | + else |
---|
| 35 | + ifeq ($(SRCARCH),$(filter $(SRCARCH),powerpc arm64 s390)) |
---|
| 36 | + NO_SYSCALL_TABLE := 0 |
---|
| 37 | + endif |
---|
| 38 | + endif |
---|
| 39 | + |
---|
| 40 | + ifneq ($(NO_SYSCALL_TABLE),1) |
---|
| 41 | + CFLAGS += -DHAVE_SYSCALL_TABLE_SUPPORT |
---|
| 42 | + endif |
---|
| 43 | +endif |
---|
26 | 44 | |
---|
27 | 45 | # Additional ARCH settings for ppc |
---|
28 | 46 | ifeq ($(SRCARCH),powerpc) |
---|
29 | 47 | NO_PERF_REGS := 0 |
---|
30 | | - NO_SYSCALL_TABLE := 0 |
---|
31 | 48 | CFLAGS += -I$(OUTPUT)arch/powerpc/include/generated |
---|
32 | 49 | LIBUNWIND_LIBS := -lunwind -lunwind-ppc64 |
---|
33 | 50 | endif |
---|
.. | .. |
---|
36 | 53 | ifeq ($(SRCARCH),x86) |
---|
37 | 54 | $(call detected,CONFIG_X86) |
---|
38 | 55 | ifeq (${IS_64_BIT}, 1) |
---|
39 | | - NO_SYSCALL_TABLE := 0 |
---|
40 | 56 | CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -I$(OUTPUT)arch/x86/include/generated |
---|
41 | 57 | ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S |
---|
42 | 58 | LIBUNWIND_LIBS = -lunwind-x86_64 -lunwind -llzma |
---|
.. | .. |
---|
54 | 70 | |
---|
55 | 71 | ifeq ($(SRCARCH),arm64) |
---|
56 | 72 | NO_PERF_REGS := 0 |
---|
57 | | - NO_SYSCALL_TABLE := 0 |
---|
58 | 73 | CFLAGS += -I$(OUTPUT)arch/arm64/include/generated |
---|
59 | 74 | LIBUNWIND_LIBS = -lunwind -lunwind-aarch64 |
---|
60 | 75 | endif |
---|
61 | 76 | |
---|
| 77 | +ifeq ($(SRCARCH),riscv) |
---|
| 78 | + NO_PERF_REGS := 0 |
---|
| 79 | +endif |
---|
| 80 | + |
---|
| 81 | +ifeq ($(SRCARCH),csky) |
---|
| 82 | + NO_PERF_REGS := 0 |
---|
| 83 | +endif |
---|
| 84 | + |
---|
62 | 85 | ifeq ($(ARCH),s390) |
---|
63 | 86 | NO_PERF_REGS := 0 |
---|
64 | | - NO_SYSCALL_TABLE := 0 |
---|
65 | 87 | CFLAGS += -fPIC -I$(OUTPUT)arch/s390/include/generated |
---|
66 | 88 | endif |
---|
67 | 89 | |
---|
.. | .. |
---|
69 | 91 | $(call detected,CONFIG_PERF_REGS) |
---|
70 | 92 | endif |
---|
71 | 93 | |
---|
72 | | -ifneq ($(NO_SYSCALL_TABLE),1) |
---|
73 | | - CFLAGS += -DHAVE_SYSCALL_TABLE_SUPPORT |
---|
74 | | -endif |
---|
75 | | - |
---|
76 | 94 | # So far there's only x86 and arm libdw unwind support merged in perf. |
---|
77 | 95 | # Disable it on all other architectures in case libdw unwind |
---|
78 | 96 | # support is detected in system. Add supported architectures |
---|
79 | 97 | # to the check. |
---|
80 | | -ifneq ($(SRCARCH),$(filter $(SRCARCH),x86 arm arm64 powerpc s390)) |
---|
| 98 | +ifneq ($(SRCARCH),$(filter $(SRCARCH),x86 arm arm64 powerpc s390 csky riscv)) |
---|
81 | 99 | NO_LIBDW_DWARF_UNWIND := 1 |
---|
82 | 100 | endif |
---|
83 | 101 | |
---|
.. | .. |
---|
108 | 126 | FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS) |
---|
109 | 127 | FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS) |
---|
110 | 128 | FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS) |
---|
| 129 | + |
---|
| 130 | +FEATURE_CHECK_LDFLAGS-libunwind-arm += -lunwind -lunwind-arm |
---|
| 131 | +FEATURE_CHECK_LDFLAGS-libunwind-aarch64 += -lunwind -lunwind-aarch64 |
---|
| 132 | +FEATURE_CHECK_LDFLAGS-libunwind-x86 += -lunwind -llzma -lunwind-x86 |
---|
| 133 | +FEATURE_CHECK_LDFLAGS-libunwind-x86_64 += -lunwind -llzma -lunwind-x86_64 |
---|
| 134 | + |
---|
| 135 | +FEATURE_CHECK_LDFLAGS-libcrypto = -lcrypto |
---|
111 | 136 | |
---|
112 | 137 | ifdef CSINCLUDES |
---|
113 | 138 | LIBOPENCSD_CFLAGS := -I$(CSINCLUDES) |
---|
.. | .. |
---|
145 | 170 | FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS) |
---|
146 | 171 | FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf |
---|
147 | 172 | |
---|
| 173 | +ifdef LIBZSTD_DIR |
---|
| 174 | + LIBZSTD_CFLAGS := -I$(LIBZSTD_DIR)/lib |
---|
| 175 | + LIBZSTD_LDFLAGS := -L$(LIBZSTD_DIR)/lib |
---|
| 176 | +endif |
---|
| 177 | +FEATURE_CHECK_CFLAGS-libzstd := $(LIBZSTD_CFLAGS) |
---|
| 178 | +FEATURE_CHECK_LDFLAGS-libzstd := $(LIBZSTD_LDFLAGS) |
---|
| 179 | + |
---|
148 | 180 | FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi |
---|
149 | 181 | # include ARCH specific config |
---|
150 | 182 | -include $(src-perf)/arch/$(SRCARCH)/Makefile |
---|
.. | .. |
---|
165 | 197 | |
---|
166 | 198 | # Treat warnings as errors unless directed not to |
---|
167 | 199 | ifneq ($(WERROR),0) |
---|
168 | | - CFLAGS += -Werror |
---|
| 200 | + CORE_CFLAGS += -Werror |
---|
169 | 201 | CXXFLAGS += -Werror |
---|
170 | 202 | endif |
---|
171 | 203 | |
---|
.. | .. |
---|
175 | 207 | |
---|
176 | 208 | ifeq ($(DEBUG),0) |
---|
177 | 209 | ifeq ($(CC_NO_CLANG), 0) |
---|
178 | | - CFLAGS += -O3 |
---|
| 210 | + CORE_CFLAGS += -O3 |
---|
179 | 211 | else |
---|
180 | | - CFLAGS += -O6 |
---|
| 212 | + CORE_CFLAGS += -O6 |
---|
181 | 213 | endif |
---|
182 | 214 | endif |
---|
183 | 215 | |
---|
.. | .. |
---|
190 | 222 | endif |
---|
191 | 223 | |
---|
192 | 224 | # Try different combinations to accommodate systems that only have |
---|
193 | | -# python[2][-config] in weird combinations but always preferring |
---|
194 | | -# python2 and python2-config as per pep-0394. If we catch a |
---|
195 | | -# python[-config] in version 3, the version check will kill it. |
---|
196 | | -PYTHON2 := $(if $(call get-executable,python2),python2,python) |
---|
197 | | -override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON2)) |
---|
198 | | -PYTHON2_CONFIG := \ |
---|
199 | | - $(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config) |
---|
200 | | -override PYTHON_CONFIG := \ |
---|
201 | | - $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG)) |
---|
| 225 | +# python[2][3]-config in weird combinations in the following order of |
---|
| 226 | +# priority from lowest to highest: |
---|
| 227 | +# * python3-config |
---|
| 228 | +# * python-config |
---|
| 229 | +# * python2-config as per pep-0394. |
---|
| 230 | +# * $(PYTHON)-config (If PYTHON is user supplied but PYTHON_CONFIG isn't) |
---|
| 231 | +# |
---|
| 232 | +PYTHON_AUTO := python-config |
---|
| 233 | +PYTHON_AUTO := $(if $(call get-executable,python3-config),python3-config,$(PYTHON_AUTO)) |
---|
| 234 | +PYTHON_AUTO := $(if $(call get-executable,python-config),python-config,$(PYTHON_AUTO)) |
---|
| 235 | +PYTHON_AUTO := $(if $(call get-executable,python2-config),python2-config,$(PYTHON_AUTO)) |
---|
| 236 | + |
---|
| 237 | +# If PYTHON is defined but PYTHON_CONFIG isn't, then take $(PYTHON)-config as if it was the user |
---|
| 238 | +# supplied value for PYTHON_CONFIG. Because it's "user supplied", error out if it doesn't exist. |
---|
| 239 | +ifdef PYTHON |
---|
| 240 | + ifndef PYTHON_CONFIG |
---|
| 241 | + PYTHON_CONFIG_AUTO := $(call get-executable,$(PYTHON)-config) |
---|
| 242 | + PYTHON_CONFIG := $(if $(PYTHON_CONFIG_AUTO),$(PYTHON_CONFIG_AUTO),\ |
---|
| 243 | + $(call $(error $(PYTHON)-config not found))) |
---|
| 244 | + endif |
---|
| 245 | +endif |
---|
| 246 | + |
---|
| 247 | +# Select either auto detected python and python-config or use user supplied values if they are |
---|
| 248 | +# defined. get-executable-or-default fails with an error if the first argument is supplied but |
---|
| 249 | +# doesn't exist. |
---|
| 250 | +override PYTHON_CONFIG := $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON_AUTO)) |
---|
| 251 | +override PYTHON := $(call get-executable-or-default,PYTHON,$(subst -config,,$(PYTHON_CONFIG))) |
---|
202 | 252 | |
---|
203 | 253 | grep-libs = $(filter -l%,$(1)) |
---|
204 | 254 | strip-libs = $(filter-out -l%,$(1)) |
---|
.. | .. |
---|
220 | 270 | PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil |
---|
221 | 271 | PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null) |
---|
222 | 272 | FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) |
---|
| 273 | + ifeq ($(CC_NO_CLANG), 0) |
---|
| 274 | + PYTHON_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PYTHON_EMBED_CCOPTS)) |
---|
| 275 | + endif |
---|
223 | 276 | endif |
---|
224 | 277 | |
---|
225 | 278 | FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS) |
---|
226 | 279 | FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS) |
---|
227 | 280 | |
---|
228 | | -CFLAGS += -fno-omit-frame-pointer |
---|
229 | | -CFLAGS += -ggdb3 |
---|
230 | | -CFLAGS += -funwind-tables |
---|
231 | | -CFLAGS += -Wall |
---|
232 | | -CFLAGS += -Wextra |
---|
233 | | -CFLAGS += -std=gnu99 |
---|
| 281 | +FEATURE_CHECK_LDFLAGS-libaio = -lrt |
---|
| 282 | + |
---|
| 283 | +FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl |
---|
| 284 | + |
---|
| 285 | +CORE_CFLAGS += -fno-omit-frame-pointer |
---|
| 286 | +CORE_CFLAGS += -ggdb3 |
---|
| 287 | +CORE_CFLAGS += -funwind-tables |
---|
| 288 | +CORE_CFLAGS += -Wall |
---|
| 289 | +CORE_CFLAGS += -Wextra |
---|
| 290 | +CORE_CFLAGS += -std=gnu99 |
---|
234 | 291 | |
---|
235 | 292 | CXXFLAGS += -std=gnu++11 -fno-exceptions -fno-rtti |
---|
236 | 293 | CXXFLAGS += -Wall |
---|
.. | .. |
---|
245 | 302 | |
---|
246 | 303 | EXTLIBS = -lpthread -lrt -lm -ldl |
---|
247 | 304 | |
---|
| 305 | +ifneq ($(TCMALLOC),) |
---|
| 306 | + CFLAGS += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free |
---|
| 307 | + EXTLIBS += -ltcmalloc |
---|
| 308 | +endif |
---|
| 309 | + |
---|
248 | 310 | ifeq ($(FEATURES_DUMP),) |
---|
249 | 311 | include $(srctree)/tools/build/Makefile.feature |
---|
250 | 312 | else |
---|
.. | .. |
---|
252 | 314 | endif |
---|
253 | 315 | |
---|
254 | 316 | ifeq ($(feature-stackprotector-all), 1) |
---|
255 | | - CFLAGS += -fstack-protector-all |
---|
| 317 | + CORE_CFLAGS += -fstack-protector-all |
---|
256 | 318 | endif |
---|
257 | 319 | |
---|
258 | 320 | ifeq ($(DEBUG),0) |
---|
259 | 321 | ifeq ($(feature-fortify-source), 1) |
---|
260 | | - CFLAGS += -D_FORTIFY_SOURCE=2 |
---|
| 322 | + CORE_CFLAGS += -D_FORTIFY_SOURCE=2 |
---|
261 | 323 | endif |
---|
262 | 324 | endif |
---|
263 | 325 | |
---|
| 326 | +INC_FLAGS += -I$(srctree)/tools/lib/perf/include |
---|
264 | 327 | INC_FLAGS += -I$(src-perf)/util/include |
---|
265 | 328 | INC_FLAGS += -I$(src-perf)/arch/$(SRCARCH)/include |
---|
266 | | -INC_FLAGS += -I$(srctree)/tools/include/uapi |
---|
267 | 329 | INC_FLAGS += -I$(srctree)/tools/include/ |
---|
268 | 330 | INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi |
---|
| 331 | +INC_FLAGS += -I$(srctree)/tools/include/uapi |
---|
269 | 332 | INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/ |
---|
270 | 333 | INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/ |
---|
271 | 334 | |
---|
.. | .. |
---|
280 | 343 | INC_FLAGS += -I$(src-perf) |
---|
281 | 344 | INC_FLAGS += -I$(srctree)/tools/lib/ |
---|
282 | 345 | |
---|
283 | | -CFLAGS += $(INC_FLAGS) |
---|
| 346 | +CORE_CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE |
---|
| 347 | + |
---|
| 348 | +CFLAGS += $(CORE_CFLAGS) $(INC_FLAGS) |
---|
284 | 349 | CXXFLAGS += $(INC_FLAGS) |
---|
285 | 350 | |
---|
286 | | -CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE |
---|
| 351 | +LIBPERF_CFLAGS := $(CORE_CFLAGS) $(EXTRA_CFLAGS) |
---|
287 | 352 | |
---|
288 | 353 | ifeq ($(feature-sync-compare-and-swap), 1) |
---|
289 | 354 | CFLAGS += -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT |
---|
.. | .. |
---|
309 | 374 | endif |
---|
310 | 375 | |
---|
311 | 376 | ifeq ($(feature-eventfd), 1) |
---|
312 | | - CFLAGS += -DHAVE_EVENTFD |
---|
| 377 | + CFLAGS += -DHAVE_EVENTFD_SUPPORT |
---|
313 | 378 | endif |
---|
314 | 379 | |
---|
315 | 380 | ifeq ($(feature-get_current_dir_name), 1) |
---|
.. | .. |
---|
318 | 383 | |
---|
319 | 384 | ifeq ($(feature-gettid), 1) |
---|
320 | 385 | CFLAGS += -DHAVE_GETTID |
---|
| 386 | +endif |
---|
| 387 | + |
---|
| 388 | +ifeq ($(feature-file-handle), 1) |
---|
| 389 | + CFLAGS += -DHAVE_FILE_HANDLE |
---|
321 | 390 | endif |
---|
322 | 391 | |
---|
323 | 392 | ifdef NO_LIBELF |
---|
.. | .. |
---|
346 | 415 | NO_LIBBPF := 1 |
---|
347 | 416 | NO_JVMTI := 1 |
---|
348 | 417 | else |
---|
| 418 | + ifneq ($(filter s% -fsanitize=address%,$(EXTRA_CFLAGS),),) |
---|
| 419 | + ifneq ($(shell ldconfig -p | grep libasan >/dev/null 2>&1; echo $$?), 0) |
---|
| 420 | + msg := $(error No libasan found, please install libasan); |
---|
| 421 | + endif |
---|
| 422 | + endif |
---|
| 423 | + |
---|
| 424 | + ifneq ($(filter s% -fsanitize=undefined%,$(EXTRA_CFLAGS),),) |
---|
| 425 | + ifneq ($(shell ldconfig -p | grep libubsan >/dev/null 2>&1; echo $$?), 0) |
---|
| 426 | + msg := $(error No libubsan found, please install libubsan); |
---|
| 427 | + endif |
---|
| 428 | + endif |
---|
| 429 | + |
---|
349 | 430 | ifneq ($(filter s% -static%,$(LDFLAGS),),) |
---|
350 | 431 | msg := $(error No static glibc found, please install glibc-static); |
---|
351 | 432 | else |
---|
.. | .. |
---|
378 | 459 | CFLAGS += -DHAVE_GLIBC_SUPPORT |
---|
379 | 460 | endif |
---|
380 | 461 | |
---|
| 462 | +ifeq ($(feature-libaio), 1) |
---|
| 463 | + ifndef NO_AIO |
---|
| 464 | + CFLAGS += -DHAVE_AIO_SUPPORT |
---|
| 465 | + endif |
---|
| 466 | +endif |
---|
| 467 | + |
---|
381 | 468 | ifdef NO_DWARF |
---|
382 | 469 | NO_LIBDW_DWARF_UNWIND := 1 |
---|
383 | 470 | endif |
---|
.. | .. |
---|
391 | 478 | $(call detected,CONFIG_SETNS) |
---|
392 | 479 | endif |
---|
393 | 480 | |
---|
394 | | -ifndef NO_CORESIGHT |
---|
| 481 | +ifdef CORESIGHT |
---|
| 482 | + $(call feature_check,libopencsd) |
---|
395 | 483 | ifeq ($(feature-libopencsd), 1) |
---|
396 | 484 | CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS) |
---|
| 485 | + ifeq ($(feature-reallocarray), 0) |
---|
| 486 | + CFLAGS += -DCOMPAT_NEED_REALLOCARRAY |
---|
| 487 | + endif |
---|
397 | 488 | LDFLAGS += $(LIBOPENCSD_LDFLAGS) |
---|
398 | 489 | EXTLIBS += $(OPENCSDLIBS) |
---|
399 | 490 | $(call detected,CONFIG_LIBOPENCSD) |
---|
.. | .. |
---|
411 | 502 | EXTLIBS += -lelf |
---|
412 | 503 | $(call detected,CONFIG_LIBELF) |
---|
413 | 504 | |
---|
414 | | - ifeq ($(feature-libelf-mmap), 1) |
---|
415 | | - CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT |
---|
416 | | - endif |
---|
417 | | - |
---|
418 | 505 | ifeq ($(feature-libelf-getphdrnum), 1) |
---|
419 | 506 | CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT |
---|
420 | 507 | endif |
---|
.. | .. |
---|
427 | 514 | |
---|
428 | 515 | ifeq ($(feature-libelf-getshdrstrndx), 1) |
---|
429 | 516 | CFLAGS += -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT |
---|
| 517 | + endif |
---|
| 518 | + |
---|
| 519 | + ifndef NO_LIBDEBUGINFOD |
---|
| 520 | + $(call feature_check,libdebuginfod) |
---|
| 521 | + ifeq ($(feature-libdebuginfod), 1) |
---|
| 522 | + CFLAGS += -DHAVE_DEBUGINFOD_SUPPORT |
---|
| 523 | + EXTLIBS += -ldebuginfod |
---|
| 524 | + endif |
---|
430 | 525 | endif |
---|
431 | 526 | |
---|
432 | 527 | ifndef NO_DWARF |
---|
.. | .. |
---|
445 | 540 | ifeq ($(feature-bpf), 1) |
---|
446 | 541 | CFLAGS += -DHAVE_LIBBPF_SUPPORT |
---|
447 | 542 | $(call detected,CONFIG_LIBBPF) |
---|
| 543 | + |
---|
| 544 | + # detecting libbpf without LIBBPF_DYNAMIC, so make VF=1 shows libbpf detection status |
---|
| 545 | + $(call feature_check,libbpf) |
---|
| 546 | + ifdef LIBBPF_DYNAMIC |
---|
| 547 | + ifeq ($(feature-libbpf), 1) |
---|
| 548 | + EXTLIBS += -lbpf |
---|
| 549 | + $(call detected,CONFIG_LIBBPF_DYNAMIC) |
---|
| 550 | + else |
---|
| 551 | + dummy := $(error Error: No libbpf devel library found, please install libbpf-devel); |
---|
| 552 | + endif |
---|
| 553 | + endif |
---|
448 | 554 | endif |
---|
449 | 555 | |
---|
450 | 556 | ifndef NO_DWARF |
---|
.. | .. |
---|
487 | 593 | ifndef NO_LIBUNWIND |
---|
488 | 594 | have_libunwind := |
---|
489 | 595 | |
---|
| 596 | + $(call feature_check,libunwind-x86) |
---|
490 | 597 | ifeq ($(feature-libunwind-x86), 1) |
---|
491 | 598 | $(call detected,CONFIG_LIBUNWIND_X86) |
---|
492 | 599 | CFLAGS += -DHAVE_LIBUNWIND_X86_SUPPORT |
---|
.. | .. |
---|
495 | 602 | have_libunwind = 1 |
---|
496 | 603 | endif |
---|
497 | 604 | |
---|
| 605 | + $(call feature_check,libunwind-aarch64) |
---|
498 | 606 | ifeq ($(feature-libunwind-aarch64), 1) |
---|
499 | 607 | $(call detected,CONFIG_LIBUNWIND_AARCH64) |
---|
500 | 608 | CFLAGS += -DHAVE_LIBUNWIND_AARCH64_SUPPORT |
---|
.. | .. |
---|
588 | 696 | $(call detected,CONFIG_TRACE) |
---|
589 | 697 | else |
---|
590 | 698 | ifndef NO_LIBAUDIT |
---|
| 699 | + $(call feature_check,libaudit) |
---|
591 | 700 | ifneq ($(feature-libaudit), 1) |
---|
592 | 701 | msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); |
---|
593 | 702 | NO_LIBAUDIT := 1 |
---|
.. | .. |
---|
601 | 710 | |
---|
602 | 711 | ifndef NO_LIBCRYPTO |
---|
603 | 712 | ifneq ($(feature-libcrypto), 1) |
---|
604 | | - msg := $(warning No libcrypto.h found, disables jitted code injection, please install libssl-devel or libssl-dev); |
---|
| 713 | + msg := $(warning No libcrypto.h found, disables jitted code injection, please install openssl-devel or libssl-dev); |
---|
605 | 714 | NO_LIBCRYPTO := 1 |
---|
606 | 715 | else |
---|
607 | 716 | CFLAGS += -DHAVE_LIBCRYPTO_SUPPORT |
---|
.. | .. |
---|
616 | 725 | |
---|
617 | 726 | ifndef NO_SLANG |
---|
618 | 727 | ifneq ($(feature-libslang), 1) |
---|
619 | | - msg := $(warning slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev); |
---|
620 | | - NO_SLANG := 1 |
---|
621 | | - else |
---|
| 728 | + ifneq ($(feature-libslang-include-subdir), 1) |
---|
| 729 | + msg := $(warning slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev); |
---|
| 730 | + NO_SLANG := 1 |
---|
| 731 | + else |
---|
| 732 | + CFLAGS += -DHAVE_SLANG_INCLUDE_SUBDIR |
---|
| 733 | + endif |
---|
| 734 | + endif |
---|
| 735 | + ifndef NO_SLANG |
---|
622 | 736 | # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h |
---|
623 | | - CFLAGS += -I/usr/include/slang |
---|
624 | 737 | CFLAGS += -DHAVE_SLANG_SUPPORT |
---|
625 | 738 | EXTLIBS += -lslang |
---|
626 | 739 | $(call detected,CONFIG_SLANG) |
---|
627 | 740 | endif |
---|
628 | 741 | endif |
---|
629 | 742 | |
---|
630 | | -ifndef NO_GTK2 |
---|
| 743 | +ifdef GTK2 |
---|
631 | 744 | FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) |
---|
| 745 | + $(call feature_check,gtk2) |
---|
632 | 746 | ifneq ($(feature-gtk2), 1) |
---|
633 | 747 | msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); |
---|
634 | 748 | NO_GTK2 := 1 |
---|
635 | 749 | else |
---|
| 750 | + $(call feature_check,gtk2-infobar) |
---|
636 | 751 | ifeq ($(feature-gtk2-infobar), 1) |
---|
637 | 752 | GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT |
---|
638 | 753 | endif |
---|
.. | .. |
---|
651 | 766 | PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) |
---|
652 | 767 | PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null) |
---|
653 | 768 | PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS)) |
---|
| 769 | + PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(PERL_EMBED_CCOPTS)) |
---|
654 | 770 | PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS)) |
---|
655 | 771 | FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) |
---|
656 | 772 | |
---|
.. | .. |
---|
662 | 778 | LDFLAGS += $(PERL_EMBED_LDFLAGS) |
---|
663 | 779 | EXTLIBS += $(PERL_EMBED_LIBADD) |
---|
664 | 780 | CFLAGS += -DHAVE_LIBPERL_SUPPORT |
---|
| 781 | + ifeq ($(CC_NO_CLANG), 0) |
---|
| 782 | + CFLAGS += -Wno-compound-token-split-by-macro |
---|
| 783 | + endif |
---|
665 | 784 | $(call detected,CONFIG_LIBPERL) |
---|
666 | 785 | endif |
---|
667 | 786 | endif |
---|
.. | .. |
---|
706 | 825 | endif |
---|
707 | 826 | |
---|
708 | 827 | ifeq ($(feature-libbfd), 1) |
---|
709 | | - EXTLIBS += -lbfd |
---|
| 828 | + EXTLIBS += -lbfd -lopcodes |
---|
710 | 829 | else |
---|
711 | 830 | # we are on a system that requires -liberty and (maybe) -lz |
---|
712 | 831 | # to link against -lbfd; test each case individually here |
---|
.. | .. |
---|
717 | 836 | $(call feature_check,libbfd-liberty-z) |
---|
718 | 837 | |
---|
719 | 838 | ifeq ($(feature-libbfd-liberty), 1) |
---|
720 | | - EXTLIBS += -lbfd -liberty |
---|
| 839 | + EXTLIBS += -lbfd -lopcodes -liberty |
---|
| 840 | + FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl |
---|
721 | 841 | else |
---|
722 | 842 | ifeq ($(feature-libbfd-liberty-z), 1) |
---|
723 | | - EXTLIBS += -lbfd -liberty -lz |
---|
| 843 | + EXTLIBS += -lbfd -lopcodes -liberty -lz |
---|
| 844 | + FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl |
---|
724 | 845 | endif |
---|
725 | 846 | endif |
---|
| 847 | + $(call feature_check,disassembler-four-args) |
---|
| 848 | +endif |
---|
| 849 | + |
---|
| 850 | +ifeq ($(feature-libbfd-buildid), 1) |
---|
| 851 | + CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT |
---|
| 852 | +else |
---|
| 853 | + msg := $(warning Old version of libbfd/binutils things like PE executable profiling will not be available); |
---|
726 | 854 | endif |
---|
727 | 855 | |
---|
728 | 856 | ifdef NO_DEMANGLE |
---|
.. | .. |
---|
775 | 903 | endif |
---|
776 | 904 | endif |
---|
777 | 905 | |
---|
| 906 | +ifndef NO_LIBZSTD |
---|
| 907 | + ifeq ($(feature-libzstd), 1) |
---|
| 908 | + CFLAGS += -DHAVE_ZSTD_SUPPORT |
---|
| 909 | + CFLAGS += $(LIBZSTD_CFLAGS) |
---|
| 910 | + LDFLAGS += $(LIBZSTD_LDFLAGS) |
---|
| 911 | + EXTLIBS += -lzstd |
---|
| 912 | + $(call detected,CONFIG_ZSTD) |
---|
| 913 | + else |
---|
| 914 | + msg := $(warning No libzstd found, disables trace compression, please install libzstd-dev[el] and/or set LIBZSTD_DIR); |
---|
| 915 | + NO_LIBZSTD := 1 |
---|
| 916 | + endif |
---|
| 917 | +endif |
---|
| 918 | + |
---|
| 919 | +ifndef NO_LIBCAP |
---|
| 920 | + ifeq ($(feature-libcap), 1) |
---|
| 921 | + CFLAGS += -DHAVE_LIBCAP_SUPPORT |
---|
| 922 | + EXTLIBS += -lcap |
---|
| 923 | + $(call detected,CONFIG_LIBCAP) |
---|
| 924 | + else |
---|
| 925 | + msg := $(warning No libcap found, disables capability support, please install libcap-devel/libcap-dev); |
---|
| 926 | + NO_LIBCAP := 1 |
---|
| 927 | + endif |
---|
| 928 | +endif |
---|
| 929 | + |
---|
778 | 930 | ifndef NO_BACKTRACE |
---|
779 | 931 | ifeq ($(feature-backtrace), 1) |
---|
780 | 932 | CFLAGS += -DHAVE_BACKTRACE_SUPPORT |
---|
.. | .. |
---|
799 | 951 | |
---|
800 | 952 | ifdef HAVE_KVM_STAT_SUPPORT |
---|
801 | 953 | CFLAGS += -DHAVE_KVM_STAT_SUPPORT |
---|
| 954 | +endif |
---|
| 955 | + |
---|
| 956 | +ifeq ($(feature-disassembler-four-args), 1) |
---|
| 957 | + CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE |
---|
802 | 958 | endif |
---|
803 | 959 | |
---|
804 | 960 | ifeq (${IS_64_BIT}, 1) |
---|
.. | .. |
---|
870 | 1026 | $(call feature_check,jvmti) |
---|
871 | 1027 | ifeq ($(feature-jvmti), 1) |
---|
872 | 1028 | $(call detected_var,JDIR) |
---|
| 1029 | + ifndef NO_JVMTI_CMLR |
---|
| 1030 | + FEATURE_CHECK_CFLAGS-jvmti-cmlr := $(FEATURE_CHECK_CFLAGS-jvmti) |
---|
| 1031 | + $(call feature_check,jvmti-cmlr) |
---|
| 1032 | + ifeq ($(feature-jvmti-cmlr), 1) |
---|
| 1033 | + CFLAGS += -DHAVE_JVMTI_CMLR |
---|
| 1034 | + endif |
---|
| 1035 | + endif # NO_JVMTI_CMLR |
---|
873 | 1036 | else |
---|
874 | 1037 | $(warning No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel) |
---|
875 | 1038 | NO_JVMTI := 1 |
---|
.. | .. |
---|
907 | 1070 | endif |
---|
908 | 1071 | endif |
---|
909 | 1072 | |
---|
| 1073 | +ifdef LIBPFM4 |
---|
| 1074 | + $(call feature_check,libpfm4) |
---|
| 1075 | + ifeq ($(feature-libpfm4), 1) |
---|
| 1076 | + CFLAGS += -DHAVE_LIBPFM |
---|
| 1077 | + EXTLIBS += -lpfm |
---|
| 1078 | + ASCIIDOC_EXTRA = -aHAVE_LIBPFM=1 |
---|
| 1079 | + $(call detected,CONFIG_LIBPFM4) |
---|
| 1080 | + else |
---|
| 1081 | + msg := $(warning libpfm4 not found, disables libpfm4 support. Please install libpfm4-dev); |
---|
| 1082 | + NO_LIBPFM4 := 1 |
---|
| 1083 | + endif |
---|
| 1084 | +endif |
---|
| 1085 | + |
---|
910 | 1086 | # Among the variables below, these: |
---|
911 | 1087 | # perfexecdir |
---|
912 | 1088 | # perf_include_dir |
---|