From e7d14e42caf28c421dfaa4b3b15bda7cf5a77e43 Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Mon, 8 Sep 2014 12:08:21 -0500 Subject: Fix memory leak detector on newer GCC. Change-Id: Ifb42ce134d6cc27db23aa4787ad83c92070c1c95 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/13249 Tested-by: Jenkins Server Reviewed-by: STEPHEN M. CPREK Reviewed-by: Douglas R. Gilbert Reviewed-by: A. Patrick Williams III --- src/lib/stdlib.C | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/stdlib.C b/src/lib/stdlib.C index 2693848a6..610a045a3 100644 --- a/src/lib/stdlib.C +++ b/src/lib/stdlib.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2010,2014 */ +/* Contributors Listed Below - COPYRIGHT 2010,2014 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -63,6 +65,10 @@ static void memoryleak_magic_instruction(MemoryLeak_FunctionType func, void* ptr, void* ptr2) { + // Newer GCC seems to optimize out the parameter placement unless we + // fake them going into an assembly instruction. + asm volatile("" :: "r"(func), "r"(size), "r"(ptr), "r"(ptr2)); + MAGIC_INSTRUCTION(MAGIC_MEMORYLEAK_FUNCTION); return; } -- cgit v1.2.1