Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
None
-
SmartOS 5.11 joyent_20160317T000621Z, gcc 4.9.3, binutils 2.25.1, gmake 4.1
Description
Compilation fails at mysys/my_context.c with:
[ 75%] Building C object mysys/CMakeFiles/mysys.dir/my_rdtsc.c.o
[ 75%] Building C object mysys/CMakeFiles/mysys.dir/my_context.c.o
/var/tmp//ccjkasbn.s: Assembler messages:
/var/tmp//ccjkasbn.s:24: Error: CFI instruction used without previous .cfi_startproc
mysys/CMakeFiles/mysys.dir/build.make:2558: recipe for target 'mysys/CMakeFiles/mysys.dir/my_context.c.o' failed
make[2]: *** [mysys/CMakeFiles/mysys.dir/my_context.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:1463: recipe for target 'mysys/CMakeFiles/mysys.dir/all' failed
make[1]: *** [mysys/CMakeFiles/mysys.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2
I found that if I prioritize the #elif defined(HAVE_UCONTEXT_H) check in mysys/my_context.c so that it comes before the 64-bit GNUC check, then it compiles just fine.
> was there a special reason why ucontext has lower priority than asm
> implementations?
Sure, ucontext is much slower. The whole point of the asm implementations
is to get good performance on common platforms, with ucontext as a fallback.
Why not fix the missing .cfi_startproc? I wonder what is special on the
SmartOS platform for this to show up only there?
Try generating the assembler output from my_context.c (gcc -S) and check
where the .cfi_escape instruction ends up and why there is no .cfi_startproc
on that function.
Does my_context_spawn() need _attribute_((noinline))?
Or is dwarf debug info maybe disabled on that platform?
If the .cfi_escape is not available on SmartOS, it can just be disabled in
the code, there is already an #ifdef for other situations. The .cfi_escape
is just a hint to debuggers that the stack trace ends here, it can be safely
omitted from the code.
(But it would still be interesting to see the assembler output from the
compiler to understand what is going on).