aboutsummaryrefslogtreecommitdiff
path: root/sim/ppc
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-04-08 09:49:30 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-04-08 09:49:30 -0400
commit2b8d134be46071f6869ed45ebbf521d91c93fb66 (patch)
treeb7e9539146a59fd0cfa2dd562f217bbccbbf8aac /sim/ppc
parent16e311ab6d4d379da18ad03bc5373f621f488f41 (diff)
downloadfsf-binutils-gdb-2b8d134be46071f6869ed45ebbf521d91c93fb66.zip
fsf-binutils-gdb-2b8d134be46071f6869ed45ebbf521d91c93fb66.tar.gz
fsf-binutils-gdb-2b8d134be46071f6869ed45ebbf521d91c93fb66.tar.bz2
sim: set ASAN_OPTIONS=detect_leaks=0 when running igen and opc2c
The igen/dgen and opc2c tools leak their heap-allocated memory (on purpose) at program exit, which makes AddressSanitizer fail the tool execution. This breaks the build, as it makes the tool return a non-zero exit code. Fix that by disabling leak detection through the setting of that environment variable. I also changed the opc2c rules for m32c to go through a temporary file. What happened is that the failing opc2c would produce an incomplete file (probably because ASan exits the process before stdout is flushed). This meant that further make attempts didn't try to re-create the file, as it already existed. A "clean" was therefore necessary. This can also happen in regular builds if the user interrupts the build (^C) in the middle of the opc2c execution and tries to resume it. Going to a temporary file avoids this issue. sim/m32c/ChangeLog: * Makefile.in: Set ASAN_OPTIONS when running opc2c. sim/mips/ChangeLog: * Makefile.in: Set ASAN_OPTIONS when running igen. sim/mn10300/ChangeLog: * Makefile.in: Set ASAN_OPTIONS when running igen. sim/ppc/ChangeLog: * Makefile.in: Set ASAN_OPTIONS when running igen. sim/v850/ChangeLog: * Makefile.in: Set ASAN_OPTIONS when running igen. Change-Id: I00f21d4dc1aff0ef73471925d41ce7c23e83e082
Diffstat (limited to 'sim/ppc')
-rw-r--r--sim/ppc/ChangeLog4
-rw-r--r--sim/ppc/Makefile.in10
2 files changed, 12 insertions, 2 deletions
diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog
index 539d317..910996f 100644
--- a/sim/ppc/ChangeLog
+++ b/sim/ppc/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-08 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * Makefile.in: Set ASAN_OPTIONS when running igen.
+
2021-04-03 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (install): Install as run-ppc when not the primary arch.
diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in
index d2bd1d3..d9d0198 100644
--- a/sim/ppc/Makefile.in
+++ b/sim/ppc/Makefile.in
@@ -133,6 +133,12 @@ IGEN_FLAGS = \
$(IGEN_SMP) \
$(IGEN_LINE_NR)
+# igen/dgen leak memory, and therefore makes AddressSanitizer unhappy. Disable
+# leak detection while running them.
+
+IGEN = ASAN_OPTIONS=detect_leaks=0 ./igen
+DGEN = ASAN_OPTIONS=detect_leaks=0 ./dgen
+
.NOEXPORT:
MAKEOVERRIDES=
@@ -666,7 +672,7 @@ ppc-config.h: $(CONFIG_FILE)
tmp-dgen: dgen ppc-spr-table $(srcdir)/../../move-if-change
- ./dgen $(DGEN_FLAGS) \
+ $(DGEN) $(DGEN_FLAGS) \
-r $(srcdir)/ppc-spr-table \
-n spreg.h -hp tmp-spreg.h \
-n spreg.c -p tmp-spreg.c
@@ -675,7 +681,7 @@ tmp-dgen: dgen ppc-spr-table $(srcdir)/../../move-if-change
touch tmp-dgen
tmp-igen: igen $(srcdir)/ppc-instructions $(srcdir)/altivec.igen $(srcdir)/e500.igen $(IGEN_OPCODE_RULES) $(srcdir)/../../move-if-change tmp-ld-decode tmp-ld-cache tmp-ld-insn tmp-filter
- ./igen $(IGEN_FLAGS) \
+ $(IGEN) $(IGEN_FLAGS) \
-o $(srcdir)/$(IGEN_OPCODE_RULES) \
-I $(srcdir) -i $(srcdir)/ppc-instructions \
-n icache.h -hc tmp-icache.h \