From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20316 invoked by alias); 25 Sep 2014 07:08:23 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 20294 invoked by uid 48); 25 Sep 2014 07:08:19 -0000 From: "mathieu.malaterre at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/63368] New: undefined reference to `__sync_val_compare_and_swap_8' Date: Thu, 25 Sep 2014 07:08:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.9.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mathieu.malaterre at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-09/txt/msg02345.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63368 Bug ID: 63368 Summary: undefined reference to `__sync_val_compare_and_swap_8' Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: mathieu.malaterre at gmail dot com If I am reading the online documentation properly: https://gcc.gnu.org/onlinedocs/gcc-4.9.1/gcc/_005f_005fsync-Builtins.html#_005f_005fsync-Builtins __sync_val_compare_and_swap on some targets will result in a function call (where direct code generation is not available or not yet implemented). It seems to be happening in my testcase, however __sync_val_compare_and_swap_8 does not seems to be defined anywhere else. Steps: $ cat t.c #include int main() { int64_t x = 0, y = 1; y = __sync_val_compare_and_swap(&x, x, y); return 0; } $ gcc t.c /tmp/cc6JIpFx.o: In function `main': t.c:(.text+0x64): undefined reference to `__sync_val_compare_and_swap_8' collect2: ld returned 1 exit status $ gcc t.c -lgcc_s /tmp/ccu3ReMZ.o: In function `main': t.c:(.text+0x64): undefined reference to `__sync_val_compare_and_swap_8' collect2: ld returned 1 exit status $ gcc t.c -lgcc /tmp/ccO8gyeR.o: In function `main': t.c:(.text+0x64): undefined reference to `__sync_val_compare_and_swap_8' collect2: ld returned 1 exit status