align file offset with address layout

<rdar://problem/10445047>

--- src/ld/OutputFile.cpp
+++ src/ld/OutputFile.cpp
@@ -551,8 +551,8 @@ void OutputFile::assignFileOffsets(ld::Internal& state)
 				throwf("section %s (address=0x%08llX, size=%llu) would make the output executable exceed available address range", 
 						sect->sectionName(), address, sect->size);
 		
-		if ( log ) fprintf(stderr, "  address=0x%08llX, hidden=%d, alignment=%02d, padBytes=%d, section=%s,%s\n",
-							sect->address, sect->isSectionHidden(), sect->alignment, sect->alignmentPaddingBytes, 
+		if ( log ) fprintf(stderr, "  address=0x%08llX, size=0x%08llX, hidden=%d, alignment=%02d, padBytes=%d, section=%s,%s\n",
+							sect->address, sect->size, sect->isSectionHidden(), sect->alignment, sect->alignmentPaddingBytes, 
 							sect->segmentName(), sect->sectionName());
 		// update running totals
 		if ( !sect->isSectionHidden() || hiddenSectionsOccupyAddressSpace )
@@ -569,6 +569,9 @@ void OutputFile::assignFileOffsets(ld::Internal& state)
 		if ( hasZeroForFileOffset(sect) ) {
 			// fileoff of zerofill sections is moot, but historically it is set to zero
 			sect->fileOffset = 0;
+
+			// <rdar://problem/10445047> align file offset with address layout
+			fileOffset += sect->alignmentPaddingBytes;
 		}
 		else {
 			// page align file offset at start of each segment
