[PATCH] D45841: Keep the output text sections with prefixes ".text.hot" , ".text.unlikely", ".text.startup", ".text.exit" separate

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 3 23:48:54 PDT 2018


grimar added a comment.

Can you add a test case, please?



================
Comment at: ELF/Driver.cpp:765
+  Config->ZKeeptextsectionprefix = getZFlag(
+      Args, "keep-text-section-prefix", "nokeep-text-section-prefix", false);
   Config->ZExecstack = getZFlag(Args, "execstack", "noexecstack", false);
----------------
Since each word is separated in a command line option name, I believe naming
should use uppercases:

`ZKeepTextSectionPrefix`


================
Comment at: ELF/Writer.cpp:94
+    return true;
+  return false;
+}
----------------
This can be just:

```
return SectionName.startswith(PrefixName) || SectionName == PrefixName.drop_back();
```

I would probably also use shorter namings for arguments:
`PrefixName` -> `Prefix`
`SectionName` -> `Name`


================
Comment at: ELF/Writer.cpp:114
+  // This check is for -z keep-text-section-prefix.  This option separates text
+  // sections with prefix ".text.hot" or ".text.unlikely" or ".text.startup" or
+  // ".text.exit".
----------------
I think using commas would be more correct?

`".text.hot", ".text.unlikely", ".text.startup" or ".text.exit"`


https://reviews.llvm.org/D45841





More information about the llvm-commits mailing list