Q: undefined reference to `_addcarry_u64' I have code like this:
uint8_t carry;

carry = 0;
for (i = 0; i < 8; i++)
    carry = _addcarry_u64 (carry, *(buf1 + i),
            *(buf2 + i), buf1 + i);

And the following error:
undefined reference to `_addcarry_u64'

I compile with flags:
CCFLAGS = -Wall -g -msse -msse2 -msse3 -msse4 -mavx -mavx2 -fopenmp

I also include:
#include <immintrin.h>
#include <emmintrin.h>
#include <pmmintrin.h>
#include <smmintrin.h>
#include <omp.h>

The same kind of problem I have while trying to use bittest function from intrinsics.
I use x86_64 ubuntu 14.04 and gcc compiler.

A: _addcarry_u64 was added in GCC 5.1. You also need the intrinsics include:
 #include <x86intrin.h>

Then your example will compile, like you can see on the Godbolt compiler explorer.

For the related _addcarryx_u64 intrinsic to actually compile to ADCX/ADOX, you also need -madx to enable code-gen using the ADX instruction-set extension.  -march=native will include this on hosts that support it (see /proc/cpuinfo), as well as enabling -mtune=native.
You also need a newer version of gcc (which doesn't exist yet).  gcc curently (2016) just compiles it to correct code using the normal adc.
