License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
2021-01-28 09:50:58 +08:00
|
|
|
include ../../scripts/Makefile.include
|
|
|
|
|
2016-12-05 04:42:53 +08:00
|
|
|
FILES= \
|
|
|
|
test-all.bin \
|
|
|
|
test-backtrace.bin \
|
|
|
|
test-bionic.bin \
|
|
|
|
test-dwarf.bin \
|
|
|
|
test-dwarf_getlocations.bin \
|
2018-11-22 04:42:00 +08:00
|
|
|
test-eventfd.bin \
|
2016-12-05 04:42:53 +08:00
|
|
|
test-fortify-source.bin \
|
2018-11-20 03:56:22 +08:00
|
|
|
test-get_current_dir_name.bin \
|
2016-12-05 04:42:53 +08:00
|
|
|
test-glibc.bin \
|
|
|
|
test-gtk2.bin \
|
|
|
|
test-gtk2-infobar.bin \
|
|
|
|
test-hello.bin \
|
|
|
|
test-libaudit.bin \
|
|
|
|
test-libbfd.bin \
|
2020-09-04 00:44:39 +08:00
|
|
|
test-libbfd-buildid.bin \
|
2017-12-28 03:16:29 +08:00
|
|
|
test-disassembler-four-args.bin \
|
2018-07-11 05:43:05 +08:00
|
|
|
test-reallocarray.bin \
|
2018-11-16 08:32:01 +08:00
|
|
|
test-libbfd-liberty.bin \
|
|
|
|
test-libbfd-liberty-z.bin \
|
2016-12-05 04:42:53 +08:00
|
|
|
test-cplus-demangle.bin \
|
2019-08-07 22:44:14 +08:00
|
|
|
test-libcap.bin \
|
2016-12-05 04:42:53 +08:00
|
|
|
test-libelf.bin \
|
|
|
|
test-libelf-getphdrnum.bin \
|
|
|
|
test-libelf-gelf_getnote.bin \
|
|
|
|
test-libelf-getshdrstrndx.bin \
|
2020-08-13 16:22:04 +08:00
|
|
|
test-libdebuginfod.bin \
|
2016-12-05 04:42:53 +08:00
|
|
|
test-libnuma.bin \
|
|
|
|
test-numa_num_possible_cpus.bin \
|
|
|
|
test-libperl.bin \
|
|
|
|
test-libpython.bin \
|
|
|
|
test-libslang.bin \
|
2019-06-19 04:43:35 +08:00
|
|
|
test-libslang-include-subdir.bin \
|
2021-04-28 17:20:23 +08:00
|
|
|
test-libtraceevent.bin \
|
2021-09-23 08:10:21 +08:00
|
|
|
test-libtracefs.bin \
|
2016-12-05 04:42:53 +08:00
|
|
|
test-libcrypto.bin \
|
|
|
|
test-libunwind.bin \
|
|
|
|
test-libunwind-debug-frame.bin \
|
|
|
|
test-libunwind-x86.bin \
|
|
|
|
test-libunwind-x86_64.bin \
|
|
|
|
test-libunwind-arm.bin \
|
|
|
|
test-libunwind-aarch64.bin \
|
|
|
|
test-libunwind-debug-frame-arm.bin \
|
|
|
|
test-libunwind-debug-frame-aarch64.bin \
|
|
|
|
test-pthread-attr-setaffinity-np.bin \
|
2017-12-05 21:14:42 +08:00
|
|
|
test-pthread-barrier.bin \
|
2016-12-05 04:42:53 +08:00
|
|
|
test-stackprotector-all.bin \
|
|
|
|
test-timerfd.bin \
|
|
|
|
test-libdw-dwarf-unwind.bin \
|
|
|
|
test-libbabeltrace.bin \
|
|
|
|
test-compile-32.bin \
|
|
|
|
test-compile-x32.bin \
|
|
|
|
test-zlib.bin \
|
|
|
|
test-lzma.bin \
|
|
|
|
test-bpf.bin \
|
2019-11-26 20:12:53 +08:00
|
|
|
test-libbpf.bin \
|
2016-12-05 04:42:53 +08:00
|
|
|
test-get_cpuid.bin \
|
|
|
|
test-sdt.bin \
|
|
|
|
test-cxx.bin \
|
2019-06-13 23:04:19 +08:00
|
|
|
test-gettid.bin \
|
2017-03-02 23:55:49 +08:00
|
|
|
test-jvmti.bin \
|
2018-11-21 23:43:41 +08:00
|
|
|
test-jvmti-cmlr.bin \
|
2017-07-19 04:15:29 +08:00
|
|
|
test-sched_getcpu.bin \
|
2018-01-18 01:52:10 +08:00
|
|
|
test-setns.bin \
|
2018-03-07 23:50:19 +08:00
|
|
|
test-libopencsd.bin \
|
|
|
|
test-clang.bin \
|
|
|
|
test-llvm.bin \
|
2018-11-06 17:03:35 +08:00
|
|
|
test-llvm-version.bin \
|
2019-03-19 01:39:49 +08:00
|
|
|
test-libaio.bin \
|
2020-03-13 02:23:30 +08:00
|
|
|
test-libzstd.bin \
|
2020-06-20 07:17:00 +08:00
|
|
|
test-clang-bpf-co-re.bin \
|
2020-04-30 07:14:41 +08:00
|
|
|
test-file-handle.bin \
|
|
|
|
test-libpfm4.bin
|
2013-09-30 16:08:24 +08:00
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
FILES := $(addprefix $(OUTPUT),$(FILES))
|
|
|
|
|
2017-04-12 14:49:14 +08:00
|
|
|
PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
|
2013-09-30 19:51:28 +08:00
|
|
|
|
2013-09-30 16:08:24 +08:00
|
|
|
all: $(FILES)
|
|
|
|
|
2017-04-12 14:49:14 +08:00
|
|
|
__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
|
2015-12-15 23:39:32 +08:00
|
|
|
BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
|
2013-09-30 16:08:24 +08:00
|
|
|
|
2017-04-12 14:49:14 +08:00
|
|
|
__BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
|
2016-09-26 15:26:56 +08:00
|
|
|
BUILDXX = $(__BUILDXX) > $(@:.bin=.make.output) 2>&1
|
|
|
|
|
2013-09-30 16:08:24 +08:00
|
|
|
###############################
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-all.bin:
|
2021-10-26 01:23:13 +08:00
|
|
|
$(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -lslang $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma -lzstd -lcap
|
2013-10-01 20:14:31 +08:00
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-hello.bin:
|
2013-09-30 16:08:24 +08:00
|
|
|
$(BUILD)
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-pthread-attr-setaffinity-np.bin:
|
2015-02-28 17:16:27 +08:00
|
|
|
$(BUILD) -D_GNU_SOURCE -lpthread
|
2015-01-13 21:43:24 +08:00
|
|
|
|
2017-12-05 21:14:42 +08:00
|
|
|
$(OUTPUT)test-pthread-barrier.bin:
|
|
|
|
$(BUILD) -lpthread
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-stackprotector-all.bin:
|
2015-02-28 17:16:27 +08:00
|
|
|
$(BUILD) -fstack-protector-all
|
2013-09-30 19:48:44 +08:00
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-fortify-source.bin:
|
2015-02-28 17:16:27 +08:00
|
|
|
$(BUILD) -O2 -D_FORTIFY_SOURCE=2
|
2013-10-07 15:38:28 +08:00
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-bionic.bin:
|
2013-09-30 20:11:46 +08:00
|
|
|
$(BUILD)
|
|
|
|
|
2019-08-07 22:44:14 +08:00
|
|
|
$(OUTPUT)test-libcap.bin:
|
|
|
|
$(BUILD) -lcap
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-libelf.bin:
|
2013-09-30 20:20:25 +08:00
|
|
|
$(BUILD) -lelf
|
|
|
|
|
2018-11-22 04:42:00 +08:00
|
|
|
$(OUTPUT)test-eventfd.bin:
|
|
|
|
$(BUILD)
|
|
|
|
|
2018-11-20 03:56:22 +08:00
|
|
|
$(OUTPUT)test-get_current_dir_name.bin:
|
|
|
|
$(BUILD)
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-glibc.bin:
|
2013-10-07 16:34:20 +08:00
|
|
|
$(BUILD)
|
|
|
|
|
2017-03-02 23:55:49 +08:00
|
|
|
$(OUTPUT)test-sched_getcpu.bin:
|
|
|
|
$(BUILD)
|
|
|
|
|
2017-07-19 04:15:29 +08:00
|
|
|
$(OUTPUT)test-setns.bin:
|
|
|
|
$(BUILD)
|
|
|
|
|
2018-01-18 01:52:10 +08:00
|
|
|
$(OUTPUT)test-libopencsd.bin:
|
|
|
|
$(BUILD) # -lopencsd_c_api -lopencsd provided by
|
|
|
|
# $(FEATURE_CHECK_LDFLAGS-libopencsd)
|
|
|
|
|
2015-08-13 06:48:37 +08:00
|
|
|
DWARFLIBS := -ldw
|
|
|
|
ifeq ($(findstring -static,${LDFLAGS}),-static)
|
|
|
|
DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
|
|
|
|
endif
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-dwarf.bin:
|
2015-08-13 06:48:37 +08:00
|
|
|
$(BUILD) $(DWARFLIBS)
|
2013-10-07 16:35:39 +08:00
|
|
|
|
2016-04-05 22:33:41 +08:00
|
|
|
$(OUTPUT)test-dwarf_getlocations.bin:
|
|
|
|
$(BUILD) $(DWARFLIBS)
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-libelf-getphdrnum.bin:
|
2013-09-30 20:35:27 +08:00
|
|
|
$(BUILD) -lelf
|
|
|
|
|
2016-07-12 23:19:09 +08:00
|
|
|
$(OUTPUT)test-libelf-gelf_getnote.bin:
|
|
|
|
$(BUILD) -lelf
|
|
|
|
|
2016-07-05 06:35:47 +08:00
|
|
|
$(OUTPUT)test-libelf-getshdrstrndx.bin:
|
|
|
|
$(BUILD) -lelf
|
|
|
|
|
2020-08-13 16:22:04 +08:00
|
|
|
$(OUTPUT)test-libdebuginfod.bin:
|
|
|
|
$(BUILD) -ldebuginfod
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-libnuma.bin:
|
2013-09-30 19:37:10 +08:00
|
|
|
$(BUILD) -lnuma
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-numa_num_possible_cpus.bin:
|
2015-09-17 23:20:28 +08:00
|
|
|
$(BUILD) -lnuma
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-libunwind.bin:
|
2013-12-10 20:24:04 +08:00
|
|
|
$(BUILD) -lelf
|
2013-09-30 20:45:44 +08:00
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-libunwind-debug-frame.bin:
|
2013-12-10 20:24:04 +08:00
|
|
|
$(BUILD) -lelf
|
2016-05-10 15:40:31 +08:00
|
|
|
$(OUTPUT)test-libunwind-x86.bin:
|
|
|
|
$(BUILD) -lelf -lunwind-x86
|
|
|
|
|
|
|
|
$(OUTPUT)test-libunwind-x86_64.bin:
|
|
|
|
$(BUILD) -lelf -lunwind-x86_64
|
|
|
|
|
|
|
|
$(OUTPUT)test-libunwind-arm.bin:
|
|
|
|
$(BUILD) -lelf -lunwind-arm
|
|
|
|
|
|
|
|
$(OUTPUT)test-libunwind-aarch64.bin:
|
|
|
|
$(BUILD) -lelf -lunwind-aarch64
|
|
|
|
|
2016-05-10 15:40:32 +08:00
|
|
|
$(OUTPUT)test-libunwind-debug-frame-arm.bin:
|
|
|
|
$(BUILD) -lelf -lunwind-arm
|
|
|
|
|
|
|
|
$(OUTPUT)test-libunwind-debug-frame-aarch64.bin:
|
|
|
|
$(BUILD) -lelf -lunwind-aarch64
|
2013-11-14 15:25:24 +08:00
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-libaudit.bin:
|
2013-09-30 20:55:31 +08:00
|
|
|
$(BUILD) -laudit
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-libslang.bin:
|
2019-06-15 02:39:47 +08:00
|
|
|
$(BUILD) -lslang
|
2013-09-30 20:57:54 +08:00
|
|
|
|
2019-06-19 04:43:35 +08:00
|
|
|
$(OUTPUT)test-libslang-include-subdir.bin:
|
|
|
|
$(BUILD) -lslang
|
|
|
|
|
2021-04-28 17:20:23 +08:00
|
|
|
$(OUTPUT)test-libtraceevent.bin:
|
|
|
|
$(BUILD) -ltraceevent
|
|
|
|
|
2021-09-23 08:10:21 +08:00
|
|
|
$(OUTPUT)test-libtracefs.bin:
|
|
|
|
$(BUILD) -ltracefs
|
|
|
|
|
2015-11-30 17:02:21 +08:00
|
|
|
$(OUTPUT)test-libcrypto.bin:
|
|
|
|
$(BUILD) -lcrypto
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-gtk2.bin:
|
2020-01-13 18:43:58 +08:00
|
|
|
$(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) -Wno-deprecated-declarations
|
2013-09-30 21:01:56 +08:00
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-gtk2-infobar.bin:
|
2014-01-15 18:44:08 +08:00
|
|
|
$(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
|
2013-09-30 21:08:30 +08:00
|
|
|
|
2013-09-30 21:15:36 +08:00
|
|
|
grep-libs = $(filter -l%,$(1))
|
|
|
|
strip-libs = $(filter-out -l%,$(1))
|
|
|
|
|
|
|
|
PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
|
|
|
|
PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
|
|
|
|
PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
|
|
|
|
PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
|
|
|
|
FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-libperl.bin:
|
2013-09-30 21:15:36 +08:00
|
|
|
$(BUILD) $(FLAGS_PERL_EMBED)
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-libpython.bin:
|
2017-04-12 14:49:13 +08:00
|
|
|
$(BUILD) $(FLAGS_PYTHON_EMBED)
|
2013-09-30 21:18:37 +08:00
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-libbfd.bin:
|
2018-11-16 08:32:01 +08:00
|
|
|
$(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
|
2013-09-30 21:53:31 +08:00
|
|
|
|
2020-09-04 00:44:39 +08:00
|
|
|
$(OUTPUT)test-libbfd-buildid.bin:
|
|
|
|
$(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
|
|
|
|
|
2017-12-28 03:16:29 +08:00
|
|
|
$(OUTPUT)test-disassembler-four-args.bin:
|
2018-01-17 07:51:47 +08:00
|
|
|
$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
|
2017-12-28 03:16:29 +08:00
|
|
|
|
2018-07-11 05:43:05 +08:00
|
|
|
$(OUTPUT)test-reallocarray.bin:
|
|
|
|
$(BUILD)
|
|
|
|
|
2018-11-16 08:32:01 +08:00
|
|
|
$(OUTPUT)test-libbfd-liberty.bin:
|
2015-12-15 23:39:32 +08:00
|
|
|
$(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
|
2013-10-02 21:15:09 +08:00
|
|
|
|
2018-11-16 08:32:01 +08:00
|
|
|
$(OUTPUT)test-libbfd-liberty-z.bin:
|
2015-12-15 23:39:32 +08:00
|
|
|
$(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
|
2013-10-02 21:15:09 +08:00
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-cplus-demangle.bin:
|
2013-10-02 21:15:09 +08:00
|
|
|
$(BUILD) -liberty
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-backtrace.bin:
|
2013-09-30 22:49:38 +08:00
|
|
|
$(BUILD)
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-timerfd.bin:
|
2013-10-30 00:43:16 +08:00
|
|
|
$(BUILD)
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-libdw-dwarf-unwind.bin:
|
2015-02-21 06:16:58 +08:00
|
|
|
$(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-libbabeltrace.bin:
|
2015-02-21 06:16:58 +08:00
|
|
|
$(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
|
2014-02-19 23:52:56 +08:00
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-compile-32.bin:
|
|
|
|
$(CC) -m32 -o $@ test-compile.c
|
2014-10-24 05:16:03 +08:00
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-compile-x32.bin:
|
|
|
|
$(CC) -mx32 -o $@ test-compile.c
|
2014-10-24 05:16:03 +08:00
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-zlib.bin:
|
perf tools: Add gzip decompression support for kernel module
Now my Archlinux box shows module symbols correctly.
Before:
$ perf report --stdio
Failed to open /tmp/perf-3477.map, continuing without symbols
no symbols found in /usr/bin/date, maybe install a debug package?
No kallsyms or vmlinux with build-id 7b4ea0a49ae2111925857099aaf05c3246ff33e0 was found
[drm] with build id 7b4ea0a49ae2111925857099aaf05c3246ff33e0 not found, continuing without symbols
No kallsyms or vmlinux with build-id edd931629094b660ca9dec09a1b635c8d87aa2ee was found
[jbd2] with build id edd931629094b660ca9dec09a1b635c8d87aa2ee not found, continuing without symbols
No kallsyms or vmlinux with build-id a7b1eada671c34933e5610bb920b2ca4945a82c3 was found
[ext4] with build id a7b1eada671c34933e5610bb920b2ca4945a82c3 not found, continuing without symbols
No kallsyms or vmlinux with build-id d69511fa3e5840e770336ef45b06c83fef8d74e3 was found
[scsi_mod] with build id d69511fa3e5840e770336ef45b06c83fef8d74e3 not found, continuing without symbols
No kallsyms or vmlinux with build-id af0430af13461af058770ee9b87afc07922c2e77 was found
[libata] with build id af0430af13461af058770ee9b87afc07922c2e77 not found, continuing without symbols
No kallsyms or vmlinux with build-id aaeedff8160ce631a5f0333591c6ff291201d29f was found
[libahci] with build id aaeedff8160ce631a5f0333591c6ff291201d29f not found, continuing without symbols
No kallsyms or vmlinux with build-id c57907712becaf662dc4981824bb372c0441d605 was found
[mac80211] with build id c57907712becaf662dc4981824bb372c0441d605 not found, continuing without symbols
No kallsyms or vmlinux with build-id e0589077cc0ec8c3e4c40eb9f2d9e69d236bee8f was found
[iwldvm] with build id e0589077cc0ec8c3e4c40eb9f2d9e69d236bee8f not found, continuing without symbols
No kallsyms or vmlinux with build-id 2d86086bf136bf374a2f029cf85a48194f9b950b was found
[cfg80211] with build id 2d86086bf136bf374a2f029cf85a48194f9b950b not found, continuing without symbols
No kallsyms or vmlinux with build-id 4493c48599bdb3d91d0f8db5150e0be33fdd9221 was found
[iwlwifi] with build id 4493c48599bdb3d91d0f8db5150e0be33fdd9221 not found, continuing without symbols
...
#
# Overhead Command Shared Object Symbol
# ........ ............... ....................... ........................................................
#
0.03% swapper [ext4] [k] 0x000000000000fe2e
0.03% swapper [kernel.kallsyms] [k] account_entity_enqueue
0.03% swapper [ext4] [k] 0x000000000000fc2b
0.03% irq/50-iwlwifi [iwlwifi] [k] 0x000000000000200b
0.03% swapper [kernel.kallsyms] [k] ktime_add_safe
0.03% swapper [kernel.kallsyms] [k] elv_completed_request
0.03% swapper [libata] [k] 0x0000000000003997
0.03% swapper [libahci] [k] 0x0000000000001f25
0.03% swapper [kernel.kallsyms] [k] rb_next
0.03% swapper [kernel.kallsyms] [k] blk_finish_request
0.03% swapper [ext4] [k] 0x0000000000010248
0.00% perf [kernel.kallsyms] [k] native_write_msr_safe
After:
$ perf report --stdio
Failed to open /tmp/perf-3477.map, continuing without symbols
no symbols found in /usr/bin/tr, maybe install a debug package?
...
#
# Overhead Command Shared Object Symbol
# ........ ............... ........................... ......................................................
#
0.04% kworker/u16:3 [ext4] [k] ext4_read_block_bitmap
0.03% kworker/u16:0 [mac80211] [k] ieee80211_sta_reset_beacon_monitor
0.02% irq/50-iwlwifi [mac80211] [k] ieee80211_get_bssid
0.02% firefox [e1000e] [k] __ew32_prepare
0.02% swapper [libahci] [k] ahci_handle_port_interrupt
0.02% emacs libglib-2.0.so.0.4000.0 [.] g_mutex_unlock
0.02% swapper [e1000e] [k] e1000_clean_tx_irq
0.02% dwm [kernel.kallsyms] [k] __schedule
0.02% gnome-terminal- [vdso] [.] __vdso_clock_gettime
0.02% swapper [e1000e] [k] e1000_alloc_rx_buffers
0.02% irq/50-iwlwifi [mac80211] [k] ieee80211_rx
0.01% firefox [vdso] [.] __vdso_gettimeofday
0.01% irq/50-iwlwifi [iwlwifi] [k] iwl_pcie_rxq_restock.part.13
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/87h9yexshi.fsf@sejong.aot.lge.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-10-31 15:51:38 +08:00
|
|
|
$(BUILD) -lz
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-lzma.bin:
|
2015-03-04 18:35:47 +08:00
|
|
|
$(BUILD) -llzma
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-get_cpuid.bin:
|
2015-09-17 23:54:30 +08:00
|
|
|
$(BUILD)
|
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
$(OUTPUT)test-bpf.bin:
|
bpf tools: Introduce 'bpf' library and add bpf feature check
This is the first patch of libbpf. The goal of libbpf is to create a
standard way for accessing eBPF object files. This patch creates
'Makefile' and 'Build' for it, allows 'make' to build libbpf.a and
libbpf.so, 'make install' to put them into proper directories.
Most part of Makefile is borrowed from traceevent.
Before building, it checks the existence of libelf in Makefile, and deny
to build if not found. Instead of throwing an error if libelf not found,
the error raises in a phony target "elfdep". This design is to ensure
'make clean' still workable even if libelf is not found.
Because libbpf requires 'kern_version' field set for 'union bpf_attr'
(bpfdep" is used for that dependency), Kernel BPF API is also checked
by intruducing a new feature check 'bpf' into tools/build/feature,
which checks the existence and version of linux/bpf.h. When building
libbpf, it searches that file from include/uapi/linux in kernel source
tree (controlled by FEATURE_CHECK_CFLAGS-bpf). Since it searches kernel
source tree it reside, installing of newest kernel headers is not
required, except we are trying to port these files to an old kernel.
To avoid checking that file when perf building, the newly introduced
'bpf' feature check doesn't added into FEATURE_TESTS and
FEATURE_DISPLAY by default in tools/build/Makefile.feature, but added
into libbpf's specific.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David Ahern <dsahern@gmail.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kaixu Xia <xiakaixu@huawei.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Zefan Li <lizefan@huawei.com>
Bcc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1435716878-189507-4-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-07-01 10:13:51 +08:00
|
|
|
$(BUILD)
|
|
|
|
|
2019-11-26 20:12:53 +08:00
|
|
|
$(OUTPUT)test-libbpf.bin:
|
|
|
|
$(BUILD) -lbpf
|
|
|
|
|
2016-07-12 18:05:56 +08:00
|
|
|
$(OUTPUT)test-sdt.bin:
|
|
|
|
$(BUILD)
|
|
|
|
|
2016-09-26 15:26:56 +08:00
|
|
|
$(OUTPUT)test-cxx.bin:
|
|
|
|
$(BUILDXX) -std=gnu++11
|
|
|
|
|
2019-06-13 23:04:19 +08:00
|
|
|
$(OUTPUT)test-gettid.bin:
|
|
|
|
$(BUILD)
|
|
|
|
|
2016-11-02 21:35:48 +08:00
|
|
|
$(OUTPUT)test-jvmti.bin:
|
|
|
|
$(BUILD)
|
|
|
|
|
2018-11-21 23:43:41 +08:00
|
|
|
$(OUTPUT)test-jvmti-cmlr.bin:
|
|
|
|
$(BUILD)
|
|
|
|
|
2016-11-26 15:03:31 +08:00
|
|
|
$(OUTPUT)test-llvm.bin:
|
2021-10-12 10:13:20 +08:00
|
|
|
$(BUILDXX) -std=gnu++14 \
|
2016-11-26 15:03:31 +08:00
|
|
|
-I$(shell $(LLVM_CONFIG) --includedir) \
|
|
|
|
-L$(shell $(LLVM_CONFIG) --libdir) \
|
|
|
|
$(shell $(LLVM_CONFIG) --libs Core BPF) \
|
2018-03-07 23:50:20 +08:00
|
|
|
$(shell $(LLVM_CONFIG) --system-libs) \
|
|
|
|
> $(@:.bin=.make.output) 2>&1
|
2016-11-26 15:03:31 +08:00
|
|
|
|
perf build: Check LLVM version in feature check
Cancel builtin llvm and clang support when LLVM version is less than
3.9.0: following commits uses newer API.
Since Clang/LLVM's API is not guaranteed to be stable, add a
test-llvm-version.cpp feature checker, issue warning if LLVM found in
compiling environment is not tested yet.
Committer Notes:
Testing it:
Environment:
$ cat /etc/fedora-release
Fedora release 25 (Twenty Five)
$ rpm -q llvm-devel clang-devel
llvm-devel-3.8.0-1.fc25.x86_64
clang-devel-3.8.0-2.fc25.x86_64
$
Before:
$ make -k LIBCLANGLLVM=1 O=/tmp/build/perf -C tools/perf install-bin
make: Entering directory '/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build
Warning: tools/include/uapi/linux/bpf.h differs from kernel
Warning: tools/arch/arm/include/uapi/asm/kvm.h differs from kernel
INSTALL GTK UI
LINK /tmp/build/perf/perf
/tmp/build/perf/libperf.a(libperf-in.o): In function `perf::createCompilerInvocation(llvm::SmallVector<char const*, 16u>, llvm::StringRef&, clang::DiagnosticsEngine&)':
/home/acme/git/linux/tools/perf/util/c++/clang.cpp:56: undefined reference to `clang::tooling::newInvocation(clang::DiagnosticsEngine*, llvm::SmallVector<char const*, 16u> const&)'
/tmp/build/perf/libperf.a(libperf-in.o): In function `perf::getModuleFromSource(llvm::SmallVector<char const*, 16u>, llvm::StringRef, llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem>)':
/home/acme/git/linux/tools/perf/util/c++/clang.cpp:68: undefined reference to `clang::CompilerInstance::CompilerInstance(std::shared_ptr<clang::PCHContainerOperations>, bool)'
/home/acme/git/linux/tools/perf/util/c++/clang.cpp:69: undefined reference to `clang::CompilerInstance::createDiagnostics(clang::DiagnosticConsumer*, bool)'
<SNIP>
After:
Makefile.config:807: No suitable libLLVM found, disabling builtin clang and llvm support. Please install llvm-dev(el) (>= 3.9.0)
Updating the environment to a locally built LLVM 4.0 + clang 3.9 (forgot
to git pull, duh) combo, all works as expected, it is properly detected
and built into the resulting perf binary.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Reported-and-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Joe Stringer <joe@ovn.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/20161206072230.7651-1-wangnan0@huawei.com
[ Change the warning message a bit (add 'suitable' and 'builtin'), clarifying it, see committer notes above ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-12-06 15:22:30 +08:00
|
|
|
$(OUTPUT)test-llvm-version.bin:
|
2021-10-12 10:13:20 +08:00
|
|
|
$(BUILDXX) -std=gnu++14 \
|
2018-03-07 23:50:20 +08:00
|
|
|
-I$(shell $(LLVM_CONFIG) --includedir) \
|
|
|
|
> $(@:.bin=.make.output) 2>&1
|
perf build: Check LLVM version in feature check
Cancel builtin llvm and clang support when LLVM version is less than
3.9.0: following commits uses newer API.
Since Clang/LLVM's API is not guaranteed to be stable, add a
test-llvm-version.cpp feature checker, issue warning if LLVM found in
compiling environment is not tested yet.
Committer Notes:
Testing it:
Environment:
$ cat /etc/fedora-release
Fedora release 25 (Twenty Five)
$ rpm -q llvm-devel clang-devel
llvm-devel-3.8.0-1.fc25.x86_64
clang-devel-3.8.0-2.fc25.x86_64
$
Before:
$ make -k LIBCLANGLLVM=1 O=/tmp/build/perf -C tools/perf install-bin
make: Entering directory '/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build
Warning: tools/include/uapi/linux/bpf.h differs from kernel
Warning: tools/arch/arm/include/uapi/asm/kvm.h differs from kernel
INSTALL GTK UI
LINK /tmp/build/perf/perf
/tmp/build/perf/libperf.a(libperf-in.o): In function `perf::createCompilerInvocation(llvm::SmallVector<char const*, 16u>, llvm::StringRef&, clang::DiagnosticsEngine&)':
/home/acme/git/linux/tools/perf/util/c++/clang.cpp:56: undefined reference to `clang::tooling::newInvocation(clang::DiagnosticsEngine*, llvm::SmallVector<char const*, 16u> const&)'
/tmp/build/perf/libperf.a(libperf-in.o): In function `perf::getModuleFromSource(llvm::SmallVector<char const*, 16u>, llvm::StringRef, llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem>)':
/home/acme/git/linux/tools/perf/util/c++/clang.cpp:68: undefined reference to `clang::CompilerInstance::CompilerInstance(std::shared_ptr<clang::PCHContainerOperations>, bool)'
/home/acme/git/linux/tools/perf/util/c++/clang.cpp:69: undefined reference to `clang::CompilerInstance::createDiagnostics(clang::DiagnosticConsumer*, bool)'
<SNIP>
After:
Makefile.config:807: No suitable libLLVM found, disabling builtin clang and llvm support. Please install llvm-dev(el) (>= 3.9.0)
Updating the environment to a locally built LLVM 4.0 + clang 3.9 (forgot
to git pull, duh) combo, all works as expected, it is properly detected
and built into the resulting perf binary.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Reported-and-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Joe Stringer <joe@ovn.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/20161206072230.7651-1-wangnan0@huawei.com
[ Change the warning message a bit (add 'suitable' and 'builtin'), clarifying it, see committer notes above ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-12-06 15:22:30 +08:00
|
|
|
|
2016-11-26 15:03:32 +08:00
|
|
|
$(OUTPUT)test-clang.bin:
|
2021-10-12 10:13:20 +08:00
|
|
|
$(BUILDXX) -std=gnu++14 \
|
2016-11-26 15:03:32 +08:00
|
|
|
-I$(shell $(LLVM_CONFIG) --includedir) \
|
|
|
|
-L$(shell $(LLVM_CONFIG) --libdir) \
|
|
|
|
-Wl,--start-group -lclangBasic -lclangDriver \
|
|
|
|
-lclangFrontend -lclangEdit -lclangLex \
|
|
|
|
-lclangAST -Wl,--end-group \
|
|
|
|
$(shell $(LLVM_CONFIG) --libs Core option) \
|
2018-03-07 23:50:20 +08:00
|
|
|
$(shell $(LLVM_CONFIG) --system-libs) \
|
|
|
|
> $(@:.bin=.make.output) 2>&1
|
2016-11-26 15:03:32 +08:00
|
|
|
|
2015-12-15 23:39:32 +08:00
|
|
|
-include $(OUTPUT)*.d
|
2013-09-30 19:51:28 +08:00
|
|
|
|
2018-11-06 17:03:35 +08:00
|
|
|
$(OUTPUT)test-libaio.bin:
|
|
|
|
$(BUILD) -lrt
|
|
|
|
|
2019-03-19 01:39:49 +08:00
|
|
|
$(OUTPUT)test-libzstd.bin:
|
|
|
|
$(BUILD) -lzstd
|
|
|
|
|
2020-06-20 07:17:00 +08:00
|
|
|
$(OUTPUT)test-clang-bpf-co-re.bin:
|
2020-03-13 02:23:30 +08:00
|
|
|
$(CLANG) -S -g -target bpf -o - $(patsubst %.bin,%.c,$(@F)) | \
|
|
|
|
grep BTF_KIND_VAR
|
|
|
|
|
2020-04-02 09:52:49 +08:00
|
|
|
$(OUTPUT)test-file-handle.bin:
|
|
|
|
$(BUILD)
|
2020-03-13 02:23:30 +08:00
|
|
|
|
2020-04-30 07:14:41 +08:00
|
|
|
$(OUTPUT)test-libpfm4.bin:
|
|
|
|
$(BUILD) -lpfm
|
|
|
|
|
2013-09-30 16:08:24 +08:00
|
|
|
###############################
|
|
|
|
|
|
|
|
clean:
|
2015-12-15 23:39:32 +08:00
|
|
|
rm -f $(FILES) $(OUTPUT)*.d $(FILES:.bin=.make.output)
|