Make GCC initialize global variable using instructions instead of assembly directive such as .long or .quad

William Tambe tambewilliam@gmail.com
Tue Jan 7 20:08:00 GMT 2020


Given the following code example:

    void myfunc (void) {}
    void *myglobal = myfunc;
    void main (void) {
            return;
    }

Is there a way to make GCC initialize global variable using
instructions instead of assembly directive such as .long or .quad ?
Such that in the above example the address of myfunc that is used to
initialize myglobal get computed at run-time instead of at compile
time.



More information about the Gcc-help mailing list