https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80878
Bug ID: 80878
Summary: -mcx16 (enable 128 bit CAS) on x86_64 seems not to
work
Product: gcc
Version: 7.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: admin_public at liblfds dot org
Target Milestone: ---
Hi.
I've been building GCC compilers, starting with 4.1.2 up till 7.1.0, on a
couple of platforms. It's hard to do, and I'm really not good at it, and I
think it practically certain this bug is really me messing things up, rather
than there being an actual real bug, except that when I switch to 6.2.0, which
I built in exactly the same way (I've written a script), the problem goes away.
The problem is that the compiler when compiling reports "undefined reference to
`__atomic_compare_exchange_16'".
I have reduced this down to a short test program, thus;
#include <stdio.h>
#include <stdlib.h>
int main( void );
int main()
{
__uint128_t
compare = 1,
exchange = 2,
target = 1;
printf( "target before = %llu\n", (int long long unsigned) target );
__atomic_compare_exchange( &target, &compare, &exchange, 1, __ATOMIC_SEQ_CST,
__ATOMIC_SEQ_CST );
printf( "target after = %llu\n", (int long long unsigned) target );
return EXIT_SUCCESS;
}
I compile this with;
gcc -Wall -march=native -mtune=native -mcx16 test.c
With GCC 6.2.0, the output is;
./a.out
target before = 1
target after = 2
With GCC 7.1.0, the output is;
/tmp/ccjMRvw1.o: In function `main':
test.c:(.text+0x75): undefined reference to `__atomic_compare_exchange_16'
collect2: error: ld returned 1 exit status
This is the same error 6.2.0 gives if I omit "-mcx16".