File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,20 @@ extern void clear_cpu_cap(struct cpuinfo_x86 *c, unsigned int bit);
140
140
141
141
#define setup_force_cpu_bug (bit ) setup_force_cpu_cap(bit)
142
142
143
+ #if defined(__clang__ ) && !defined(CC_HAVE_ASM_GOTO )
144
+
145
+ /*
146
+ * Workaround for the sake of BPF compilation which utilizes kernel
147
+ * headers, but clang does not support ASM GOTO and fails the build.
148
+ */
149
+ #ifndef __BPF_TRACING__
150
+ #warning "Compiler lacks ASM_GOTO support. Add -D __BPF_TRACING__ to your compiler arguments"
151
+ #endif
152
+
153
+ #define static_cpu_has (bit ) boot_cpu_has(bit)
154
+
155
+ #else
156
+
143
157
/*
144
158
* Static testing of CPU features. Used the same as boot_cpu_has().
145
159
* These will statically patch the target code for additional
@@ -195,6 +209,7 @@ static __always_inline __pure bool _static_cpu_has(u16 bit)
195
209
boot_cpu_has(bit) : \
196
210
_static_cpu_has(bit) \
197
211
)
212
+ #endif
198
213
199
214
#define cpu_has_bug (c , bit ) cpu_has(c, (bit))
200
215
#define set_cpu_bug (c , bit ) set_cpu_cap(c, (bit))
Original file line number Diff line number Diff line change @@ -255,7 +255,7 @@ $(obj)/tracex5_kern.o: $(obj)/syscall_nrs.h
255
255
$(obj ) /% .o : $(src ) /% .c
256
256
$(CLANG ) $(NOSTDINC_FLAGS ) $(LINUXINCLUDE ) $(EXTRA_CFLAGS ) -I$(obj ) \
257
257
-I$(srctree ) /tools/testing/selftests/bpf/ \
258
- -D__KERNEL__ -Wno-unused-value -Wno-pointer-sign \
258
+ -D__KERNEL__ -D__BPF_TRACING__ - Wno-unused-value -Wno-pointer-sign \
259
259
-D__TARGET_ARCH_$(ARCH ) -Wno-compare-distinct-pointer-types \
260
260
-Wno-gnu-variable-sized-type-not-at-end \
261
261
-Wno-address-of-packed-member -Wno-tautological-compare \
You can’t perform that action at this time.
0 commit comments