* workaround for issue #30348, FPC allowes now 65535 sections in coff object files, but as the section index is normally signed, this is only a dirty workaround

git-svn-id: trunk@34904 -
This commit is contained in:
florian 2016-11-15 22:06:00 +00:00
parent 8e3381b4bc
commit 3f072b3e29
3 changed files with 21 additions and 4 deletions

1
.gitattributes vendored
View File

@ -15230,6 +15230,7 @@ tests/webtbs/tw3028.pp svneol=native#text/plain
tests/webtbs/tw30299.pp svneol=native#text/plain
tests/webtbs/tw30310.pp svneol=native#text/plain
tests/webtbs/tw30329.pp -text svneol=native#text/plain
tests/webtbs/tw30348.pp svneol=native#text/pascal
tests/webtbs/tw30357.pp svneol=native#text/pascal
tests/webtbs/tw3038.pp svneol=native#text/plain
tests/webtbs/tw3041.pp svneol=native#text/plain

View File

@ -168,7 +168,7 @@ interface
{ Convert symidx -> TObjSymbol }
FSymTbl : ^TObjSymbolArray;
{ Convert secidx -> TObjSection }
FSecCount : smallint;
FSecCount : Longint;
FSecTbl : ^TObjSectionArray;
win32 : boolean;
function GetSection(secidx:longint):TObjSection;
@ -1583,6 +1583,7 @@ const pemagic : array[0..3] of byte = (
result:=nil;
if (secidx<1) or (secidx>FSecCount) then
begin
writeln(secidx,' ',FSecCount);
InputError('Failed reading coff file, invalid section index');
exit;
end;
@ -1751,7 +1752,7 @@ const pemagic : array[0..3] of byte = (
else
begin
bind:=AB_GLOBAL;
objsec:=GetSection(sym.section);
objsec:=GetSection(word(sym.section));
if sym.value>=objsec.mempos then
address:=sym.value-objsec.mempos;
end;
@ -1768,7 +1769,7 @@ const pemagic : array[0..3] of byte = (
{ do not add constants (section=-1) }
if sym.section<>-1 then
begin
objsec:=GetSection(sym.section);
objsec:=GetSection(word(sym.section));
if sym.value>=objsec.mempos then
address:=sym.value-objsec.mempos;
objsym:=CreateSymbol(strname);
@ -1782,7 +1783,7 @@ const pemagic : array[0..3] of byte = (
COFF_SYM_SECTION :
begin
{ GetSection checks that index is in range }
objsec:=GetSection(sym.section);
objsec:=GetSection(word(sym.section));
if assigned(objsec) then
begin
if sym.value>=objsec.mempos then

15
tests/webtbs/tw30348.pp Normal file
View File

@ -0,0 +1,15 @@
{ %os=win32,win64 }
program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes, JwaWindows
{ you can add units after this };
begin
end.