On Wed, 25 May 2016, Nathan Sidwell wrote:

> This  patch reimplements crt0  as C rather than assembly.  That means it;ll be
> good with 32 bit addresses.  I've also completely moved abort and exit into
> newlib (a fork on github), which had it's own copies that failed to set the
> exit code.  Things happened to work because they were never found, being
> hidden by the ones provided in crt0.s.  You'll need to update your newlib
> sources for exit codes to continue to work.

Doesn't this break offloading compilation? When you link offloaded code
against new newlib, nothing provides a definition of __exitval_ptr (crt0 is
only linked in with -mmainkernel), and PTX does not support ELF semantics for
undefined weak symbols where they get a null address. OpenACC testcases that
call abort() should get a link error after this change.

Also note that &__exitval_ptr is always non-null for that reason.

> Alex, this should make it simple to add a  check in __main for a single thread
> soft stack allocation.  I imagine a check on a weakly declared __soft_stack
> symbol or something?

For the above reason weak linkage is not usable in that fashion. Code on my
branch simply sets up soft stack in __main regardless of whether it's used.

> Or is that something nvptx-run should check for and initialize?

The interface between nvptx-run and crt0 would need to change to allow that.

Alexander

Reply via email to