[PATCH] D124121: [DebugInfo] Give warning instead of error for premature terminator in .debug_aranges section.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 01:46:05 PDT 2022


jhenderson added inline comments.


================
Comment at: llvm/test/tools/llvm-profgen/premature-warning.s:7-15
+# the assembly code is from clang t.c -mllvm -generate-arange-section -g2 -save-temps
+# #include <stdio.h>
+# int main(){
+#   printf("hello world.\n");
+#   return 0;
+# }
+# then manually changed .debug_aragnes section
----------------
junfd wrote:
> jhenderson wrote:
> > In addition to the above, I'd note the version of clang you used to generate this assembly.
> > 
> > Up to you, but I'd consider using YAML as input instead of asm. For the simple test case here, you might find it leads to more readable and maintainable input, once you've done the initial legwork of writing the debug_info and debug_abbrev sections.
> I saw some tests using YAML and coverts to obj file. could it be convert to executable file further? llvm-profgen require the binary input to be a valid executable.
YAML will just convert the YAML into whatever its literal representation is. If you've written it correctly, you could use it to generate an executable, yes, although that would likely require you to know a fair amount about the file format, or to just use obj2yaml to generate the YAML input, although at that point, it may not be particularly readable (there's usually a lot of cruft in an executable that isn't actually needed for a test case).

However, your comment raised a further issue, which might torpedo this test in its current form anyway: just as the main lit tests can't use clang, they also can't use a linker, such as LLD either, for the same reasons. That means you simply cannot build from source or assembly. The //only// way to make this test usable directly where it is is to use yaml2obj. You'd have to put the test in cross-project-tests to have access to clang and/or LLD, but I'm not convinced that's the right place for this sort of test, since linked addresses aren't really involved.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124121



More information about the llvm-commits mailing list