> Under the assumption that it can't work, have you looked at the
assembler version as an alternative?
I don't know assembler. I only read about .init/.fini section.

> Also, have you tried it without __attribute__((constructor)) and
__attribute__((destructor))? Was there an error message?
Yes and no respectively.
11 сент. 2015 г. 2:42 пользователь "Jared Maddox" <[email protected]>
написал:

> > Date: Thu, 10 Sep 2015 15:04:27 +0300
> > From: Dmitry Selyutin <[email protected]>
> > To: [email protected]
> > Subject: Re: [Tinycc-devel] Shared libraries: startup and cleanup
> > Message-ID:
> >         <CAMqzjeunCzXSL87-RA3-TgMMkUVYYHCbrgx2tm9=
> [email protected]>
> > Content-Type: text/plain; charset="utf-8"
> >
> > Hello Jared,
> >
> > I've already tried to follow this approach before (and did it again just
> > now) and it seems that it doesn't work either.
>
> Under the assumption that it can't work, have you looked at the
> assembler version as an alternative?
>
> > Both section(".init")/section(".fini") and
> > section(".ctor")/section(".dtor") were tried.
> > No success even if I put __attribute__ before function's return type.
> > I took and built tcc from tinycc repository (tcc version 0.9.26 (x86-64
> > Linux)).
> > >From what I see it seems that __attribute__ is ignored entirely.
> > Below is a simple code which I used to test this functionality.
> > Thank you for your advice!
> >
> >
> > #include <stddef.h>
> > #include <stdio.h>
> >
> >
> > void init(void)
> > __attribute__((constructor)) __attribute__((section(".init")))
> > {
> >         printf("init\n");
> > }
> >
> >
> > void fini(void)
> > __attribute__((destructor)) __attribute__((section(".fini")))
> > {
> >         printf("fini\n");
> > }
> >
> >
> > int main(void)
> > {
> >         printf("main\n");
> >         return 0;
> > }
> >
>
> Does anyone remember if this is supposed to currently work? Is there
> some sort of caveat, such as requiring a linker flag or script?
>
> Also, have you tried it without __attribute__((constructor)) and
> __attribute__((destructor))? Was there an error message?
>
> _______________________________________________
> Tinycc-devel mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to