Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 494604

Summary: app-emulation/xen-tools doesn't build on hardened, test_x86_emulator.c
Product: Gentoo Linux Reporter: Ian Delaney (RETIRED) <idella4>
Component: Current packagesAssignee: The Gentoo Linux Hardened Team <hardened>
Status: RESOLVED FIXED    
Severity: normal Keywords: NeedPatch
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Ian Delaney (RETIRED) gentoo-dev 2013-12-18 04:51:41 UTC
So 'we' know it's an established scenario of a register being occupied in the x86.

The code block 

asm("
    pushl %%ebx
    cpuid
    popl %%ebx
    " : : : "eax", "ecx", "edx");

patched into test_x86_emulator.c just gives a long line of what appear to be syntax style errors and after some legitimate attempts it continues to cough up more of the same style error(s).

Here's the actual line compiling the file.

gcc -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing -Wdeclaration-after-statement -I/var/tmp/portage-btrfs/portage/app-emulation/xen-tools-4.3.0-r3/work/xen-4.3.0/tools/tests/x86_emulator/../../../tools/include -c -o test_x86_emulator.o test_x86_emulator.c

which yields

test_x86_emulator.c: In function cpuid:
test_x86_emulator.c:65:5: error: inconsistent operand constraints in an asm
make[4]: *** [test_x86_emulator.o] Error 1


Patched, it yields

test_x86_emulator.c: In function ‘cpuid’:
test_x86_emulator.c:65:9: warning: missing terminating " character [enabled by default]
     asm("
         ^
test_x86_emulator.c:65:5: error: missing terminating " character
     asm("
     ^
test_x86_emulator.c:66:9: error: expected string literal before ‘pushl’
         pushl %%ebx
         ^
test_x86_emulator.c:69:9: error: stray ‘\’ in program
         " : : : "eax", "ecx", "edx");+    asm ("" "pushl %%ebx\n" 
         ^
test_x86_emulator.c:69:65: warning: missing terminating " character [enabled by default]
         " : : : "eax", "ecx", "edx");+    asm ("" "pushl %%ebx\n" 
                                                                 ^
test_x86_emulator.c:69:9: error: missing terminating " character
         " : : : "eax", "ecx", "edx");+    asm ("" "pushl %%ebx\n" 
         ^
make[4]: *** [test_x86_emulator.o] Error 1

which makes the line of 'Im still not satisfied ya still got the wrong syntax' errors begin its unwelcome march.


Another legitimate attempt to help by another lead to trying
Before:
    asm("
        pushl %%ebx
        cpuid
        popl %%ebx
        " : : : "eax", "ecx", "edx");

After:

    asm(""
        "pushl %%ebx\n"
        "cpuid\n"
        "popl %%ebx\n"
        : : : "eax", "ecx", "edx");

nm about pasting its version of error, after all it's just error.

What I did do was to go to the source and run indent and tried that resultant syntax and the list grew.

What 2 of us did was to run the initial code block locally in a foo.c and sure it compiled.  Put it in the xensource and run make in the folder where it, the test_x86_emulator.c, resides, and it 'explodes', and the list grew.

I came, I tried, I didn't conquer. Please make gcc and its finicky syntax wants do what we couldn't, and i can commit the patch being the xen maintainer.
Comment 1 Yixun Lan archtester gentoo-dev 2014-10-10 03:26:08 UTC
fixed this by drop compiling tools/tests