gcc/libvtv/Makefile.am
Caroline Tice f7f049fa46 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
2015-01-29 00:03:56 -08:00

120 lines
3.1 KiB
Makefile

## Makefile for the VTV library.
##
## Copyright (C) 2013 Free Software Foundation, Inc.
##
## Process this file with automake to produce Makefile.in.
##
## This file is part of the Vtable Verification (VTV) Library. This
## library is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3, or (at your option)
## any later version.
## This library is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
## You should have received a copy of the GNU General Public License
## along with this library; see the file COPYING3. If not see
## <http://www.gnu.org/licenses/>.
if ENABLE_VTABLE_VERIFY
SUBDIRS = testsuite
else
SUBDIRS=
endif
ACLOCAL_AMFLAGS = -I .. -I ../config
# May be used by toolexeclibdir.
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
DEFS = @DEFS@
AM_CPPFLAGS = -I$(top_srcdir)/../include
AM_CFLAGS = $(XCFLAGS)
AM_CCASFLAGS = $(XCFLAGS)
AM_CXXFLAGS = $(XCFLAGS)
AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
AM_CXXFLAGS += -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end
if VTV_CYGMIN
toolexeclib_LTLIBRARIES = libvtv.la libvtv_stubs.la
else
toolexeclib_LTLIBRARIES = libvtv.la
endif
vtv_headers = \
vtv_map.h \
vtv_malloc.h \
vtv_fail.h \
vtv_set.h \
vtv_utils.h \
vtv_rts.h
vtv_sources = \
vtv_start.c \
vtv_malloc.cc \
vtv_rts.cc \
vtv_utils.cc \
vtv_end.c
vtv_stubs_sources = \
vtv_start.c \
vtv_stubs.cc \
vtv_end.c
libvtv_includedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
# Link in vtv_start and vtv_end.
BUILT_SOURCES = vtv_start.c vtv_end.c
vtv_start.c:
rm -f $@
$(LN_S) $(toplevel_srcdir)/libgcc/vtv_start.c $@
vtv_end.c:
rm -f $@
$(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 VTV_CYGMIN
libvtv_la_SOURCES = $(vtv_sources) obstack.c
libvtv_stubs_la_SOURCES = $(vtv_stubs_sources)
else
libvtv_la_SOURCES = $(vtv_sources)
endif
libvtv_include_HEADERS = $(vtv_headers)
else
libvtv_la_SOURCES =
libvtv_include_HEADERS =
endif
# Least ordering for dependencies mean linking w/o libstdc++ for as
# long as the development of libvtv does not absolutely require it.
CXXVTV=$(CC_FOR_TARGET)
CXXLD=$(CC_FOR_TARGET)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CXXVTV) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXVTV) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@