2019-05-19 13:07:45 +01:00
# SPDX-License-Identifier: GPL-2.0-only
2015-03-01 21:19:44 +01:00
f e a t u r e _ d i r : = $ ( s r c t r e e ) / t o o l s / b u i l d / f e a t u r e
2015-03-01 21:12:25 +01:00
2015-03-01 21:04:01 +01:00
i f n e q ( $ ( O U T P U T ) , )
2015-03-01 21:19:44 +01:00
O U T P U T _ F E A T U R E S = $ ( O U T P U T ) f e a t u r e /
2015-03-01 21:04:01 +01:00
$ ( s h e l l m k d i r - p $ ( O U T P U T _ F E A T U R E S ) )
e n d i f
f e a t u r e _ c h e c k = $ ( e v a l $ ( f e a t u r e _ c h e c k _ c o d e ) )
d e f i n e f e a t u r e _ c h e c k _ c o d e
2020-08-12 17:15:17 -05:00
f e a t u r e - $ ( 1 ) : = $ ( s h e l l $ ( M A K E ) O U T P U T = $ ( O U T P U T _ F E A T U R E S ) C C = " $ ( C C ) " C X X = " $ ( C X X ) " C F L A G S = " $ ( E X T R A _ C F L A G S ) $ ( F E A T U R E _ C H E C K _ C F L A G S - $ ( 1 ) ) " C X X F L A G S = " $ ( E X T R A _ C X X F L A G S ) $ ( F E A T U R E _ C H E C K _ C X X F L A G S - $ ( 1 ) ) " L D F L A G S = " $ ( L D F L A G S ) $ ( F E A T U R E _ C H E C K _ L D F L A G S - $ ( 1 ) ) " - C $ ( f e a t u r e _ d i r ) $ ( O U T P U T _ F E A T U R E S ) t e s t - $ 1. b i n > / d e v / n u l l 2 > / d e v / n u l l & & e c h o 1 | | e c h o 0 )
2015-03-01 21:04:01 +01:00
e n d e f
f e a t u r e _ s e t = $ ( e v a l $ ( f e a t u r e _ s e t _ c o d e ) )
d e f i n e f e a t u r e _ s e t _ c o d e
f e a t u r e - $ ( 1 ) : = 1
e n d e f
#
# Build the feature check binaries in parallel, ignore errors, ignore return value and suppress output:
#
#
# Note that this is not a complete list of all feature tests, just
# those that are typically built on a fully configured system.
#
# [ Feature tests not mentioned here have to be built explicitly in
# the rule that uses them - an example for that is the 'bionic'
# feature check. ]
#
2016-12-04 21:42:53 +01:00
F E A T U R E _ T E S T S _ B A S I C : = \
b a c k t r a c e \
d w a r f \
d w a r f _ g e t l o c a t i o n s \
2018-11-21 17:42:00 -03:00
e v e n t f d \
2016-12-04 21:42:53 +01:00
f o r t i f y - s o u r c e \
2018-11-19 16:56:22 -03:00
g e t _ c u r r e n t _ d i r _ n a m e \
2019-06-13 12:04:19 -03:00
g e t t i d \
2016-12-04 21:42:53 +01:00
g l i b c \
l i b b f d \
2020-09-03 13:44:39 -03:00
l i b b f d - b u i l d i d \
2019-08-07 10:44:14 -04:00
l i b c a p \
2016-12-04 21:42:53 +01:00
l i b e l f \
l i b e l f - g e t p h d r n u m \
l i b e l f - g e l f _ g e t n o t e \
l i b e l f - g e t s h d r s t r n d x \
l i b n u m a \
n u m a _ n u m _ p o s s i b l e _ c p u s \
l i b p e r l \
l i b p y t h o n \
l i b s l a n g \
2019-06-18 17:43:35 -03:00
l i b s l a n g - i n c l u d e - s u b d i r \
2021-04-28 11:20:23 +02:00
l i b t r a c e e v e n t \
2021-09-22 17:10:21 -07:00
l i b t r a c e f s \
2016-12-04 21:42:53 +01:00
l i b c r y p t o \
l i b u n w i n d \
p t h r e a d - a t t r - s e t a f f i n i t y - n p \
2017-12-05 10:14:42 -03:00
p t h r e a d - b a r r i e r \
2018-07-13 19:08:59 -07:00
r e a l l o c a r r a y \
2016-12-04 21:42:53 +01:00
s t a c k p r o t e c t o r - a l l \
t i m e r f d \
l i b d w - d w a r f - u n w i n d \
z l i b \
l z m a \
g e t _ c p u i d \
b p f \
2017-03-02 12:55:49 -03:00
s c h e d _ g e t c p u \
2017-07-18 17:15:29 -03:00
s d t \
2018-01-17 10:52:10 -07:00
s e t n s \
2019-03-11 22:30:48 -07:00
l i b a i o \
2019-03-18 20:39:49 +03:00
l i b z s t d \
2020-04-02 10:52:49 +09:00
d i s a s s e m b l e r - f o u r - a r g s \
f i l e - h a n d l e
2015-03-01 21:04:01 +01:00
2016-01-25 09:55:50 +00:00
# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
# of all feature tests
2016-12-04 21:42:53 +01:00
F E A T U R E _ T E S T S _ E X T R A : = \
b i o n i c \
c o m p i l e - 32 \
c o m p i l e - x 32 \
c p l u s - d e m a n g l e \
2020-09-04 17:11:59 -03:00
g t k 2 \
g t k 2 - i n f o b a r \
2016-12-04 21:42:53 +01:00
h e l l o \
l i b b a b e l t r a c e \
2018-11-15 16:32:01 -08:00
l i b b f d - l i b e r t y \
l i b b f d - l i b e r t y - z \
2019-02-12 14:37:15 -03:00
l i b o p e n c s d \
2019-02-12 16:34:32 -03:00
l i b u n w i n d - x 86 \
l i b u n w i n d - x 86 _ 64 \
l i b u n w i n d - a r m \
l i b u n w i n d - a a r c h 64 \
2016-12-04 21:42:53 +01:00
l i b u n w i n d - d e b u g - f r a m e \
l i b u n w i n d - d e b u g - f r a m e - a r m \
2018-03-07 16:50:18 +01:00
l i b u n w i n d - d e b u g - f r a m e - a a r c h 64 \
c x x \
l l v m \
l l v m - v e r s i o n \
2019-11-26 13:12:53 +01:00
c l a n g \
2020-04-29 16:14:41 -07:00
l i b b p f \
perf build: Fix check for btf__load_from_kernel_by_id() in libbpf
Avi Kivity reported a problem where the __weak
btf__load_from_kernel_by_id() in tools/perf/util/bpf-event.c was being
used and it called btf__get_from_id() in tools/lib/bpf/btf.c that in
turn called back to btf__load_from_kernel_by_id(), resulting in an
endless loop.
Fix this by adding a feature test to check if
btf__load_from_kernel_by_id() is available when building perf with
LIBBPF_DYNAMIC=1, and if not then provide the fallback to the old
btf__get_from_id(), that doesn't call back to btf__load_from_kernel_by_id()
since at that time it didn't exist at all.
Tested on Fedora 35 where we have libbpf-devel 0.4.0 with LIBBPF_DYNAMIC
where we don't have btf__load_from_kernel_by_id() and thus its feature
test fail, not defining HAVE_LIBBPF_BTF__LOAD_FROM_KERNEL_BY_ID:
$ cat /tmp/build/perf-urgent/feature/test-libbpf-btf__load_from_kernel_by_id.make.output
test-libbpf-btf__load_from_kernel_by_id.c: In function ‘main’:
test-libbpf-btf__load_from_kernel_by_id.c:6:16: error: implicit declaration of function ‘btf__load_from_kernel_by_id’ [-Werror=implicit-function-declaration]
6 | return btf__load_from_kernel_by_id(20151128, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
$
$ nm /tmp/build/perf-urgent/perf | grep btf__load_from_kernel_by_id
00000000005ba180 T btf__load_from_kernel_by_id
$
$ objdump --disassemble=btf__load_from_kernel_by_id -S /tmp/build/perf-urgent/perf
/tmp/build/perf-urgent/perf: file format elf64-x86-64
<SNIP>
00000000005ba180 <btf__load_from_kernel_by_id>:
#include "record.h"
#include "util/synthetic-events.h"
#ifndef HAVE_LIBBPF_BTF__LOAD_FROM_KERNEL_BY_ID
struct btf *btf__load_from_kernel_by_id(__u32 id)
{
5ba180: 55 push %rbp
5ba181: 48 89 e5 mov %rsp,%rbp
5ba184: 48 83 ec 10 sub $0x10,%rsp
5ba188: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax
5ba18f: 00 00
5ba191: 48 89 45 f8 mov %rax,-0x8(%rbp)
5ba195: 31 c0 xor %eax,%eax
struct btf *btf;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
int err = btf__get_from_id(id, &btf);
5ba197: 48 8d 75 f0 lea -0x10(%rbp),%rsi
5ba19b: e8 a0 57 e5 ff call 40f940 <btf__get_from_id@plt>
5ba1a0: 89 c2 mov %eax,%edx
#pragma GCC diagnostic pop
return err ? ERR_PTR(err) : btf;
5ba1a2: 48 98 cltq
5ba1a4: 85 d2 test %edx,%edx
5ba1a6: 48 0f 44 45 f0 cmove -0x10(%rbp),%rax
}
<SNIP>
Fixes: 218e7b775d368f38 ("perf bpf: Provide a weak btf__load_from_kernel_by_id() for older libbpf versions")
Reported-by: Avi Kivity <avi@scylladb.com>
Link: https://lore.kernel.org/linux-perf-users/f0add43b-3de5-20c5-22c4-70aff4af959f@scylladb.com
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/linux-perf-users/YobjjFOblY4Xvwo7@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-05-19 21:25:12 -03:00
l i b b p f - b t f _ _ l o a d _ f r o m _ k e r n e l _ b y _ i d \
perf build: Stop using __weak bpf_prog_load() to handle older libbpf versions
By adding a feature test for bpf_prog_load() and providing a fallback if
it isn't present in older versions of libbpf.
Committer testing:
$ rpm -q libbpf-devel
libbpf-devel-0.4.0-2.fc35.x86_64
$ make -C tools/perf LIBBPF_DYNAMIC=1 O=/tmp/build/perf install-bin
$ cat /tmp/build/perf/feature/test-libbpf-bpf_prog_load.make.output
test-libbpf-bpf_prog_load.c: In function ‘main’:
test-libbpf-bpf_prog_load.c:6:16: error: implicit declaration of function ‘bpf_prog_load’ [-Werror=implicit-function-declaration]
6 | return bpf_prog_load(0 /* prog_type */, NULL /* prog_name */,
| ^~~~~~~~~~~~~
cc1: all warnings being treated as errors
$
$ objdump -dS /tmp/build/perf/perf | grep '<bpf_prog_load>:' -A20
00000000005b2d70 <bpf_prog_load>:
{
5b2d70: 55 push %rbp
5b2d71: 48 89 ce mov %rcx,%rsi
5b2d74: 4c 89 c8 mov %r9,%rax
5b2d77: 49 89 d2 mov %rdx,%r10
5b2d7a: 4c 89 c2 mov %r8,%rdx
5b2d7d: 48 89 e5 mov %rsp,%rbp
5b2d80: 48 83 ec 18 sub $0x18,%rsp
5b2d84: 64 48 8b 0c 25 28 00 mov %fs:0x28,%rcx
5b2d8b: 00 00
5b2d8d: 48 89 4d f8 mov %rcx,-0x8(%rbp)
5b2d91: 31 c9 xor %ecx,%ecx
return bpf_load_program(prog_type, insns, insn_cnt, license,
5b2d93: 41 8b 49 5c mov 0x5c(%r9),%ecx
5b2d97: 51 push %rcx
5b2d98: 4d 8b 49 60 mov 0x60(%r9),%r9
5b2d9c: 4c 89 d1 mov %r10,%rcx
5b2d9f: 44 8b 40 1c mov 0x1c(%rax),%r8d
5b2da3: e8 f8 aa e5 ff call 40d8a0 <bpf_load_program@plt>
}
$
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Link: http://lore.kernel.org/linux-perf-users/YozLKby7ITEtchC9@krava
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-05-24 13:04:43 +02:00
l i b b p f - b p f _ p r o g _ l o a d \
perf build: Stop using __weak bpf_object__next_program() to handle older libbpf versions
By adding a feature test for bpf_object__next_program() and providing a fallback if
it isn't present in older versions of libbpf.
Committer testing:
$ rpm -q libbpf-devel
libbpf-devel-0.4.0-2.fc35.x86_64
$ make -C tools/perf LIBBPF_DYNAMIC=1 O=/tmp/build/perf install-bin
$ cat /tmp/build/perf/feature/test-libbpf-bpf_object__next_program.make.output
test-libbpf-bpf_object__next_program.c: In function ‘main’:
test-libbpf-bpf_object__next_program.c:6:9: error: implicit declaration of function ‘bpf_object__next_program’; did you mean ‘bpf_object__unpin_programs’? [-Werror=implicit-function-declaration]
6 | bpf_object__next_program(NULL /* obj */, NULL /* prev */);
| ^~~~~~~~~~~~~~~~~~~~~~~~
| bpf_object__unpin_programs
cc1: all warnings being treated as errors
$
$ objdump -dS /tmp/build/perf/perf | grep '<bpf_object__next_program>:' -A20
00000000005b2dc0 <bpf_object__next_program>:
{
5b2dc0: 55 push %rbp
5b2dc1: 48 89 e5 mov %rsp,%rbp
5b2dc4: 48 83 ec 10 sub $0x10,%rsp
5b2dc8: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax
5b2dcf: 00 00
5b2dd1: 48 89 45 f8 mov %rax,-0x8(%rbp)
5b2dd5: 31 c0 xor %eax,%eax
return bpf_program__next(prev, obj);
5b2dd7: 48 8b 45 f8 mov -0x8(%rbp),%rax
5b2ddb: 64 48 2b 04 25 28 00 sub %fs:0x28,%rax
5b2de2: 00 00
5b2de4: 75 0f jne 5b2df5 <bpf_object__next_program+0x35>
}
5b2de6: c9 leave
5b2de7: 49 89 f8 mov %rdi,%r8
5b2dea: 48 89 f7 mov %rsi,%rdi
return bpf_program__next(prev, obj);
5b2ded: 4c 89 c6 mov %r8,%rsi
5b2df0: e9 3b b4 e5 ff jmp 40e230 <bpf_program__next@plt>
$
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Link: http://lore.kernel.org/linux-perf-users/YozLKby7ITEtchC9@krava
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-05-24 13:09:42 +02:00
l i b b p f - b p f _ o b j e c t _ _ n e x t _ p r o g r a m \
perf build: Stop using __weak bpf_object__next_map() to handle older libbpf versions
By adding a feature test for bpf_object__next_map() and providing a fallback if
it isn't present in older versions of libbpf.
Committer testing:
$ rpm -q libbpf-devel
libbpf-devel-0.4.0-2.fc35.x86_64
$ make -C tools/perf LIBBPF_DYNAMIC=1 O=/tmp/build/perf install-bin
$ cat /tmp/build/perf/feature/test-libbpf-bpf_object__next_map.make.output
test-libbpf-bpf_object__next_map.c: In function ‘main’:
test-libbpf-bpf_object__next_map.c:6:9: error: implicit declaration of function ‘bpf_object__next_map’; did you mean ‘bpf_object__next’? [-Werror=implicit-function-declaration]
6 | bpf_object__next_map(NULL /* obj */, NULL /* prev */);
| ^~~~~~~~~~~~~~~~~~~~
| bpf_object__next
cc1: all warnings being treated as errors
$
$ objdump -dS /tmp/build/perf/perf | grep '<bpf_object__next_map>:' -A20
00000000005b2e00 <bpf_object__next_map>:
{
5b2e00: 55 push %rbp
5b2e01: 48 89 e5 mov %rsp,%rbp
5b2e04: 48 83 ec 10 sub $0x10,%rsp
5b2e08: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax
5b2e0f: 00 00
5b2e11: 48 89 45 f8 mov %rax,-0x8(%rbp)
5b2e15: 31 c0 xor %eax,%eax
return bpf_map__next(prev, obj);
5b2e17: 48 8b 45 f8 mov -0x8(%rbp),%rax
5b2e1b: 64 48 2b 04 25 28 00 sub %fs:0x28,%rax
5b2e22: 00 00
5b2e24: 75 0f jne 5b2e35 <bpf_object__next_map+0x35>
}
5b2e26: c9 leave
5b2e27: 49 89 f8 mov %rdi,%r8
5b2e2a: 48 89 f7 mov %rsi,%rdi
return bpf_map__next(prev, obj);
5b2e2d: 4c 89 c6 mov %r8,%rsi
5b2e30: e9 cb b1 e5 ff jmp 40e000 <bpf_map__next@plt>
$
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Link: http://lore.kernel.org/linux-perf-users/YozLKby7ITEtchC9@krava
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-05-24 13:13:17 +02:00
l i b b p f - b p f _ o b j e c t _ _ n e x t _ m a p \
perf build: Stop using __weak bpf_map_create() to handle older libbpf versions
By adding a feature test for bpf_map_create() and providing a fallback if
it isn't present in older versions of libbpf.
This also fixes the build with torvalds/master at this point:
$ git log --oneline -5 torvalds/master
babf0bb978e3c9fc (torvalds/master) Merge tag 'xfs-5.19-for-linus' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
e375780b631a5fc2 Merge tag 'fsnotify_for_v5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
8b728edc5be16179 Merge tag 'fs_for_v5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
3f306ea2e18568f6 Merge tag 'dma-mapping-5.19-2022-05-25' of git://git.infradead.org/users/hch/dma-mapping
fbe86daca0ba878b Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
$
Coping with:
$ git log --oneline -2 d16495a982324f75
d16495a982324f75 libbpf: remove bpf_create_map*() APIs
e2371b1632b1c61c libbpf: start 1.0 development cycle
$
As the __weak function fails to build as it calls the now removed
bpf_create_map() API.
Testing:
$ rpm -q libbpf-devel
libbpf-devel-0.4.0-2.fc35.x86_64
$
$ make -C tools/perf BUILD_BPF_SKEL=1 LIBBPF_DYNAMIC=1 O=/tmp/build/perf install-bin
$ cat /tmp/build/perf/feature/test-libbpf-bpf_map_create.make.output
test-libbpf-bpf_map_create.c: In function ‘main’:
test-libbpf-bpf_map_create.c:6:16: error: implicit declaration of function ‘bpf_map_create’; did you mean ‘bpf_map_freeze’? [-Werror=implicit-function-declaration]
6 | return bpf_map_create(0 /* map_type */, NULL /* map_name */, 0, /* key_size */,
| ^~~~~~~~~~~~~~
| bpf_map_freeze
test-libbpf-bpf_map_create.c:6:87: error: expected expression before ‘,’ token
6 | return bpf_map_create(0 /* map_type */, NULL /* map_name */, 0, /* key_size */,
| ^
cc1: all warnings being treated as errors
$
$ objdump -dS /tmp/build/perf/perf | grep '<bpf_map_create>:' -A20
000000000058b290 <bpf_map_create>:
{
58b290: 55 push %rbp
58b291: 48 89 e5 mov %rsp,%rbp
58b294: 48 83 ec 10 sub $0x10,%rsp
58b298: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax
58b29f: 00 00
58b2a1: 48 89 45 f8 mov %rax,-0x8(%rbp)
58b2a5: 31 c0 xor %eax,%eax
return bpf_create_map(map_type, key_size, value_size, max_entries, 0);
58b2a7: 48 8b 45 f8 mov -0x8(%rbp),%rax
58b2ab: 64 48 2b 04 25 28 00 sub %fs:0x28,%rax
58b2b2: 00 00
58b2b4: 75 10 jne 58b2c6 <bpf_map_create+0x36>
}
58b2b6: c9 leave
58b2b7: 89 d6 mov %edx,%esi
58b2b9: 89 ca mov %ecx,%edx
58b2bb: 44 89 c1 mov %r8d,%ecx
return bpf_create_map(map_type, key_size, value_size, max_entries, 0);
58b2be: 45 31 c0 xor %r8d,%r8d
$
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Link: http://lore.kernel.org/linux-perf-users/Yo+XvQNKL4K5khl2@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-05-26 11:48:58 -03:00
l i b b p f - b p f _ c r e a t e _ m a p \
2020-08-13 10:22:04 +02:00
l i b p f m 4 \
2020-12-29 13:42:13 -08:00
l i b d e b u g i n f o d \
c l a n g - b p f - c o - r e
2016-01-25 09:55:50 +00:00
F E A T U R E _ T E S T S ? = $ ( F E A T U R E _ T E S T S _ B A S I C )
i f e q ( $ ( F E A T U R E _ T E S T S ) , a l l )
F E A T U R E _ T E S T S : = $ ( F E A T U R E _ T E S T S _ B A S I C ) $ ( F E A T U R E _ T E S T S _ E X T R A )
e n d i f
2016-12-04 21:42:53 +01:00
F E A T U R E _ D I S P L A Y ? = \
d w a r f \
d w a r f _ g e t l o c a t i o n s \
g l i b c \
l i b b f d \
2020-09-03 13:44:39 -03:00
l i b b f d - b u i l d i d \
2019-08-07 10:44:14 -04:00
l i b c a p \
2016-12-04 21:42:53 +01:00
l i b e l f \
l i b n u m a \
n u m a _ n u m _ p o s s i b l e _ c p u s \
l i b p e r l \
l i b p y t h o n \
l i b c r y p t o \
l i b u n w i n d \
l i b d w - d w a r f - u n w i n d \
z l i b \
l z m a \
g e t _ c p u i d \
2018-11-06 12:03:35 +03:00
b p f \
2019-03-11 22:30:48 -07:00
l i b a i o \
2019-03-18 20:39:49 +03:00
l i b z s t d \
2019-03-11 22:30:48 -07:00
d i s a s s e m b l e r - f o u r - a r g s
2015-03-01 21:04:01 +01:00
# Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features.
# If in the future we need per-feature checks/flags for features not
# mentioned in this list we need to refactor this ;-).
s e t _ t e s t _ a l l _ f l a g s = $ ( e v a l $ ( s e t _ t e s t _ a l l _ f l a g s _ c o d e ) )
d e f i n e s e t _ t e s t _ a l l _ f l a g s _ c o d e
F E A T U R E _ C H E C K _ C F L A G S - a l l + = $ ( F E A T U R E _ C H E C K _ C F L A G S - $ ( 1 ) )
F E A T U R E _ C H E C K _ L D F L A G S - a l l + = $ ( F E A T U R E _ C H E C K _ L D F L A G S - $ ( 1 ) )
e n d e f
$ ( f o r e a c h f e a t , $ ( F E A T U R E _ T E S T S ) , $ ( c a l l s e t _ t e s t _ a l l _ f l a g s , $ ( f e a t ) ) )
#
# Special fast-path for the 'all features are available' case:
#
$ ( c a l l f e a t u r e _ c h e c k , a l l , $ ( M S G ) )
#
# Just in case the build freshly failed, make sure we print the
# feature matrix:
#
i f e q ( $ ( f e a t u r e - a l l ) , 1 )
#
# test-all.c passed - just set all the core feature flags to 1:
#
$ ( f o r e a c h f e a t , $ ( F E A T U R E _ T E S T S ) , $ ( c a l l f e a t u r e _ s e t , $ ( f e a t ) ) )
2016-01-28 16:13:24 -03:00
#
# test-all.c does not comprise these tests, so we need to
# for this case to get features proper values
#
$ ( c a l l f e a t u r e _ c h e c k , c o m p i l e - 32 )
$ ( c a l l f e a t u r e _ c h e c k , c o m p i l e - x 32 )
$ ( c a l l f e a t u r e _ c h e c k , b i o n i c )
$ ( c a l l f e a t u r e _ c h e c k , l i b b a b e l t r a c e )
2015-03-01 21:04:01 +01:00
e l s e
$ ( f o r e a c h f e a t , $ ( F E A T U R E _ T E S T S ) , $ ( c a l l f e a t u r e _ c h e c k , $ ( f e a t ) ) )
e n d i f
#
# Print the result of the feature test:
#
f e a t u r e _ p r i n t _ s t a t u s = $ ( e v a l $ ( f e a t u r e _ p r i n t _ s t a t u s _ c o d e ) ) $ ( i n f o $ ( M S G ) )
d e f i n e f e a t u r e _ p r i n t _ s t a t u s _ c o d e
i f e q ( $ ( f e a t u r e - $ ( 1 ) ) , 1 )
M S G = $ ( s h e l l p r i n t f ' . . . % 30 s : [ \ 033 [ 32 m o n \ 033 [ m ] ' $ ( 1 ) )
e l s e
M S G = $ ( s h e l l p r i n t f ' . . . % 30 s : [ \ 033 [ 31 m O F F \ 033 [ m ] ' $ ( 1 ) )
e n d i f
e n d e f
f e a t u r e _ p r i n t _ t e x t = $ ( e v a l $ ( f e a t u r e _ p r i n t _ t e x t _ c o d e ) ) $ ( i n f o $ ( M S G ) )
d e f i n e f e a t u r e _ p r i n t _ t e x t _ c o d e
M S G = $ ( s h e l l p r i n t f ' . . . % 30 s : % s ' $ ( 1 ) $ ( 2 ) )
e n d e f
2015-12-23 18:58:32 +01:00
#
# generates feature value assignment for name, like:
# $(call feature_assign,dwarf) == feature-dwarf=1
#
f e a t u r e _ a s s i g n = f e a t u r e - $ ( 1 ) = $ ( f e a t u r e - $ ( 1 ) )
2015-09-21 12:24:47 -03:00
F E A T U R E _ D U M P _ F I L E N A M E = $ ( O U T P U T ) F E A T U R E - D U M P $ ( F E A T U R E _ U S E R )
2015-12-23 18:58:33 +01:00
F E A T U R E _ D U M P : = $ ( s h e l l t o u c h $ ( F E A T U R E _ D U M P _ F I L E N A M E ) ; c a t $ ( F E A T U R E _ D U M P _ F I L E N A M E ) )
f e a t u r e _ d u m p _ c h e c k = $ ( e v a l $ ( f e a t u r e _ d u m p _ c h e c k _ c o d e ) )
d e f i n e f e a t u r e _ d u m p _ c h e c k _ c o d e
i f e q ( $ ( f i n d s t r i n g $ ( 1 ) , $ ( F E A T U R E _ D U M P ) ) , )
$ ( 2 ) : = 1
e n d i f
e n d e f
#
# First check if any test from FEATURE_DISPLAY
# and set feature_display := 1 if it does
$ ( f o r e a c h f e a t , $ ( F E A T U R E _ D I S P L A Y ) , $ ( c a l l f e a t u r e _ d u m p _ c h e c k , $ ( c a l l f e a t u r e _ a s s i g n , $ ( f e a t ) ) , f e a t u r e _ d i s p l a y ) )
#
# Now also check if any other test changed,
# so we force FEATURE-DUMP generation
$ ( f o r e a c h f e a t , $ ( F E A T U R E _ T E S T S ) , $ ( c a l l f e a t u r e _ d u m p _ c h e c k , $ ( c a l l f e a t u r e _ a s s i g n , $ ( f e a t ) ) , f e a t u r e _ d u m p _ c h a n g e d ) )
2015-03-01 21:04:01 +01:00
# The $(feature_display) controls the default detection message
# output. It's set if:
# - detected features differes from stored features from
2015-09-21 12:24:47 -03:00
# last build (in $(FEATURE_DUMP_FILENAME) file)
2015-03-01 21:04:01 +01:00
# - one of the $(FEATURE_DISPLAY) is not detected
# - VF is enabled
2015-12-23 18:58:33 +01:00
i f e q ( $ ( f e a t u r e _ d u m p _ c h a n g e d ) , 1 )
$ ( s h e l l r m - f $ ( F E A T U R E _ D U M P _ F I L E N A M E ) )
$ ( f o r e a c h f e a t , $ ( F E A T U R E _ T E S T S ) , $ ( s h e l l e c h o " $ ( c a l l f e a t u r e _ a s s i g n , $ ( f e a t ) ) " > > $ ( F E A T U R E _ D U M P _ F I L E N A M E ) ) )
2015-03-01 21:04:01 +01:00
e n d i f
2015-09-21 11:49:51 -03:00
f e a t u r e _ d i s p l a y _ c h e c k = $ ( e v a l $ ( f e a t u r e _ c h e c k _ d i s p l a y _ c o d e ) )
2015-12-23 18:58:30 +01:00
d e f i n e f e a t u r e _ c h e c k _ d i s p l a y _ c o d e
2015-03-01 21:04:01 +01:00
i f n e q ( $ ( f e a t u r e - $ ( 1 ) ) , 1 )
f e a t u r e _ d i s p l a y : = 1
e n d i f
e n d e f
$ ( f o r e a c h f e a t , $ ( F E A T U R E _ D I S P L A Y ) , $ ( c a l l f e a t u r e _ d i s p l a y _ c h e c k , $ ( f e a t ) ) )
i f e q ( $ ( V F ) , 1 )
f e a t u r e _ d i s p l a y : = 1
f e a t u r e _ v e r b o s e : = 1
e n d i f
2021-04-26 17:01:24 -03:00
f e a t u r e _ d i s p l a y _ e n t r i e s = $ ( e v a l $ ( f e a t u r e _ d i s p l a y _ e n t r i e s _ c o d e ) )
d e f i n e f e a t u r e _ d i s p l a y _ e n t r i e s _ c o d e
i f e q ( $ ( f e a t u r e _ d i s p l a y ) , 1 )
2015-03-01 21:04:01 +01:00
$ ( i n f o )
2021-04-26 17:01:24 -03:00
$ ( i n f o A u t o - d e t e c t i n g s y s t e m f e a t u r e s : )
$ ( f o r e a c h f e a t , $ ( F E A T U R E _ D I S P L A Y ) , $ ( c a l l f e a t u r e _ p r i n t _ s t a t u s , $ ( f e a t ) , ) )
i f n e q ( $ ( f e a t u r e _ v e r b o s e ) , 1 )
$ ( i n f o )
e n d i f
2015-03-01 21:04:01 +01:00
e n d i f
2021-04-26 17:01:24 -03:00
i f e q ( $ ( f e a t u r e _ v e r b o s e ) , 1 )
T M P : = $ ( f i l t e r - o u t $ ( F E A T U R E _ D I S P L A Y ) , $ ( F E A T U R E _ T E S T S ) )
$ ( f o r e a c h f e a t , $ ( T M P ) , $ ( c a l l f e a t u r e _ p r i n t _ s t a t u s , $ ( f e a t ) , ) )
$ ( i n f o )
e n d i f
e n d e f
i f e q ( $ ( F E A T U R E _ D I S P L A Y _ D E F E R R E D ) , )
$ ( c a l l f e a t u r e _ d i s p l a y _ e n t r i e s )
2015-03-01 21:04:01 +01:00
e n d i f