* controlling exception type per target @ 1997-09-25 10:31 Robert Lipe 1997-09-28 21:41 ` Robert Lipe [not found] ` <19970928233930.41615.cygnus.egcs@dgii.com> 0 siblings, 2 replies; 6+ messages in thread From: Robert Lipe @ 1997-09-25 10:31 UTC (permalink / raw) To: egcs I've been looking at the dwarf2 exception stuff and have a timid suggestion that I'd like some feedback on before I actually write the trivial (?) patch to do it. EGCS on OpenServer generates either COFF or ELF. For ELF, we want DWARF2 exception handling because that's what the people that know about such things say we want. For COFF, we run into two problems with the native assembler. 1) The section names are too long. I have submitted a patch to cure this. 2) The DWARF2 stuff (reasonably) expects an assembler that can handle forward references. Since DWARF and COFF don't go together (right?) does it make more sense for us to just set 'exceptions_via_longjmp' if we're emitting COFF? Some preliminary poking around in the 924 snapshot shows that if I just set this variable either via the debugger or via -fsjlj-exceptions while generating COFF, we don't trigger the lameness in the assembler which eliminates both of the above problems. To do this, we need a way that the target files (ala sco5.h) can whack this variable at runtime. Would it be reasonable to provide a line in, say, init_eh() that could override the constant initialization of exceptions_via_longjmp at the top of exception.c? Then we could stick something like #define DEFAULT_SJLJ_EXCEPTION \ (TARGET_ELF) ? 0 : 1 in the affected targets. In an appropriate place (init_eh()?) we could then say #if defined (DEFAULT_SJLJ_EXCEPTION) exceptions_via_longjmp = DEFAULT_SJLJ_EXCEPTION ; #endif We can't do it where this variable is now being set becuase it has to be a constant. Is there a better way to do this? It looks like resetting it in init_eh() works for at least the trivial case. Thanx in advance. -- Robert Lipe http://www.dgii.com/people/robertl robertl@dgii.com ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: controlling exception type per target 1997-09-25 10:31 controlling exception type per target Robert Lipe @ 1997-09-28 21:41 ` Robert Lipe [not found] ` <19970928233930.41615.cygnus.egcs@dgii.com> 1 sibling, 0 replies; 6+ messages in thread From: Robert Lipe @ 1997-09-28 21:41 UTC (permalink / raw) To: egcs On Sep 25, Robert Lipe wrote: > I've been looking at the dwarf2 exception stuff and have a timid > suggestion that I'd like some feedback on before I actually write > the trivial (?) patch to do it. > [ explanation of difficulties encountered with current scheme deleted ] > > Would it be reasonable to provide a line in, say, init_eh() that could > override the constant initialization of exceptions_via_longjmp at the > top of exception.c? Then we could stick something like > > #define DEFAULT_SJLJ_EXCEPTION \ > (TARGET_ELF) ? 0 : 1 > > in the affected targets. > > In an appropriate place (init_eh()?) we could then say > > #if defined (DEFAULT_SJLJ_EXCEPTION) > exceptions_via_longjmp = DEFAULT_SJLJ_EXCEPTION ; > #endif In the silence that ensued, I did implement a variation this. This allowed me to get all the library stuff built for both COFF (sjlj) and ELF (dwarf2unwind) but I then ran into problem with the crtstuff.c file where it tried to do dwarf things when it shouldn't have (on this target). Should I expand this scheme on into crtstuff as well? If someone could give me a little guidance on what would be the preferred direction to go with this (there are a couple) I don't mind doing the coding and testing. I just don't want to have to do it twice... Thanx, RJL ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <19970928233930.41615.cygnus.egcs@dgii.com>]
* Re: controlling exception type per target [not found] ` <19970928233930.41615.cygnus.egcs@dgii.com> @ 1997-10-01 19:22 ` Jason Merrill 1997-10-01 23:00 ` Patches for egcs/OSR5 Was: " Robert Lipe 0 siblings, 1 reply; 6+ messages in thread From: Jason Merrill @ 1997-10-01 19:22 UTC (permalink / raw) To: Robert Lipe, egcs Sorry I haven't gotten back to you before. I think this should be handled by setting up exceptions_via_longjmp in main(), with a simple #ifdef DWARF2_UNWIND_INFO exceptions_via_longjmp = DWARF2_UNWIND_INFO; #endif > Should I expand this scheme on into crtstuff as well? You can tell whether you are doing COFF or ELF with #ifdefs, right? I would think you could special-case the SCO tm.h so that when CRT_BEGIN or CRT_END are defined, you use unconditional defines. irix6.h does something similar for n32/n64 multilibbing. Jason ^ permalink raw reply [flat|nested] 6+ messages in thread
* Patches for egcs/OSR5 Was: controlling exception type per target 1997-10-01 19:22 ` Jason Merrill @ 1997-10-01 23:00 ` Robert Lipe 1997-10-01 23:33 ` Jason Merrill 0 siblings, 1 reply; 6+ messages in thread From: Robert Lipe @ 1997-10-01 23:00 UTC (permalink / raw) To: Jason Merrill; +Cc: egcs > Sorry I haven't gotten back to you before. 'Tis quite OK. I'm glad I waited for your reply, becuase I was indeed headed down a bad path. Your suggestions took me where I needed to go. Thanx, Jason! > I think this should be handled > by setting up exceptions_via_longjmp in main(), with a simple > > #ifdef DWARF2_UNWIND_INFO > exceptions_via_longjmp = DWARF2_UNWIND_INFO; > #endif The negative logic definitions took a while for me to grok. I'll leave submitting/applying that patch to you. I stuck it in my copy in what seemed like an OK place. It is required. *** toplev.c_ Mon Sep 15 21:07:28 1997 --- toplev.c Wed Oct 1 22:47:54 1997 *************** *** 4289,4294 **** --- 4289,4298 ---- OVERRIDE_OPTIONS; #endif + #ifdef DWARF2_UNWIND_INFO + exceptions_via_longjmp = DWARF2_UNWIND_INFO ; + #endif + if (profile_block_flag == 3) { warning ("`-ax' and `-a' are conflicting options. `-a' ignored."); > > Should I expand this scheme on into crtstuff as well? > > You can tell whether you are doing COFF or ELF with #ifdefs, right? I > would think you could special-case the SCO tm.h so that when CRT_BEGIN or > CRT_END are defined, you use unconditional defines. irix6.h does something > similar for n32/n64 multilibbing. You could. I think I've found that if I just let crtstuff spill the eh sections, it's OK as long as I pick a name that makes the assembler not vomit. It seems that they're never referenced. I decided to go ahead and put the scaffolding for EH_FRAMEs in for COFF in case they come in handy in the future. I haven't rerun the full make bootstrap/runtest with it, but I did do a 'make bootstrap3 followed by a nice runtest --outdir ${COFFDIR} --tool g++ \ --srcdir ${SRC}/gcc/testsuite \ --target_board 'unix{-mcoff,-melf}' \ GXX_UNDER_TEST=negcs \ CXXFLAGS="-g -O" \ old-deja.exp=eh* and got really promising results: Test Run By robertl on Thu Oct 2 00:41:57 1997 Native configuration is i586-pc-sco3.2v5.0.4 === g++ tests === Running target unix/-mcoff Running /play/egcs-970917/gcc/testsuite/g++.old-deja/old-deja.exp ... === g++ Summary for unix/-mcoff === # of expected passes 103 Running target unix/-melf Running /play/egcs-970917/gcc/testsuite/g++.old-deja/old-deja.exp ... === g++ Summary for unix/-melf === # of expected passes 103 === g++ Summary === # of expected passes 206 negcs version egcs-2.90.11 970929 (gcc2-970802 experimental) So please consider this patch for inclusion: Thu Oct 2 00:30:15 1997 Robert Lipe (robertl@dgii.com) * sco5.h: Let ELF use dwarf2 unwinding. COFF uses sjlj (EH_FRAME_SECTION_ASM_OP, EH_FRAME_SECTION_ASM_OP_ELF): Defined. (EH_FRAME_SECTION_ASM_OP_COFF): Likewise. (DWARF2_UNWIND_INFO): Let this track object file format. (EXTRA_SECTIONS): Add in_eh. (EH_FRAME_SECTION_ASM_OP, EH_FRAME_SECTION_ASM_OP_ELF, EH_FRAME_SECTION_ASM_OP_COFF): defined *** config/i386/sco5.h_ Wed Oct 1 22:35:32 1997 --- config/i386/sco5.h Wed Oct 1 23:17:35 1997 *************** *** 76,81 **** --- 76,92 ---- #undef GLOBAL_ASM_OP #define GLOBAL_ASM_OP "\t.globl" + #undef EH_FRAME_SECTION_ASM_OP + #define EH_FRAME_SECTION_ASM_OP_COFF "\t.section\t.ehfram, \"x\"" + #define EH_FRAME_SECTION_ASM_OP_ELF "\t.section\t.eh_frame, \"aw\"" + #define EH_FRAME_SECTION_ASM_OP \ + ((TARGET_ELF) ? EH_FRAME_SECTION_ASM_OP_ELF : EH_FRAME_SECTION_ASM_OP_COFF) + + /* Avoid problems (long sectino names, forward assembler refs) with DWARF + exception unwinding when we're generating COFF */ + #define DWARF2_UNWIND_INFO \ + ((TARGET_ELF) ? 1 : 0 ) + #undef CONST_SECTION_ASM_OP #define CONST_SECTION_ASM_OP_COFF "\t.section\t.rodata, \"x\"" #define CONST_SECTION_ASM_OP_ELF "\t.section\t.rodata" *************** *** 563,569 **** ((TARGET_ELF) ? DWARF_DEBUG: SDB_DEBUG) #undef EXTRA_SECTIONS ! #define EXTRA_SECTIONS in_const, in_init, in_fini, in_ctors, in_dtors #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ --- 574,580 ---- ((TARGET_ELF) ? DWARF_DEBUG: SDB_DEBUG) #undef EXTRA_SECTIONS ! #define EXTRA_SECTIONS in_const, in_init, in_fini, in_ctors, in_dtors, in_eh #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ *************** *** 901,906 **** --- 912,918 ---- # undef FINI_SECTION_ASM_OP # undef CTORS_SECTION_ASM_OP # undef DTORS_SECTION_ASM_OP + # undef EH_FRAME_SECTION_ASM_OP # undef CTOR_LIST_BEGIN # undef CTOR_LIST_END # undef DO_GLOBAL_CTORS_BODY *************** *** 912,922 **** --- 924,936 ---- # define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_ELF # define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_ELF # define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_ELF + # define EH_FRAME_SECTION_ASM_OP EH_FRAME_SECTION_ASM_OP_ELF # else /* ! _SCO_ELF */ # define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_COFF # define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_COFF # define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_COFF # define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_COFF + # define EH_FRAME_SECTION_ASM_OP "" # define CTOR_LIST_BEGIN asm (INIT_SECTION_ASM_OP); asm ("pushl $0") # define CTOR_LIST_END CTOR_LIST_BEGIN # define DO_GLOBAL_CTORS_BODY \ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Patches for egcs/OSR5 Was: controlling exception type per target 1997-10-01 23:00 ` Patches for egcs/OSR5 Was: " Robert Lipe @ 1997-10-01 23:33 ` Jason Merrill 0 siblings, 0 replies; 6+ messages in thread From: Jason Merrill @ 1997-10-01 23:33 UTC (permalink / raw) To: Robert Lipe; +Cc: egcs >>>>> Robert Lipe <robertl@dgii.com> writes: >> #ifdef DWARF2_UNWIND_INFO >> exceptions_via_longjmp = DWARF2_UNWIND_INFO; >> #endif > The negative logic definitions took a while for me to grok. Er, you're right. It should be !DWARF2_UNWIND_INFO. > I'll leave submitting/applying that patch to you. OK. > *************** > *** 563,569 **** > ((TARGET_ELF) ? DWARF_DEBUG: SDB_DEBUG) > #undef EXTRA_SECTIONS > ! #define EXTRA_SECTIONS in_const, in_init, in_fini, in_ctors, in_dtors > #undef EXTRA_SECTION_FUNCTIONS > #define EXTRA_SECTION_FUNCTIONS \ > --- 574,580 ---- > ((TARGET_ELF) ? DWARF_DEBUG: SDB_DEBUG) > #undef EXTRA_SECTIONS > ! #define EXTRA_SECTIONS in_const, in_init, in_fini, in_ctors, in_dtors, in_eh > #undef EXTRA_SECTION_FUNCTIONS > #define EXTRA_SECTION_FUNCTIONS \ This hunk seems unnecessary. Other than that, looks fine. Jason ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Patches for egcs/OSR5 Was: controlling exception type per target @ 1997-10-02 11:08 Mike Stump 0 siblings, 0 replies; 6+ messages in thread From: Mike Stump @ 1997-10-02 11:08 UTC (permalink / raw) To: jason, robertl; +Cc: egcs Excellent progress! ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1997-10-02 11:08 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 1997-09-25 10:31 controlling exception type per target Robert Lipe 1997-09-28 21:41 ` Robert Lipe [not found] ` <19970928233930.41615.cygnus.egcs@dgii.com> 1997-10-01 19:22 ` Jason Merrill 1997-10-01 23:00 ` Patches for egcs/OSR5 Was: " Robert Lipe 1997-10-01 23:33 ` Jason Merrill 1997-10-02 11:08 Mike Stump
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).