_symbolAtom[*si] = atom;
_definedAtomLocations[section][(*si)->Value].push_back(atom);
}
-
- // Finally, set alignment to the first atom so that the section contents
- // will be aligned as specified by the object section header.
- _definedAtomLocations[section][0][0]->setAlignment(getAlignment(section));
return std::error_code();
}
AtomizeDefinedSymbolsInSection(section, symbols, atoms))
return ec;
+ // Set alignment to the first atom so that the section contents
+ // will be aligned as specified by the object section header.
+ if (atoms.size() > 0)
+ atoms[0]->setAlignment(getAlignment(section));
+
// Connect atoms with layout-before/layout-after edges.
connectAtomsWithLayoutEdge(atoms);
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
Alignment: 0
SectionData: 22
+ - Name: .bss$1
+ Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
+ Alignment: 16
+ SectionData: 0000
+ - Name: .bss$2
+ Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
+ Alignment: 16
+ SectionData: 0000
symbols:
- Name: .text
Value: 0
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: .bss$1
+ Value: 0
+ SectionNumber: 6
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ - Name: .bss$2
+ Value: 0
+ SectionNumber: 7
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
...
# RUN: yaml2obj %p/Inputs/alignment.obj.yaml > %t.obj
#
-# RUN: lld -flavor link /out:%t.exe /subsystem:console /force /entry:start \
-# RUN: -- %t.obj
+# RUN: lld -flavor link /out:%t.exe /subsystem:console /force \
+# RUN: /entry:start /opt:noref -- %t.obj
# RUN: llvm-readobj -sections %t.exe | FileCheck %s
+CHECK: Name: .bss (2E 62 73 73 00 00 00 00)
+CHECK: RawDataSize: 18
+
CHECK: Name: .data (2E 64 61 74 61 00 00 00)
CHECK-NEXT: VirtualSize: 0x6