- // bit5+ = Slot # for type
- unsigned oSlot = ((unsigned)Slot << 5) | (getEncodedLinkage(I) << 2) |
- (I->hasInitializer() << 1) | (unsigned)I->isConstant();
- output_vbr(oSlot);
+ // bit5+ = Slot # for type.
+ bool HasExtensionWord = I->getAlignment() != 0;
+
+ // If we need to use the extension byte, set linkage=3(internal) and
+ // initializer = 0 (impossible!).
+ if (!HasExtensionWord) {
+ unsigned oSlot = ((unsigned)Slot << 5) | (getEncodedLinkage(I) << 2) |
+ (I->hasInitializer() << 1) | (unsigned)I->isConstant();
+ output_vbr(oSlot);
+ } else {
+ unsigned oSlot = ((unsigned)Slot << 5) | (3 << 2) |
+ (0 << 1) | (unsigned)I->isConstant();
+ output_vbr(oSlot);
+
+ // The extension word has this format: bit 0 = has initializer, bit 1-3 =
+ // linkage, bit 4-8 = alignment (log2), bits 10+ = future use.
+ unsigned ExtWord = I->hasInitializer() | (getEncodedLinkage(I) << 1) |
+ (Log2_32(I->getAlignment())+1) << 4;
+ output_vbr(ExtWord);
+
+ }