Coder Social home page Coder Social logo

Comments (8)

kaimast avatar kaimast commented on August 29, 2024 3

Same problem on Ubuntu 18.04 with linux 4.15

from linux-sgx-driver.

hecto2 avatar hecto2 commented on August 29, 2024 1

I ran into similiar problems when compiling kernel 4.14 by changing -O2 to -O0.

`In file included from ./include/linux/compiler_types.h:58:0,
from ./include/linux/compiler.h:5,
from ./arch/x86/include/asm/atomic.h:5,
from ./include/linux/atomic.h:5,
from ./include/linux/crypto.h:20,
from arch/x86/kernel/asm-offsets.c:9:
./arch/x86/include/asm/cpufeature.h: In function ‘_static_cpu_has’:
./include/linux/compiler-gcc.h:270:38: warning: asm operand 0 probably doesn’t match constraints
#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
^
./arch/x86/include/asm/cpufeature.h:148:3: note: in expansion of macro ‘asm_volatile_goto’
asm_volatile_goto("1: jmp 6f\n"
^
./include/linux/compiler-gcc.h:270:38: warning: asm operand 2 probably doesn’t match constraints
#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
^
./arch/x86/include/asm/cpufeature.h:148:3: note: in expansion of macro ‘asm_volatile_goto’
asm_volatile_goto("1: jmp 6f\n"

./include/linux/compiler-gcc.h:270:38: error: impossible constraint in ‘asm’
#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
^
./arch/x86/include/asm/cpufeature.h:148:3: note: in expansion of macro ‘asm_volatile_goto’
asm_volatile_goto("1: jmp 6f\n"
^`

The trouble above was caused by extended assembly in arch/x86/include/asm/cpufeature.h, where the modifiers of the operand 0 and 2 were i, meaning that immediate integers were expected. But they both used parameter bit, which was a variable instead of a constant. If -O2 was specified, the inline function _static_cpu_has was expanded with a constant in place of parameter bit, which bypassed the restriction.

static __always_inline __pure bool _static_cpu_has(u16 bit) { asm_volatile_goto("1: jmp 6f\n" "2:\n" ".skip -(((5f-4f) - (2b-1b)) > 0) * " "((5f-4f) - (2b-1b)),0x90\n" "3:\n" ".section .altinstructions,\"a\"\n" " .long 1b - .\n" /* src offset */ " .long 4f - .\n" /* repl offset */ " .word %P1\n" /* always replace */ " .byte 3b - 1b\n" /* src len */ " .byte 5f - 4f\n" /* repl len */ " .byte 3b - 2b\n" /* pad len */ ".previous\n" ".section .altinstr_replacement,\"ax\"\n" "4: jmp %l[t_no]\n" "5:\n" ".previous\n" ".section .altinstructions,\"a\"\n" " .long 1b - .\n" /* src offset */ " .long 0\n" /* no replacement */ " .word %P0\n" /* feature bit */ " .byte 3b - 1b\n" /* src len */ " .byte 0\n" /* repl len */ " .byte 0\n" /* pad len */ ".previous\n" ".section .altinstr_aux,\"ax\"\n" "6:\n" " testb %[bitnum],%[cap_byte]\n" " jnz %l[t_yes]\n" " jmp %l[t_no]\n" ".previous\n" : : **"i" (bit)**, "i" (X86_FEATURE_ALWAYS), **[bitnum] "i" (1 << (bit & 7)),** [cap_byte] "m" (((const char *)boot_cpu_data.x86_capability)[bit >> 3]) : : t_yes, t_no); t_yes: return true; t_no: return false; }

from linux-sgx-driver.

chrisr3 avatar chrisr3 commented on August 29, 2024

Assembler version:

$ as -V
GNU assembler version 2.29.1 (x86_64-pc-linux-gnu) using BFD version (GNU Binutils) 2.29.1

from linux-sgx-driver.

chrisr3 avatar chrisr3 commented on August 29, 2024

This seems to be a recurrence of #13, and even has the same workaround.

from linux-sgx-driver.

sergeay avatar sergeay commented on August 29, 2024

So I understand that the only difference is the addition of M=$(PWD) instead of SUBDIRS=$(PWD) in the original Makefile.
Can we close it?

from linux-sgx-driver.

chrisr3 avatar chrisr3 commented on August 29, 2024

I have been working around this problem by removing the -O0 option from CFLAGS_MODULE in the Makefile. I would consider closing it without an attempt at understanding it to be premature.

from linux-sgx-driver.

sergeay avatar sergeay commented on August 29, 2024

The issue has to do with conflicting flags - I will submit a change to the Makefile.
Thanks for raising this issue.

from linux-sgx-driver.

sergeay avatar sergeay commented on August 29, 2024

closing issue - fix was submitted.

from linux-sgx-driver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.