Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libperf: Do not include non-UAPI linux/compiler.h header

Its just for that __packed define, so use it expanded as __attribute__((packed)),
like the other files in /usr/include do.

This was problem was preventing building the libperf examples on ALT
Linux and Fedora 35, fix it.

Reported-by: Vitaly Chikunov <vt@altlinux.org>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Dmitry Levin <ldv@altlinux.org
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lore.kernel.org/lkml/Y0lnpl2Ix7VljVDc@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+2 -3
+2 -3
tools/lib/perf/include/perf/event.h
··· 6 6 #include <linux/types.h> 7 7 #include <linux/limits.h> 8 8 #include <linux/bpf.h> 9 - #include <linux/compiler.h> 10 9 #include <sys/types.h> /* pid_t */ 11 10 12 11 #define event_contains(obj, mem) ((obj).header.size > offsetof(typeof(obj), mem)) ··· 206 207 __u16 end_cpu; 207 208 }; 208 209 209 - struct __packed perf_record_cpu_map_data { 210 + struct perf_record_cpu_map_data { 210 211 __u16 type; 211 212 union { 212 213 /* Used when type == PERF_CPU_MAP__CPUS. */ ··· 218 219 /* Used when type == PERF_CPU_MAP__RANGE_CPUS. */ 219 220 struct perf_record_range_cpu_map range_cpu_data; 220 221 }; 221 - }; 222 + } __attribute__((packed)); 222 223 223 224 #pragma GCC diagnostic pop 224 225