Commit f7f049fa by Caroline Tice Committed by Caroline Tice

Committing VTV Cygwin patch for Patrick Wollgast

* 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.

From-SVN: r220232
parent 10881cff
2015-01-27 Caroline Tice <cmtice@google.com>
Committing VTV Cywin/Ming patch for Patrick Wollgast
* config/i386/cygwin.h (STARTFILE_SPEC): Add vtv_start.o,
if -fvtable-verify=preinit/std is used.
* config/i386/mingw-w64.h (STARTFILE_SPEC): Likewise.
* config/i386/mingw32.h (STARTFILE_SPEC): Likewise.
* config/i386/cygwin.h (ENDFILE_SPEC): Add vtv_end.o,
if -fvtable-verify=preinit/std is used.
* config/i386/mingw32.h (ENDFILE_SPEC): Likewise.
* config/i386/cygwin.h (LIB_SPEC): Pass -lvtv and -lpsapi,
if -fvtable-verify=preinit/std is used.
* config/i386/mingw-w64.h (LIB_SPEC): Likewise.
* config/i386/mingw32.h (LIB_SPEC): Likewise.
* 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.
2015-01-29 Jan Hubicka <hubicka@ucw.cz> 2015-01-29 Jan Hubicka <hubicka@ucw.cz>
PR ipa/64801 PR ipa/64801
......
...@@ -41,12 +41,18 @@ along with GCC; see the file COPYING3. If not see ...@@ -41,12 +41,18 @@ along with GCC; see the file COPYING3. If not see
#define STARTFILE_SPEC "\ #define STARTFILE_SPEC "\
%{!shared: %{!mdll: crt0%O%s \ %{!shared: %{!mdll: crt0%O%s \
%{pg:gcrt0%O%s}}}\ %{pg:gcrt0%O%s}}}\
%{shared:crtbeginS.o%s;:crtbegin.o%s}" %{shared:crtbeginS.o%s;:crtbegin.o%s} \
%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_start.o%s; \
fvtable-verify=std:vtv_start.o%s}"
#undef ENDFILE_SPEC #undef ENDFILE_SPEC
#define ENDFILE_SPEC \ #define ENDFILE_SPEC \
"%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}\ "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}\
%{!shared:%:if-exists(default-manifest.o%s)}\ %{!shared:%:if-exists(default-manifest.o%s)}\
%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_end.o%s; \
fvtable-verify=std:vtv_end.o%s} \
crtend.o%s" crtend.o%s"
/* Normally, -lgcc is not needed since everything in it is in the DLL, but we /* Normally, -lgcc is not needed since everything in it is in the DLL, but we
...@@ -81,6 +87,8 @@ along with GCC; see the file COPYING3. If not see ...@@ -81,6 +87,8 @@ along with GCC; see the file COPYING3. If not see
%{pthread: } \ %{pthread: } \
-lcygwin \ -lcygwin \
%{mwindows:-lgdi32 -lcomdlg32} \ %{mwindows:-lgdi32 -lcomdlg32} \
%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} \
-ladvapi32 -lshell32 -luser32 -lkernel32" -ladvapi32 -lshell32 -luser32 -lkernel32"
/* To implement C++ function replacement we always wrap the cxx /* To implement C++ function replacement we always wrap the cxx
......
...@@ -32,7 +32,10 @@ along with GCC; see the file COPYING3. If not see ...@@ -32,7 +32,10 @@ along with GCC; see the file COPYING3. If not see
%{!shared:%{!mdll:%{!municode:crt2%O%s}}} \ %{!shared:%{!mdll:%{!municode:crt2%O%s}}} \
%{!shared:%{!mdll:%{municode:crt2u%O%s}}} \ %{!shared:%{!mdll:%{municode:crt2u%O%s}}} \
%{pg:gcrt2%O%s} \ %{pg:gcrt2%O%s} \
crtbegin.o%s" crtbegin.o%s \
%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_start.o%s; \
fvtable-verify=std:vtv_start.o%s}"
/* Enable multilib. */ /* Enable multilib. */
...@@ -43,6 +46,8 @@ along with GCC; see the file COPYING3. If not see ...@@ -43,6 +46,8 @@ along with GCC; see the file COPYING3. If not see
#define LIB_SPEC "%{pg:-lgmon} %{" SPEC_PTHREAD1 ":-lpthread} " \ #define LIB_SPEC "%{pg:-lgmon} %{" SPEC_PTHREAD1 ":-lpthread} " \
"%{" SPEC_PTHREAD2 ": } " \ "%{" SPEC_PTHREAD2 ": } " \
"%{mwindows:-lgdi32 -lcomdlg32} " \ "%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
"-ladvapi32 -lshell32 -luser32 -lkernel32" "-ladvapi32 -lshell32 -luser32 -lkernel32"
#undef SPEC_32 #undef SPEC_32
......
...@@ -91,6 +91,8 @@ along with GCC; see the file COPYING3. If not see ...@@ -91,6 +91,8 @@ along with GCC; see the file COPYING3. If not see
#define LIB_SPEC "%{pg:-lgmon} %{" SPEC_PTHREAD1 ":-lpthread} " \ #define LIB_SPEC "%{pg:-lgmon} %{" SPEC_PTHREAD1 ":-lpthread} " \
"%{" SPEC_PTHREAD2 ": } " \ "%{" SPEC_PTHREAD2 ": } " \
"%{mwindows:-lgdi32 -lcomdlg32} " \ "%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
"-ladvapi32 -lshell32 -luser32 -lkernel32" "-ladvapi32 -lshell32 -luser32 -lkernel32"
/* Weak symbols do not get resolved if using a Windows dll import lib. /* Weak symbols do not get resolved if using a Windows dll import lib.
...@@ -143,12 +145,18 @@ along with GCC; see the file COPYING3. If not see ...@@ -143,12 +145,18 @@ along with GCC; see the file COPYING3. If not see
#undef STARTFILE_SPEC #undef STARTFILE_SPEC
#define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \ #define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
%{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s} \ %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s} \
crtbegin.o%s" crtbegin.o%s \
%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_start.o%s; \
fvtable-verify=std:vtv_start.o%s}"
#undef ENDFILE_SPEC #undef ENDFILE_SPEC
#define ENDFILE_SPEC \ #define ENDFILE_SPEC \
"%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
%{!shared:%:if-exists(default-manifest.o%s)}\ %{!shared:%:if-exists(default-manifest.o%s)}\
%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_end.o%s; \
fvtable-verify=std:vtv_end.o%s} \
crtend.o%s" crtend.o%s"
/* Override startfile prefix defaults. */ /* Override startfile prefix defaults. */
......
2015-01-27 Caroline Tice <cmtice@google.com>
Committing VTV Cywin/Ming patch for Patrick Wollgast
* vtable-class-hierarchy.cc (vtv_generate_init_routine): Add
check for not TARGET_PECOFF at the VTV_PREINIT_PRIORITY checks.
2015-01-27 Jason Merrill <jason@redhat.com> 2015-01-27 Jason Merrill <jason@redhat.com>
PR c++/58597 PR c++/58597
......
...@@ -1194,7 +1194,11 @@ vtv_generate_init_routine (void) ...@@ -1194,7 +1194,11 @@ vtv_generate_init_routine (void)
TREE_STATIC (vtv_fndecl) = 1; TREE_STATIC (vtv_fndecl) = 1;
TREE_USED (vtv_fndecl) = 1; TREE_USED (vtv_fndecl) = 1;
DECL_PRESERVE_P (vtv_fndecl) = 1; DECL_PRESERVE_P (vtv_fndecl) = 1;
#if defined (TARGET_PECOFF)
if (flag_vtable_verify == VTV_PREINIT_PRIORITY && !TARGET_PECOFF)
#else
if (flag_vtable_verify == VTV_PREINIT_PRIORITY) if (flag_vtable_verify == VTV_PREINIT_PRIORITY)
#endif
DECL_STATIC_CONSTRUCTOR (vtv_fndecl) = 0; DECL_STATIC_CONSTRUCTOR (vtv_fndecl) = 0;
gimplify_function_tree (vtv_fndecl); gimplify_function_tree (vtv_fndecl);
...@@ -1202,7 +1206,11 @@ vtv_generate_init_routine (void) ...@@ -1202,7 +1206,11 @@ vtv_generate_init_routine (void)
symtab->process_new_functions (); symtab->process_new_functions ();
#if defined (TARGET_PECOFF)
if (flag_vtable_verify == VTV_PREINIT_PRIORITY && !TARGET_PECOFF)
#else
if (flag_vtable_verify == VTV_PREINIT_PRIORITY) if (flag_vtable_verify == VTV_PREINIT_PRIORITY)
#endif
assemble_vtv_preinit_initializer (vtv_fndecl); assemble_vtv_preinit_initializer (vtv_fndecl);
} }
......
...@@ -2252,6 +2252,33 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED, ...@@ -2252,6 +2252,33 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED,
| SECTION_LINKONCE, | SECTION_LINKONCE,
DECL_NAME (decl)); DECL_NAME (decl));
in_section = sect; in_section = sect;
#elif defined (TARGET_PECOFF)
/* Neither OBJECT_FORMAT_PE, nor OBJECT_FORMAT_COFF is set here.
Therefore the following check is used.
In case a the target is PE or COFF a comdat group section
is created, e.g. .vtable_map_vars$foo. The linker places
everything in .vtable_map_vars at the end.
A fix could be made in
gcc/config/i386/winnt.c: i386_pe_unique_section. */
if (TARGET_PECOFF)
{
char *name;
if (TREE_CODE (DECL_NAME (decl)) == IDENTIFIER_NODE)
name = ACONCAT ((sect->named.name, "$",
IDENTIFIER_POINTER (DECL_NAME (decl)), NULL));
else
name = ACONCAT ((sect->named.name, "$",
IDENTIFIER_POINTER (DECL_COMDAT_GROUP (DECL_NAME (decl))),
NULL));
targetm.asm_out.named_section (name,
sect->named.common.flags
| SECTION_LINKONCE,
DECL_NAME (decl));
in_section = sect;
}
#else #else
switch_to_section (sect); switch_to_section (sect);
#endif #endif
......
2015-01-27 Caroline Tice <cmtice@google.com>
Committing VTV Cywin/Ming patch for Patrick Wollgast
* Makefile.in: Move rules to build vtv_*.o out of the check
for CUSTOM_CRTSTUFF.
* 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.
2015-01-27 Nick Clifton <nickc@redhat.com> 2015-01-27 Nick Clifton <nickc@redhat.com>
* config/rl78/cmpsi2.S: Use function start and end macros. * config/rl78/cmpsi2.S: Use function start and end macros.
......
...@@ -1003,6 +1003,7 @@ crtoffloadbegin$(objext): $(srcdir)/offloadstuff.c ...@@ -1003,6 +1003,7 @@ crtoffloadbegin$(objext): $(srcdir)/offloadstuff.c
crtoffloadend$(objext): $(srcdir)/offloadstuff.c crtoffloadend$(objext): $(srcdir)/offloadstuff.c
$(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_END $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_END
endif
ifeq ($(enable_vtable_verify),yes) ifeq ($(enable_vtable_verify),yes)
# These are used in vtable verification; see comments in source files for # These are used in vtable verification; see comments in source files for
...@@ -1019,7 +1020,6 @@ vtv_start_preinit$(objext): $(srcdir)/vtv_start_preinit.c ...@@ -1019,7 +1020,6 @@ vtv_start_preinit$(objext): $(srcdir)/vtv_start_preinit.c
vtv_end_preinit$(objext): $(srcdir)/vtv_end_preinit.c vtv_end_preinit$(objext): $(srcdir)/vtv_end_preinit.c
$(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $(srcdir)/vtv_end_preinit.c $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $(srcdir)/vtv_end_preinit.c
endif endif
endif
ifeq ($(CUSTOM_CRTIN),) ifeq ($(CUSTOM_CRTIN),)
# -x assembler-with-cpp is only needed on case-insensitive filesystem. # -x assembler-with-cpp is only needed on case-insensitive filesystem.
......
...@@ -626,6 +626,9 @@ i[4567]86-wrs-vxworks|i[4567]86-wrs-vxworksae) ...@@ -626,6 +626,9 @@ i[4567]86-wrs-vxworks|i[4567]86-wrs-vxworksae)
;; ;;
i[34567]86-*-cygwin*) i[34567]86-*-cygwin*)
extra_parts="crtbegin.o crtbeginS.o crtend.o crtfastmath.o" extra_parts="crtbegin.o crtbeginS.o crtend.o crtfastmath.o"
if test x$enable_vtable_verify = xyes; then
extra_parts="$extra_parts vtv_start.o vtv_end.o vtv_start_preinit.o vtv_end_preinit.o"
fi
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h # This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$enable_sjlj_exceptions = xyes; then if test x$enable_sjlj_exceptions = xyes; then
tmake_eh_file="i386/t-sjlj-eh" tmake_eh_file="i386/t-sjlj-eh"
...@@ -642,6 +645,9 @@ i[34567]86-*-cygwin*) ...@@ -642,6 +645,9 @@ i[34567]86-*-cygwin*)
;; ;;
x86_64-*-cygwin*) x86_64-*-cygwin*)
extra_parts="crtbegin.o crtbeginS.o crtend.o crtfastmath.o" extra_parts="crtbegin.o crtbeginS.o crtend.o crtfastmath.o"
if test x$enable_vtable_verify = xyes; then
extra_parts="$extra_parts vtv_start.o vtv_end.o vtv_start_preinit.o vtv_end_preinit.o"
fi
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h # This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$enable_sjlj_exceptions = xyes; then if test x$enable_sjlj_exceptions = xyes; then
tmake_eh_file="i386/t-sjlj-eh" tmake_eh_file="i386/t-sjlj-eh"
...@@ -659,6 +665,9 @@ x86_64-*-cygwin*) ...@@ -659,6 +665,9 @@ x86_64-*-cygwin*)
;; ;;
i[34567]86-*-mingw*) i[34567]86-*-mingw*)
extra_parts="crtbegin.o crtend.o crtfastmath.o" extra_parts="crtbegin.o crtend.o crtfastmath.o"
if test x$enable_vtable_verify = xyes; then
extra_parts="$extra_parts vtv_start.o vtv_end.o vtv_start_preinit.o vtv_end_preinit.o"
fi
case ${target_thread_file} in case ${target_thread_file} in
win32) win32)
tmake_file="$tmake_file i386/t-gthr-win32" tmake_file="$tmake_file i386/t-gthr-win32"
...@@ -705,6 +714,9 @@ x86_64-*-mingw*) ...@@ -705,6 +714,9 @@ x86_64-*-mingw*)
fi fi
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" 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" extra_parts="$extra_parts crtbegin.o crtend.o crtfastmath.o"
if test x$enable_vtable_verify = xyes; then
extra_parts="$extra_parts vtv_start.o vtv_end.o vtv_start_preinit.o vtv_end_preinit.o"
fi
;; ;;
i[34567]86-*-interix[3-9]*) i[34567]86-*-interix[3-9]*)
tmake_file="$tmake_file i386/t-interix i386/t-chkstk" tmake_file="$tmake_file i386/t-interix i386/t-chkstk"
......
2015-01-27 Caroline Tice <cmtice@google.com>
Committing VTV Cywin/Ming patch for Patrick Wollgast
* acinclude.m4: Define VTV_CYGMIN.
* configure: Regenerate.
* libsupc++/Makefile.am: Add vtv_sources only to libsupc___la_SOURCES
and libsupc__convenience_la_SOURCES if VTV_CYGMIN is not set.
* libsupc++/Makefile.in: Regenerated.
* libsupc++/vtv_stubs.cc: Add none weak declaration of every function
for Cygwin and MinGW.
* 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.
2015-01-28 Jonathan Wakely <jwakely@redhat.com> 2015-01-28 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/64828 PR libstdc++/64828
......
...@@ -2321,7 +2321,17 @@ AC_DEFUN([GLIBCXX_ENABLE_VTABLE_VERIFY], [ ...@@ -2321,7 +2321,17 @@ AC_DEFUN([GLIBCXX_ENABLE_VTABLE_VERIFY], [
AC_MSG_RESULT([$enable_vtable_verify]) AC_MSG_RESULT([$enable_vtable_verify])
if test $enable_vtable_verify = yes; then if test $enable_vtable_verify = yes; then
VTV_CXXFLAGS="-fvtable-verify=std -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end" 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_PCH_CXXFLAGS="-fvtable-verify=std"
VTV_CXXLINKFLAGS="-L${toplevel_builddir}/libvtv/.libs -Wl,--rpath -Wl,${toplevel_builddir}/libvtv/.libs" VTV_CXXLINKFLAGS="-L${toplevel_builddir}/libvtv/.libs -Wl,--rpath -Wl,${toplevel_builddir}/libvtv/.libs"
else else
......
...@@ -100,9 +100,11 @@ sources = \ ...@@ -100,9 +100,11 @@ sources = \
vterminate.cc vterminate.cc
if ENABLE_VTABLE_VERIFY if ENABLE_VTABLE_VERIFY
if !VTV_CYGMIN
vtv_sources = \ vtv_sources = \
vtv_stubs.cc vtv_stubs.cc
endif endif
endif
libsupc___la_SOURCES = $(sources) $(c_sources) $(vtv_sources) libsupc___la_SOURCES = $(sources) $(c_sources) $(vtv_sources)
libsupc__convenience_la_SOURCES = $(sources) $(c_sources) $(vtv_sources) libsupc__convenience_la_SOURCES = $(sources) $(c_sources) $(vtv_sources)
......
...@@ -37,6 +37,39 @@ ...@@ -37,6 +37,39 @@
#include <cstddef> #include <cstddef>
/* weak symbols on Windows work differently than on Linux. To be able
to switch vtv on and off on Windows two dlls are built. One with
the sources from libvtv, the other from these stubs. Depending on
which dll is placed in the folder of the executable the functions
from libvtv or the stubs functions are used. */
#if defined (__CYGWIN__) || defined (__MINGW32__)
extern "C"
void
__VLTChangePermission(int);
void
__VLTRegisterSet(void**, const void*, std::size_t, std::size_t,
void**);
void
__VLTRegisterPair(void**, const void*, std::size_t,
const void*);
const void*
__VLTVerifyVtablePointer(void**, const void*);
void
__VLTRegisterSetDebug(void**, const void*, std::size_t, std::size_t,
void**);
void
__VLTRegisterPairDebug(void**, const void*, std::size_t, const void*,
const char*, const char*);
const void*
__VLTVerifyVtablePointerDebug(void**, const void*, const char*,
const char*);
#else
// Declare as weak for libsupc++, strong definitions are in libvtv. // Declare as weak for libsupc++, strong definitions are in libvtv.
#if __GXX_WEAK__ #if __GXX_WEAK__
extern "C" extern "C"
...@@ -66,6 +99,7 @@ const void* ...@@ -66,6 +99,7 @@ const void*
__VLTVerifyVtablePointerDebug(void**, const void*, const char*, __VLTVerifyVtablePointerDebug(void**, const void*, const char*,
const char*) __attribute__((weak)); const char*) __attribute__((weak));
#endif #endif
#endif
// Stub definitions. // Stub definitions.
extern "C" extern "C"
......
...@@ -25,7 +25,30 @@ include $(top_srcdir)/fragment.am ...@@ -25,7 +25,30 @@ include $(top_srcdir)/fragment.am
SUBDIRS = c++98 c++11 SUBDIRS = c++98 c++11
# Cross compiler support. # Cross compiler support.
if VTV_CYGMIN
toolexeclib_LTLIBRARIES = libvtv.la libstdc++.la
else
toolexeclib_LTLIBRARIES = libstdc++.la toolexeclib_LTLIBRARIES = libstdc++.la
endif
if VTV_CYGMIN
vtv_stubs.cc:
rm -f $@
$(LN_S) $(toplevel_srcdir)/libstdc++-v3/libsupc++/vtv_stubs.cc $@
libvtv_la_SOURCES = vtv_stubs.cc
libvtv_la_LDFLAGS = $(lt_host_flags)
libvtv_la_AM_CXXFLAGS = \
$(glibcxx_compiler_pic_flag) \
$(XTEMPLATE_FLAGS) \
-Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end \
$(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
libvtv_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(libvtv_la_AM_CXXFLAGS) \
$(CXXFLAGS) $(libvtv_la_LDFLAGS) $(LDFLAGS) -o $@
endif
vpath % $(top_srcdir)/src/c++98 vpath % $(top_srcdir)/src/c++98
vpath % $(top_srcdir)/src/c++11 vpath % $(top_srcdir)/src/c++11
......
2015-01-27 Caroline Tice <cmtice@google.com>
Committing VTV Cywin/Ming patch for Patrick Wollgast
* 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.
2014-12-12 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2014-12-12 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* testsuite/lib/libvtv.exp: Load target-utils.exp * testsuite/lib/libvtv.exp: Load target-utils.exp
......
...@@ -38,7 +38,11 @@ AM_CXXFLAGS = $(XCFLAGS) ...@@ -38,7 +38,11 @@ AM_CXXFLAGS = $(XCFLAGS)
AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS) AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
AM_CXXFLAGS += -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end AM_CXXFLAGS += -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end
toolexeclib_LTLIBRARIES = libvtv.la if VTV_CYGMIN
toolexeclib_LTLIBRARIES = libvtv.la libvtv_stubs.la
else
toolexeclib_LTLIBRARIES = libvtv.la
endif
vtv_headers = \ vtv_headers = \
vtv_map.h \ vtv_map.h \
...@@ -55,6 +59,11 @@ vtv_sources = \ ...@@ -55,6 +59,11 @@ vtv_sources = \
vtv_utils.cc \ vtv_utils.cc \
vtv_end.c vtv_end.c
vtv_stubs_sources = \
vtv_start.c \
vtv_stubs.cc \
vtv_end.c
libvtv_includedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include libvtv_includedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
# Link in vtv_start and vtv_end. # Link in vtv_start and vtv_end.
...@@ -67,8 +76,29 @@ vtv_end.c: ...@@ -67,8 +76,29 @@ vtv_end.c:
rm -f $@ rm -f $@
$(LN_S) $(toplevel_srcdir)/libgcc/vtv_end.c $@ $(LN_S) $(toplevel_srcdir)/libgcc/vtv_end.c $@
if VTV_CYGMIN
obstack.c:
rm -f $@
$(LN_S) $(toplevel_srcdir)/libiberty/obstack.c $@
vtv_stubs.cc:
rm -f $@
$(LN_S) $(toplevel_srcdir)/libstdc++-v3/libsupc++/vtv_stubs.cc $@
endif
if VTV_CYGMIN
libvtv_la_LIBADD = -lpsapi
libvtv_la_LDFLAGS = $(lt_host_flags)
libvtv_stubs_la_LDFLAGS = $(lt_host_flags)
endif
if ENABLE_VTABLE_VERIFY if ENABLE_VTABLE_VERIFY
if VTV_CYGMIN
libvtv_la_SOURCES = $(vtv_sources) obstack.c
libvtv_stubs_la_SOURCES = $(vtv_stubs_sources)
else
libvtv_la_SOURCES = $(vtv_sources) libvtv_la_SOURCES = $(vtv_sources)
endif
libvtv_include_HEADERS = $(vtv_headers) libvtv_include_HEADERS = $(vtv_headers)
else else
libvtv_la_SOURCES = libvtv_la_SOURCES =
...@@ -78,6 +108,8 @@ endif ...@@ -78,6 +108,8 @@ endif
# Least ordering for dependencies mean linking w/o libstdc++ for as # Least ordering for dependencies mean linking w/o libstdc++ for as
# long as the development of libvtv does not absolutely require it. # long as the development of libvtv does not absolutely require it.
CXXVTV=$(CC_FOR_TARGET) CXXVTV=$(CC_FOR_TARGET)
CXXLD=$(CC_FOR_TARGET)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CXXVTV) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ --mode=compile $(CXXVTV) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
......
...@@ -122,6 +122,7 @@ AC_CHECK_TOOL(RANLIB, ranlib, :) ...@@ -122,6 +122,7 @@ AC_CHECK_TOOL(RANLIB, ranlib, :)
# Configure libtool # Configure libtool
AC_LIBTOOL_DLOPEN AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared) AC_SUBST(enable_shared)
AC_SUBST(enable_static) AC_SUBST(enable_static)
...@@ -155,4 +156,15 @@ _EOF ...@@ -155,4 +156,15 @@ _EOF
]) ])
fi fi
case "$target_os" in
cygwin*|mingw32*)
vtv_cygmin="yes"
;;
*)
vtv_cygmin="no"
;;
esac
AM_CONDITIONAL(VTV_CYGMIN, test $vtv_cygmin = yes)
AC_OUTPUT AC_OUTPUT
...@@ -26,6 +26,12 @@ case "${target}" in ...@@ -26,6 +26,12 @@ case "${target}" in
x86_64-*-linux* | i?86-*-linux*) x86_64-*-linux* | i?86-*-linux*)
VTV_SUPPORTED=yes VTV_SUPPORTED=yes
;; ;;
x86_64-*-cygwin* | i?86-*-cygwin*)
VTV_SUPPORTED=yes
;;
x86_64-*-mingw* | i?86-*-mingw*)
VTV_SUPPORTED=yes
;;
powerpc*-*-linux*) powerpc*-*-linux*)
;; ;;
sparc*-*-linux*) sparc*-*-linux*)
......
...@@ -46,7 +46,11 @@ ...@@ -46,7 +46,11 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#if !defined (__CYGWIN__) && !defined (__MINGW32__)
#include <execinfo.h> #include <execinfo.h>
#endif
#include <unistd.h> #include <unistd.h>
#include "vtv_utils.h" #include "vtv_utils.h"
...@@ -102,8 +106,10 @@ log_error_message (const char *log_msg, bool generate_backtrace) ...@@ -102,8 +106,10 @@ log_error_message (const char *log_msg, bool generate_backtrace)
{ {
#define STACK_DEPTH 20 #define STACK_DEPTH 20
void *callers[STACK_DEPTH]; void *callers[STACK_DEPTH];
#if !defined (__CYGWIN__) && !defined (__MINGW32__)
int actual_depth = backtrace (callers, STACK_DEPTH); int actual_depth = backtrace (callers, STACK_DEPTH);
backtrace_symbols_fd (callers, actual_depth, vtv_failures_log_fd); backtrace_symbols_fd (callers, actual_depth, vtv_failures_log_fd);
#endif
} }
} }
......
...@@ -33,7 +33,11 @@ ...@@ -33,7 +33,11 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#if defined (__CYGWIN__) || defined (__MINGW32__)
#include <windows.h>
#else
#include <sys/mman.h> #include <sys/mman.h>
#endif
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
...@@ -62,6 +66,18 @@ static void *current_chunk VTV_PROTECTED_VAR = 0; ...@@ -62,6 +66,18 @@ static void *current_chunk VTV_PROTECTED_VAR = 0;
static size_t current_chunk_size VTV_PROTECTED_VAR = 0; static size_t current_chunk_size VTV_PROTECTED_VAR = 0;
static int malloc_initialized VTV_PROTECTED_VAR = 0; static int malloc_initialized VTV_PROTECTED_VAR = 0;
#if defined (__CYGWIN__) || defined (__MINGW32__)
//sysconf(_SC_PAGE_SIZE) port
long sysconf_SC_PAGE_SIZE()
{
SYSTEM_INFO si;
GetSystemInfo(&si);
long pageSize = (long)si.dwPageSize;
return pageSize;
//return 4096; // standard usermode 32bit pagesize in bytes // FIXME
}
#endif
/* The function goes through and counts all the pages we have allocated /* The function goes through and counts all the pages we have allocated
so far. It returns the page count. */ so far. It returns the page count. */
...@@ -162,8 +178,13 @@ obstack_chunk_alloc (size_t size) ...@@ -162,8 +178,13 @@ obstack_chunk_alloc (size_t size)
VTV_DEBUG_ASSERT ((size & (VTV_PAGE_SIZE - 1)) == 0); VTV_DEBUG_ASSERT ((size & (VTV_PAGE_SIZE - 1)) == 0);
void *allocated; void *allocated;
#if defined (__CYGWIN__) || defined (__MINGW32__)
if ((allocated = VirtualAlloc(NULL, size, MEM_RESERVE|MEM_COMMIT,
PAGE_READWRITE)) == 0)
#else
if ((allocated = mmap (NULL, size, PROT_READ | PROT_WRITE, if ((allocated = mmap (NULL, size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)) == 0) MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)) == 0)
#endif
VTV_error (); VTV_error ();
VTV_DEBUG_ASSERT (((unsigned long) allocated & (VTV_PAGE_SIZE - 1)) == 0); VTV_DEBUG_ASSERT (((unsigned long) allocated & (VTV_PAGE_SIZE - 1)) == 0);
...@@ -190,7 +211,11 @@ __vtv_malloc_init (void) ...@@ -190,7 +211,11 @@ __vtv_malloc_init (void)
if (malloc_initialized) if (malloc_initialized)
return; return;
#if defined (__CYGWIN__) || defined (__MINGW32__)
if (VTV_PAGE_SIZE != sysconf_SC_PAGE_SIZE())
#else
if (VTV_PAGE_SIZE != sysconf (_SC_PAGE_SIZE)) if (VTV_PAGE_SIZE != sysconf (_SC_PAGE_SIZE))
#endif
VTV_error (); VTV_error ();
obstack_chunk_size (&vtv_obstack) = VTV_PAGE_SIZE; obstack_chunk_size (&vtv_obstack) = VTV_PAGE_SIZE;
......
...@@ -95,4 +95,11 @@ extern void __vtv_malloc_stats (void); ...@@ -95,4 +95,11 @@ extern void __vtv_malloc_stats (void);
extern void __vtv_malloc_dump_stats (void); extern void __vtv_malloc_dump_stats (void);
extern int __vtv_count_mmapped_pages (void); extern int __vtv_count_mmapped_pages (void);
#if defined (__CYGWIN__) || defined (__MINGW32__)
extern "C" int mprotect (void *addr, int len, int prot);
#define PROT_READ 0x1
#define PROT_WRITE 0x2
#endif
#endif /* vtv_malloc.h */ #endif /* vtv_malloc.h */
...@@ -26,7 +26,13 @@ ...@@ -26,7 +26,13 @@
#define _VTV_MAP_H 1 #define _VTV_MAP_H 1
#include <string.h> #include <string.h>
#ifdef __MINGW32__
#include <stdint.h>
#include "vtv_utils.h"
#else
#include <vtv_utils.h> #include <vtv_utils.h>
#endif
inline uint64_t inline uint64_t
load8bytes (const void *p) load8bytes (const void *p)
......
...@@ -33,7 +33,12 @@ ...@@ -33,7 +33,12 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#if defined (__CYGWIN__) || defined (__MINGW32__)
#include <windows.h>
#else
#include <execinfo.h> #include <execinfo.h>
#endif
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
...@@ -64,8 +69,12 @@ __vtv_open_log (const char *name) ...@@ -64,8 +69,12 @@ __vtv_open_log (const char *name)
{ {
char log_name[1024]; char log_name[1024];
char log_dir[512]; char log_dir[512];
#if defined (__CYGWIN__) || defined (__MINGW32__)
pid_t process_id = GetCurrentProcessId ();
#else
uid_t user_id = getuid (); uid_t user_id = getuid ();
pid_t process_id = getpid (); pid_t process_id = getpid ();
#endif
char *logs_prefix; char *logs_prefix;
bool logs_dir_specified = false; bool logs_dir_specified = false;
int fd = -1; int fd = -1;
...@@ -74,14 +83,29 @@ __vtv_open_log (const char *name) ...@@ -74,14 +83,29 @@ __vtv_open_log (const char *name)
if (logs_prefix && strlen (logs_prefix) > 0) if (logs_prefix && strlen (logs_prefix) > 0)
{ {
logs_dir_specified = true; logs_dir_specified = true;
#ifdef __MINGW32__
mkdir (logs_prefix);
#else
mkdir (logs_prefix, S_IRWXU); mkdir (logs_prefix, S_IRWXU);
#endif
snprintf (log_dir, sizeof (log_dir), "%s/vtv_logs", logs_prefix); snprintf (log_dir, sizeof (log_dir), "%s/vtv_logs", logs_prefix);
mkdir (log_dir, S_IRWXU);
#ifdef __MINGW32__
mkdir (log_dir);
#else
mkdir (log_dir, S_IRWXU);
#endif
#if defined (__CYGWIN__) || defined (__MINGW32__)
snprintf (log_name, sizeof (log_name), "%s_%d_%s", log_dir,
(unsigned) process_id, name);
fd = open (log_name, O_WRONLY | O_APPEND | O_CREAT, S_IRWXU);
#else
snprintf (log_name, sizeof (log_name), "%s/%d_%d_%s", log_dir, snprintf (log_name, sizeof (log_name), "%s/%d_%d_%s", log_dir,
(unsigned) user_id, (unsigned) process_id, name); (unsigned) user_id, (unsigned) process_id, name);
fd = open (log_name, O_WRONLY | O_APPEND | O_CREAT | O_NOFOLLOW, fd = open (log_name, O_WRONLY | O_APPEND | O_CREAT | O_NOFOLLOW,
S_IRWXU); S_IRWXU);
#endif
} }
else else
fd = dup (2); fd = dup (2);
...@@ -125,8 +149,12 @@ __vtv_add_to_log (int log_file, const char * format, ...) ...@@ -125,8 +149,12 @@ __vtv_add_to_log (int log_file, const char * format, ...)
va_list ap; va_list ap;
va_start (ap, format); va_start (ap, format);
#if defined (__CYGWIN__) || defined (__MINGW32__)
snprintf (output, sizeof (output), "VTV: PID=%ld ", GetCurrentProcessId ());
#else
snprintf (output, sizeof (output), "VTV: PID=%d PPID=%d ", getpid (), snprintf (output, sizeof (output), "VTV: PID=%d PPID=%d ", getpid (),
getppid ()); getppid ());
#endif
vtv_log_write (log_file, output); vtv_log_write (log_file, output);
vsnprintf (output, sizeof (output), format, ap); vsnprintf (output, sizeof (output), format, ap);
vtv_log_write (log_file, output); vtv_log_write (log_file, output);
...@@ -151,6 +179,7 @@ __vtv_log_verification_failure (const char *log_msg, bool generate_backtrace) ...@@ -151,6 +179,7 @@ __vtv_log_verification_failure (const char *log_msg, bool generate_backtrace)
__vtv_add_to_log (vtv_failures_log_fd, "%s", log_msg); __vtv_add_to_log (vtv_failures_log_fd, "%s", log_msg);
#if !defined (__CYGWIN__) && !defined (__MINGW32__)
if (generate_backtrace) if (generate_backtrace)
{ {
#define STACK_DEPTH 20 #define STACK_DEPTH 20
...@@ -158,4 +187,5 @@ __vtv_log_verification_failure (const char *log_msg, bool generate_backtrace) ...@@ -158,4 +187,5 @@ __vtv_log_verification_failure (const char *log_msg, bool generate_backtrace)
int actual_depth = backtrace (callers, STACK_DEPTH); int actual_depth = backtrace (callers, STACK_DEPTH);
backtrace_symbols_fd (callers, actual_depth, vtv_failures_log_fd); backtrace_symbols_fd (callers, actual_depth, vtv_failures_log_fd);
} }
#endif
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment