-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[BOLT][test] Fix callcont-fallthru.s after #129481 #135867
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
base: users/aaupov/spr/main.bolttest-fix-callcont-fallthrus-after-129481
Are you sure you want to change the base?
[BOLT][test] Fix callcont-fallthru.s after #129481 #135867
Conversation
Created using spr 1.3.4
@llvm/pr-subscribers-bolt Author: Amir Ayupov (aaupov) ChangesForce the use of llvm-nm for PREAGGPLT check. Test Plan: bin/llvm-lit -a tools/bolt/test/X86/callcont-fallthru.s Full diff: https://github.com/llvm/llvm-project/pull/135867.diff 1 Files Affected:
diff --git a/bolt/test/X86/callcont-fallthru.s b/bolt/test/X86/callcont-fallthru.s
index ee72d8f62e032..6b5caa08d3128 100644
--- a/bolt/test/X86/callcont-fallthru.s
+++ b/bolt/test/X86/callcont-fallthru.s
@@ -9,7 +9,7 @@
# RUN: link_fdata %s %t %t.pa3 PREAGG3
# RUN: link_fdata %s %t %t.pat PREAGGT1
# RUN: link_fdata %s %t %t.pat2 PREAGGT2
-# RUN: link_fdata %s %t %t.patplt PREAGGPLT
+# RUN: link_fdata %s %t %t.patplt PREAGGPLT --nmtool llvm-nm
## Check normal case: fallthrough is not LP or secondary entry.
# RUN: llvm-strip --strip-unneeded %t -o %t.strip
|
Created using spr 1.3.4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Amir,
Thanks for the PR. Unfortunately, it is still failing. The trick below doesn't seem to work on my buildbot machine:
Link against a DSO to ensure PLT entries.
So doing:
nm --synthetic callcont-fallthru.s.tmp
won't list a puts@plt
symbol, which is what causes an link_fdata.py
assertion:
AssertionError: ERROR: symbol puts@plt is not defined in binary
On my dev AArch64 instance --synthetic
does the trick. BTW run lines 4 and 6 appear identical when inspected (-###
)
@MaskRay – can you please advise how to force a PLT entry if linking with a DSO hack doesn't work? |
You need a |
Thanks a lot both! In case there's some delay in resolving this edge case, may I suggest temporarily disabling this test on AArch64 until a more consistent workaround is in place? |
Hey folks, any updates on this? I spent some time experimenting with @MaskRay's suggestion. I used a mock libc shared object that had a |
Maybe I'm missing something but why use /dev/null library hack in the first place here? There is stub.c available with puts symbol already, just use it to compile so and link against it, plt entry should appear normally. |
Hey @yota9, thanks for the input. I tried something similar. -# RUN: %clang %cflags -fpic -shared -xc /dev/null -o %t.so
-## Link against a DSO to ensure PLT entries.
+# RUN: %clang %cflags %p/../Inputs/stub.c -fPIC -shared -o %t.so then running GNU nm: nm %t --synthetic would emit only
which U puts
0000000000001234 T puts@plt which works well. In both cases it was the same nm driver version. I might've missed something on my end. I briefly discussed this with Amir (see discord) as I'm trying to unblock our AArch64 buildbot. We figured it's fine to disable this test on AArch64 until the issue gets resolved. Could you mind taking a look at #137831, and consider accepting it? |
@paschalis-mpeis Could you please check if the binaries are identical and it is indeed nm problem? E.g. with objdump, is plt entry is there? Maybe there is problem related to the plt section type, e.g. one of the binaries has .plt.sec or .plt.got section and there is some kind of but in nm that not lists symbols from these sections. Then we can use custom linker script with .plt section only. |
Hey @yota9, thanks for the suggestions! Indeed, the PLT entries exist in both binaries. For example running:
shows:
I noticed some code differences in the binaries but I haven't looked deeper into it. It looks like it's differences in GNU nm though: On my AArch64 dev-machine, Conversely, I too agree that relying on GNU is not ideal. Essentially using any binary tool that does not come from the built LLVM revision. However, BTW, thanks for all the help! I'm focused on AArch64, so while I may be involved to some extent with this, I'll let Amir drive the fix. That's why I'm looking for a code owner to get #137831 stamped. :) |
Thanks for tracking it down, looks like it's an issue with GNU nm. However llvm-nm has no functionality equivalent to Let me try to decouple this test from GNU nm. |
Great. A quick way to use an llvm tool could be: llvm-objdump -d -j .plt %t | grep @plt This produces output similar to what 0000000000001430 <puts@plt>: You'll need ofc to tweak llvm-project/bolt/test/link_fdata.py Lines 96 to 99 in fb8d61d
|
I've decided to add synthetic option to llvm-nm here #138232 . Unfortunately it would take some time, as main maintainer won't be able to review it soon, so probably for now we might just mark the test as XFAIL until then.. Not forgetting to replace nm with llvm-nm |
That is perfect and the way we should go forward with this – thanks @yota9. The problem is that the test is flaky: it passes on most systems but fails on a few. That's why I propose restricting this to X86 for now, as a way to unblock us in the meantime: llvm-project/bolt/test/X86/callcont-fallthru.s Lines 3 to 5 in 42d76a3
|
@paschalis-mpeis Indeed, you're right. Let's wait about @aaupov decision then, it LGTM |
Compatible with GNU nm --syntethic option is used to show special symbols created by the linker. Current implementation is limited to show plt entries in the form of symbol@plt and plt entry address. Currently it would be used for BOLT testing purposes (llvm#135867) in order to eliminate external GNU nm dependency.
Compatible with GNU nm --syntethic option is used to show special symbols created by the linker. Current implementation is limited to show plt entries in the form of symbol@plt and plt entry address. Currently it would be used for BOLT testing purposes (llvm#135867) in order to eliminate external GNU nm dependency.
@paschalis-mpeis I realised that if would change the nm to llvm-nm that we can just mark test as xfail, as it would fail until the patch above would be submitted. This way we would guarantee to have proper changes it test. |
Yeap, good idea. I could add
The differences would be :
I'm happy to proceed with this as well. |
Yeah, that's right. Although maybe we need to replace nm to llvm-nm in link_fdata to be default... Up to you and @aaupov to decide.. |
Only set
--synthetic
nm flag in link_fdata if requested explicitly.Test Plan: bin/llvm-lit -a tools/bolt/test/X86/callcont-fallthru.s