|
71 | 71 | CC ?= cc |
72 | 72 | LD ?= ld |
73 | 73 | OBJDUMP ?= objdump |
| 74 | + AWK ?= awk |
| 75 | + # Bake the following awk program in a string. The program is needed to add C++ |
| 76 | + # to the languages excluded from BTF generation. |
| 77 | + # |
| 78 | + # Also, unconditionally return success (0) from the awk program, rather than |
| 79 | + # propagating pahole's return status (with 'exit system(pahole_cmd)'), to |
| 80 | + # workaround an DW_TAG_rvalue_reference_type error in |
| 81 | + # kernel/nvidia-modeset.ko. |
| 82 | + # |
| 83 | + # BEGIN { |
| 84 | + # pahole_cmd = "pahole" |
| 85 | + # for (i = 1; i < ARGC; i++) { |
| 86 | + # if (ARGV[i] ~ /--lang_exclude=/) { |
| 87 | + # pahole_cmd = pahole_cmd sprintf(" %s,c++", ARGV[i]) |
| 88 | + # } else { |
| 89 | + # pahole_cmd = pahole_cmd sprintf(" %s", ARGV[i]) |
| 90 | + # } |
| 91 | + # } |
| 92 | + # system(pahole_cmd) |
| 93 | + # } |
| 94 | + PAHOLE_AWK_PROGRAM = BEGIN { pahole_cmd = \"pahole\"; for (i = 1; i < ARGC; i++) { if (ARGV[i] ~ /--lang_exclude=/) { pahole_cmd = pahole_cmd sprintf(\" %s,c++\", ARGV[i]); } else { pahole_cmd = pahole_cmd sprintf(\" %s\", ARGV[i]); } } system(pahole_cmd); } |
| 95 | + # If scripts/pahole-flags.sh is not present in the kernel tree, add PAHOLE and |
| 96 | + # PAHOLE_AWK_PROGRAM assignments to PAHOLE_VARIABLES; otherwise assign the |
| 97 | + # empty string to PAHOLE_VARIABLES. |
| 98 | + PAHOLE_VARIABLES=$(if $(wildcard $(KERNEL_SOURCES)/scripts/pahole-flags.sh),,"PAHOLE=$(AWK) '$(PAHOLE_AWK_PROGRAM)'") |
74 | 99 |
|
75 | 100 | ifndef ARCH |
76 | 101 | ARCH := $(shell uname -m | sed -e 's/i.86/i386/' \ |
|
86 | 111 | ifneq ($(filter $(ARCH),i386 x86_64),) |
87 | 112 | KERNEL_ARCH = x86 |
88 | 113 | else |
89 | | - ifeq ($(filter $(ARCH),arm64 powerpc),) |
| 114 | + ifeq ($(filter $(ARCH),arm64 powerpc riscv),) |
90 | 115 | $(error Unsupported architecture $(ARCH)) |
91 | 116 | endif |
92 | 117 | endif |
|
112 | 137 |
|
113 | 138 | .PHONY: modules module clean clean_conftest modules_install |
114 | 139 | modules clean modules_install: |
115 | | - @$(MAKE) "LD=$(LD)" "CC=$(CC)" "OBJDUMP=$(OBJDUMP)" $(KBUILD_PARAMS) $@ |
| 140 | + @$(MAKE) "LD=$(LD)" "CC=$(CC)" "OBJDUMP=$(OBJDUMP)" \ |
| 141 | + $(PAHOLE_VARIABLES) $(KBUILD_PARAMS) $@ |
116 | 142 | @if [ "$@" = "modules" ]; then \ |
117 | 143 | for module in $(NV_KERNEL_MODULES); do \ |
118 | 144 | if [ -x split-object-file.sh ]; then \ |
|
0 commit comments