The following two source files
int bar = 4;
extern int bar;
int main(int ac, char *av)
bar = 0;
when compiled with
pcc -c bar.c
pcc -shared bar.o -o bar.so
pcc -c foo.c
pcc foo.o bar.so
ld: dynamic variable `bar' is zero size
ld: foo.o(.text+0x5): unresolvable R_386_32 relocation against symbol `bar'
ld: final link failed: Nonrepresentable section on output
this is because bar has no size.. inserting a size statement to bar.s as per
--- bar.s.orig 2011-02-28 21:49:38.000000000 +0000
+++ bar.s 2011-02-28 21:49:44.000000000 +0000
@@ -1,8 +1,9 @@
+ .size bar,4
.ident "PCC: pcc 1.1.0.DEVEL  (netbsd)"
allows it to link properly..
I looked in the source and find that eoftn() emits a size statement for functions and defzero() for empty variables, but I don't really see where it should happen for initialized objects..