@@ -68,6 +68,11 @@ struct Symbol {
68
68
XCOFF::StorageClass getStorageClass () const {
69
69
return MCSym->getStorageClass ();
70
70
}
71
+
72
+ XCOFF::VisibilityType getVisibilityType () const {
73
+ return MCSym->getVisibilityType ();
74
+ }
75
+
71
76
StringRef getSymbolTableName () const { return MCSym->getSymbolTableName (); }
72
77
Symbol (const MCSymbolXCOFF *MCSym) : MCSym(MCSym), SymbolTableIndex(-1 ) {}
73
78
};
@@ -561,13 +566,12 @@ void XCOFFObjectWriter::writeSymbolTableEntryForCsectMemberLabel(
561
566
W.write <uint32_t >(CSectionRef.Address + SymbolOffset);
562
567
W.write <int16_t >(SectionIndex);
563
568
// Basic/Derived type. See the description of the n_type field for symbol
564
- // table entries for a detailed description. Since we don't yet support
565
- // visibility, and all other bits are either optionally set or reserved, this
566
- // is always zero.
567
- // TODO FIXME How to assert a symbol's visibilty is default?
569
+ // table entries for a detailed description. Since we support visibility, and
570
+ // all other bits are either optionally set or reserved, we only set bits 0-3
571
+ // for symbol's visibility and leave other bits to zero.
568
572
// TODO Set the function indicator (bit 10, 0x0020) for functions
569
573
// when debugging is enabled.
570
- W.write <uint16_t >(0 );
574
+ W.write <uint16_t >(SymbolRef. getVisibilityType () );
571
575
W.write <uint8_t >(SymbolRef.getStorageClass ());
572
576
// Always 1 aux entry for now.
573
577
W.write <uint8_t >(1 );
@@ -598,13 +602,12 @@ void XCOFFObjectWriter::writeSymbolTableEntryForControlSection(
598
602
// n_scnum
599
603
W.write <int16_t >(SectionIndex);
600
604
// Basic/Derived type. See the description of the n_type field for symbol
601
- // table entries for a detailed description. Since we don't yet support
602
- // visibility, and all other bits are either optionally set or reserved, this
603
- // is always zero.
604
- // TODO FIXME How to assert a symbol's visibilty is default?
605
+ // table entries for a detailed description. Since we support visibility, and
606
+ // all other bits are either optionally set or reserved, we only set bits 0-3
607
+ // for symbol's visibility and leave other bits to zero.
605
608
// TODO Set the function indicator (bit 10, 0x0020) for functions
606
609
// when debugging is enabled.
607
- W.write <uint16_t >(0 );
610
+ W.write <uint16_t >(CSectionRef. MCCsect -> getVisibilityType () );
608
611
// n_sclass
609
612
W.write <uint8_t >(StorageClass);
610
613
// Always 1 aux entry for now.
0 commit comments