Skip to contentSkip to conversation

gcc possibly generating invalid assembler

DISCUSSION Michael Jeanson 2 participants 2 messages Apr 20, 2017

lore
Share & tools
lore
#0 lore raw
Quoted 10 lines · John Paul Adrian Glaubitz

I have unsuccessfully been trying to build liburcu on Debian/m68k. After adding "m68k" as a detected architecture in configure.ac, the build fails with the assembler generating syntax error messages [1]:

gcc -DHAVE_CONFIG_H -I. -I../.. -I../../urcu -Wdate-time -D_FORTIFY_SOURCE=2 -I../.. -I../.. -I../../tests/common -g -g -O2
-fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -pthread -c -o test_urcu_defer.o test_urcu_defer.c /tmp/ccXHVXOc.s: Assembler messages:
/tmp/ccXHVXOc.s:312: Error: syntax error -- statement `add.l %d1,nr_writes@TLSLE+4(%a0)' ignored
/tmp/ccXHVXOc.s:440: Error: syntax error -- statement `add.l %d1,nr_writes@TLSLE+4(%a0)' ignored

The invalid asm is related to Thread Local Storage and liburcu has a compat layer that can be enabled at configure for platforms that don't have it.

With './configure --disable-compiler-tls' the build succeeds and the regression test suite completes without having to disable optimisations.

Hope this helps,

Michael

#1 lore raw
Quoted 12 lines · Michael Jeanson
Quoted 10 lines · John Paul Adrian Glaubitz

I have unsuccessfully been trying to build liburcu on Debian/m68k. After adding "m68k" as a detected architecture in configure.ac, the build fails with the assembler generating syntax error messages [1]:

gcc -DHAVE_CONFIG_H -I. -I../.. -I../../urcu -Wdate-time -D_FORTIFY_SOURCE=2 -I../.. -I../.. -I../../tests/common -g -g -O2
-fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -pthread -c -o test_urcu_defer.o test_urcu_defer.c /tmp/ccXHVXOc.s: Assembler messages:
/tmp/ccXHVXOc.s:312: Error: syntax error -- statement `add.l %d1,nr_writes@TLSLE+4(%a0)' ignored
/tmp/ccXHVXOc.s:440: Error: syntax error -- statement `add.l %d1,nr_writes@TLSLE+4(%a0)' ignored

Quoted 3 lines

The invalid asm is related to Thread Local Storage and liburcu has a compat layer that can be enabled at configure for platforms that don't have it.

Last I checked, m68k does have TLS, though. It is a requirement for recent versions of glibc, and although the m68k port was stuck on it for a while, recent versions should have it.

In fact, when checking the generated asm code, it shows that the nr_writes@TLSLE indirection is used in other locations too; but those don't have the "+4" bit right after that. I suspect that's the problem.

(then again, trying to use gcc5 rather than gcc6 does not fix the issue, so meh)

Quoted 2 lines

With './configure --disable-compiler-tls' the build succeeds and the regression test suite completes without having to disable optimisations.

Well, that's good to know :-)

Signature · 4 lines
< ron> I mean, the main *practical* problem with C++, is there's like a dozen
       people in the world who think they really understand all of its rules,
       and pretty much all of them are just lying to themselves too.
 -- #debian-devel, OFTC, 2016-02-12