[PATCH] D72194: [MC][ELF] Ensure that mergeable globals with an explicit section are assigned to SHF_MERGE sections with compatible entsizes
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 11 20:30:44 PDT 2020
MaskRay added a comment.
> The basic mechanism is to create multiple sections with the same name, using LLVM's ", unique," assembly extension (I refer to such sections as unique/uniqued sections) if incompatible symbols are explicitly given the same section name.
unique linkage. `assembly extension` can be deleted because GNU as>=2.35 supports it as well.
> Update: There will be a similar issue for associated symbols once https://reviews.llvm.org/D74006 lands.
This sentence can be deleted now.
> Symbols with a an explicit assignment
`a an` -> an
The summary is very long. Can you simplify it?
================
Comment at: llvm/include/llvm/MC/MCContext.h:318
+ if ((Flags & ELF::SHF_STRINGS) != (Other.Flags & ELF::SHF_STRINGS))
+ return (Other.Flags & ELF::SHF_STRINGS);
+ return EntrySize < Other.EntrySize;
----------------
excess parentheses
================
Comment at: llvm/include/llvm/MC/MCContext.h:327
+ // sizes. This can occur when a symbol is explicitly assigned to a
+ // section, e.g. via _attribute_((section("myname"))).
+ std::map<ELFEntrySizeKey, unsigned> ELFEntrySizeMap;
----------------
`__attribute__`
================
Comment at: llvm/include/llvm/MC/MCContext.h:335
+ // sections (e.g. via _attribute_((section("myname")))).
+ std::set<StringRef> ELFSeenGenericMergeableSections;
+
----------------
DenseSet
================
Comment at: llvm/lib/MC/MCContext.cpp:452
+ bool IsMergeable = Flags & ELF::SHF_MERGE;
+ bool IsGenericSection = UniqueID == GenericSectionID;
+
----------------
The variable IsGenericSection can be omitted.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72194/new/
https://reviews.llvm.org/D72194
More information about the llvm-commits
mailing list