[PATCH] Fix failure of elf/tst-audit2 when compiled with GCC-5

Andreas Schwab schwab@suse.de
Thu Jan 22 17:11:00 GMT 2015


GCC-5 translates a malloc call that is followed by memset on the return
value into a call to calloc, which will of course call our calloc
recursively.  Prevent that by passing -fno-builtin.

Tested on x86_64-suse-linux.

Andreas.

	* elf/Makefile (CFLAGS-tst-audit2.c): Define.
---
 elf/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/elf/Makefile b/elf/Makefile
index e5b142c..7a1093b 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1016,6 +1016,8 @@ $(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
 tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
 
 $(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so
+# Prevent GCC-5 from translating a malloc/memset pair into calloc
+CFLAGS-tst-audit2.c += -fno-builtin
 tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
 
 $(objpfx)tst-audit9: $(libdl)
-- 
2.2.2

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



More information about the Libc-alpha mailing list