IAIK/sweb

Build errors with gcc Debian 8.2.0-14

Closed this issue · 2 comments

arch/x86/64/source/boot.32.C:1:5: error: expected ‘(’ before ‘volatile’
 asm volatile(".code32");
     ^~~~~~~~
     (
arch/x86/64/source/boot.32.C:1:14: error: expected unqualified-id before string constant
 asm volatile(".code32");
              ^~~~~~~~~
arch/x86/64/source/boot.32.C:1:14: error: expected ‘)’ before string constant
 asm volatile(".code32");
             ~^~~~~~~~~
              )
arch/x86/64/source/boot.32.C:2:5: error: expected ‘(’ before ‘volatile’
 asm volatile(".equ BASE,0xFFFFFFFF80000000");
     ^~~~~~~~
     (
arch/x86/64/source/boot.32.C:2:14: error: expected unqualified-id before string constant
 asm volatile(".equ BASE,0xFFFFFFFF80000000");
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/64/source/boot.32.C:2:14: error: expected ‘)’ before string constant
 asm volatile(".equ BASE,0xFFFFFFFF80000000");
             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              )
arch/x86/64/source/boot.32.C:3:5: error: expected ‘(’ before ‘volatile’
 asm volatile(".equ PHYS_BASE,0xFFFFFFFF00000000");
     ^~~~~~~~
     (
arch/x86/64/source/boot.32.C:3:14: error: expected unqualified-id before string constant
 asm volatile(".equ PHYS_BASE,0xFFFFFFFF00000000");
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/64/source/boot.32.C:3:14: error: expected ‘)’ before string constant
 asm volatile(".equ PHYS_BASE,0xFFFFFFFF00000000");
             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              )
[  9%] Building CXX object common/source/fs/devicefs/CMakeFiles/common_fs_devicefs.dir/DeviceFSSuperblock.cpp.o
[ 10%] Building CXX object common/source/fs/CMakeFiles/common_fs.dir/File.cpp.o
[ 10%] Building C object CMakeFiles/userspace_libc.dir/userspace/libc/src/ctype.c.o
[ 10%] Building CXX object common/source/mm/CMakeFiles/common_mm.dir/PageFaultHandler.cpp.o
arch/x86/64/source/boot.32.C:170:5: error: expected ‘(’ before ‘volatile’
 asm volatile(".code64");
     ^~~~~~~~
     (
arch/x86/64/source/boot.32.C:170:14: error: expected unqualified-id before string constant
 asm volatile(".code64");
              ^~~~~~~~~
arch/x86/64/source/boot.32.C:170:14: error: expected ‘)’ before string constant
 asm volatile(".code64");
             ~^~~~~~~~~
              )

Build works fine with 8.2.0-13

Apparently the volatile qualifier outside of functions is the culprit. The code compiles without errors when removing it from the affected asm blocks.

asm(".code32");
asm(".equ BASE,0xFFFFFFFF80000000");
asm(".equ PHYS_BASE,0xFFFFFFFF00000000");
// ...
asm(".code64");

https://gcc.gnu.org/onlinedocs/gcc/Basic-Asm.html#Basic-Asm

The optional volatile qualifier has no effect. All basic asm blocks are implicitly volatile.

Just removing them should be fine