summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/ogelf.pas5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/ogelf.pas b/compiler/ogelf.pas
index 8a8ee3388a..5324b8df7d 100644
--- a/compiler/ogelf.pas
+++ b/compiler/ogelf.pas
@@ -1241,7 +1241,7 @@ implementation
{ section data }
layoutsections(datapos);
{ section headers }
- shoffset:=datapos;
+ shoffset:=align(datapos,dword(Sizeof(AInt)));
inc(datapos,(nsections+1)*sizeof(telfsechdr));
{ Write ELF Header }
@@ -1277,6 +1277,9 @@ implementation
writer.writezeros($40-sizeof(header)); { align }
{ Sections }
WriteSectionContent(data);
+
+ { Align header }
+ Writer.Writezeros(Align(Writer.Size,Sizeof(AInt))-Writer.Size);
{ section headers, start with an empty header for sh_undef }
writer.writezeros(sizeof(telfsechdr));
ObjSectionList.ForEachCall(@section_write_sechdr,nil);