This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC/Patch] : Enable Dwarf2 unwind on cygwin and mingw32


Danny Smith wrote:
> Richard Henderson wrote:

>> If you support init priorities, why not use them?  Set the
>> registration functions to the maximum prioirity.  That plus link-line
>> position is sufficient to ensure the proper invocation sequence.
>>
> Umm,
>
> void my_ctor (void) __attribute__ ((constructor,
> init_priority(MAX_INIT_PRIORITY)));
>
> gets me:
>
>  error: can only use 'init_priority' attribute on file-scope
> definitions of objects of class type
>
> Are you suggesting that I write out the section directive in asm,
> rather than use attributes?

Assuming that you were....

This is a revised patch, based on suggestion to use init_priority.
cygwin and mingw now share common code, using the ctor/dtor approach.

I have replaced the use of __attribute__((constructor)) with asm code
that adds the priority suffix to the section name, ie:

#define STRINGX(s) #s
#define XSTRING(s) STRINGX(s)

static void __attribute__((used))
__reg_frame_ctor (void)
{
  __asm__(
    ".section\t.ctors." XSTRING (MAX_INIT_PRIORITY) ",\"w\"\n\t"
    ".align 4\n\t"
    ".long\t___reg_frame_ctor\n\t"
    ".text\n");

  __do_register_frame ();
}

and similar for the dtor.

Bootstrap (c,c++,objc, java) on mingw32 completed. Regtest in progress..
The initp1.C test and other tests in g++.dg/special are okay, so at
least that part works.

Danny


ChangeLog

2004-11-25  Danny Smith  <dannysmith@users.sourceforge.net>

        * config.gcc (*-cygwin*): Add crtbegin.o, crtend.o as
        extra_parts.
        * config.gcc (*-mingw*): Likewise.
        * config/i386/cygming.h (DWARF2_UNWIND_INFO): Don't ovveride
        default.
        * config/i386/cygwin.h (STARTFILE_SPEC): Add crtbegin.o.
        (ENDFILE_SPEC): Define as crtend.o.
        * config/i386/mingw32.h (STARTFILE_SEC): Add crtbegin.o.
        (ENDFILE_SPEC): Define as crtend.o.
        * config/i386/t-cygming: Add rules for crtbegin.o, crtend.o.
        * config/i386/cygming-crtbegin.c: New file.
        * config/i386/cygming-crtend.c: New file.

.

Attachment: cygming-dwarf2-eh[2].patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]