[PATCH] Handle undefined extern vars in output_in_order
Jeff Law
law@redhat.com
Thu Jul 14 20:28:00 GMT 2016
On 07/14/2016 12:33 PM, Alexander Monakov wrote:
> On Thu, 14 Jul 2016, Jeff Law wrote:
>> Is the point here to be able to deduce what symbols are external & undefined
>> and emit some kind of directive to the assembler in that case?
>
> Yes, PTX assembly requires that properly typed declarations are emitted for
> external references. Today, the NVPTX backend in GCC performs that internally
> for function symbols, and relies on the middle-end to do that for data symbols,
> but when the port was added that was implemented only when -ftoplevel-reorder is
> in effect (the default).
Right. I remember noting that in my brief review of the PTX assembly
specs and figuring it wouldn't be a big deal since we had a functional
hack in place for the PA/SOM which has similar requirements.
>
> *nod*, although as I mentioned above today it's handled in a generic way only
> for undefined data symbols, not undefined function symbols.
Understood. Quickly reviewing the PA code, the other bit of magic is we
avoided importing a symbol which was declared as extern, but never
actually used. IIRC that caused the HP/SOM linker to core dump.
Hopefully the PTX assembler/linker/finalizer handles that case more
gracefully...
Jeff
More information about the Gcc-patches
mailing list