Opened 10 years ago
Last modified 3 years ago
#2675 closed defect
[PATCH] x86_x64.cpp fails to build with -fpie on i386 — at Version 2
Reported by: | pstumpf | Owned by: | |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 18 |
Component: | Core engine | Keywords: | patch |
Cc: | Patch: |
Description (last modified by )
The cpuid assembler stuff does not compile when using PIE on i386 due to register constraints. One must save and restore the PIC register (%ebx) before and after the call. See also cpuid.h as provided by GCC or Clang.
In all other cases (amd64 and !PIE i386), use the regular code.
Compile and runtime tested on OpenBSD/i386, which uses -fpie by default.
-
x86_x64.cpp
49 49 #if defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 150030729 50 50 // VC10+ and VC9 SP1: __cpuidex is already available 51 51 #elif GCC_VERSION 52 # if defined(__i386__) && defined(__PIC__) 52 53 # define __cpuidex(regsArray, level, index)\ 54 __asm__ __volatile__ ("pushl %%ebx\n" \ 55 " cpuid\n"\ 56 "mov %%ebx,%1\n" \ 57 "popl %%ebx" \ 58 : "=a" ((regsArray)[0]), "=r" ((regsArray)[1]), "=c" ((regsArray)[2]), "=d" ((regsArray)[3])\ 59 : "0" (level), "2" (index)); 60 # else 61 # define __cpuidex(regsArray, level, index)\ 53 62 __asm__ __volatile__ ("cpuid"\ 54 63 : "=a" ((regsArray)[0]), "=b" ((regsArray)[1]), "=c" ((regsArray)[2]), "=d" ((regsArray)[3])\ 55 64 : "0" (level), "2" (index)); 65 # endif 56 66 #else 57 67 # error "compiler not supported" 58 68 #endif
Change History (3)
by , 10 years ago
comment:1 by , 10 years ago
Keywords: | unanswered added |
---|
comment:2 by , 10 years ago
Description: | modified (diff) |
---|---|
Keywords: | patch review added; unanswered removed |
Milestone: | Backlog → Alpha 18 |
Summary: | x86_x64.cpp fails to build with -fpie on i386 → [PATCH] x86_x64.cpp fails to build with -fpie on i386 |
Note:
See TracTickets
for help on using tickets.
Hi, please follow the instructions when submitting patches: SubmittingPatches