[Ping] Port of VTV for Cygwin and MinGW

Patrick Wollgast patrick.wollgast@rub.de
Wed Sep 24 22:25:00 GMT 2014


On 23.09.2014 12:22, Jonathan Wakely wrote:
> On 19/09/14 00:23 +0200, Patrick Wollgast wrote:
>> Index: libstdc++-v3/acinclude.m4
>> ===================================================================
>> --- libstdc++-v3/acinclude.m4    (Revision 214408)
>> +++ libstdc++-v3/acinclude.m4    (Arbeitskopie)
>> @@ -2321,7 +2321,17 @@ AC_DEFUN([GLIBCXX_ENABLE_VTABLE_VERIFY],
>>   AC_MSG_RESULT([$enable_vtable_verify])
>>
>>   if test $enable_vtable_verify = yes; then
>> +    case ${target_os} in
>> +  cygwin*|mingw32*)
>> +    VTV_CXXFLAGS="-fvtable-verify=std
>> -Wl,-lvtv,-u_vtable_map_vars_start,-u_vtable_map_vars_end"
>> +    vtv_cygmin="yes"
>> +    ;;
>> +  *)
>>     VTV_CXXFLAGS="-fvtable-verify=std
>> -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end"
>> +    vtv_cygmin="no"
>> +    ;;
>> +    esac
>> +    AM_CONDITIONAL(VTV_CYGMIN, test $vtv_cygmin = yes)
>>     VTV_PCH_CXXFLAGS="-fvtable-verify=std"
>>     VTV_CXXLINKFLAGS="-L${toplevel_builddir}/libvtv/.libs -Wl,--rpath
>> -Wl,${toplevel_builddir}/libvtv/.libs"       
>>   else
> 
> The lines between case and esac should be indented by four more
> spaces.
> 
> Apart from that the libstdc++ changes are OK and I'll approve them.
> 

I've changed the indentation at the newly attached patch.


On 23.09.2014 08:16, Caroline Tice wrote:
> Ok, your patch looks OK to me, but I can only approve the libvtv file
> changes.  The changes in the other files also seem ok to me, but
> someone else will have to approve the modifications in them:
>
> gcc/config/i386/cygwin.h
> gcc/config/i386/mingw-w64.h
> gcc/config/i386/mingw32.h
> gcc/cp/vtable-class-hierarchy.c
> gcc/varasm.c
>
> libgcc/Makefile.in
> libgcc/config.host
>
> libiberty/obstack.c
>
> libstdc++-v3/acinclude.m4
> libstdc++-v3/libsupc++/Makefile.am
> libstdc++-v3/libsupc++/vtv_stubs.cc

I've added Ian Lance Taylor to cc of this mail.

Thank you both for the reviews!

regards
Patrick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtv_cygmin.patch
Type: text/x-patch
Size: 38923 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20140924/b5d3aba6/attachment.bin>
-------------- next part --------------
* gcc/config/i386/cygwin.h (STARTFILE_SPEC): Add vtv_start.o,
    if -fvtable-verify=preinit/std is used.
* gcc/config/i386/mingw-w64.h (STARTFILE_SPEC): Likewise.
* gcc/config/i386/mingw32.h (STARTFILE_SPEC): Likewise.
* gcc/config/i386/cygwin.h (ENDFILE_SPEC): Add vtv_end.o,
    if -fvtable-verify=preinit/std is used.
* gcc/config/i386/mingw32.h (ENDFILE_SPEC): Likewise.
* gcc/config/i386/cygwin.h (LIB_SPEC): Pass -lvtv and -lpsapi,
    if -fvtable-verify=preinit/std is used.
* gcc/config/i386/mingw-w64.h (LIB_SPEC): Likewise.
* gcc/config/i386/mingw32.h (LIB_SPEC): Likewise.

* gcc/cp/vtable-class-hierarchy.c (vtv_generate_init_routine): Add
    check for not TARGET_PECOFF at the VTV_PREINIT_PRIORITY checks.

* gcc/varasm.c (assemble_variable): Add code to properly set the comdat
    section and name for the .vtable_map_vars section in case the
    target is PE or COFF.


* libgcc/Makefile.in: Move rules to build vtv_*.o out of the check
    for CUSTOM_CRTSTUFF.
* libgcc/config.host (i[34567]86-*-cygwin*, x86_64-*-cygwin*, i[34567]86-*-mingw*)
    (x86_64-*-mingw*): Only add vtv_*.o to extra_parts if enable_vtable_verify.


* libiberty/obstack.c: Include windows.h on Cygwin and MinGW.
    Exchange abort with TerminateProcess on Cygwin and MinGW.
    Exchange exit with ExitProcess on Cygwin and MinGW.


* libstdc++-v3/acinclude.m4: Define VTV_CYGMIN.
* libstdc++-v3/configure: Regenerate.

* libstdc++-v3/libsupc++/Makefile.am: Add vtv_sources only to
    libsupc___la_SOURCES and libsupc__convenience_la_SOURCES if VTV_CYGMIN is
    not set.
* libstdc++-v3/libsupc++/Makefile.in: Regenerated.
* libstdc++-v3/libsupc++/vtv_stubs.cc: Add none weak declaration of every
    function for Cygwin and MinGW.

* libstdc++-v3/src/Makefile.am: Add libvtv.la to toolexeclib_LTLIBRARIES,
    if VTV_CYGMIN is set. Define libvtv_la_SOURCES, libvtv_la_LDFLAGS,
    libvtv_la_AM_CXXFLAGS and libvtv_la_LINK if VTV_CYGMIN is set.
* libstdc++-v3/src/Makefile.in: Regenerate.


* libvtv/Makefile.am : Add libvtv.la to toolexeclib_LTLIBRARIES, if VTV_CYGMIN
    is set. Define libvtv_la_LIBADD, libvtv_la_LDFLAGS, libvtv_stubs_la_LDFLAGS
    and libvtv_stubs_la_SOURCES if VTV_CYGMIN is set. Add obstac.c to
    libvtv_la_SOURCES if VTV_CYGMIN is set.
* libvtv/Makefile.in : Regenerate.
* libvtv/aclocal.m4 : Regenerate.
* libvtv/configure : Regenerate.
* libvtv/configure.ac : Add ACX_LT_HOST_FLAGS. Define VTV_CYGMIN.
* libvtv/configure.tgt : (x86_64-*-cygwin*, i?86-*-cygwin*, x86_64-*-mingw*)
    (i?86-*-mingw*): Add to supported targets.
* libvtv/vtv_fail.cc : Skip inclusion of execinfo.h on Cygwin and MinGW.
(log_error_message): Skip calls to backtrace and backtrace_symbols_fd on Cygwin
    and MinGW.
* libvtv/vtv_malloc.cc : Include windows.h and skip sys/mman.h inclusion on
    Cygwin and MinGW. Add sysconf and mprotect port on Cygwin and MinGW.
(obstack_chunk_alloc): Exchange call to mmap with call to VirtualAlloc on Cygwin
    and MinGW.
(__vtv_malloc_init): Exchange call to sysconf with call to port of sysconf on
    Cygwin and MinGW.
* libvtv/vtv_malloc.h : Declare mprotect and define PROT_READ and PROT_WRITE on
    Cygwin and MinGW.
* libvtv/map.h : Include stdint.h on MinGW.
* libvtv/rts.cc : Include windows.h, winternl.h and psapi.h, skip include of
    execinfo.h, sys/mman.h and link.h on Cygwin and MinGW.
    Add port of __fortify_fail on Cygwin and MinGW.
    Change ElfW (Addr) to uintptr_t on Cygwin and MinGW.
(read_section_offset_and_length): Add port for Cygwin and MinGW
(iterate_modules): New function.
(vtv_unprotect_vtable_vars): Use iterate_modules instead of dl_iterate_phdr on
    Cygwin and MinGW.
(vtv_protect_vtable_vars): Likewise.
(count_all_pages): Likewise.
(dl_iterate_phdr_count_pages): Don't build on Cygwin and MinGW.
* libvtv/utils.cc : Include windows.h and skip execinfo.h inclusion on
    Cygwin and MinGW.
(__vtv_open_log): Exchange call to getuid and getpid with GetCurrentProcessId and
    adjust call to snprintf accordingly on Cygwin and MinGW.
    Adjust calls to mkdir on MinGW.
    Adjust call to open on Cygwin and MinGW.
(__vtv_add_to_log): Adjust call to snprintf on Cygwin and MinGW.
(__vtv_log_verification_failure): Don't generate a backtrace on Cygwin and MinGW.


More information about the Libstdc++ mailing list