Do not build core_handler unless memfd_create is available

Restores build compatibility with glibc < 2.27.

Change-Id: I1e58ab5e15d7691ad076769a52260fa01c9cfd06
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2597562
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Eric Astor 2020-12-21 16:32:39 -05:00 committed by Mike Frysinger
parent 83203748ae
commit 86c090b77f
5 changed files with 38 additions and 13 deletions

View file

@ -365,9 +365,11 @@ if X86_HOST
bin_PROGRAMS += \ bin_PROGRAMS += \
src/tools/mac/dump_syms/dump_syms_mac src/tools/mac/dump_syms/dump_syms_mac
endif endif
if HAVE_MEMFD_CREATE
libexec_PROGRAMS += \ libexec_PROGRAMS += \
src/tools/linux/core_handler/core_handler src/tools/linux/core_handler/core_handler
endif endif
endif
endif LINUX_HOST endif LINUX_HOST
@ -576,11 +578,13 @@ src_tools_linux_core2md_core2md_SOURCES = \
src_tools_linux_core2md_core2md_LDADD = \ src_tools_linux_core2md_core2md_LDADD = \
src/client/linux/libbreakpad_client.a src/client/linux/libbreakpad_client.a
if HAVE_MEMFD_CREATE
src_tools_linux_core_handler_core_handler_SOURCES = \ src_tools_linux_core_handler_core_handler_SOURCES = \
src/tools/linux/core_handler/core_handler.cc src/tools/linux/core_handler/core_handler.cc
src_tools_linux_core_handler_core_handler_LDADD = \ src_tools_linux_core_handler_core_handler_LDADD = \
src/client/linux/libbreakpad_client.a src/client/linux/libbreakpad_client.a
endif
src_tools_linux_pid2md_pid2md_SOURCES = \ src_tools_linux_pid2md_pid2md_SOURCES = \
src/tools/linux/pid2md/pid2md.cc src/tools/linux/pid2md/pid2md.cc

View file

@ -165,8 +165,8 @@ EXTRA_PROGRAMS = $(am__EXEEXT_1)
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@@X86_HOST_TRUE@am__append_14 = \ @DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@@X86_HOST_TRUE@am__append_14 = \
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@@X86_HOST_TRUE@ src/tools/mac/dump_syms/dump_syms_mac @DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@@X86_HOST_TRUE@ src/tools/mac/dump_syms/dump_syms_mac
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@am__append_15 = \ @DISABLE_TOOLS_FALSE@@HAVE_MEMFD_CREATE_TRUE@@LINUX_HOST_TRUE@am__append_15 = \
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/core_handler/core_handler @DISABLE_TOOLS_FALSE@@HAVE_MEMFD_CREATE_TRUE@@LINUX_HOST_TRUE@ src/tools/linux/core_handler/core_handler
@DISABLE_PROCESSOR_FALSE@am__append_16 = \ @DISABLE_PROCESSOR_FALSE@am__append_16 = \
@DISABLE_PROCESSOR_FALSE@ src/common/test_assembler_unittest \ @DISABLE_PROCESSOR_FALSE@ src/common/test_assembler_unittest \
@ -307,7 +307,7 @@ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)" \
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/md2core/minidump_2_core_unittest$(EXEEXT) @DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/md2core/minidump_2_core_unittest$(EXEEXT)
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@@X86_HOST_TRUE@am__EXEEXT_8 = src/common/mac/macho_reader_unittest$(EXEEXT) @DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@@X86_HOST_TRUE@am__EXEEXT_8 = src/common/mac/macho_reader_unittest$(EXEEXT)
@DISABLE_PROCESSOR_FALSE@@SELFTEST_TRUE@am__EXEEXT_9 = src/processor/stackwalker_selftest$(EXEEXT) @DISABLE_PROCESSOR_FALSE@@SELFTEST_TRUE@am__EXEEXT_9 = src/processor/stackwalker_selftest$(EXEEXT)
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@am__EXEEXT_10 = src/tools/linux/core_handler/core_handler$(EXEEXT) @DISABLE_TOOLS_FALSE@@HAVE_MEMFD_CREATE_TRUE@@LINUX_HOST_TRUE@am__EXEEXT_10 = src/tools/linux/core_handler/core_handler$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS) $(libexec_PROGRAMS) $(noinst_PROGRAMS) PROGRAMS = $(bin_PROGRAMS) $(libexec_PROGRAMS) $(noinst_PROGRAMS)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \ am__vpath_adj = case $$p in \
@ -1451,10 +1451,10 @@ src_tools_linux_core2md_core2md_OBJECTS = \
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@src_tools_linux_core2md_core2md_DEPENDENCIES = src/client/linux/libbreakpad_client.a @DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@src_tools_linux_core2md_core2md_DEPENDENCIES = src/client/linux/libbreakpad_client.a
am__src_tools_linux_core_handler_core_handler_SOURCES_DIST = \ am__src_tools_linux_core_handler_core_handler_SOURCES_DIST = \
src/tools/linux/core_handler/core_handler.cc src/tools/linux/core_handler/core_handler.cc
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@am_src_tools_linux_core_handler_core_handler_OBJECTS = src/tools/linux/core_handler/core_handler.$(OBJEXT) @DISABLE_TOOLS_FALSE@@HAVE_MEMFD_CREATE_TRUE@@LINUX_HOST_TRUE@am_src_tools_linux_core_handler_core_handler_OBJECTS = src/tools/linux/core_handler/core_handler.$(OBJEXT)
src_tools_linux_core_handler_core_handler_OBJECTS = \ src_tools_linux_core_handler_core_handler_OBJECTS = \
$(am_src_tools_linux_core_handler_core_handler_OBJECTS) $(am_src_tools_linux_core_handler_core_handler_OBJECTS)
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@src_tools_linux_core_handler_core_handler_DEPENDENCIES = src/client/linux/libbreakpad_client.a @DISABLE_TOOLS_FALSE@@HAVE_MEMFD_CREATE_TRUE@@LINUX_HOST_TRUE@src_tools_linux_core_handler_core_handler_DEPENDENCIES = src/client/linux/libbreakpad_client.a
am__src_tools_linux_dump_syms_dump_syms_SOURCES_DIST = \ am__src_tools_linux_dump_syms_dump_syms_SOURCES_DIST = \
src/common/dwarf_cfi_to_module.cc \ src/common/dwarf_cfi_to_module.cc \
src/common/dwarf_cu_to_module.cc \ src/common/dwarf_cu_to_module.cc \
@ -2777,11 +2777,11 @@ TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@src_tools_linux_core2md_core2md_LDADD = \ @DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@src_tools_linux_core2md_core2md_LDADD = \
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/client/linux/libbreakpad_client.a @DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/client/linux/libbreakpad_client.a
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@src_tools_linux_core_handler_core_handler_SOURCES = \ @DISABLE_TOOLS_FALSE@@HAVE_MEMFD_CREATE_TRUE@@LINUX_HOST_TRUE@src_tools_linux_core_handler_core_handler_SOURCES = \
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/core_handler/core_handler.cc @DISABLE_TOOLS_FALSE@@HAVE_MEMFD_CREATE_TRUE@@LINUX_HOST_TRUE@ src/tools/linux/core_handler/core_handler.cc
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@src_tools_linux_core_handler_core_handler_LDADD = \ @DISABLE_TOOLS_FALSE@@HAVE_MEMFD_CREATE_TRUE@@LINUX_HOST_TRUE@src_tools_linux_core_handler_core_handler_LDADD = \
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/client/linux/libbreakpad_client.a @DISABLE_TOOLS_FALSE@@HAVE_MEMFD_CREATE_TRUE@@LINUX_HOST_TRUE@ src/client/linux/libbreakpad_client.a
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@src_tools_linux_pid2md_pid2md_SOURCES = \ @DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@src_tools_linux_pid2md_pid2md_SOURCES = \
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/pid2md/pid2md.cc @DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/pid2md/pid2md.cc

18
configure vendored
View file

@ -650,6 +650,8 @@ LINUX_HOST_FALSE
LINUX_HOST_TRUE LINUX_HOST_TRUE
WARN_CXXFLAGS WARN_CXXFLAGS
HAVE_CXX11 HAVE_CXX11
HAVE_MEMFD_CREATE_FALSE
HAVE_MEMFD_CREATE_TRUE
HAVE_GETCONTEXT_FALSE HAVE_GETCONTEXT_FALSE
HAVE_GETCONTEXT_TRUE HAVE_GETCONTEXT_TRUE
PTHREAD_CFLAGS PTHREAD_CFLAGS
@ -6651,7 +6653,7 @@ fi
done done
for ac_header in a.out.h sys/random.h for ac_header in a.out.h sys/mman.h sys/random.h
do : do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@ -6664,7 +6666,7 @@ fi
done done
for ac_func in arc4random getcontext getrandom for ac_func in arc4random getcontext getrandom memfd_create
do : do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@ -6684,6 +6686,14 @@ else
HAVE_GETCONTEXT_FALSE= HAVE_GETCONTEXT_FALSE=
fi fi
if test "x$ac_cv_func_memfd_create" = xyes; then
HAVE_MEMFD_CREATE_TRUE=
HAVE_MEMFD_CREATE_FALSE='#'
else
HAVE_MEMFD_CREATE_TRUE='#'
HAVE_MEMFD_CREATE_FALSE=
fi
ax_cxx_compile_cxx11_required=true ax_cxx_compile_cxx11_required=true
@ -7886,6 +7896,10 @@ if test -z "${HAVE_GETCONTEXT_TRUE}" && test -z "${HAVE_GETCONTEXT_FALSE}"; then
as_fn_error $? "conditional \"HAVE_GETCONTEXT\" was never defined. as_fn_error $? "conditional \"HAVE_GETCONTEXT\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5 Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi fi
if test -z "${HAVE_MEMFD_CREATE_TRUE}" && test -z "${HAVE_MEMFD_CREATE_FALSE}"; then
as_fn_error $? "conditional \"HAVE_MEMFD_CREATE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LINUX_HOST_TRUE}" && test -z "${LINUX_HOST_FALSE}"; then if test -z "${LINUX_HOST_TRUE}" && test -z "${LINUX_HOST_FALSE}"; then
as_fn_error $? "conditional \"LINUX_HOST\" was never defined. as_fn_error $? "conditional \"LINUX_HOST\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5 Usually this means the macro was only invoked conditionally." "$LINENO" 5

View file

@ -72,9 +72,10 @@ AC_ARG_ENABLE(m32,
AC_HEADER_STDC AC_HEADER_STDC
AC_SYS_LARGEFILE AC_SYS_LARGEFILE
AX_PTHREAD AX_PTHREAD
AC_CHECK_HEADERS([a.out.h sys/random.h]) AC_CHECK_HEADERS([a.out.h sys/mman.h sys/random.h])
AC_CHECK_FUNCS([arc4random getcontext getrandom]) AC_CHECK_FUNCS([arc4random getcontext getrandom memfd_create])
AM_CONDITIONAL([HAVE_GETCONTEXT], [test "x$ac_cv_func_getcontext" = xyes]) AM_CONDITIONAL([HAVE_GETCONTEXT], [test "x$ac_cv_func_getcontext" = xyes])
AM_CONDITIONAL([HAVE_MEMFD_CREATE], [test "x$ac_cv_func_memfd_create" = xyes])
AX_CXX_COMPILE_STDCXX(11, noext, mandatory) AX_CXX_COMPILE_STDCXX(11, noext, mandatory)

View file

@ -18,6 +18,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */ /* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H #undef HAVE_INTTYPES_H
/* Define to 1 if you have the `memfd_create' function. */
#undef HAVE_MEMFD_CREATE
/* Define to 1 if you have the <memory.h> header file. */ /* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H #undef HAVE_MEMORY_H
@ -36,6 +39,9 @@
/* Define to 1 if you have the <string.h> header file. */ /* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H #undef HAVE_STRING_H
/* Define to 1 if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
/* Define to 1 if you have the <sys/random.h> header file. */ /* Define to 1 if you have the <sys/random.h> header file. */
#undef HAVE_SYS_RANDOM_H #undef HAVE_SYS_RANDOM_H