Browse Source

Merged revisions 7883,7913 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk

........
r7883 | yury | 2007-07-01 02:01:22 +0300 (Вс, 01 июл 2007) | 2 lines

* Fixed resources support on Linux when internal assembler is used.
* Enabled multiple resources support on Linux.
........
r7913 | yury | 2007-07-01 22:57:09 +0300 (Вс, 01 июл 2007) | 1 line

* Don't be too strict while reading COFF symtable if obj file does not have COFF string table (to be compatible with LD and MS linkers). It fixes bug #9175.
........

git-svn-id: branches/fixes_2_2@7929 -

yury 18 years ago
parent
commit
1f5963094d
3 changed files with 16 additions and 18 deletions
  1. 1 6
      compiler/ogcoff.pas
  2. 13 10
      compiler/ogelf.pas
  3. 2 2
      compiler/systems/t_linux.pas

+ 1 - 6
compiler/ogcoff.pas

@@ -1775,12 +1775,7 @@ const pemagic : array[0..3] of byte = (
                InputError('Error reading COFF Symtable');
                InputError('Error reading COFF Symtable');
                exit;
                exit;
              end;
              end;
-           if strsize<4 then
-             begin
-               InputError('Error reading COFF Symtable');
-               exit;
-             end;
-           if not AReader.ReadArray(FCoffStrs,Strsize-4) then
+           if (strsize>4) and not AReader.ReadArray(FCoffStrs,Strsize-4) then
              begin
              begin
                InputError('Error reading COFF Symtable');
                InputError('Error reading COFF Symtable');
                exit;
                exit;

+ 13 - 10
compiler/ogelf.pas

@@ -581,7 +581,7 @@ implementation
           '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
           '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
           '.eh_frame',
           '.eh_frame',
           '.debug_frame','.debug_info','.debug_line','.debug_abbrev',
           '.debug_frame','.debug_info','.debug_line','.debug_abbrev',
-          'fpc',
+          '.fpc',
           '.toc',
           '.toc',
           '.init'
           '.init'
         );
         );
@@ -598,7 +598,7 @@ implementation
           '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
           '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
           '.eh_frame',
           '.eh_frame',
           '.debug_frame','.debug_info','.debug_line','.debug_abbrev',
           '.debug_frame','.debug_info','.debug_line','.debug_abbrev',
-          'fpc',
+          '.fpc',
           '.toc',
           '.toc',
           '.init'
           '.init'
         );
         );
@@ -614,14 +614,17 @@ implementation
         if (use_smartlink_section and
         if (use_smartlink_section and
            (aname<>'')) or (atype=sec_fpc) then
            (aname<>'')) or (atype=sec_fpc) then
           begin
           begin
-            case aorder of
-              secorder_begin :
-                sep:='.b_';
-              secorder_end :
-                sep:='.z_';
-              else
-                sep:='.n_';
-            end;
+            if (atype=sec_fpc) and (aname='resptrs') then
+              sep:='.'
+            else
+              case aorder of
+                secorder_begin :
+                  sep:='.b_';
+                secorder_end :
+                  sep:='.z_';
+                else
+                  sep:='.n_';
+              end;
             result:=secname+sep+aname
             result:=secname+sep+aname
           end
           end
         else
         else

+ 2 - 2
compiler/systems/t_linux.pas

@@ -927,7 +927,7 @@ initialization
   RegisterImport(system_i386_linux,timportliblinux);
   RegisterImport(system_i386_linux,timportliblinux);
   RegisterExport(system_i386_linux,texportliblinux);
   RegisterExport(system_i386_linux,texportliblinux);
   RegisterTarget(system_i386_linux_info);
   RegisterTarget(system_i386_linux_info);
-  RegisterRes(res_elf32_info,TResourceFile);
+  RegisterRes(res_elf32_info,TWinLikeResourceFile);
 
 
   RegisterExternalLinker(system_x86_6432_linux_info,TLinkerLinux);
   RegisterExternalLinker(system_x86_6432_linux_info,TLinkerLinux);
   RegisterImport(system_x86_6432_linux,timportliblinux);
   RegisterImport(system_x86_6432_linux,timportliblinux);
@@ -963,7 +963,7 @@ initialization
   RegisterImport(system_x86_64_linux,timportliblinux);
   RegisterImport(system_x86_64_linux,timportliblinux);
   RegisterExport(system_x86_64_linux,texportliblinux);
   RegisterExport(system_x86_64_linux,texportliblinux);
   RegisterTarget(system_x86_64_linux_info);
   RegisterTarget(system_x86_64_linux_info);
-  RegisterRes(res_elf64_info,TResourceFile);
+  RegisterRes(res_elf64_info,TWinLikeResourceFile);
 {$endif x86_64}
 {$endif x86_64}
 {$ifdef SPARC}
 {$ifdef SPARC}
   RegisterExternalLinker(system_sparc_linux_info,TLinkerLinux);
   RegisterExternalLinker(system_sparc_linux_info,TLinkerLinux);