Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4849

Undefined reference to `rdtsc'

$
0
0

Hi there,

Compiling haproxy 2.2 w/ TRACE=1 on mac host, inside ubuntu container, using this command,

make -j $(nproc) TARGET=linux-glibc USE_LUA=1 TRACE=1

throws following error:

/usr/bin/ld: src/calltrace.o: in function `make_line':
/opt/src/calltrace.c:204: undefined reference to `rdtsc'
/usr/bin/ld: src/calltrace.o: in function `calltrace':
/opt/src/calltrace.c:277: undefined reference to `rdtsc'
collect2: error: ld returned 1 exit status
make: *** [Makefile:864: haproxy] Error 1

Following fixes the issue (found on SO):

 __inline__ uint64_t rdtsc(void)
   {
uint32_t lo, hi;
__asm__ __volatile__ (
        "xorl %%eax,%%eax \n        cpuid"
        ::: "%rax", "%rbx", "%rcx", "%rdx");
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
return (uint64_t)hi << 32 | lo;
 }

I don’t understand why it doesn’t work out of the box…surely the patch should not needed. Am I missing something?

Thanks,
Karan

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 4849

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>