From cee4c731af1e68814548ff00e4e7ecaa8ac07790 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 27 Sep 2021 00:13:56 -0400 Subject: sim: drop weak func attrs on module inits When I first wrote this, I was thinking we'd scan all source files that existed and generate a complete init list. That means for any particular build, we'd probably have a few functions that didn't exist, so weak attributes was necessary. What I ended up scanning though was only the source files that went into a particular build. There was another concern too: a source file might be included, but the build settings would cause all of its contents to be skipped (via CPP defines). So scanning via naive grep would pick up names not actually available. A check of the source tree shows that we never do this, and it's pretty easy to institute a policy that we don't start (by at the very least including a stub init func). The use of weak symbols ends up causing a problem in practice: for a few modules (like profiling), nothing else pulls it in, so the linker omits it entirely, which leads to the profiling module never being available. So drop the weak markings since we know all these funcs will be available. --- sim/common/Make-common.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sim/common') diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in index 8c2cace..c9ea08f 100644 --- a/sim/common/Make-common.in +++ b/sim/common/Make-common.in @@ -443,7 +443,7 @@ stamp-modules: Makefile $(SIM_OBJS:.o=.c) echo '/* It is created automatically by the Makefile. */'; \ echo '#include "libiberty.h"'; \ echo '#include "sim-module.h"'; \ - sed -e 's:\(.*\):extern __attribute__((__weak__)) MODULE_INIT_FN \1;:' $@.l-tmp; \ + sed -e 's:\(.*\):extern MODULE_INIT_FN \1;:' $@.l-tmp; \ echo 'MODULE_INSTALL_FN * const sim_modules_detected[] = {'; \ sed -e 's:\(.*\): \1,:' $@.l-tmp; \ echo '};'; \ -- cgit v1.1