[PATCH] D87178: [lld-macho] Emit indirect symbol table

Greg McGary via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 18:40:49 PDT 2020


gkm added inline comments.


================
Comment at: lld/MachO/OutputSection.h:66-67
   uint32_t flags = 0;
+  uint32_t reserved1 = 0;
+  uint32_t reserved2 = 0;
 
----------------
int3 wrote:
> gkm wrote:
> > Semantically blank names are beyond our reach in `struct section_64`, but `class OutputSection` is ours and we have the freedom to grant meaningful names. In `writeTo()` the assignments from members of `OutputSection` to `section_64` will make it clear how the meaningful names map onto the meaningless names.
> It's not clear to me that `reserved1` is *only* used to point to the indirect symbol table. Its semantics might be section-type-specific. That's why I didn't call it `indirectSymtabOffset` or something
Ah, I see. `OutputSection` is very superclassy, so the `reserved[12]` members are just as generic as for `section_64`. My suggestion would be better suited to a subclass shared by `GotSection`, `TlvPointerSection`, and `StubsSection`.


================
Comment at: lld/MachO/SyntheticSections.h:392
+// The indirect symbol table is a list of 32-bit integers that serve as indices
+// into the (actual) symbol table. The indirect symbol table is composed of a
+// concatentation of several sub-arrays of indices, each sub-array belonging to
----------------
int3 wrote:
> gkm wrote:
> > English style nit.
> Aren't they the same thing? Accordingly to Grammarly:
> 
> > Comprise is a verb that means “to be composed of.”
> 
> On second thought though it would be more accurate to say that "the indirect symbol table *is* a concatentation"
While Grammarly is technically correct (as are you), the nit I am picking is a matter of //style//.

This is the famous passage from Strunk & White's //The Elements of Style// (do you know it?):



> Omit needless words.
>  
> Vigorous writing is concise. A sentence should contain no unnecessary words, a paragraph no unnecessary sentences, for the same reason that a drawing should have no unnecessary lines and a machine no unnecessary parts. This requires not that the writer make all his sentences short, or that he avoid all detail and treat his subjects only in outline, but that every word tell.
>  
> Many expressions in common use violate this principle:
> 
> | the question as to whether |	whether
> | there is no doubt but that | no doubt (doubtless)
> | used for fuel purposes | used for fuel
> | he is a man who | he
> | in a hasty manner | hastily
> | this is a subject which | this subject
> | His story is a strange one | His story is strange |
>  
> In especial the expression the fact that should be revised out of every sentence in which it occurs.
>  
> | owing to the fact that | since (because)
> | in spite of the fact that | though (although)
> | call your attention to the fact that | remind you (notify you)
> | I was unaware of the fact that | I was unaware that (did not know)
> | the fact that he had not succeeded | his failure
> | the fact that I had arrived | my arrival |

... and your second thought is even better!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87178



More information about the llvm-commits mailing list