tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Shared libraries: startup and cleanup


From: Jared Maddox
Subject: Re: [Tinycc-devel] Shared libraries: startup and cleanup
Date: Thu, 10 Sep 2015 18:32:38 -0500

> Date: Thu, 10 Sep 2015 15:04:27 +0300
> From: Dmitry Selyutin <address@hidden>
> To: address@hidden
> Subject: Re: [Tinycc-devel] Shared libraries: startup and cleanup
> Message-ID:
>         <address@hidden>
> 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?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]