[cfe-dev] Fix for symbol conflict caused by aliases

Chris Lattner clattner at apple.com
Wed Aug 19 09:46:07 PDT 2009


On Aug 15, 2009, at 6:43 AM, David Chisnall wrote:

> Hi,
>
> This patch adds some name mangling to the GNU runtime's selector  
> alias handling.  Without it, selectors that have the same name as C  
> symbols cause those symbols to be renamed, breaking linking (for  
> example, a selector named "close" causes the close() function to be  
> renamed @close123, and the linker to complain that _close123 is not  
> a valid symbol).  This seems like it might be a bug in LLVM -  given  
> a conflict between an internal and external global the internal one  
> should be renamed - but this patch works around the behaviour.
>
> Note that this diff is taken after my other diff, so if that has not  
> been applied it will need to be manually merged (which should be  
> easy, since it only changes two lines).

Hi David,

This fix is ok, but not the best solution.  It would be better to add  
a new function like CreateRuntimeGlobal but that autorenames the  
global if there is a conflict.  Maybe it should be call  
CreateAnonymousGlobal?  All the global variables created for string  
constants etc could go through this as well, because they could very  
well conflict with random other stuff as well.

-Chris



More information about the cfe-dev mailing list