Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault bootstrapping on aarch64 #1931

Closed
markos opened this issue Dec 19, 2016 · 4 comments
Closed

Segfault bootstrapping on aarch64 #1931

markos opened this issue Dec 19, 2016 · 4 comments

Comments

@markos
Copy link

markos commented Dec 19, 2016

After bootstrapping successfully from the latest ltsmaster on debian/arm64 (unstable), I tried to build the latest 1.1.0+b6 package. Tried with both llvm-3.8 (default for the package) and llvm-3.9 (in case it contained fixes for arm64), bootstrap fails eventually at this point:

# cd /root/ldc-1.1.0+b6 && /root/ldc-1.1.0+b6/build-static/bin/ldc2 --output-o -c -I/root/ldc-1.1.0+b6/runtime/druntime/src -I/root/ldc-1.1.0+b6/runtime/druntime/src/gc /root/ldc-1.1.0+b6/runtime/phobos/std/array.d -of/root/ldc-1.1.0+b6/build-static/runtime/std/array-debug.o -g -link-debuglib -I/root/ldc-1.1.0+b6/runtime/phobos -v-cg
0  libLLVM-3.9.so.1 0x0000ffff7f580f44 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 52
Segmentation fault
root@sirius:~/ldc-1.1.0+b6# gdb /root/ldc-1.1.0+b6/build-static/bin/ldc2
GNU gdb (Debian 7.12-4) 7.12
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "aarch64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /root/ldc-1.1.0+b6/build-static/bin/ldc2...done.
(gdb) run --output-o -c -I/root/ldc-1.1.0+b6/runtime/druntime/src -I/root/ldc-1.1.0+b6/runtime/druntime/src/gc /root/ldc-1.1.0+b6/runtime/phobos/std/array.d -of/root/ldc-1.1.0+b6/build-static/runtime/std/array-debug.o -g -link-debuglib -I/root/ldc-1.1.0+b6/runtime/phobos
Starting program: /root/ldc-1.1.0+b6/build-static/bin/ldc2 --output-o -c -I/root/ldc-1.1.0+b6/runtime/druntime/src -I/root/ldc-1.1.0+b6/runtime/druntime/src/gc /root/ldc-1.1.0+b6/runtime/phobos/std/array.d -of/root/ldc-1.1.0+b6/build-static/runtime/std/array-debug.o -g -link-debuglib -I/root/ldc-1.1.0+b6/runtime/phobos
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
_IO_vsnprintf (string=0xaaaaab009360 "", maxlen=<optimized out>, format=0xaaaaaae92157 "__unittestL%u_", args=<error reading variable: Cannot access memory at address 0x111>) at vsnprintf.c:114
114	vsnprintf.c: No such file or directory.
(gdb) where
#0  _IO_vsnprintf (string=0xaaaaab009360 "", maxlen=<optimized out>, format=0xaaaaaae92157 "__unittestL%u_", args=<error reading variable: Cannot access memory at address 0x111>) at vsnprintf.c:114
#1  0x0000aaaaaacbf248 in OutBuffer::vprintf(char const*, std::__va_list) ()
#2  0x0000aaaaaac389bc in OutBuffer::printf(char const*, ...) ()
#3  0x0000aaaaaad0bd40 in unitTestId(Loc) ()
#4  0x0000aaaaaac263c0 in ddmd.parse.Parser.parseDeclDefs(int, ddmd.dsymbol.Dsymbol*, ddmd.parse.PrefixAttributes*) ()
#5  0x0000aaaaaac2538c in ddmd.parse.Parser.parseDeclDefs(int, ddmd.dsymbol.Dsymbol*, ddmd.parse.PrefixAttributes*) ()
#6  0x0000aaaaaac2538c in ddmd.parse.Parser.parseDeclDefs(int, ddmd.dsymbol.Dsymbol*, ddmd.parse.PrefixAttributes*) ()
#7  0x0000aaaaaac2538c in ddmd.parse.Parser.parseDeclDefs(int, ddmd.dsymbol.Dsymbol*, ddmd.parse.PrefixAttributes*) ()
#8  0x0000aaaaaac93008 in ddmd.parse.Parser.parseModule() ()
#9  0x0000aaaaaac916cc in Module::parse() ()
#10 0x0000aaaaaad302e8 in mars_mainBody(Array<char const*>&, Array<char const*>&) ()
#11 0x0000aaaaaae2d49c in cppmain (argc=<optimized out>, argv=<optimized out>) at ./driver/main.cpp:1101
#12 0x0000aaaaaae77dac in rt.dmain2._d_run_main(int, char**, extern(C) int(char[][]) function).runAll().__lambda1() ()
#13 0x0000aaaaaae77d64 in rt.dmain2._d_run_main(int, char**, extern(C) int(char[][]) function).tryExec(scope void() delegate) ()
#14 0x0000aaaaaae77c68 in _d_run_main ()
#15 0x0000ffffb5506364 in __libc_start_main (main=0x0, argc=0, argv=0x0, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=<optimized out>) at libc-start.c:291
#16 0x0000aaaaaabf4238 in _start ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
@kinke
Copy link
Member

kinke commented Dec 19, 2016

varargs - https://github.com/ldc-developers/druntime/blob/ldc/src/core/stdc/stdarg.d looks incomplete for AArch64. Not really surprising, as the only LDC dev working on that platform (Kai) is currently blocked from LDC development.

@markos
Copy link
Author

markos commented Dec 19, 2016

Any suggestions on how/what to fix?

@kinke
Copy link
Member

kinke commented Dec 19, 2016

Most of it should be in that file, some adaptations might also be required in https://github.com/ldc-developers/ldc/blob/master/gen/abi-aarch64.cpp. Running the dmd-testsuite tests (ctest -R dmd-testsuite-debug in the CMake working dir) should help as there are multiple ABI tests in there, some of which involve variadics. And some docs about the AArch64 ABI details or at least a C++ stdarg.h header won't hurt either.

@joakim-noah
Copy link
Contributor

Should finally work with latest releases 0.17.6/1.11.0, let us know if it doesn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants