[PATCH] D74393: [llvm-readobj] Add support for decoding FreeBSD ELF notes

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 4 03:38:36 PST 2021


arichardson added inline comments.


================
Comment at: llvm/test/tools/llvm-readobj/ELF/note-freebsd-core.test:73
+# LLVM-NEXT:   NoteSection {
+# LLVM-NEXT:     Name: <?>
+# LLVM-NEXT:     Offset: 0xB0
----------------
jhenderson wrote:
> Why the `<?>` for the name? Sounds like something odd is going on if I follow it correctly (there are perfectly good section headers as far as I can see from yaml). If it's expected, add a comment explaining why.
I don't understand why this is happening, but it also appears to affect other tests. Possibly a bug in yaml2obj? Unfortunately I don't have time to investigate this.


================
Comment at: llvm/test/tools/llvm-readobj/ELF/note-freebsd.test:94
+#  FreeBSD       0x00000004      NT_FREEBSD_FEATURE_CTL
+#   Features: ASLR_DISABLE PROTMAX_DISABLE STKGAP_DISABLE WXNEEDED unknown (0xfffffff0)
+#  FreeBSD       0x00000001      NT_FREEBSD_FEATURE_CTL
----------------
emaste wrote:
> emaste wrote:
> > `0xfffffff0` looks like an ELF Tool Chain bug :(
> Oh, nvm you set the field to 0xFFFFFFFF. ELF Tool Chain masks off the known bits as it prints them, and displays what's left.
Yeah I'm not sure what the best output format is. I think just printing the raw value in parens seems less confusing than printing the non-matching bits.


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:5220-5224
+      // FreeBSD also places the generic core notes in the FreeBSD namespace.
+      StringRef Result = FindNote(FreeBSDCoreNoteTypes);
+      if (!Result.empty())
+        return Result;
+      return FindNote(CoreNoteTypes);
----------------
jhenderson wrote:
> I might have missed it, but is there testing for both halves of this code path (i.e. regular core notes + FreeBSD)?
note-freebsd-core.test checks for NT_PRPSINFO (which is one of the generic core notes) with a FreeBSD owner.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74393



More information about the llvm-commits mailing list