public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [google 4_7] fix unsat for target w/o atomic builtins (issue7031051)
@ 2013-01-03  0:58 Rong Xu
  2013-01-03  1:10 ` Xinliang David Li
  0 siblings, 1 reply; 2+ messages in thread
From: Rong Xu @ 2013-01-03  0:58 UTC (permalink / raw)
  To: gcc-patches, davidxl, reply

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  <xur@google.com>

	* gcc/gcov-io.h: Make __atomic_fetch_add weak for these
        target without sync builtin support.

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

--
This patch is available for review at http://codereview.appspot.com/7031051

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [google 4_7] fix unsat for target w/o atomic builtins (issue7031051)
  2013-01-03  0:58 [google 4_7] fix unsat for target w/o atomic builtins (issue7031051) Rong Xu
@ 2013-01-03  1:10 ` Xinliang David Li
  0 siblings, 0 replies; 2+ messages in thread
From: Xinliang David Li @ 2013-01-03  1:10 UTC (permalink / raw)
  To: Rong Xu; +Cc: GCC Patches, reply

Ok for google branch, but it might be better to warn this at compile
time (more discussion needed for the trunk version).

David

On Wed, Jan 2, 2013 at 4:58 PM, Rong Xu <xur@google.com> wrote:
> 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  <xur@google.com>
>
>         * gcc/gcov-io.h: Make __atomic_fetch_add weak for these
>         target without sync builtin support.
>
> 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
>
> --
> This patch is available for review at http://codereview.appspot.com/7031051

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-03  1:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-03  0:58 [google 4_7] fix unsat for target w/o atomic builtins (issue7031051) Rong Xu
2013-01-03  1:10 ` Xinliang David Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).