[Ping] Port of VTV for Cygwin and MinGW

Patrick Wollgast patrick.wollgast@rub.de
Thu Jan 15 21:51:00 GMT 2015


On 15.01.2015 17:01, Ian Lance Taylor wrote:
> On Wed, Jan 14, 2015 at 11:54 PM, Patrick Wollgast
> <patrick.wollgast@rub.de> wrote:
>> Is there something I'm still supposed to do, since I don't have write
>> access and this was the last part missing an "OK"?
> 
> Somebody with write access will need to commit the patch for you.  You
> should send a new clean patch including all the changes, along with
> updated ChangeLog entries.
> 
> Ian
> 

For the clean patch I co'ed the latest version of the trunk again and
applied my patch. It applies correctly, except for two changes:

patching file libgcc/Makefile.in
Hunk #1 succeeded at 995 with fuzz 2 (offset 9 lines).
Hunk #2 succeeded at 1020 (offset 17 lines).

> # This is a version of crtbegin for -static links.
> crtbeginT$(objext): $(srcdir)/crtstuff.c
> 	$(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN
> -DCRTSTUFFT_O
> endif
>
> ifeq ($(enable_vtable_verify),yes)
> # These are used in vtable verification; see comments in source files
> for
> # more details.

I had to move the endif down, since something was added before
"ifeq ($(enable_vtable_verify),yes)" inside the if.

> # This is a version of crtbegin for -static links.
> crtbeginT$(objext): $(srcdir)/crtstuff.c
> 	$(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN
> -DCRTSTUFFT_O
>
> # crtoffloadbegin and crtoffloadend contain symbols, that mark the
> begin and
> # the end of tables with addresses, required for offloading.
> crtoffloadbegin$(objext): $(srcdir)/offloadstuff.c
> 	$(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN
>
> crtoffloadend$(objext): $(srcdir)/offloadstuff.c
> 	$(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_END
> endif
>
> ifeq ($(enable_vtable_verify),yes)
> # These are used in vtable verification; see comments in source files
> for
> # more details.


patching file libgcc/config.host
Hunk #1 succeeded at 621 (offset 6 lines).
Hunk #2 succeeded at 640 (offset 6 lines).
Hunk #3 succeeded at 660 (offset 6 lines).
Hunk #4 succeeded at 1198 with fuzz 2 (offset 495 lines).

> 	tmake_file="${tmake_file} ${tmake_eh_file} ${tmake_dlldir_file}
i386/t-slibgcc-cygming i386/t-mingw32 t-dfprules i386/t-crtfm i386/t-chkstk"
> 	extra_parts="$extra_parts crtfastmath.o"

The last two lines were changed to the following two lines.

> 	tmake_file="${tmake_file} ${tmake_eh_file} ${tmake_dlldir_file}
i386/t-slibgcc-cygming i386/t-cygming i386/t-mingw32 t-dfprules
i386/t-crtfm i386/t-chkstk"
> 	extra_parts="$extra_parts crtbegin.o crtend.o crtfastmath.o"

And therefore Hunk #4, which follows these lines, wasn't applied correctly.

These two parts were corrected in vtv_cygmin_clean.patch. For
convenience I also added vtv_cygmin_unclean.patch, which is the patch
from my last mail.

Regards,
Patrick
-------------- 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.


* 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 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtv_cygmin_clean.patch
Type: text/x-patch
Size: 37384 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20150115/9757bdae/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtv_cygmin_unclean.patch
Type: text/x-patch
Size: 37408 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20150115/9757bdae/attachment-0001.bin>


More information about the Libstdc++ mailing list