[clang] [clang-sycl-linker] Generate SymbolTable for each image (PR #161287)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 29 18:13:42 PDT 2025
================
@@ -486,6 +492,22 @@ Error runSYCLLink(ArrayRef<std::string> Files, const ArgList &Args) {
SmallVector<std::string> SplitModules;
SplitModules.emplace_back(*LinkedFile);
+ // Generate symbol table.
+ SmallVector<std::string> SymbolTable;
+ for (size_t I = 0, E = SplitModules.size(); I != E; ++I) {
+ Expected<std::unique_ptr<Module>> ModOrErr =
+ getBitcodeModule(SplitModules[I], C);
+ if (!ModOrErr)
+ return ModOrErr.takeError();
+
+ SmallVector<StringRef> Symbols;
+ for (Function &F : **ModOrErr) {
+ if (isKernel(F))
+ Symbols.push_back(F.getName());
+ }
+ SymbolTable.emplace_back(llvm::join(Symbols.begin(), Symbols.end(), "\n"));
----------------
jhuber6 wrote:
Right, that's a data structure that's basically `Map<string, const char *>` so it doesn't know how to iterate over multiple of them. Now I'm wishing I put the size of the string in as part of the `StringEntry`. (You could put that as a string in a different string entry if you really wanted to). My main desire to just stick with normal strings is that you don't need to bother with the `join` stuff, but if it's that much of a pain I suppose it makes sense.
https://github.com/llvm/llvm-project/pull/161287
More information about the cfe-commits
mailing list