This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Handle undefined extern vars in output_in_order


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).

The point of my patch is to handle it under -fno-toplevel-reorder in the same
way.

> Avoiding duplicates

this is not required for PTX, but nevertheless a good cleanup we get for free

> as well as symbols which may have had originally looked like external &
> undefined, but later we find a definition?

I think this only would be a problem if GCC continued to support
-fno-unit-at-a-time.  AFAIK today GCC's symtab reflects symbol availability
exactly, because the whole translation unit has been read upfront.

> The reason I ask someone might be able to simplify a bit of the PA backend if
> that's the goal here.  The PA (when using the SOM object format) has similar
> needs.  We solved it by queuing up everything that might need "importing".
> Then at the end of the compilation unit, we'd walk that queue of symbols
> emitting the proper magic.

*nod*, although as I mentioned above today it's handled in a generic way only
for undefined data symbols, not undefined function symbols.

Alexander


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]