fails to link with LLVM's lld linker" https://bugs.freepascal.org/view.php?id=32900 New bootstrap by pascal@
28 lines
1.0 KiB
Plaintext
28 lines
1.0 KiB
Plaintext
$OpenBSD: patch-fpcsrc_compiler_ogelf_pas,v 1.1 2018/10/23 14:39:56 naddy Exp $
|
|
|
|
Fix ELF section alignment.
|
|
http://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&revision=38251
|
|
|
|
Index: fpcsrc/compiler/ogelf.pas
|
|
--- fpcsrc/compiler/ogelf.pas.orig
|
|
+++ fpcsrc/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);
|