Skip to contentSkip to conversation

selftests/sched_ext: Drop -rdynamic and stop clobbering LDFLAGS

PATCH Applied Cheng-Yang Chou 2 participants 2 messages Sep 9

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 selftests/sched_ext: Drop -rdynamic and stop clobbering LDFLAGS

CFLAGS passes the link-time flag -rdynamic to compile steps ($(CC) -c), where it is unused. Under -Werror, Clang fails the build:

    $ make CC=clang-21
    clang-21: error: argument unused during compilation: '-rdynamic'
                     [-Werror,-Wunused-command-line-argument]

Nothing needs the exported symbols. Separately, LDFLAGS uses '=' rather than '+=', discarding USERLDFLAGS from lib.mk.

Drop -rdynamic and append LDFLAGS with '+='. This fixes builds with CC=clang-N while preserving USERLDFLAGS.

---
Changes in v2:
- Drop -rdynamic instead of moving it to LDFLAGS (Tejun Heo)
- Link to v1:
https://lore.kernel.org/r/[email protected]/

 tools/testing/selftests/sched_ext/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/sched_ext/Makefile +2 -2
index 3cfe90e0f34f..5f5dd9ab903a 100644
@@ -53,7 +53,7 @@ ifneq ($(wildcard $(GENHDR)),)
   GENFLAGS := -DHAVE_GENHDR
 endif
 
-CFLAGS += -g -O2 -rdynamic -pthread -Wall -Werror $(GENFLAGS)			\
+CFLAGS += -g -O2 -pthread -Wall -Werror $(GENFLAGS)				\
 	  -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR)				\
 	  -I$(TOOLSINCDIR) -I$(APIDIR) -I$(CURDIR)/include -I$(SCXTOOLSINCDIR)
 
@@ -62,7 +62,7 @@ ifneq ($(LLVM),)
 CFLAGS += -Wno-unused-command-line-argument
 endif
 
-LDFLAGS = -lelf -lz -lpthread -lzstd
+LDFLAGS += -lelf -lz -lpthread -lzstd
 
 IS_LITTLE_ENDIAN = $(shell $(CC) -dM -E - </dev/null |				\
 			grep 'define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__')
Signature · 1 line
2.43.0
reviewer Applied
#1 lore raw

Hello,

Applied to sched_ext/for-7.4.

Thanks.

Signature · 1 line
tejun