Просмотр исходного кода

Merged revisions 957-958,992 via svnmerge from
/trunk

git-svn-id: branches/fixes_2_0@1006 -

peter 20 лет назад
Родитель
Сommit
69ae8235c5
5 измененных файлов с 61 добавлено и 15 удалено
  1. 1 0
      .gitattributes
  2. 8 4
      utils/Makefile
  3. 3 2
      utils/Makefile.fpc
  4. 11 9
      utils/fpcres/elfres.pas
  5. 38 0
      utils/fpcres/resptrs.as

+ 1 - 0
.gitattributes

@@ -6105,6 +6105,7 @@ utils/fpcres/elfres.pas svneol=native#text/plain
 utils/fpcres/elfresfix.pas svneol=native#text/plain
 utils/fpcres/fpcres.lpi svneol=native#text/plain
 utils/fpcres/fpcres.pas svneol=native#text/plain
+utils/fpcres/resptrs.as -text
 utils/fpdoc/COPYING -text
 utils/fpdoc/Makefile svneol=native#text/plain
 utils/fpdoc/Makefile.fpc svneol=native#text/plain

+ 8 - 4
utils/Makefile

@@ -239,13 +239,13 @@ ifeq ($(FULL_TARGET),i386-go32v2)
 override TARGET_DIRS+=fpcm tply h2pas fprcp dxegen fpdoc
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_DIRS+=fpcm tply h2pas fprcp dxegen fpdoc  fpmc
+override TARGET_DIRS+=fpcm tply h2pas fprcp dxegen fpdoc  fpmc fpcres
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 override TARGET_DIRS+=fpcm tply h2pas fprcp dxegen fpdoc
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_DIRS+=fpcm tply h2pas fprcp dxegen fpdoc
+override TARGET_DIRS+=fpcm tply h2pas fprcp dxegen fpdoc  fpcres
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 override TARGET_DIRS+=fpcm tply h2pas fprcp dxegen fpdoc
@@ -284,7 +284,7 @@ ifeq ($(FULL_TARGET),m68k-linux)
 override TARGET_DIRS+=fpcm tply h2pas fprcp dxegen fpdoc  fpcres
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_DIRS+=fpcm tply h2pas fprcp dxegen fpdoc
+override TARGET_DIRS+=fpcm tply h2pas fprcp dxegen fpdoc  fpcres
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 override TARGET_DIRS+=fpcm tply h2pas fprcp dxegen fpdoc
@@ -329,7 +329,7 @@ ifeq ($(FULL_TARGET),x86_64-linux)
 override TARGET_DIRS+=fpcm tply h2pas fprcp dxegen fpdoc  fpcres
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_DIRS+=fpcm tply h2pas fprcp dxegen fpdoc
+override TARGET_DIRS+=fpcm tply h2pas fprcp dxegen fpdoc  fpcres
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 override TARGET_DIRS+=fpcm tply h2pas fprcp dxegen fpdoc
@@ -2619,6 +2619,7 @@ TARGET_DIRS_FPRCP=1
 TARGET_DIRS_DXEGEN=1
 TARGET_DIRS_FPDOC=1
 TARGET_DIRS_FPMC=1
+TARGET_DIRS_FPCRES=1
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 TARGET_DIRS_FPCM=1
@@ -2635,6 +2636,7 @@ TARGET_DIRS_H2PAS=1
 TARGET_DIRS_FPRCP=1
 TARGET_DIRS_DXEGEN=1
 TARGET_DIRS_FPDOC=1
+TARGET_DIRS_FPCRES=1
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 TARGET_DIRS_FPCM=1
@@ -2740,6 +2742,7 @@ TARGET_DIRS_H2PAS=1
 TARGET_DIRS_FPRCP=1
 TARGET_DIRS_DXEGEN=1
 TARGET_DIRS_FPDOC=1
+TARGET_DIRS_FPCRES=1
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 TARGET_DIRS_FPCM=1
@@ -2863,6 +2866,7 @@ TARGET_DIRS_H2PAS=1
 TARGET_DIRS_FPRCP=1
 TARGET_DIRS_DXEGEN=1
 TARGET_DIRS_FPDOC=1
+TARGET_DIRS_FPCRES=1
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 TARGET_DIRS_FPCM=1

+ 3 - 2
utils/Makefile.fpc

@@ -7,10 +7,11 @@ name=utils
 version=2.0.0
 
 [target]
-dirs=fpcm tply h2pas fprcp dxegen fpdoc
+dirs=fpcm tply h2pas fprcp dxegen fpdoc 
 programs=ppdep ptop rstconv data2inc delp bin2obj postw32
-dirs_win32=fpmc
+dirs_win32=fpmc fpcres
 dirs_linux=fpcres
+dirs_freebsd=fpcres
 rsts=rstconv
 
 [require]

+ 11 - 9
utils/fpcres/elfres.pas

@@ -63,7 +63,8 @@ Index   Pointer to
 {$ifdef fpc}
 {$mode objfpc}
 {$endif}
-{$H+}
+{$h+}
+
 unit elfres;
 
 interface
@@ -226,7 +227,7 @@ procedure TElfResCreator.DoAlign(const a: integer);
 var i: integer;
 begin
   i:=(4 - (FSectionStream.position MOD a)) MOD a;
-  if (i>0) then FSectionStream.Write(zeros,i);
+  if (i>0) then FSectionStream.Write(zeros[1],i);
 end;
 
 procedure TElfResCreator.Convert(const Source, Destination: String);
@@ -286,7 +287,7 @@ var l:longint;
     ws:WideString;
     wc:WideChar;
     name:string;
-    i: integer;
+    i,nl: integer;
     headersize:integer;
     headerstart:integer;
 begin
@@ -333,11 +334,11 @@ begin
 
   // create a hash of the name
   resinfo.reshash:=HashELF(name);
-
   // save the name plus a trailing #0 to the SymStream, also save
   // the position of this name in the SymStream
   resinfo.name:=SymStream.Position;
   name:=name+#0;
+  nl:=length(name);
   SymStream.Write(name[1],length(name));
 
   // We don't care about the rest of the header
@@ -353,7 +354,7 @@ begin
 
   // Align the data stream on a dword boundary
   i:=(4 - (DataStream.Position MOD 4)) MOD 4;
-  if (i>0) then DataStream.Write(zeros,i);
+  if (i>0) then DataStream.Write(zeros[1],i);
 end;
 
 procedure TElf32ResCreator.LoadBinaryDFMEntry(const rs:TStream; const DataStream:TMemoryStream; const SymStream:TMemoryStream; var resinfo:TELF32ResourceInfo);
@@ -494,7 +495,7 @@ begin
 
   // shstrtab - this is not aligned
   shstrtab_ofs:=FSectionStream.Position+sizeof(TElf32Header);
-  FSectionStream.Write(shstrtab,length(shstrtab));
+  FSectionStream.Write(shstrtab[1],length(shstrtab));
 
   // Write 12 section headers. The headers itself don't need to be aligned,
   // as their size can be divided by 4. As shstrtab is uneven and not aligned,
@@ -651,11 +652,11 @@ begin
   FSectionStream.Write(SectionHeader,sizeOf(SectionHeader));
 
   // now write the symbol table
-  FSectionStream.Write(symtab,length(symtab));
+  FSectionStream.Write(symtab[1],length(symtab));
   // We don't need to align it, as it's $90 in size
 
   // now write the string table, it's just a single byte
-  FSectionStream.Write(strtab,1);
+  FSectionStream.Write(strtab[1],1);
 
   // Ok, we are done, now let's really write something to disk...
 
@@ -678,7 +679,8 @@ begin
   Dest.Write(ElfHeader,sizeof(TElf32header));
 
   // And now let's dump our whole memorystream into it.
-  Dest.CopyFrom(FSectionStream,0);
+  FSectionStream.Position:=0;
+  Dest.CopyFrom(FSectionStream,FsectionStream.Size);
 end;
 
 

+ 38 - 0
utils/fpcres/resptrs.as

@@ -0,0 +1,38 @@
+.section fpc.resptrs, "a", @progbits
+        .balign 4
+.globl  FPC_RESSYMBOL
+        .type FPC_RESSYMBOL,@object
+FPC_RESSYMBOL:
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+        .long 0
+