24
24
namespace lld {
25
25
namespace macho {
26
26
27
- enum LinkerOptReason : uint8_t {
28
- NotOptimized,
29
- CategoryMerging,
30
- };
31
-
32
27
class InputFile ;
33
28
class OutputSection ;
34
29
@@ -65,7 +60,6 @@ class InputSection {
65
60
// Whether the data at \p off in this InputSection is live.
66
61
virtual bool isLive (uint64_t off) const = 0;
67
62
virtual void markLive (uint64_t off) = 0;
68
- virtual bool isLinkOptimizedAway () const { return false ; }
69
63
virtual InputSection *canonical () { return this ; }
70
64
virtual const InputSection *canonical () const { return this ; }
71
65
@@ -120,12 +114,7 @@ class ConcatInputSection final : public InputSection {
120
114
bool isLive (uint64_t off) const override { return live; }
121
115
void markLive (uint64_t off) override { live = true ; }
122
116
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 (); }
129
118
void writeTo (uint8_t *buf);
130
119
131
120
void foldIdentical (ConcatInputSection *redundant);
@@ -152,11 +141,6 @@ class ConcatInputSection final : public InputSection {
152
141
// first and not copied to the output.
153
142
bool wasCoalesced = false ;
154
143
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;
160
144
bool hasCallSites = false ;
161
145
// This variable has two usages. Initially, it represents the input order.
162
146
// After assignAddresses is called, it represents the offset from the
@@ -192,20 +176,10 @@ struct StringPiece {
192
176
// Only set if deduplicating literals
193
177
uint32_t hash : 31 ;
194
178
// 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 ;
203
180
204
181
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) {}
209
183
};
210
184
211
185
static_assert (sizeof (StringPiece) == 16, "StringPiece is too big!");
0 commit comments