On 04/22/16 10:04, Alexander Monakov wrote:
echo 'int v __attribute__((section("foo")));' |
x86_64-pc-linux-gnu-accel-nvptx-none-gcc -xc - -o /dev/null
<stdin>:1:5: error: section attributes are not supported for this target
Presumably it's missing a necessary hook? Couldn't such a hook check the
section name is acceptable?
Why can it not apply to variables of auto storage? I.e. function scope,
function lifetime? That would seem to be a useful property.
Because PTX does not support auto storage semantics for .shared data. It's
statically allocated at link time.
I suppose it's not worth going through hoops to define such function-scoped
variables if PTX isn't going to take advantage of that.
What happens if an initializer is present, is it silently ignored?
GCC accepts and reemits it in assembly output (if non-zero), and ptxas rejects
it ("syntax error").
ptx errors are inscrutable.
It would be better for nvptx_assemble_decl_end to check if an initializer has
been output and emit an error (you'll need to record the decl itself in the
initializer structure to do that). Record the decl in
nvptx_assemble_decl_begin if the symbol's data area is .shared, and then check
in NADE?
nathan