<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>86835</bug_id>
          
          <creation_ts>2012-05-18 02:54:07 -0700</creation_ts>
          <short_desc>Webkit fails to build on sparc64/gcc, missing implementation of atomic{In,De}crement</short_desc>
          <delta_ts>2014-03-08 01:16:24 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Other</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>UNCONFIRMED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Landry Breuil">landry</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>gnome</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>627521</commentid>
    <comment_count>0</comment_count>
    <who name="Landry Breuil">landry</who>
    <bug_when>2012-05-18 02:54:07 -0700</bug_when>
    <thetext>WebkitGtk 1.8.0 built fine on OpenBSD/sparc64/gcc 4.2.1, 1.8.1 started failing with the following :

Source/WebCore/platform/network/DNSResolveQueue.h: In member function &apos;void WebCore::DNSResolveQueue::decrementRequestCount()&apos;:
Source/WebCore/platform/network/DNSResolveQueue.h:49: error: &apos;atomicDecrement&apos; was not declared in this scope
Source/WebCore/platform/network/DNSResolveQueue.cpp: In member function &apos;void WebCore::DNSResolveQueue::add(const WTF::String&amp;)&apos;:
Source/WebCore/platform/network/DNSResolveQueue.cpp:57: error: &apos;atomicIncrement&apos; was not declared in this scope
Source/WebCore/platform/network/DNSResolveQueue.cpp:61: error: &apos;atomicDecrement&apos; was not declared in this scope
Source/WebCore/platform/network/DNSResolveQueue.cpp: In member function &apos;virtual void WebCore::DNSResolveQueue::fired()&apos;:
Source/WebCore/platform/network/DNSResolveQueue.cpp:83: error: &apos;atomicIncrement&apos; was not declared in this scope

I traced it back to WTF/Atomics.h not providing an implem for atomicIncrement/atomicDecrement on sparc64/gcc.

Providing a simple implementation based on builtin __sync_fetch_and_add() allows me to build WebkitGtk 1.8.1 on sparc64.
See http://www.openbsd.org/cgi-bin/cvsweb/ports/www/webkit/patches/patch-Source_JavaScriptCore_wtf_Atomics_h?rev=1.1

inline int atomicIncrement(int volatile* addend) { return __sync_fetch_and_add(addend, 1) + 1; }
inline int atomicDecrement(int volatile* addend) { return __sync_fetch_and_add(addend, -1) - 1; }

If this can be considered a valid solution i&apos;ll provide a patch for trunk.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>866613</commentid>
    <comment_count>1</comment_count>
    <who name="Landry Breuil">landry</who>
    <bug_when>2013-03-30 07:35:18 -0700</bug_when>
    <thetext>Still apparently needed for webkitgtk 2.0.0, even if code moved to Source/WTF/wtf/Atomics.h</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>941672</commentid>
    <comment_count>2</comment_count>
    <who name="Landry Breuil">landry</who>
    <bug_when>2013-10-20 02:07:19 -0700</bug_when>
    <thetext>Starting with webkit 2.2, i also need to provide int64_t based atomicImplement/Decrement ops..</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>