[flang-commits] [PATCH] D104290: [flang] Check there's no dependency on C++ libs

Diana Picus via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Jun 16 01:02:15 PDT 2021


rovka added a comment.

In D104290#2819654 <https://reviews.llvm.org/D104290#2819654>, @klausler wrote:

> I would like to have some automated check in the build that would catch an inadvertent binary dependency, but this scheme seems to admit false negative results when the linkage is static.

This just tests that CpuTime doesn't bring in any C++ symbols. If we added calls to all the runtime functions here, we could be reasonably confident that nothing in the runtime lib brings in C++ symbols, right? So there shouldn't be any false negatives unless the C compiler does something funny. I suppose we could avoid that if we called the linker directly? I'm not sure off the top of my head how complicated it would be to do that in a portable way.

> I have an extra step in my build that scrapes the runtime libraries' binaries' unsatisfied external symbols in search of mangled C++ names, but that's obviously not portable.
>
> When the llvm tree can build an end-to-end Fortran compiler, if we're allowed to have end-to-end Fortran compilation tests, they'll be better checks for C++-free linking.

We can definitely have end-to-end fortran tests. In the worst case, they'll have to live in the test-suite :) But I'm thinking when flang can handle linking we could just replace this file with the fortran equivalent and call flang instead of cc.



================
Comment at: flang/test/lit.cfg.py:85
+    tools.append(ToolSubst('%libruntime',
+        command=os.path.join(config.flang_lib_dir, 'libFortranRuntime.a'),
+        unresolved='warn'))
----------------
jeanPerier wrote:
> I wonder if you should also add `libFortranDecimal.a` to this, `libFortranRuntime.a` depends upon it. The dependency is not required for your test, so maybe this could also be done when adding an I/O runtime call use that actually depends on it.
Yeah, I think it's better to add it when there's a need for it. It will be easy to know because the test will fail then :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104290/new/

https://reviews.llvm.org/D104290



More information about the flang-commits mailing list