valgrind: Fix build for x86_64

This commit is contained in:
Tee KOBAYASHI 2022-02-10 14:50:18 +09:00 committed by Henrik Grimler
parent 33e9cda847
commit 8a82ee521d
No known key found for this signature in database
GPG Key ID: B0076E490B71616B
5 changed files with 55 additions and 2 deletions

View File

@ -0,0 +1,20 @@
--- a/Makefile.all.am
+++ b/Makefile.all.am
@@ -335,13 +335,13 @@
PRELOAD_LDFLAGS_COMMON_LINUX += -nostdlib
endif
-PRELOAD_LDFLAGS_X86_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
-PRELOAD_LDFLAGS_AMD64_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
+PRELOAD_LDFLAGS_X86_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@ $(shell $(CC) @FLAG_M32@ -print-libgcc-file-name)
+PRELOAD_LDFLAGS_AMD64_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@ $(shell $(CC) @FLAG_M64@ -print-libgcc-file-name)
PRELOAD_LDFLAGS_PPC32_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
PRELOAD_LDFLAGS_PPC64BE_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
PRELOAD_LDFLAGS_PPC64LE_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
-PRELOAD_LDFLAGS_ARM_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
-PRELOAD_LDFLAGS_ARM64_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
+PRELOAD_LDFLAGS_ARM_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@ $(shell $(CC) @FLAG_M32@ -print-libgcc-file-name)
+PRELOAD_LDFLAGS_ARM64_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@ $(shell $(CC) @FLAG_M64@ -print-libgcc-file-name)
PRELOAD_LDFLAGS_X86_FREEBSD = $(PRELOAD_LDFLAGS_COMMON_FREEBSD) @FLAG_M32@
PRELOAD_LDFLAGS_AMD64_FREEBSD= $(PRELOAD_LDFLAGS_COMMON_FREEBSD) @FLAG_M64@
PRELOAD_LDFLAGS_X86_DARWIN = $(PRELOAD_LDFLAGS_COMMON_DARWIN) -arch i386

View File

@ -0,0 +1,31 @@
--- a/Makefile.tool.am
+++ b/Makefile.tool.am
@@ -44,13 +44,13 @@
-nodefaultlibs -nostartfiles -Wl,-u,_start @FLAG_NO_BUILD_ID@
TOOL_LDFLAGS_X86_LINUX = \
- $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@
+ $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@ $(shell $(CC) @FLAG_M32@ -print-libgcc-file-name)
TOOL_LDFLAGS_X86_FREEBSD = \
$(TOOL_LDFLAGS_COMMON_FREEBSD) @FLAG_M32@
TOOL_LDFLAGS_AMD64_LINUX = \
- $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@
+ $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@ $(shell $(CC) @FLAG_M64@ -print-libgcc-file-name)
TOOL_LDFLAGS_AMD64_FREEBSD = \
$(TOOL_LDFLAGS_COMMON_FREEBSD) @FLAG_M64@
@@ -65,10 +65,10 @@
$(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@
TOOL_LDFLAGS_ARM_LINUX = \
- $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@
+ $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@ $(shell $(CC) @FLAG_M32@ -print-libgcc-file-name)
TOOL_LDFLAGS_ARM64_LINUX = \
- $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@
+ $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@ $(shell $(CC) @FLAG_M64@ -print-libgcc-file-name)
TOOL_LDFLAGS_S390X_LINUX = \
$(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@

View File

@ -11,11 +11,11 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--with-tmpdir=$TERMUX_PREFIX/tmp"
termux_step_pre_configure() {
CFLAGS=${CFLAGS/-fstack-protector-strong/}
LDFLAGS+=" $($CC -print-libgcc-file-name)"
if [ "$TERMUX_ARCH" == "aarch64" ]; then
cp $TERMUX_PKG_BUILDER_DIR/aarch64-setjmp.S $TERMUX_PKG_SRCDIR
autoreconf -if
patch --silent -p1 < $TERMUX_PKG_BUILDER_DIR/coregrindmake.am.diff
patch --silent -p1 < $TERMUX_PKG_BUILDER_DIR/memcheckmake.am.diff
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --enable-only64bit"
elif [ "$TERMUX_ARCH" == "arm" ]; then
# valgrind doesn't like arm; armv7 works, though.
@ -24,4 +24,6 @@ termux_step_pre_configure() {
# "valgrind uses inline assembly that is not Thumb compatible":
CFLAGS=${CFLAGS/-mthumb/}
fi
autoreconf -fi
}