Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x86-64: Initial checkin of support for loading a core from ELF sections
Quickstart for the impatient (assuming you've already done a full build): % (cd src/runtime ; make shrinkwrap-sbcl) % src/runtime/shrinkwrap-sbcl This approach relies on the immobile code feature and is very different from the patch series circulated on sbcl-devel. First a native '.core' file is saved, then it is separated (by a Lisp program into two pieces): code components and all else. Immobile code components get written out as assembly source code to make the system assembler do all the heavy lifting of adding DWARF info without which gdb would have problems. All other spaces are written into a '.o' file directly. The '.s' and '.o' files are then linked with the rest of the C runtime. Linking will move the immobile code space arbitrarily, but it is position-independent code. The space is at that time fixed in size to the minimum required to hold its contents. Important note: ELFinated core files can not load fasl files. I plan to allow for that by having COMPILE-FILE write code destined for dynamic space. And eventually we will emit linker relocations so that coreparse does not need to determine where the immobile code resides and perform startup-time relocation (unless it could not get map the other spaces where expected). As just one example of what you can do, using the shrinkwrap-sbcl target you can get a sane (other than every source file being named "shrinkwrap-sbcl.s" allegedly) backtrace from a C debugger. Apparently '.file' directives aren't enough. (gdb) bt > #0 0x00007f31fb8cfc40 in __poll_nocancel () at ../sysdeps/unix/syscall-template.S:81 > sbcl#1 0x00000000005906c8 in sb-unix:unix-simple-poll () at shrinkwrap-sbcl.s:22953 > sbcl#2 0x000000000058e355 in sb-sys:wait-until-fd-usable () at shrinkwrap-sbcl.s:22686 > sbcl#3 0x00000000005b7380 in sb-impl::refill-input-buffer () at shrinkwrap-sbcl.s:27806 > sbcl#4 0x0000000000e3e32e in sb-impl::input-char/utf-8 () at shrinkwrap-sbcl.s:340954 > sbcl#5 0x000000000052688b in (lambda # in sb-impl::get-external-format)_2 () at shrinkwrap-sbcl.s:9488 > sbcl#6 0x00000000005c22cc in cl:read-char () at shrinkwrap-sbcl.s:28818
- Loading branch information