From patchwork Thu Jan 3 00:58:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [google,4_7] fix unsat for target w/o atomic builtins (issue7031051) From: Rong Xu X-Patchwork-Id: 209165 Message-Id: <20130103005808.21730100706@rong.mtv.corp.google.com> To: gcc-patches@gcc.gnu.org, davidxl@google.com, reply@codereview.appspotmail.com Date: Wed, 02 Jan 2013 16:58:07 -0800 Hi, This patch fixes an issue in r194725. The call to atmoic builtin is emmitted regardless of -fprofile-gen-atomic -- which results in link unsat for targets without sync builtin support. Tested with regression test in x86 (with builtin support.) and powerpc32 (without builtin support). Thanks, -Rong 2013-01-02 Rong Xu * gcc/gcov-io.h: Make __atomic_fetch_add weak for these target without sync builtin support. --- This patch is available for review at http://codereview.appspot.com/7031051 Index: gcc/gcov-io.h =================================================================== --- gcc/gcov-io.h (revision 194739) +++ gcc/gcov-io.h (working copy) @@ -308,6 +308,10 @@ typedef unsigned gcov_type_unsigned __attribute__ #define GCOV_TYPE_ATOMIC_FETCH_ADD_FN __atomic_fetch_add_4 #define GCOV_TYPE_ATOMIC_FETCH_ADD BUILT_IN_ATOMIC_FETCH_ADD_4 #endif +/* Make the atomic builtin weak. Otherwise we get link unsat + if the builtin is not available. */ +extern gcov_type GCOV_TYPE_ATOMIC_FETCH_ADD_FN + (gcov_type*, gcov_type, int) __attribute__ ((weak)); #undef EXTRACT_MODULE_ID_FROM_GLOBAL_ID #undef EXTRACT_FUNC_ID_FROM_GLOBAL_ID