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

x86 Linux build fails #55521

Closed
t-mustafin opened this issue Jul 12, 2021 · 10 comments · Fixed by #55924
Closed

x86 Linux build fails #55521

t-mustafin opened this issue Jul 12, 2021 · 10 comments · Fixed by #55924
Milestone

Comments

@t-mustafin
Copy link
Contributor

x86 Linux build fails with message:

  /home/tmustafin/dotnet/runtime/src/coreclr/vm/i386/jithelp.S:314:21: error: cannot use more than one symbol in memory operand
      add eax, offset _GLOBAL_OFFSET_TABLE_+1
                      ^
  vm/wks/CMakeFiles/cee_wks_core.dir/build.make:3330: recipe for target 'vm/wks/CMakeFiles/cee_wks_core.dir/__/i386/jithelp.S.o' failed

Problem occures on

add eax, offset _GLOBAL_OFFSET_TABLE_+1 // (2b - 1b)
.
Build command:

sudo ./eng/common/cross/build-rootfs.sh x86 bionic
ROOTFS_DIR=`pwd`/.tools/rootfs/x86 ./build.sh --cross --clang9 --arch x86 --configuration Release --subset clr.runtime+clr.corelib+clr.iltools+clr.dactools+clr.jit /p:EnableSourceLink=false

cc @janvorli @jkotas @alpencolt @gbalykov

@dotnet-issue-labeler dotnet-issue-labeler bot added area-VM-coreclr untriaged New issue has not been triaged by the area owner labels Jul 12, 2021
@janvorli
Copy link
Member

I've just found that it is a clang issue. The build works fine with clang 10, but not with clang 9 for some reason. @t-mustafin would using clang-10 be an option for you? The clang 9 seems to be somehow confused by the instruction. Even with just add eax, offset _GLOBAL_OFFSET_TABLE_, it complains the same way.

@janvorli
Copy link
Member

It seems to be a known issue in clang, apparently fixed in clang >=10:
https://bugs.llvm.org/show_bug.cgi?id=32530

@alpencolt
Copy link

@janvorli we use old clang-5 for production builds. Thank you for information, we'll check whether this bug exists on other clang versions.

@janvorli
Copy link
Member

I have a workaround that works on the older clangs as well, just verifying that it generates the expected code.

@janvorli
Copy link
Member

It seems to generate proper code, the diff is:

diff --git a/src/coreclr/vm/i386/jithelp.S b/src/coreclr/vm/i386/jithelp.S
index dc56da1d177..4f227c9cf60 100644
--- a/src/coreclr/vm/i386/jithelp.S
+++ b/src/coreclr/vm/i386/jithelp.S
@@ -392,7 +392,9 @@ LEAF_ENTRY JIT_WriteBarrier_Callable, _TEXT
 1:
     pop     eax
 2:
-    add     eax, offset _GLOBAL_OFFSET_TABLE_+1 // (2b - 1b)
+.att_syntax
+    addl     $_GLOBAL_OFFSET_TABLE_+(2b-1b), %eax
+.intel_syntax noprefix
     mov     eax, dword ptr [eax + C_FUNC(JIT_WriteBarrierEAX_Loc)@GOT]
     xchg    eax, dword ptr [esp]
     ret

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jul 19, 2021
@t-mustafin
Copy link
Contributor Author

@janvorli Thanks, it works for me with clang9 and clang5.

@mangod9 mangod9 removed the untriaged New issue has not been triaged by the area owner label Jul 20, 2021
@mangod9 mangod9 added this to the 6.0.0 milestone Jul 20, 2021
@ghost ghost added in-pr There is an active PR which will close this issue when it is merged and removed in-pr There is an active PR which will close this issue when it is merged labels Jul 20, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jul 20, 2021
@alpencolt
Copy link

@janvorli btw as I see clang11 is last supported version. Are there plans for adding clang12 support?

@janvorli
Copy link
Member

@alpencolt yes, I'd like to support the latest clang releases. I haven't monitored the llvm releases recently, so I've missed the fact that there is a version 12 already. Have you tried it and found issues with it?

@alpencolt
Copy link

It seems it was released in April. We haven't tried it yet but want to update our toolchain and I check which version fits more.
If you're ok with using latest one we can check clang12 on ARM close to autumn.

@janvorli
Copy link
Member

Usually moving to a new version just works. In some cases, it caused build breaks in the past that we needed to fix.

@ghost ghost locked as resolved and limited conversation to collaborators Aug 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants