On Wed, Nov 08, 2017 at 10:58:09PM -0800, Philip Guenther wrote: > @nobits means the section won't have filespace (where the initialization > data is) included in the loaded data. It should work with @progbits > instead.
Wow, I suck at assembly. However, once again binutils saved me: $ readelf -SW test.o | grep .tdata [ 4] .tdata PROGBITS 0000000000000000 00004c 000004 00 WAT 0 0 4 I'm afraid changing it to @progbits in the source doesn't make any difference to the result. It still returns the correct thing when dynamically linked but zero when statically linked. -- Charles