mold
mold copied to clipboard
Consider emitting warnings for .gnu.warning.X
Similarly to other linkers, please consider emitting a warning:
a.c:
void foo(void)
{
}
static const char foo_warning[] __attribute__((section(".gnu.warning.foo")))
= "foo is deprecated, please use the shiny new foobar function";
$ gcc-12 *.c
/usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: /tmp/ccuzFlLI.o: in function `main':
b.c:(.text+0x5): warning: foo is deprecated, please use the shiny new foobar function
$ gcc-12 *.c -B ~/Programming/mold/objdir
@rui314 do we have any plan to implement this feature? If so, I can give it a try, seems straightforward.
Related to https://github.com/llvm/llvm-project/issues/41353
LLVM lld doesn't support it, and no one seems to have requested to support this feature. So I think this feature isn't used much and/or people don't find it useful. People seems to use __attribute__((deprecated)) to emit the same warning during compile time.
Fair enough!