* [PATCH sched_ext/for-7.4 0/2] sched_ext: Clean up -rdynamic and LDFLAGS in Makefiles
@ 2026-09-08 13:47 Cheng-Yang Chou
2026-09-08 13:47 ` [PATCH 1/2] tools/sched_ext: Drop the no-op -rdynamic from CFLAGS Cheng-Yang Chou
0 siblings, 1 reply; 6+ messages in thread
From: Cheng-Yang Chou @ 2026-09-08 13:47 UTC (permalink / raw)
To: sched-ext, Tejun Heo, David Vernet, Andrea Righi, Changwoo Min
Cc: Ching-Chun Huang, Chia-Ping Tsai, chengyang.chou, Cheng-Yang Chou
Building the demo schedulers and selftests with CC=clang-N fails under
-Werror because CFLAGS passes the link-time flag -rdynamic to compile
steps ($(CC) -c):
$ make CC=clang-21
clang-21: error: argument unused during compilation: '-rdynamic'
[-Werror,-Wunused-command-line-argument]
Patch 1: Drop the inert -rdynamic from tools/sched_ext. Binaries remain
byte-identical before and after.
Patch 2: Move -rdynamic to LDFLAGS and append with '+=' in selftests.
Thanks,
Cheng-Yang
---
Cheng-Yang Chou (2):
tools/sched_ext: Drop the no-op -rdynamic from CFLAGS
selftests/sched_ext: Move -rdynamic to LDFLAGS and append to it
tools/sched_ext/Makefile | 2 +-
tools/testing/selftests/sched_ext/Makefile | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] tools/sched_ext: Drop the no-op -rdynamic from CFLAGS
2026-09-08 13:47 [PATCH sched_ext/for-7.4 0/2] sched_ext: Clean up -rdynamic and LDFLAGS in Makefiles Cheng-Yang Chou
@ 2026-09-08 13:47 ` Cheng-Yang Chou
2026-09-08 13:47 ` [PATCH 2/2] selftests/sched_ext: Move -rdynamic to LDFLAGS and append to it Cheng-Yang Chou
2026-09-08 17:09 ` [PATCH 1/2] tools/sched_ext: Drop the no-op -rdynamic from CFLAGS Tejun Heo
0 siblings, 2 replies; 6+ messages in thread
From: Cheng-Yang Chou @ 2026-09-08 13:47 UTC (permalink / raw)
To: sched-ext, Tejun Heo, David Vernet, Andrea Righi, Changwoo Min
Cc: Ching-Chun Huang, Chia-Ping Tsai, chengyang.chou, Cheng-Yang Chou
Because CFLAGS only applies to compilation ($(CC) -c), the link-time
flag -rdynamic is inert during the build. Schedulers do not rely on
exported dynamic symbols, and binaries remain byte-identical without it.
Under -Werror, Clang treats this unused argument as a build error:
$ make CC=clang-21
clang-21: error: argument unused during compilation: '-rdynamic'
[-Werror,-Wunused-command-line-argument]
Drop -rdynamic from CFLAGS to ensure clean builds across Clang versions.
Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
---
tools/sched_ext/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/sched_ext/Makefile b/tools/sched_ext/Makefile
index 21554f0896923..70d2503b6b330 100644
--- a/tools/sched_ext/Makefile
+++ b/tools/sched_ext/Makefile
@@ -89,7 +89,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
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] selftests/sched_ext: Move -rdynamic to LDFLAGS and append to it
2026-09-08 13:47 ` [PATCH 1/2] tools/sched_ext: Drop the no-op -rdynamic from CFLAGS Cheng-Yang Chou
@ 2026-09-08 13:47 ` Cheng-Yang Chou
2026-09-08 17:09 ` Tejun Heo
2026-09-08 17:09 ` [PATCH 1/2] tools/sched_ext: Drop the no-op -rdynamic from CFLAGS Tejun Heo
1 sibling, 1 reply; 6+ messages in thread
From: Cheng-Yang Chou @ 2026-09-08 13:47 UTC (permalink / raw)
To: sched-ext, Tejun Heo, David Vernet, Andrea Righi, Changwoo Min
Cc: Ching-Chun Huang, Chia-Ping Tsai, chengyang.chou, Cheng-Yang Chou
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]
Unlike the demo schedulers, the selftest runner requires -rdynamic at
link time to populate .dynsym for testcases. Additionally, LDFLAGS uses
'=' rather than '+=', silently discarding USERLDFLAGS from lib.mk.
Move -rdynamic from CFLAGS to LDFLAGS and append with '+='. This fixes
builds with CC=clang-N while preserving symbol export and USERLDFLAGS.
Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
---
tools/testing/selftests/sched_ext/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/sched_ext/Makefile b/tools/testing/selftests/sched_ext/Makefile
index 3cfe90e0f34fa..c756285a4903e 100644
--- a/tools/testing/selftests/sched_ext/Makefile
+++ b/tools/testing/selftests/sched_ext/Makefile
@@ -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 += -rdynamic -lelf -lz -lpthread -lzstd
IS_LITTLE_ENDIAN = $(shell $(CC) -dM -E - </dev/null | \
grep 'define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__')
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] tools/sched_ext: Drop the no-op -rdynamic from CFLAGS
2026-09-08 13:47 ` [PATCH 1/2] tools/sched_ext: Drop the no-op -rdynamic from CFLAGS Cheng-Yang Chou
2026-09-08 13:47 ` [PATCH 2/2] selftests/sched_ext: Move -rdynamic to LDFLAGS and append to it Cheng-Yang Chou
@ 2026-09-08 17:09 ` Tejun Heo
1 sibling, 0 replies; 6+ messages in thread
From: Tejun Heo @ 2026-09-08 17:09 UTC (permalink / raw)
To: Cheng-Yang Chou
Cc: sched-ext, David Vernet, Andrea Righi, Changwoo Min,
Ching-Chun Huang, Chia-Ping Tsai, chengyang.chou
Hello,
On Tue, Sep 08, 2026 at 09:47:08PM +0800, Cheng-Yang Chou wrote:
> Because CFLAGS only applies to compilation ($(CC) -c), the link-time
> flag -rdynamic is inert during the build. Schedulers do not rely on
> exported dynamic symbols, and binaries remain byte-identical without it.
Applied to sched_ext/for-7.4.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] selftests/sched_ext: Move -rdynamic to LDFLAGS and append to it
2026-09-08 13:47 ` [PATCH 2/2] selftests/sched_ext: Move -rdynamic to LDFLAGS and append to it Cheng-Yang Chou
@ 2026-09-08 17:09 ` Tejun Heo
2026-09-09 14:55 ` Cheng-Yang Chou
0 siblings, 1 reply; 6+ messages in thread
From: Tejun Heo @ 2026-09-08 17:09 UTC (permalink / raw)
To: Cheng-Yang Chou
Cc: sched-ext, David Vernet, Andrea Righi, Changwoo Min,
Ching-Chun Huang, Chia-Ping Tsai, chengyang.chou
Hello,
On Tue, Sep 08, 2026 at 09:47:09PM +0800, Cheng-Yang Chou wrote:
> Unlike the demo schedulers, the selftest runner requires -rdynamic at
> link time to populate .dynsym for testcases. Additionally, LDFLAGS uses
> '=' rather than '+=', silently discarding USERLDFLAGS from lib.mk.
The runner doesn't need -rdynamic. Testcases register through constructors
calling scx_test_register() and nothing in the selftests, tools/sched_ext or
libbpf looks up symbols dynamically or prints backtraces. The flag was copied
from the BPF selftests where the test_progs crash handler needs it for
backtrace symbolization. Please drop -rdynamic here too, as in the first
patch. The '=' to '+=' change is good, keep that.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] selftests/sched_ext: Move -rdynamic to LDFLAGS and append to it
2026-09-08 17:09 ` Tejun Heo
@ 2026-09-09 14:55 ` Cheng-Yang Chou
0 siblings, 0 replies; 6+ messages in thread
From: Cheng-Yang Chou @ 2026-09-09 14:55 UTC (permalink / raw)
To: Tejun Heo
Cc: sched-ext, David Vernet, Andrea Righi, Changwoo Min,
Ching-Chun Huang, Chia-Ping Tsai, chengyang.chou
Hi Tejun,
On Tue, Sep 08, 2026 at 07:09:58AM -1000, Tejun Heo wrote:
> Hello,
>
> On Tue, Sep 08, 2026 at 09:47:09PM +0800, Cheng-Yang Chou wrote:
> > Unlike the demo schedulers, the selftest runner requires -rdynamic at
> > link time to populate .dynsym for testcases. Additionally, LDFLAGS uses
> > '=' rather than '+=', silently discarding USERLDFLAGS from lib.mk.
>
> The runner doesn't need -rdynamic. Testcases register through constructors
> calling scx_test_register() and nothing in the selftests, tools/sched_ext or
> libbpf looks up symbols dynamically or prints backtraces. The flag was copied
> from the BPF selftests where the test_progs crash handler needs it for
> backtrace symbolization. Please drop -rdynamic here too, as in the first
> patch. The '=' to '+=' change is good, keep that.
Confirmed here, dropping it takes the runner's .dynsym from 572 to 172
entries, and all testcases still register and run, so nothing was
relying on the exported symbols.
Will send v2 patch soon, thanks!
>
> Thanks.
>
> --
> tejun
--
Cheers,
Cheng-Yang
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-09-09 14:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-08 13:47 [PATCH sched_ext/for-7.4 0/2] sched_ext: Clean up -rdynamic and LDFLAGS in Makefiles Cheng-Yang Chou
2026-09-08 13:47 ` [PATCH 1/2] tools/sched_ext: Drop the no-op -rdynamic from CFLAGS Cheng-Yang Chou
2026-09-08 13:47 ` [PATCH 2/2] selftests/sched_ext: Move -rdynamic to LDFLAGS and append to it Cheng-Yang Chou
2026-09-08 17:09 ` Tejun Heo
2026-09-09 14:55 ` Cheng-Yang Chou
2026-09-08 17:09 ` [PATCH 1/2] tools/sched_ext: Drop the no-op -rdynamic from CFLAGS Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox