On Mon, Jul 22, 2024 at 02:22:53PM -0700, Andrii Nakryiko wrote: > On Sun, Jul 21, 2024 at 12:51 AM Tony Ambardar <tony.ambardar@xxxxxxxxx> wrote: [...] > > --- a/tools/testing/selftests/bpf/Makefile > > +++ b/tools/testing/selftests/bpf/Makefile > > @@ -784,9 +784,12 @@ $(OUTPUT)/veristat: $(OUTPUT)/veristat.o > > $(call msg,BINARY,,$@) > > $(Q)$(CC) $(CFLAGS) $(LDFLAGS) $(filter %.a %.o,$^) $(LDLIBS) -o $@ > > > > +# Linking uprobe_multi can fail due to relocation overflows on mips. > > +uprobe_multi.c-CFLAGS := $(if $(filter mips, $(ARCH)),-mxgot) > > + > > $(OUTPUT)/uprobe_multi: uprobe_multi.c > > $(call msg,BINARY,,$@) > > - $(Q)$(CC) $(CFLAGS) -O0 $(LDFLAGS) $^ $(LDLIBS) -o $@ > > + $(Q)$(CC) $(CFLAGS) $($<-CFLAGS) -O0 $(LDFLAGS) $^ $(LDLIBS) -o $@ > > this $($<-CFLAGS) approach is fragile, non-obvious and will break. But > there is also no need for this, see: > > $(OUTPUT)/bench: LDLIBS += -lm > > make allows to override envvars on a per-target basis, so all you > should need is: > > > $(OUTPUT)/uprobe_multi: CFLAGS += $(if $(filter mips, $(ARCH)),-mxgot) > $(OUTPUT)/uprobe_multi: uprobe_multi.c > ... the rest is the same with no change whatsoever ... > Great suggestion, thanks for pointing that out! I'll update and send v2. > > > > EXTRA_CLEAN := $(SCRATCH_DIR) $(HOST_SCRATCH_DIR) \ > > prog_tests/tests.h map_tests/tests.h verifier/tests.h \ > > -- > > 2.34.1 > >