linux_dsm_epyc7002/tools/lib/bpf
Thomas Richter 1ce6a9fc15 bpf: fix build error in libbpf with EXTRA_CFLAGS="-Wp, -D_FORTIFY_SOURCE=2 -O2"
Commit 531b014e7a ("tools: bpf: make use of reallocarray") causes
a compiler error when building the perf tool in the linux-next tree.
Compile file tools/lib/bpf/libbpf.c on a FEDORA 28 installation with
gcc compiler version: gcc (GCC) 8.0.1 20180324 (Red Hat 8.0.1-0.20)
shows this error message:

  [root@p23lp27] # make V=1 EXTRA_CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -O2"
  [...]
  make -f /home6/tmricht/linux-next/tools/build/Makefile.build
  	dir=./util/scripting-engines obj=libperf
  libbpf.c: In function ‘bpf_object__elf_collect’:
  libbpf.c:811:15: error: ignoring return value of ‘strerror_r’,
  		declared with attribute warn_unused_result [-Werror=unused-result]
       strerror_r(-err, errmsg, sizeof(errmsg));
                 ^
  cc1: all warnings being treated as errors
  mv: cannot stat './.libbpf.o.tmp': No such file or directory
  /home6/tmricht/linux-next/tools/build/Makefile.build:96: recipe for target 'libbpf.o' failed

Replace all occurrences of strerror() by calls to strerror_r(). To
keep the compiler quiet also use the return value from strerror_r()
otherwise a 'variable set but not use' warning which is treated as
error terminates the compile.

Fixes: 531b014e7a ("tools: bpf: make use of reallocarray")
Suggested-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2018-07-31 02:08:55 +02:00
..
.gitignore tools lib bpf: Change FEATURE-DUMP to FEATURE-DUMP.libbpf 2015-11-05 12:47:51 -03:00
bpf.c tools/bpf: sync kernel header bpf.h and add bpf_task_fd_query in libbpf 2018-05-24 18:18:19 -07:00
bpf.h tools/bpf: sync kernel header bpf.h and add bpf_task_fd_query in libbpf 2018-05-24 18:18:19 -07:00
btf.c bpf: btf: export btf types and name by offset from lib 2018-07-14 13:00:40 +02:00
btf.h bpf: btf: export btf types and name by offset from lib 2018-07-14 13:00:40 +02:00
Build tools: libbpf: move library error code into a separate file 2018-07-11 22:13:34 +02:00
libbpf_errno.c tools: libbpf: move library error code into a separate file 2018-07-11 22:13:34 +02:00
libbpf.c bpf: fix build error in libbpf with EXTRA_CFLAGS="-Wp, -D_FORTIFY_SOURCE=2 -O2" 2018-07-31 02:08:55 +02:00
libbpf.h tools: libbpf: add bpf_object__find_program_by_title() 2018-07-27 07:18:44 +02:00
Makefile tools: libbpf: remove libelf-getphdrnum feature detection 2018-07-16 16:36:49 -07:00
nlattr.c libbpf: add error reporting in XDP 2018-02-02 17:53:48 -08:00
nlattr.h libbpf: add error reporting in XDP 2018-02-02 17:53:48 -08:00