# HG changeset patch # User Tomas Lindquist Olsen # Date 1239923943 -7200 # Node ID f1877b6be63deac2df60dae76204aec64da4ce13 # Parent fc579f389f9a3e65a63e1f2f813da42860290ced# Parent f41ff8ccc24986b84420abeb74dde7b4c9e9c500 Merge with rev [1221] diff -r fc579f389f9a -r f1877b6be63d gen/tollvm.cpp --- a/gen/tollvm.cpp Fri Apr 17 00:54:20 2009 +0200 +++ b/gen/tollvm.cpp Fri Apr 17 01:19:03 2009 +0200 @@ -305,6 +305,11 @@ assert(0 && "not global/function"); } + // The following breaks for nested naked functions, so check for that. + bool skipNestedCheck = false; + if (FuncDeclaration* fd = sym->isFuncDeclaration()) + skipNestedCheck = (fd->naked != 0); + // Any symbol nested in a function can't be referenced directly from // outside that function, so we can give such symbols internal linkage. // This holds even if nested indirectly, such as member functions of @@ -318,10 +323,11 @@ // --- // if instances get emitted in multiple object files because they'd use // different instances of 'i'. - for (Dsymbol* parent = sym->parent; parent ; parent = parent->parent) { - if (parent->isFuncDeclaration()) - return llvm::GlobalValue::InternalLinkage; - } + if (!skipNestedCheck) + for (Dsymbol* parent = sym->parent; parent ; parent = parent->parent) { + if (parent->isFuncDeclaration()) + return llvm::GlobalValue::InternalLinkage; + } // default to external linkage return llvm::GlobalValue::ExternalLinkage;