[cfe-dev] How to refer to linker script symbols?
Anton Blanchard
anton at samba.org
Mon Nov 3 16:07:37 PST 2014
Hi,
The Linux kernel makes extensive use of linker script symbols indicating
the start and end of section. An example:
extern const char *__start___trace_bprintk_fmt[];
extern const char *__stop___trace_bprintk_fmt[];
int foo(void)
{
return __stop___trace_bprintk_fmt != __start___trace_bprintk_fmt;
}
Clang assumes these two symbols can't alias, emits a warning and optimises
the comparison away:
foo.c:6:36: warning: array comparison always evaluates to true
...
foo:
li 3, 1
blr
In this particular case the section is empty, so the two symbols do
point to the same address. Any thoughts on the best way to solve this?
Anton
More information about the cfe-dev
mailing list