Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

fails to build on x32 #18

Open
arekm opened this issue Sep 11, 2015 · 3 comments
Open

fails to build on x32 #18

arekm opened this issue Sep 11, 2015 · 3 comments

Comments

@arekm
Copy link

arekm commented Sep 11, 2015

Hi.
It fails to build on x32 arch:
cm_mem.h: Assembler messages:
cm_mem.h:192: Error: invalid instruction suffix for push' cm_mem.h:195: Error: invalid instruction suffix forpop'
Makefile:835: recipe for target 'libcmrt_la-cm_buffer.lo' failed

http://tnij.org/oeanp5g

@wlin70
Copy link
Contributor

wlin70 commented Sep 18, 2015

Hi, Arekm,
Verified that g++-4.9.2 can build 01org/cmrt successfully on i386 (32-bit) Ubuntu + 64-bit CPU. I cannot reproduce the problem, what is your ENV ?
Thanks
--Wei

@arekm
Copy link
Author

arekm commented Sep 18, 2015

Here it also builds fine on 32bit and 64bit but fails on x32 - https://en.wikipedia.org/wiki/X32_ABI

@arekm
Copy link
Author

arekm commented Sep 18, 2015

Something like:

--- src/cm_mem.h~   2015-09-10 01:13:13.000000000 +0200
+++ src/cm_mem.h    2015-09-18 08:18:52.800701307 +0200
@@ -183,6 +183,7 @@
    __try {
 #endif

+#if defined(__x86_64) && !defined(__ILP32__)
        if (sizeof(void *) == 4) {
            unsigned int local_eax, local_ebx, local_ecx, local_edx;
            __asm__ __volatile__("pushl %%ebx      \n\t" "cpuid  \n\t" "movl %%ebx, %1   \n\t" "popl %%ebx \n\t"    /* restore the old %ebx */
@@ -194,7 +195,9 @@
            CPUInfo[1] = local_ebx;
            CPUInfo[2] = local_ecx;
            CPUInfo[3] = local_edx;
-       } else {
+       } else
+#endif
+       {
            uint64_t local_rax, local_rbx, local_rcx, local_rdx;
            __asm__ __volatile__("push %%rbx      \n\t" "cpuid           \n\t" "mov %%rbx, %1   \n\t" "pop %%rbx       \n\t"    /* restore the old %ebx */
                         :"=a"(local_rax), "=r"(local_rbx),

works (== compiles). That sizeof autodetection has trouble with x32 abi.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants