crash/crash-8.0.0_build.patch
Lianbo Jiang 120df7f566 Enable LTO and Hardened package
Release: crash-8.0.0-2

Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
2021-11-26 15:19:35 +08:00

36 lines
1.5 KiB
Diff

diff --git crash-8.0.0/Makefile crash-8.0.0/Makefile
index d0574d8f07d3..9dbb61d0dbc8 100644
--- crash-8.0.0/Makefile
+++ crash-8.0.0/Makefile
@@ -198,7 +198,7 @@ GDB_FLAGS=
# TARGET_CFLAGS will be configured automatically by configure
TARGET_CFLAGS=
-CRASH_CFLAGS=-g -D${TARGET} ${TARGET_CFLAGS} ${GDB_FLAGS} ${CFLAGS}
+CRASH_CFLAGS=-g -D${TARGET} ${TARGET_CFLAGS} ${GDB_FLAGS} ${CFLAGS} ${CPPFLAGS} -fPIE
GPL_FILES=
TAR_FILES=${SOURCE_FILES} Makefile ${GPL_FILES} README .rh_rpm_package crash.8 \
@@ -228,7 +228,7 @@ all: make_configure
gdb_merge: force
@if [ ! -f ${GDB}/README ]; then \
make --no-print-directory gdb_unzip; fi
- @echo "${LDFLAGS} -lz -llzo2 -lsnappy -ldl -rdynamic" > ${GDB}/gdb/mergelibs
+ @echo "${LDFLAGS} -lz -llzo2 -lsnappy -ldl -rdynamic -Wl,-z,now -fPIE" > ${GDB}/gdb/mergelibs
@echo "../../${PROGRAM} ../../${PROGRAM}lib.a" > ${GDB}/gdb/mergeobj
@rm -f ${PROGRAM}
@if [ ! -f ${GDB}/config.status ]; then \
diff --git crash-8.0.0/configure.c crash-8.0.0/configure.c
index 75006e881f5a..06c94d58c56c 100644
--- crash-8.0.0/configure.c
+++ crash-8.0.0/configure.c
@@ -780,7 +780,8 @@ build_configure(struct supported_gdb_version *sp)
fprintf(fp2, "%s\n", sp->GDB);
sprintf(target_data.gdb_version, "%s", &sp->GDB[4]);
} else if (strncmp(buf, "LDFLAGS=", strlen("LDFLAGS=")) == 0) {
- fprintf(fp2, "LDFLAGS=%s\n", ldflags ? ldflags : "");
+ if (ldflags)
+ fprintf(fp2, "LDFLAGS=%s\n", ldflags ? ldflags : "");
} else
fprintf(fp2, "%s", buf);