[PATCH] D53227: [hwasan] add stack frame descriptions.

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 12 17:38:55 PDT 2018


eugenis added inline comments.


================
Comment at: lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:151
+static cl::opt<bool>
+    ClCreateFrameDescriptions("hwasan_create_frame_descriptions",
+                              cl::desc("create static frame descriptions"),
----------------
s/_/-


================
Comment at: lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:217
+  // Get the section name for FD. Currently ELF-only.
+  const char *getFDSection() { return "__hwasan_fd"; }
+  const char *getFDSectionBeg() { return  "__start___hwasan_fd"; }
----------------
"fd" usually stands for file descriptor
Rename to __hwasan_frames?


================
Comment at: lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:319
+    // * w/o it we would have to create the call to __hwasan_init_fd after
+    //   all functions are instrumented (i.e. need to have a ModulePass).
+    createFD(*HwasanCtorFunction, "");
----------------
This section should be read-only so the (intrusive) linked list idea would not work.

I don't think this slot helps you avoid a module pass. You can create a call to __hwasan_init_fd regardless. 

You are inserting multiple calls to __hwasan_init_fd to the ctor function. Just one would be enough.

Ctor function should be comdat'ed itself, but that's orthogonal.


================
Comment at: lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:742
+  // Put GV into the F's Comadat so that if F is deleted GV can be deleted too.
+  if (!F.getName().startswith("hwasan"))
+    if (auto Comdat = GetOrCreateFunctionComdat(F, CurModuleUniqueId))
----------------
Why would F's name start with "hwasan"? Did you mean "__hwasan"?


Repository:
  rL LLVM

https://reviews.llvm.org/D53227





More information about the llvm-commits mailing list