Skip to content

[Clang][test] Limit library search when linking shared lib #80253

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

Merged
merged 1 commit into from
Feb 1, 2024

Conversation

apolloww
Copy link
Contributor

@apolloww apolloww commented Feb 1, 2024

Don't search for unnecessary libs when linking the shared lib. This allows the test to run in chroot environment.

@llvmbot llvmbot added the clang Clang issues not falling into any other category label Feb 1, 2024
@llvmbot
Copy link
Member

llvmbot commented Feb 1, 2024

@llvm/pr-subscribers-clang

Author: Wei Wang (apolloww)

Changes

Don't search for unnecessary libs when linking the shared lib. This allows the test to run in chroot environment.


Full diff: https://github.com/llvm/llvm-project/pull/80253.diff

1 Files Affected:

  • (modified) clang/test/Interpreter/cxx20-modules.cppm (+1-1)
diff --git a/clang/test/Interpreter/cxx20-modules.cppm b/clang/test/Interpreter/cxx20-modules.cppm
index 239968d8c7445..4e56e2fc1528a 100644
--- a/clang/test/Interpreter/cxx20-modules.cppm
+++ b/clang/test/Interpreter/cxx20-modules.cppm
@@ -8,7 +8,7 @@
 // RUN: %clang -std=c++20 %t/mod.cppm --precompile \
 // RUN:     -o %t/mod.pcm --target=x86_64-linux-gnu
 // RUN: %clang -fPIC %t/mod.pcm -c -o %t/mod.o --target=x86_64-linux-gnu
-// RUN: %clang -fPIC -shared %t/mod.o -o %t/libmod.so --target=x86_64-linux-gnu
+// RUN: %clang -nostdlib -fPIC -shared %t/mod.o -o %t/libmod.so --target=x86_64-linux-gnu
 //
 // RUN: cat %t/import.cpp | env LD_LIBRARY_PATH=%t:$LD_LIBRARY_PATH \
 // RUN:     clang-repl -Xcc=-std=c++20 -Xcc=-fmodule-file=M=%t/mod.pcm \

@apolloww
Copy link
Contributor Author

apolloww commented Feb 1, 2024

Our internal builds run in chroot and the test fails with the following error

/bin/ld: cannot find crti.o: No such file or directory
/bin/ld: cannot find crtbeginS.o: No such file or directory
/bin/ld: cannot find -lgcc
/bin/ld: cannot find -lgcc_s
/bin/ld: cannot find -lc
/bin/ld: cannot find -lgcc
/bin/ld: cannot find -lgcc_s
/bin/ld: cannot find crtendS.o: No such file or directory
/bin/ld: cannot find crtn.o: No such file or directory

@apolloww apolloww requested a review from ChuanqiXu9 February 1, 2024 07:27
Copy link
Member

@ChuanqiXu9 ChuanqiXu9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

@apolloww apolloww merged commit ae931b4 into llvm:main Feb 1, 2024
carlosgalvezp pushed a commit to carlosgalvezp/llvm-project that referenced this pull request Feb 1, 2024
Don't search for unnecessary libs when linking the shared lib. This
allows the test to run in chroot environment.
agozillon pushed a commit to agozillon/llvm-project that referenced this pull request Feb 5, 2024
Don't search for unnecessary libs when linking the shared lib. This
allows the test to run in chroot environment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants