Support aliasing static global nonfunction objects
commit08c777053cb3b7f4f5d33bb0beeb82787d30ebe0
authorPetr Skocik <pskocik@gmail.com>
Sun, 8 Oct 2023 16:55:04 +0000 (8 18:55 +0200)
committerPetr Skocik <pskocik@gmail.com>
Sun, 8 Oct 2023 17:08:20 +0000 (8 19:08 +0200)
treefb7559961c35f1e01d913a9f979b682741fa84da
parentb214fb6ed3897bf364d512b59f7f43fce6540de9
Support aliasing static global nonfunction objects

Enables code such as:

    #undef NDEBUG
    #include <assert.h>
    #include <stdint.h>
    static int st_x = 42;
    static int st_x_ __attribute((alias("st_x")));
    int main(void){ assert((uintptr_t)&st_x == (uintptr_t)&st_x_); }

which would previously fail with no compiler warnings. The limitation of
this is that the alias must be done (or redone) after an actual definition.
An alias done right after a later overridden tentative declaration won't
work (sufficient for my use case).
tccgen.c