Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Linux kernel compile - Error: symbol `vsysc2' is already defined

jlogan2
Beginner
815 Views
Hi,

I'm trying to compile the Linux using the Intel C compiler and I'm running into a problem where I get:

/tmp/icc0gk6bpas_.s: Assembler messages:
/tmp/icc0gk6bpas_.s:508: Error: symbol `vsysc2' is already defined


when trying to compile arch/x86_64/kernel/vsyscall.c.

When I invoke the compiler with -S and look the the output, I see the following block within both vtime() and vgettimeofday():

# Begin ASM
vsysc2: syscall
# End ASM


This asm block is in __always_inline__ gettimeofday(), which is called by __always_inline__ do_vgettimeofday(), which is called by the aforementioned vgettimeofday(), so the label gets inlined into this function. vtime() calls vgettimeofday(), and it looks like the latter is getting inlined into the former, causing the asm block to be instantiated twice.

It seems like this would cause the 'already defined' error - has anyone else run into this issue compiling the kernel, and worked around it?

Thanks,
John Logan

Details:
Linux kernel 2.6.23-9, arch x86_64 (config attached)

command line:
cce/10.1.015/bin/icc -Wp,-MD,arch/x86_64/kernel/.vsyscall.o.d -isystem /usr/lib/gcc/x86_64-linux-gnu/4.2.3/include -D__KERNEL__ -Iinclude -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -O2 -march=core2 -mno-red-zone -mcmodel=kernel -pipe -Wno-sign-compare -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -g0 -DKBUILD_STR(s)=#s -DKBUILD_BASENAME=KBUILD_STR(vsyscall) -DKBUILD_MODNAME=KBUILD_STR(vsyscall) -c -o arch/x86_64/kernel/.tmp_vsyscall.o arch/x86_64/kernel/vsyscall.c

removed '-m64', '-maccumulate-outgoing-args', '-fno-asynchronous-unwind-tables', '-nostdinc', '-funit-at-a-time', '-fno-stack-protector' using a wrapper script

0 Kudos
2 Replies
jlogan2
Beginner
815 Views
Feilong H was able to provide me with the resolution to this. Adding "noinline" to the definition of vgettimeofday() so that it reads:

int noinline __vsyscall(0) vgettimeofday(struct timeval * tv, struct timezone * tz)

resulted in a successful compile.
0 Kudos
Feilong_H_Intel
Employee
815 Views

Thank you jlogan2 for sharing this resolution with all the users.

The problem here is that icc decides to inline vgettimeofday() and gcc decides not to do that. Both compiles are doing the right decision. In this code, we don't want to have the function inlined, so we should mark it as noinline. It looks like a source code error.

Feilong

0 Kudos
Reply