[Mesa-dev] [PATCH 2/2] glsl: When linking, emit functions at the tail of the final linked program.

Eric Anholt eric at anholt.net
Thu Aug 4 08:33:25 PDT 2011


On Wed,  3 Aug 2011 17:07:42 -0700, Paul Berry <stereotype441 at gmail.com> wrote:
> When link_functions.cpp adds a new function to the final linked
> program, it needs to add it after any global variable declarations
> that the function refers to, otherwise the IR will be invalid (because
> variable declarations must occur before variable accesses).  The
> easiest way to do that is to have the linker emit functions to the
> tail of the final linked program.
> 
> The linker used to emit functions to the head of the final linked
> program, in an effort to keep callees sorted before their callers.
> However, this was not reliable: it didn't work for functions declared
> or defined in the same compilation unit as main, for diamond-shaped
> patterns in the call graph, or for some obscure cases involving
> overloaded functions.  And no code currently relies on this sort
> order.

Usually we'd swap the order of these around, so that if we have a
testcase that would hit this, you don't get extra failures when a bisect
lands on patch 1/2.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110804/ba69464a/attachment.pgp>


More information about the mesa-dev mailing list