ymxia at nudt.edu.cn
2005-Jul-25 08:35 UTC
Re: [LLVMdev] Compile a linux kernel with LLVM?
When I compiled a linux kernel, gccas was used to compile assembly code. But gccas cannot recognize the line comment character "#" of gnu assembler, and abort the compile with reporting a error "syntax error, unexpected $undefined". I watch llvm/tools/gccas, but donot known how to add this function in it. Would you give me some suggestions? Thanks.
ymxia at nudt.edu.cn wrote:> When I compiled a linux kernel, gccas was used to compile assembly code. > > But gccas cannot recognize the line comment character "#" of gnu assembler, > > and abort the compile with reporting a error "syntax error, unexpected $undefined". > > I watch llvm/tools/gccas, but donot known how to add this function in it. > > Would you give me some suggestions?This is occuring because you're trying to use gccas to compile a native code assembly file (most likely, an i386 assembly language file). You either need to not to compile this file or write an LLVM equivalent of it. -- John T.> > Thanks. > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-- John T. Criswell Research Programmer University of Illinois at Urbana-Champaign "It's today!" said Piglet. "My favorite day," said Pooh.
On Mon, Jul 25, 2005 at 11:45:10AM -0500, John Criswell wrote:> ymxia at nudt.edu.cn wrote: > >When I compiled a linux kernel, gccas was used to compile assembly > >code. > > > >But gccas cannot recognize the line comment character "#" of gnu > >assembler, and abort the compile with reporting a error "syntax > >error, unexpected $undefined". I watch llvm/tools/gccas, but donot > >known how to add this function in it. > > > >Would you give me some suggestions? > > This is occuring because you're trying to use gccas to compile a > native code assembly file (most likely, an i386 assembly language > file). > > You either need to not to compile this file or write an LLVM > equivalent of it.Or use/write the C-equivalent of it. :) Sometimes, the assembly version is just a faster version of generic platform-independent C code, and even though it's protected by something like #ifdef __i386, llvm-gcc may still be defining some of those flags if it's being compiled on an x86 machine. So in some cases, you need to modify the kernel code to not compile asm version of function, e.g. #if defined(__i386) && !defined(__llvm__) [ assembly code here ] #else [ C code ] #endif To get a list of flags defined by llvm-gcc: % touch /tmp/empty.c % llvm-gcc -dM -E /tmp/empty.c -- Misha Brukman :: http://misha.brukman.net :: http://llvm.cs.uiuc.edu
Maybe Matching Threads
- Re: [LLVMdev] Compile a linux kernel with LLVM?
- [LLVMdev] Compile a linux kernel with LLVM?
- [LLVMdev] 'make check' failed with: ... PHI node entries donot match predece
- [LLVMdev] Does the gcc frontend do inlining or deadcode elimination ?
- [LLVMdev] A question about alias analysis