http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46820
--- Comment #7 from Jan Hubicka <hubicka at ucw dot cz> 2010-12-11 13:31:21 UTC
---
> int __attribute__((used)) bar(void)
> {
> return 0;
> }
> __asm__(".weak\tfoo\n\t.set\tfoo,bar");
>
> bar ends up in a different partition than the asm which then of course
> doesn't work.
>
> I'm not sure we can do much about this. Aliases via toplevel asms
> (or toplevel asms in general) are hard to deal with with WHOPR.
Yes, they are. I think only way to make this work is to use externally_visible
attribute. I did that at Mozilla side.
>
> Honza, any ideas?
>
> The testcase seems to work fine using the linker-plugin and gold, btw.
I think it is just because gold ignore some linker errors after plugin
execution.
> Not sure if by design or only by chance though. We definitely get
> different partitioning - which shouldn't happen with 1to1 partitioning, no?
We still mangle the name of bar I think into bar.local.xyz.
We also do not track sources of __asm__ statements and simply drop them all
into first
partition. We can add lto_file handle and make partitioning code to deal with
them,
but it is not going to win us much, as requiring 1to1 for toplevel asms is bad
idea anyway.
Honza