Skip to contentSkip to conversation

Problem in compiling without optimisations

uml-devel Nikola Knezevic 3 participants 5 messages May 22, 2006 – Jun 2, 2006 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

Hi all,
When I change Makefile to have -O0 instead of -O2, this is what I get after make ARCH=um:

CC arch/um/kernel/skas/clone.o
arch/um/include/sysdep/stub.h: In function 'remap_stack':
arch/um/include/sysdep/stub.h:90: warning: asm operand 7 probably doesn't match constraints
arch/um/include/sysdep/stub.h:90: error: impossible constraint in 'asm' make[2]: *** [arch/um/kernel/skas/clone.o] Error 1
make[1]: *** [arch/um/kernel/skas] Error 2
make: *** [arch/um/kernel] Error 2

This is the culprit:
static inline void remap_stack(int fd, unsigned long offset)

{
       __asm__ volatile ("movl %%eax,%%ebp ; movl %0,%%eax ; int $0x80 ;"
                         "movl %7, %%ebx ; movl %%eax, (%%ebx)"
                         : : "g" (STUB_MMAP_NR), "b" (UML_CONFIG_STUB_DATA),
                           "c" (UM_KERN_PAGE_SIZE),
                           "d" (PROT_READ | PROT_WRITE),
                           "S" (MAP_FIXED | MAP_SHARED), "D" (fd),
                           "a" (offset),
                           "i" (&((struct stub_data *)
UML_CONFIG_STUB_DATA)->err)
                         : "memory");
}

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#1 lore raw
Quoted 14 lines · Nikola Knezevic

This is the culprit:
static inline void remap_stack(int fd, unsigned long offset)

{
        __asm__ volatile ("movl %%eax,%%ebp ; movl %0,%%eax ; int $0x80 ;"
                          "movl %7, %%ebx ; movl %%eax, (%%ebx)"
                          : : "g" (STUB_MMAP_NR), "b" (UML_CONFIG_STUB_DATA),
                            "c" (UM_KERN_PAGE_SIZE),
                            "d" (PROT_READ | PROT_WRITE),
                            "S" (MAP_FIXED | MAP_SHARED), "D" (fd),
                            "a" (offset),
                            "i" (&((struct stub_data *)
UML_CONFIG_STUB_DATA)->err)
                          : "memory");
}

Well, after reading about asm constrains, solution was to change that "i" to "g". Now, there are other problem, regarding inline functions and their ordering. Related to kernel in whole: has anyone ever tried to compile it without optimisations?

Cheers,
Nikola

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#2 lore raw
Quoted 17 lines · Nikola Knezevic
Quoted 15 lines · Nikola Knezevic

This is the culprit:
static inline void remap_stack(int fd, unsigned long offset)

{
       __asm__ volatile ("movl %%eax,%%ebp ; movl %0,%%eax ; int $0x80 ;"
                         "movl %7, %%ebx ; movl %%eax, (%%ebx)"
                         : : "g" (STUB_MMAP_NR), "b" 
                         (UML_CONFIG_STUB_DATA),
                           "c" (UM_KERN_PAGE_SIZE),
                           "d" (PROT_READ | PROT_WRITE),
                           "S" (MAP_FIXED | MAP_SHARED), "D" (fd),
                           "a" (offset),
                           "i" (&((struct stub_data *)
UML_CONFIG_STUB_DATA)->err)
                         : "memory");
}
Quoted 2 lines

Well, after reading about asm constrains, solution was to change that "i" to "g".

Checking my fuzzy recollection of asm constraints -
"i" means immediate, i.e. a compile-time constant and "g" means
anything? So, "i" breaks when gcc isn't trying hard enough to turn that expression into a constant.

If so, it doesn't look worth changing.

Jeff

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#3 lore raw
In reply to Nikola Knezevic
Quoted 3 lines · Nikola Knezevic

Hi all,
When I change Makefile to have -O0 instead of -O2, this is what I get after make ARCH=um:

I don't think the kernel will build at all with -O0.

Jeff

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#4 lore raw
In reply to Nikola Knezevic
Quoted 3 lines · Nikola Knezevic

Hi all,
When I change Makefile to have -O0 instead of -O2, this is what I get after make ARCH=um:

There are other spots where -O0 would lead to failure; search for -O0 on the ML, I remember that adding -finline and something else made it work (IIRC 2.6.15 time), and this code was present.

Quoted 28 lines

CC arch/um/kernel/skas/clone.o
arch/um/include/sysdep/stub.h: In function 'remap_stack':
arch/um/include/sysdep/stub.h:90: warning: asm operand 7 probably doesn't match constraints
arch/um/include/sysdep/stub.h:90: error: impossible constraint in 'asm' make[2]: *** [arch/um/kernel/skas/clone.o] Error 1
make[1]: *** [arch/um/kernel/skas] Error 2
make: *** [arch/um/kernel] Error 2

This is the culprit:
static inline void remap_stack(int fd, unsigned long offset)

{
        __asm__ volatile ("movl %%eax,%%ebp ; movl %0,%%eax ; int $0x80 ;"
                          "movl %7, %%ebx ; movl %%eax, (%%ebx)"

                          : : "g" (STUB_MMAP_NR), "b"
                          : : (UML_CONFIG_STUB_DATA),

                            "c" (UM_KERN_PAGE_SIZE),
                            "d" (PROT_READ | PROT_WRITE),
                            "S" (MAP_FIXED | MAP_SHARED), "D" (fd),
                            "a" (offset),
                            "i" (&((struct stub_data *)

UML_CONFIG_STUB_DATA)->err)

                          : "memory");

}

Signature · 13 lines
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade

Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 



_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel