mold icon indicating copy to clipboard operation
mold copied to clipboard

Consider emitting warnings for .gnu.warning.X

Open marxin opened this issue 3 years ago • 3 comments

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

marxin avatar Oct 25 '22 17:10 marxin

@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

ksco avatar Feb 23 '23 10:02 ksco

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.

rui314 avatar Feb 23 '23 10:02 rui314

Fair enough!

marxin avatar Feb 23 '23 11:02 marxin