Bug 56300 - Add __sync_fetch_and_add_8 and other 8-byte atomic functions to 32-bit MIPS targets
Summary: Add __sync_fetch_and_add_8 and other 8-byte atomic functions to 32-bit MIPS t...
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: libgcc (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-12 22:04 UTC by chaoyingfu@gcc.gnu.org
Modified: 2013-02-12 22:21 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description chaoyingfu@gcc.gnu.org 2013-02-12 22:04:50 UTC
There is no hardware support for 8 bytes atomic operations on 32-bit MIPS targets.  Unfortunately, programmers still want to use them.  Ex: please check this webkit bug: https://bugs.webkit.org/show_bug.cgi?id=106739 and the following example.

Ex:
fu@debian6:~/dev/test$ cat sync.c
long long K;
void main()
{
   __sync_fetch_and_add(&K, 1);
}

fu@debian6:~/dev/test$ gcc -o sync sync.c
/tmp/ccUoSg9M.o: In function `main':
sync.c:(.text+0x28): undefined reference to `__sync_fetch_and_add_8'
collect2: ld returned 1 exit status

That will be great, if we can add missing atomic functions (via pthread implementation or other methods) to libgcc for 32-bit MIPS targets.

Thanks a lot!
Comment 1 Andrew Pinski 2013-02-12 22:10:48 UTC
Use libatomic in 4.8 to fix this.
Comment 2 chaoyingfu@gcc.gnu.org 2013-02-12 22:21:09 UTC
(In reply to comment #1)
> Use libatomic in 4.8 to fix this.

Good to know this.  Thanks!