Re: Functions and Global Variables defined in Libraries

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

 



On Thu, Mar 9, 2023 at 2:48 AM Xi Ruoyao <xry111@xxxxxxxxxxx> wrote:
>
> I guess it does not work for you because your distro has enabled
> BIND_NOW (-Wl,-z,now) by default.


This can be gotten around as the GNU linker allows us to build the
executable with -Wl,-z,lazy.


> int main()
> {
>         volatile int flag = 0;
>         if (flag) {
>                 volatile int r = gtk_true ();
>         }
> }


Please add one more line to 'main':

       void *volatile p = (void*)gtk_true;

and test it again.


> And anyway your question has nothing related to GCC.  Try to find a more
> proper channel to discuss it.


It is related to the GNU compiler suite, specifically the linker 'ld'
and how it generates the tables (GLOBAL_DATA,JUMP_SLOT,got,plt).




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux