diff mbox

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

Message ID mvmlhkurbac.fsf@hawking.suse.de
State New
Headers show

Commit Message

Andreas Schwab Jan. 22, 2015, 5:10 p.m. UTC
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(+)

Comments

Mike Frysinger Feb. 22, 2015, 6:35 a.m. UTC | #1
On 22 Jan 2015 18:10, Andreas Schwab wrote:
> 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.

lgtm
-mike
diff mbox

Patch

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)