summaryrefslogtreecommitdiff
path: root/include/llvm/MC
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-26 04:13:32 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-26 04:13:32 +0000
commit6742e34385bff89b897ef0fc930c4bca9e75ac4a (patch)
tree2f287695b6a793d472137ce08c2328c82046e6b6 /include/llvm/MC
parent5e835967dd5dda294d0ef3392f4c1d4a2260f532 (diff)
downloadllvm-6742e34385bff89b897ef0fc930c4bca9e75ac4a.tar.gz
llvm-6742e34385bff89b897ef0fc930c4bca9e75ac4a.tar.bz2
llvm-6742e34385bff89b897ef0fc930c4bca9e75ac4a.tar.xz
llvm-mc/Mach-O: Add section padding where needed (to align the next section).
Also, simplify some of Mach-O writer code which can now use section addresses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80067 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC')
-rw-r--r--include/llvm/MC/MCAssembler.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h
index ce9dca1ae1..0da729b3ee 100644
--- a/include/llvm/MC/MCAssembler.h
+++ b/include/llvm/MC/MCAssembler.h
@@ -82,7 +82,7 @@ public:
uint64_t getAddress() const;
- unsigned getFileSize() const {
+ uint64_t getFileSize() const {
assert(FileSize != ~UINT64_C(0) && "File size not set!");
return FileSize;
}
@@ -267,6 +267,9 @@ private:
/// initialized.
uint64_t Address;
+ /// Size - The content size of this section. This is ~0 until initialized.
+ uint64_t Size;
+
/// FileSize - The size of this section in the object file. This is ~0 until
/// initialized.
uint64_t FileSize;
@@ -305,13 +308,19 @@ public:
//
// FIXME: This could all be kept private to the assembler implementation.
- unsigned getAddress() const {
+ uint64_t getAddress() const {
assert(Address != ~UINT64_C(0) && "Address not set!");
return Address;
}
void setAddress(uint64_t Value) { Address = Value; }
- unsigned getFileSize() const {
+ uint64_t getSize() const {
+ assert(Size != ~UINT64_C(0) && "File size not set!");
+ return Size;
+ }
+ void setSize(uint64_t Value) { Size = Value; }
+
+ uint64_t getFileSize() const {
assert(FileSize != ~UINT64_C(0) && "File size not set!");
return FileSize;
}
@@ -414,7 +423,11 @@ private:
/// LayoutSection - Assign offsets and sizes to the fragments in the section
/// \arg SD, and update the section size. The section file offset should
/// already have been computed.
- void LayoutSection(MCSectionData &SD);
+ ///
+ /// \param NextAlign - The alignment for the section end address, which may
+ /// add padding bytes to the section (these are included in the section "file"
+ /// size, but not its regular size).
+ void LayoutSection(MCSectionData &SD, unsigned NextAlign);
public:
/// Construct a new assembler instance.