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

"macro 'parse_r' is already defined" when building LoongArch with full LTO #1924

Closed
nathanchance opened this issue Aug 29, 2023 · 3 comments
Closed
Assignees
Labels
[ARCH] loongarch This bug impacts ARCH=loongarch [FEATURE] LTO Related to building the kernel with LLVM Link Time Optimization [FIXED][LINUX] 6.6 This bug was fixed in Linux 6.6

Comments

@nathanchance
Copy link
Member

When building ARCH=loongarch with CONFIG_LTO_CLANG_FULL=y, the following error is repeated several times:

ld.lld: error: ld-temp.o <inline asm>:105:1: macro 'parse_r' is already defined
.macro  parse_r var r
^

The MIPS folks hit this as well and fixed it in commit 67512a8cf5a7 ("MIPS: Avoid macro redefinitions"), a copy of which LoongArch appears to need. I can work on this tomorrow, unless someone wants to beat me to it.

@nathanchance nathanchance added [FEATURE] LTO Related to building the kernel with LLVM Link Time Optimization [ARCH] loongarch This bug impacts ARCH=loongarch labels Aug 29, 2023
@nathanchance nathanchance self-assigned this Sep 5, 2023
@nathanchance
Copy link
Member Author

@nathanchance nathanchance added the [PATCH] Submitted A patch has been submitted for review label Sep 5, 2023
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Sep 5, 2023
When building with CONFIG_LTO_CLANG_FULL, there are several errors due
to the way that parse_r is defined with an __asm__ statement in a
header:

  ld.lld: error: ld-temp.o <inline asm>:105:1: macro 'parse_r' is already defined
  .macro  parse_r var r
  ^

This was an issue for arch/mips as well, which was resolved by
commit 67512a8 ("MIPS: Avoid macro redefinitions").

However, parse_r is unused in arch/loongarch after
commit 83d8b38 ("LoongArch: Simplify the invtlb wrappers"), so
doing the same change does not make much sense now. Just remove parse_r
(and parse_v, which is also unused) to resolve the redefinition error.
If it needs to be brought back due to an actual use, it should be
brought back with the same changes as the aforementioned arch/mips
commit.

Closes: ClangBuiltLinux#1924
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
chenhuacai pushed a commit to chenhuacai/linux that referenced this issue Sep 6, 2023
When building with CONFIG_LTO_CLANG_FULL, there are several errors due
to the way that parse_r is defined with an __asm__ statement in a
header:

  ld.lld: error: ld-temp.o <inline asm>:105:1: macro 'parse_r' is already defined
  .macro  parse_r var r
  ^

This was an issue for arch/mips as well, which was resolved by commit
67512a8 ("MIPS: Avoid macro redefinitions").

However, parse_r is unused in arch/loongarch after commit 83d8b38
("LoongArch: Simplify the invtlb wrappers"), so doing the same change
does not make much sense now. Just remove parse_r (and parse_v, which
is also unused) to resolve the redefinition error. If it needs to be
brought back due to an actual use, it should be brought back with the
same changes as the aforementioned arch/mips commit.

Closes: ClangBuiltLinux/linux#1924
Reviewed-by: WANG Xuerui <git@xen0n.name>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
@nathanchance
Copy link
Member Author

Patch queued: https://git.kernel.org/chenhuacai/linux-loongson/c/8ff81bb24f68f747ab2f738c3d493b9c2cad52bf

@nathanchance nathanchance added [PATCH] Accepted A submitted patch has been accepted upstream and removed [PATCH] Submitted A patch has been submitted for review labels Sep 7, 2023
@nathanchance nathanchance added [FIXED][LINUX] 6.6 This bug was fixed in Linux 6.6 and removed [PATCH] Accepted A submitted patch has been accepted upstream labels Sep 11, 2023
@nathanchance
Copy link
Member Author

nathanchance commented Sep 11, 2023

This is actually fixed in 6.6-rc1: https://git.kernel.org/linus/8ff81bb24f68f747ab2f738c3d493b9c2cad52bf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] loongarch This bug impacts ARCH=loongarch [FEATURE] LTO Related to building the kernel with LLVM Link Time Optimization [FIXED][LINUX] 6.6 This bug was fixed in Linux 6.6
Projects
None yet
Development

No branches or pull requests

2 participants