Discussion:
feature request: __attribute__((weak))
Szabolcs Nagy
2011-07-28 12:58:17 UTC
Permalink
attribute weak is only supported with alias
with the following code

static void f() {}
void g() __attribute__((weak, alias("f")));
void h() __attribute((weak));
static void *p = h;


nm t.o prints

00000000 t f
00000000 W g
U h
00000000 d p

with gcc nm t.o prints

00000000 t f
00000000 W g
w h
00000000 d p

(linux, elf objects, i386, not stripped)

it may worth supporting the plain weak attribute
if it's not too much extra effort
Iain Hibbert
2011-07-29 10:51:47 UTC
Permalink
Post by Szabolcs Nagy
attribute weak is only supported with alias
with the following code
static void f() {}
void g() __attribute__((weak, alias("f")));
void h() __attribute((weak));
static void *p = h;
nm t.o prints
00000000 t f
00000000 W g
U h
00000000 d p
with gcc nm t.o prints
00000000 t f
00000000 W g
w h
00000000 d p
(linux, elf objects, i386, not stripped)
it may worth supporting the plain weak attribute
if it's not too much extra effort
there is a Jira issue about weak reference support, which I guess needs to
be researched a bit more fully as there are several types

http://pcc.ludd.ltu.se/jira/browse/PCC-362

feel free to add comments there..

iain

Loading...