llvm.org GIT mirror llvm / 2330df6
llvm-mc: Improve handling of implicit alignment for magic section directives (e.g., .objc_message_refs). - Just emit a .align when we see the directive; this isn't exactly what 'as' does but in practice it should be ok, at least for now. See FIXME. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79697 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Dunbar 11 years ago
2 changed file(s) with 21 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
120120 // CHECK: ('address', 0)
121121 // CHECK: ('size', 0)
122122 // CHECK: ('offset', 2464)
123 // FIXME: We aren't setting alignment correctly yet.
124 // CHECX: ('alignment', 2)
123 // CHECK: ('alignment', 2)
125124 // CHECK: ('reloc_offset', 0)
126125 // CHECK: ('num_reloc', 0)
127126 // CHECK: ('flags', 0x3)
134133 // CHECK: ('address', 0)
135134 // CHECK: ('size', 0)
136135 // CHECK: ('offset', 2464)
137 // FIXME: We aren't setting alignment correctly yet.
138 // CHECX: ('alignment', 3)
136 // CHECK: ('alignment', 3)
139137 // CHECK: ('reloc_offset', 0)
140138 // CHECK: ('num_reloc', 0)
141139 // CHECK: ('flags', 0x4)
148146 // CHECK: ('address', 0)
149147 // CHECK: ('size', 0)
150148 // CHECK: ('offset', 2464)
151 // FIXME: We aren't setting alignment correctly yet.
152 // CHECX: ('alignment', 4)
149 // CHECK: ('alignment', 4)
153150 // CHECK: ('reloc_offset', 0)
154151 // CHECK: ('num_reloc', 0)
155152 // CHECK: ('flags', 0xe)
240237 // CHECK: ('address', 0)
241238 // CHECK: ('size', 0)
242239 // CHECK: ('offset', 2464)
243 // FIXME: We aren't setting alignment correctly yet.
244 // CHECX: ('alignment', 2)
240 // CHECK: ('alignment', 2)
245241 // CHECK: ('reloc_offset', 0)
246242 // CHECK: ('num_reloc', 0)
247243 // CHECK: ('flags', 0x6)
254250 // CHECK: ('address', 0)
255251 // CHECK: ('size', 0)
256252 // CHECK: ('offset', 2464)
257 // FIXME: We aren't setting alignment correctly yet.
258 // CHECX: ('alignment', 2)
253 // CHECK: ('alignment', 2)
259254 // CHECK: ('reloc_offset', 0)
260255 // CHECK: ('num_reloc', 0)
261256 // CHECK: ('flags', 0x7)
281276 // CHECK: ('address', 0)
282277 // CHECK: ('size', 0)
283278 // CHECK: ('offset', 2464)
284 // FIXME: We aren't setting alignment correctly yet.
285 // CHECX: ('alignment', 2)
279 // CHECK: ('alignment', 2)
286280 // CHECK: ('reloc_offset', 0)
287281 // CHECK: ('num_reloc', 0)
288282 // CHECK: ('flags', 0x9)
295289 // CHECK: ('address', 0)
296290 // CHECK: ('size', 0)
297291 // CHECK: ('offset', 2464)
298 // FIXME: We aren't setting alignment correctly yet.
299 // CHECX: ('alignment', 2)
292 // CHECK: ('alignment', 2)
300293 // CHECK: ('reloc_offset', 0)
301294 // CHECK: ('num_reloc', 0)
302295 // CHECK: ('flags', 0xa)
426419 // CHECK: ('address', 0)
427420 // CHECK: ('size', 0)
428421 // CHECK: ('offset', 2464)
429 // FIXME: We aren't setting alignment correctly yet.
430 // CHECX: ('alignment', 2)
422 // CHECK: ('alignment', 2)
431423 // CHECK: ('reloc_offset', 0)
432424 // CHECK: ('num_reloc', 0)
433425 // CHECK: ('flags', 0x10000005)
440432 // CHECK: ('address', 0)
441433 // CHECK: ('size', 0)
442434 // CHECK: ('offset', 2464)
443 // FIXME: We aren't setting alignment correctly yet.
444 // CHECX: ('alignment', 2)
435 // CHECK: ('alignment', 2)
445436 // CHECK: ('reloc_offset', 0)
446437 // CHECK: ('num_reloc', 0)
447438 // CHECK: ('flags', 0x10000005)
793793
794794 // FIXME: Arch specific.
795795 // FIXME: Cache this!
796 // FIXME: Handle the implicit alignment!!
797796 MCSection *S = 0; // Ctx.GetSection(Section);
798797 if (S == 0)
799798 S = MCSectionMachO::Create(Segment, Section, TAA, StubSize,
800799 SectionKind(), Ctx);
801800
802801 Out.SwitchSection(S);
802
803 // Set the implicit alignment, if any.
804 //
805 // FIXME: This isn't really what 'as' does; I think it just uses the implicit
806 // alignment on the section (e.g., if one manually inserts bytes into the
807 // section, then just issueing the section switch directive will not realign
808 // the section. However, this is arguably more reasonable behavior, and there
809 // is no good reason for someone to intentionally emit incorrectly sized
810 // values into the implicitly aligned sections.
811 if (Align)
812 Out.EmitValueToAlignment(Align, 0, 1, 0);
813
803814 return false;
804815 }
805816