Browse Source

* preserve the actual file size (before aligning it to even bytes), when adding files to .a archives

git-svn-id: trunk@45278 -
nickysn 5 years ago
parent
commit
be26429159
1 changed files with 5 additions and 1 deletions
  1. 5 1
      compiler/owar.pas

+ 5 - 1
compiler/owar.pas

@@ -235,12 +235,16 @@ implementation
     procedure tarobjectwriter.closefile;
       const
         LF:char=#10;
+      var
+        filesize:longint;
       begin
+        { preserve file size, before aligning on an even boundary }
+        filesize:=ardata.size-objpos-sizeof(tarhdr);
         { align on an even boundary, by inserting an LF if necessary }
         if odd(ardata.size) then
           write(LF,1);
         { fix the size in the header }
-        createarhdr(objfn,ardata.size-objpos-sizeof(tarhdr),'42','42','644');
+        createarhdr(objfn,filesize,'42','42','644');
         { write the header }
         ardata.seek(objpos);
         ardata.write(arhdr,sizeof(tarhdr));