[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ctor/dtor bug

Oops, I forgot to cc: my answer to the group.  Here it is...

Juan Cespedes wrote:
> 	The constructors still don't work.  This little program
> doesn't print anything:
> ------------------------------------------------------------
> int f() __attribute__ ((constructor));
> f() { printf("Hello, world!\n"); }
> main() {}
> ------------------------------------------------------------

Well, I found a way to fix this bug.
There are no crtbegin*.o & crtend*.o compiled with libc6 (at least for
sparc(32) architecture).
You have to get them from your old libc5-dev package then fix your GCC specs
file to reintroduce crt{begin,end}* into it using the following patch.

------cut here------
--- specs.old	Tue Oct 14 22:37:19 1997
+++ specs	Tue Oct 14 22:42:47 1997
@@ -14,7 +14,7 @@
+%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s
 -m elf32_sparc -Y P,/usr/lib %{shared:-shared}   %{!shared:     %{!ibcs:       %{!static:         %{rdynamic:-export-dynamic}         %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}}         %{static:-static}}}
@@ -26,7 +26,7 @@
-%{!shared:      %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}   crti.o%s
+%{!shared:      %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}   crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}
------cut here------


 Eric Delaunay                 | "La guerre justifie l'existence des militaires.
 delaunay@lix.polytechnique.fr | En les supprimant." Henri Jeanson (1900-1970)

TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-sparc-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .

Reply to: