Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLVM ERROR: Error parsing inline asm #1334

Closed
pcercuei opened this issue Mar 20, 2021 · 11 comments
Closed

LLVM ERROR: Error parsing inline asm #1334

pcercuei opened this issue Mar 20, 2021 · 11 comments
Assignees
Labels
[ARCH] mips This bug impacts ARCH=mips [BUG] linux A bug that should be fixed in the mainline kernel. [FEATURE] LTO Related to building the kernel with LLVM Link Time Optimization [FIXED][LINUX] 5.16 This bug was fixed in Linux 5.16 [TOOL] integrated-as The issue is relevant to LLVM integrated assembler

Comments

@pcercuei
Copy link

A lot of "macro is already defined" errors, plus what seems to be a crash within LLD.

  CALL    scripts/atomic/check-atomics.sh
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  CHK     include/generated/autoksyms.h
  GEN     .version
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  AR      init/built-in.a
  GEN     .tmp_initcalls.lds
  LTO     vmlinux.o
<inline asm>:166:1: error: macro 'parse_r' is already defined
.macro  parse_r var r
^
<inline asm>:268:1: error: macro 'mfhc0' is already defined
.macro  mfhc0 rt, rs, sel = 0
^
<inline asm>:274:1: error: macro 'mthc0' is already defined
.macro  mthc0 rt, rd, sel = 0
^
<inline asm>:280:1: error: macro 'mfgc0' is already defined
.macro  mfgc0 rt, rs, sel = 0
^
<inline asm>:286:1: error: macro 'dmfgc0' is already defined
.macro  dmfgc0 rt, rs, sel = 0
^

[...]

<inline asm>:217145:1: error: macro 'tlbgwi' is already defined
.macro  tlbgwi
^
<inline asm>:217149:1: error: macro 'tlbgwr' is already defined
.macro  tlbgwr
^
<inline asm>:217153:1: error: macro 'tlbginvf' is already defined
.macro  tlbginvf
^
LLVM ERROR: Error parsing inline asm

PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.	Program arguments: ld.lld -m elf32ltsmip -mllvm -import-instr-limit=5 -r -o vmlinux.o -T .tmp_initcalls.lds --whole-archive arch/mips/kernel/head.o init/built-in.a usr/built-in.a arch/mips/built-in.a arch/mips/boot/dts/built-in.a kernel/built-in.a certs/built-in.a mm/built-in.a fs/built-in.a ipc/built-in.a security/built-in.a crypto/built-in.a block/built-in.a lib/built-in.a arch/mips/fw/lib/built-in.a arch/mips/lib/built-in.a arch/mips/math-emu/built-in.a lib/lib.a arch/mips/fw/lib/lib.a arch/mips/lib/lib.a arch/mips/math-emu/lib.a drivers/built-in.a sound/built-in.a net/built-in.a virt/built-in.a arch/mips/crypto/built-in.a arch/mips/power/built-in.a --no-whole-archive --start-group --end-group 
 #0 0x00007fe302d1af8f llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbd0f8f)
 #1 0x00007fe302d192f0 llvm::sys::RunSignalHandlers() (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbcf2f0)
 #2 0x00007fe302d1b465 (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbd1465)
 #3 0x00007fe30725c140 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14140)
 #4 0x00007fe301c95ce1 raise ./signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007fe301c7f537 abort ./stdlib/abort.c:81:7
 #6 0x00007fe302c6ad68 (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb20d68)
 #7 0x00007fe302c6ab88 (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb20b88)
 #8 0x00007fe3033e1fef (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0x1297fef)
 #9 0x00007fe3033d1849 llvm::AsmPrinter::doInitialization(llvm::Module&) (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0x1287849)
#10 0x00007fe302e2f661 llvm::FPPassManager::doInitialization(llvm::Module&) (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xce5661)
#11 0x00007fe302e2a4d1 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xce04d1)
#12 0x00007fe303d9b71c (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0x1c5171c)
#13 0x00007fe303d9857a llvm::lto::backend(llvm::lto::Config const&, std::function<std::unique_ptr<llvm::lto::NativeObjectStream, std::default_delete<llvm::lto::NativeObjectStream> > (unsigned int)>, unsigned int, std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> >, llvm::ModuleSummaryIndex&) (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0x1c4e57a)
#14 0x00007fe303d91408 llvm::lto::LTO::runRegularLTO(std::function<std::unique_ptr<llvm::lto::NativeObjectStream, std::default_delete<llvm::lto::NativeObjectStream> > (unsigned int)>) (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0x1c47408)
#15 0x00007fe303d90c53 llvm::lto::LTO::run(std::function<std::unique_ptr<llvm::lto::NativeObjectStream, std::default_delete<llvm::lto::NativeObjectStream> > (unsigned int)>, std::function<std::function<std::unique_ptr<llvm::lto::NativeObjectStream, std::default_delete<llvm::lto::NativeObjectStream> > (unsigned int)> (unsigned int, llvm::StringRef)>) (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0x1c46c53)
#16 0x00000000005c29d8 lld::elf::BitcodeCompiler::compile() (/usr/lib/llvm-11/bin/lld+0x5c29d8)
#17 0x000000000055a286 void lld::elf::LinkerDriver::compileBitcodeFiles<llvm::object::ELFType<(llvm::support::endianness)1, false> >() (/usr/lib/llvm-11/bin/lld+0x55a286)
#18 0x000000000054f042 void lld::elf::LinkerDriver::link<llvm::object::ELFType<(llvm::support::endianness)1, false> >(llvm::opt::InputArgList&) (/usr/lib/llvm-11/bin/lld+0x54f042)
#19 0x0000000000547465 lld::elf::LinkerDriver::main(llvm::ArrayRef<char const*>) (/usr/lib/llvm-11/bin/lld+0x547465)
#20 0x0000000000545666 lld::elf::link(llvm::ArrayRef<char const*>, bool, llvm::raw_ostream&, llvm::raw_ostream&) (/usr/lib/llvm-11/bin/lld+0x545666)
#21 0x00000000004ba3da main (/usr/lib/llvm-11/bin/lld+0x4ba3da)
#22 0x00007fe301c80d0a __libc_start_main ./csu/../csu/libc-start.c:308:16
#23 0x00000000004b9afa _start (/usr/lib/llvm-11/bin/lld+0x4b9afa)
Aborted
make: *** [Makefile:1199 : vmlinux] Error 134
@nickdesaulniers nickdesaulniers added [ARCH] mips This bug impacts ARCH=mips [BUG] linux A bug that should be fixed in the mainline kernel. [FEATURE] LTO Related to building the kernel with LLVM Link Time Optimization labels Mar 21, 2021
@nickdesaulniers
Copy link
Member

I'd guess that these macros are defined in a header that's missing proper header guards, so they get redefined when LTO joins all of the sources together.

@pcercuei
Copy link
Author

These are defined in arch/mips/include/asm/mipsregs.h, which does have header guards.

@glebm
Copy link

glebm commented May 23, 2021

Could this be caused by something similar to this? https://patchwork.kernel.org/project/linux-arm-kernel/patch/20190423232622.GA11776@beast/

@nickdesaulniers
Copy link
Member

#763 is already tracking the assembler macro warning, so let's use this bug to track the LLVM ERROR: Error parsing inline asm.

@nickdesaulniers nickdesaulniers added the [TOOL] integrated-as The issue is relevant to LLVM integrated assembler label Jun 28, 2021
@nickdesaulniers nickdesaulniers changed the title MIPS: cannot link with LTO LLVM ERROR: Error parsing inline asm Jun 28, 2021
@pcercuei
Copy link
Author

@nickdesaulniers it is a different bug, though. Not a duplicate.

@pcercuei
Copy link
Author

pcercuei commented Jul 18, 2021

@nickdesaulniers I sent a patch to the MIPS maintainer, and Cc'd you.

@nickdesaulniers nickdesaulniers added the [PATCH] Submitted A patch has been submitted for review label Jul 19, 2021
@nickdesaulniers
Copy link
Member

@pcercuei friendly reminder to send a v2.

@pcercuei
Copy link
Author

pcercuei commented Oct 6, 2021

The patch was merged upstream, so I guess it's time to close this bug report.

@nickdesaulniers
Copy link
Member

reopening until this hits mainline.

@nickdesaulniers nickdesaulniers added [PATCH] Accepted A submitted patch has been accepted upstream and removed [PATCH] Submitted A patch has been submitted for review labels Oct 6, 2021
@nathanchance
Copy link
Member

Merged into mainline: https://git.kernel.org/linus/67512a8cf5a730938fdb1e48de33edfef6015e03

@nathanchance nathanchance added [FIXED][LINUX] 5.16 This bug was fixed in Linux 5.16 and removed [PATCH] Accepted A submitted patch has been accepted upstream labels Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] mips This bug impacts ARCH=mips [BUG] linux A bug that should be fixed in the mainline kernel. [FEATURE] LTO Related to building the kernel with LLVM Link Time Optimization [FIXED][LINUX] 5.16 This bug was fixed in Linux 5.16 [TOOL] integrated-as The issue is relevant to LLVM integrated assembler
Projects
None yet
Development

No branches or pull requests

4 participants