[patch][pr22217] Use the most recent decl for mangling

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Jan 22 16:52:39 PST 2015


Sent the email a bit early.


>> That is not what I am seeing with gcc. Given
>>
>> int pr22217_foo;
>> int *b = &pr22217_foo;
>> extern int pr22217_foo __attribute__((section("zed")));
>
> The above works even in c++ and with foo being initialized:
>
> .section zed,"aw", at progbits
> .align 4
> .type pr22217_foo, @object
> .size pr22217_foo, 4
> pr22217_foo:
> .long 42
>
> I tested gcc 4.9.2 and current trunk (r220018).

Which brings the question: should we delay more of codegen?

The argument I have seen for not doing so is that we  get better
locality. The advantages that I know of of delaying *all* of codegen
until EOF are:

* We can get the above cases to match gcc.
* We can support all cases of "typedef struct { ...} foo;"
* We can compute the correct visibility in the case of pr16187.
* We can compute visibility of types only once.

Cheers,
Rafael



More information about the cfe-commits mailing list