Jack Howarth
2009-Sep-18 18:40 UTC
[LLVMdev] OT: intel darwin losing primary target status
On Fri, Sep 18, 2009 at 11:13:52AM -0700, Nick Kledzik wrote:> > The important thing is that only one unwinder is used. The > _Unwind_Context data structure is different between the darwin and FSF > implementations, so you can't pass it between two different > implementations. Since darwin uses two-level namespace and swapping in > a new libgcc_s.dylib at runtime is not going to effect the various OS > dylibs that are looking for _Unwind_* routines in libSystem.dylib. > > Even if you managed to get the test suite to run where everything is > consistently using the just built libgcc_s.dylib, how will this work for > end users of the gcc-4.5+ who want to ship an app built with gcc-4.5+? > Their code needs to use the OS unwinder. > > So it seems to me you should be testing the compiler against the OS > unwinder - not against the just built unwinder. > > Has something changed in the FSF unwinder that clients of gcc will want? > > -Nick > > P.S. One minor pet peeve of mine is that the exception handling is well > layered (e.g. _cxa_* layer on top the _Unwind_* layer (which on darwin is > now built upon the libunwind layer)). Except for one glaring problem. > The compiler mostly emits calls to _cxa_* functions, but it makes one > call to _Unwind_Resume. Ah!! And those are in different dylibs! If > instead the compiler made some call like __cxa_resume() in > libstdc++.dylib which turned around and called _Unwind_Resume() in > libgcc_s.dylib, then much of the problem above would never happen. >I am not sure if some of these problems were latent and only exposed by the change, but the mass regressions in the g++ and libjava testsuites were triggered by the commit... Author: rth Date: Sat May 30 00:33:46 2009 New Revision: 147995 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147995 Log: * cfgcleanup.c (try_crossjump_to_edge): Only skip past NOTE_INSN_BASIC_BLOCK. * cfglayout.c (duplicate_insn_chain): Copy epilogue insn marks. Duplicate NOTE_INSN_EPILOGUE_BEG notes. * cfgrtl.c (can_delete_note_p): Allow NOTE_INSN_EPILOGUE_BEG to be deleted. * dwarf2out.c (struct cfa_loc): Change indirect field to bitfield, add in_use field. (add_cfi): Disable check redefining cfa away from drap. (lookup_cfa_1): Add remember argument; handle remember/restore. (lookup_cfa): Pass remember argument. (cfa_remember): New. (compute_barrier_args_size_1): Remove sibcall check. (dwarf2out_frame_debug_def_cfa): New. (dwarf2out_frame_debug_adjust_cfa): New. (dwarf2out_frame_debug_cfa_offset): New. (dwarf2out_frame_debug_cfa_register): New. (dwarf2out_frame_debug_cfa_restore): New. (dwarf2out_frame_debug): Handle REG_CFA_* notes. (dwarf2out_begin_epilogue): New. (dwarf2out_frame_debug_restore_state): New. (dw_cfi_oprnd1_desc): Handle DW_CFA_remember_state, DW_CFA_restore_state. (output_cfi_directive): Likewise. (convert_cfa_to_fb_loc_list): Likewise. (dw_cfi_oprnd1_desc): Handle DW_CFA_restore. * dwarf2out.h: Update. * emit-rtl.c (try_split): Don't split RTX_FRAME_RELATED_P. (copy_insn_1): Early out for null. * final.c (final_scan_insn): Call dwarf2out_begin_epilogue and dwarf2out_frame_debug_restore_state. * function.c (prologue, epilogue, sibcall_epilogue): Remove. (prologue_insn_hash, epilogue_insn_hash): New. (free_after_compilation): Adjust freeing accordingly. (record_insns): Create hash table if needed; push insns into hash instead of array. (maybe_copy_epilogue_insn): New. (contains): Search hash table instead of array. (sibcall_epilogue_contains): Remove. (thread_prologue_and_epilogue_insns): Split eh_return insns and mark them as epilogues. (reposition_prologue_and_epilogue_notes): Rewrite epilogue scanning in terms of basic blocks. * insn-notes.def (CFA_RESTORE_STATE): New. * jump.c (returnjump_p_1): Accept EH_RETURN. (eh_returnjump_p_1, eh_returnjump_p): New. * reg-notes.def (CFA_DEF_CFA, CFA_ADJUST_CFA, CFA_OFFSET, CFA_REGISTER, CFA_RESTORE): New. * rtl.def (EH_RETURN): New. * rtl.h (eh_returnjump_p, maybe_copy_epilogue_insn): Declare. * config/bfin/bfin.md (UNSPEC_VOLATILE_EH_RETURN): Remove. (eh_return_internal): Use eh_return rtx; split w/ epilogue. * config/i386/i386.c (gen_push): Update cfa state. (pro_epilogue_adjust_stack): Add set_cfa argument. When true, add a CFA_ADJUST_CFA note. (ix86_dwarf_handle_frame_unspec): Remove. (ix86_expand_prologue): Update cfa state. (ix86_emit_restore_reg_using_pop): New. (ix86_emit_restore_regs_using_pop): New. (ix86_emit_leave): New. (ix86_emit_restore_regs_using_mov): Add CFA_RESTORE notes. (ix86_expand_epilogue): Add notes for unwinding the epilogue. * config/i386/i386.h (struct machine_cfa_state): New. (ix86_cfa_state): New. * config/i386/i386.md (UNSPEC_EH_RETURN): Remove. (eh_return_internal): Merge from eh_return_<mode>, use eh_return rtx, split w/ epilogue.
Nick Kledzik
2009-Sep-18 21:27 UTC
[LLVMdev] OT: intel darwin losing primary target status
I dug into this. Based on the .s files in bugzilla, the latest gcc is now adding dwarf unwind info to describe the function epilog. If you run dwarfdump --eh-frame on the .o files made with the new compiler, you'll see extra dwarf unwind instructions at the end like: ... DW_CFA_advance_loc4 (64) #<-- advance to near end of function DW_CFA_restore (rbp) DW_CFA_def_cfa (rsp, 8) DW_CFA_nop DW_CFA_nop The linker's conversion to compact unwind "runs" the dwarf unwind info for a function and then records the state at the end. Adding unwind info for the epilog breaks this. In the long term, I can add heuristics to the linker to detect that what looks like unwind info for the epilog and stop processing the dwarf instructions. The short term fix for gcc is to *not* add epilog unwind information for Darwin. Epilog unwind information is never needed for exception processing. Its only use is for debugging or sampling when you want to asynchronously make a stack back trace. -Nick On Sep 18, 2009, at 11:40 AM, Jack Howarth wrote:> I am not sure if some of these problems were latent and only > exposed by the change, but the mass regressions in the g++ > and libjava testsuites were triggered by the commit... > > Author: rth > Date: Sat May 30 00:33:46 2009 > New Revision: 147995 > > URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147995
Nick Kledzik
2009-Sep-18 21:40 UTC
[LLVMdev] OT: intel darwin losing primary target status
I thought of another work around. The FSF gcc driver can implicitly add -no_compact_unwind to the link line. This tells the linker to not produce compact unwind information from the dwarf unwind info in .o files. Then at runtime the darwin unwinder will fallback and use the slow dwarf unwind info. -Nick On Sep 18, 2009, at 2:27 PM, Nick Kledzik wrote:> I dug into this. Based on the .s files in bugzilla, the latest gcc is > now adding dwarf unwind info to describe the function epilog. If you > run dwarfdump --eh-frame on the .o files made with the new compiler, > you'll see extra dwarf unwind instructions at the end like: > > ... > DW_CFA_advance_loc4 (64) #<-- advance to near end of > function > DW_CFA_restore (rbp) > DW_CFA_def_cfa (rsp, 8) > DW_CFA_nop > DW_CFA_nop > > The linker's conversion to compact unwind "runs" the dwarf unwind info > for a function and then records the state at the end. Adding unwind > info for the epilog breaks this. In the long term, I can add > heuristics to the linker to detect that what looks like unwind info > for the epilog and stop processing the dwarf instructions. > > The short term fix for gcc is to *not* add epilog unwind information > for Darwin. > > Epilog unwind information is never needed for exception processing. > Its only use is for debugging or sampling when you want to > asynchronously make a stack back trace. > > -Nick > > On Sep 18, 2009, at 11:40 AM, Jack Howarth wrote: >> I am not sure if some of these problems were latent and only >> exposed by the change, but the mass regressions in the g++ >> and libjava testsuites were triggered by the commit... >> >> Author: rth >> Date: Sat May 30 00:33:46 2009 >> New Revision: 147995 >> >> URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147995 > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Seemingly Similar Threads
- [LLVMdev] OT: intel darwin losing primary target status
- [LLVMdev] OT: intel darwin losing primary target status
- [LLVMdev] llvm/test: suffix or operands invalid for `push'
- [LLVMdev] OT: intel darwin losing primary target status
- [LLVMdev] llvm/test: suffix or operands invalid for `push'