2424namespace lld {
2525namespace macho {
2626
27- enum LinkerOptReason : uint8_t {
28- NotOptimized,
29- CategoryMerging,
30- };
31-
3227class InputFile ;
3328class OutputSection ;
3429
@@ -65,7 +60,6 @@ class InputSection {
6560 // Whether the data at \p off in this InputSection is live.
6661 virtual bool isLive (uint64_t off) const = 0;
6762 virtual void markLive (uint64_t off) = 0;
68- virtual bool isLinkOptimizedAway () const { return false ; }
6963 virtual InputSection *canonical () { return this ; }
7064 virtual const InputSection *canonical () const { return this ; }
7165
@@ -120,12 +114,7 @@ class ConcatInputSection final : public InputSection {
120114 bool isLive (uint64_t off) const override { return live; }
121115 void markLive (uint64_t off) override { live = true ; }
122116 bool isCoalescedWeak () const { return wasCoalesced && symbols.empty (); }
123- bool isLinkOptimizedAway () const override {
124- return linkerOptimizeReason != LinkerOptReason::NotOptimized;
125- }
126- bool shouldOmitFromOutput () const {
127- return isLinkOptimizedAway () || !live || isCoalescedWeak ();
128- }
117+ bool shouldOmitFromOutput () const { return !live || isCoalescedWeak (); }
129118 void writeTo (uint8_t *buf);
130119
131120 void foldIdentical (ConcatInputSection *redundant);
@@ -152,11 +141,6 @@ class ConcatInputSection final : public InputSection {
152141 // first and not copied to the output.
153142 bool wasCoalesced = false ;
154143 bool live = !config->deadStrip;
155- // Flag to specify if a linker optimzation flagged this section to be
156- // discarded. Need a separate flag from live as live specifically means
157- // 'dead-stripped' which is rellevant in contexts such as linker map
158- // generation
159- LinkerOptReason linkerOptimizeReason = LinkerOptReason::NotOptimized;
160144 bool hasCallSites = false ;
161145 // This variable has two usages. Initially, it represents the input order.
162146 // After assignAddresses is called, it represents the offset from the
@@ -192,20 +176,10 @@ struct StringPiece {
192176 // Only set if deduplicating literals
193177 uint32_t hash : 31 ;
194178 // Offset from the start of the containing output section.
195- uint64_t outSecOff : 48 ;
196- // Have to declare the 'linkerOptimizeReason' and 'live' as uint64_t so that
197- // the MSVC compiler will merge the storage of it and 'outSecOff' above.
198- uint64_t /* LinkerOptReason*/ linkerOptimizeReason : 8 ;
199-
200- bool shouldOmitFromOutput () const {
201- return !live || linkerOptimizeReason != LinkerOptReason::NotOptimized;
202- }
179+ uint64_t outSecOff = 0 ;
203180
204181 StringPiece (uint64_t off, uint32_t hash)
205- : inSecOff(off), live(!config->deadStrip), hash(hash) {
206- outSecOff = 0 ;
207- linkerOptimizeReason = LinkerOptReason::NotOptimized;
208- }
182+ : inSecOff(off), live(!config->deadStrip), hash(hash) {}
209183};
210184
211185static_assert (sizeof (StringPiece) == 16 , " StringPiece is too big!" );
0 commit comments