mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-30 17:51:32 +01:00 
			
		
		
		
	* compile fixes
git-svn-id: trunk@2826 -
This commit is contained in:
		
							parent
							
								
									5ece7cbc2f
								
							
						
					
					
						commit
						0a0659da77
					
				| @ -51,7 +51,7 @@ interface | |||||||
|     {# Returns the value in @va(x) swapped to different endian } |     {# Returns the value in @va(x) swapped to different endian } | ||||||
|     function SwapWord(x : word): word;{$ifdef USEINLINE}inline;{$endif} |     function SwapWord(x : word): word;{$ifdef USEINLINE}inline;{$endif} | ||||||
|     {# Returns the value in @va(x) swapped to different endian } |     {# Returns the value in @va(x) swapped to different endian } | ||||||
|     Function SwapQWord(x : qword) : qword{$ifdef USEINLINE}inline;{$endif} |     Function SwapQWord(x : qword) : qword;{$ifdef USEINLINE}inline;{$endif} | ||||||
|     {# Return value @var(i) aligned on @var(a) boundary } |     {# Return value @var(i) aligned on @var(a) boundary } | ||||||
|     function align(i,a:longint):longint;{$ifdef USEINLINE}inline;{$endif} |     function align(i,a:longint):longint;{$ifdef USEINLINE}inline;{$endif} | ||||||
| 
 | 
 | ||||||
| @ -213,7 +213,7 @@ uses | |||||||
|       End; |       End; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     Function SwapQWord(x : qword) : qword{$ifdef USEINLINE}inline;{$endif} |     Function SwapQWord(x : qword) : qword;{$ifdef USEINLINE}inline;{$endif} | ||||||
|       Begin |       Begin | ||||||
|         result:=swaplong(longint(hi(x))); |         result:=swaplong(longint(hi(x))); | ||||||
|         result:=result or (swaplong(longint(lo(x))) shl 32); |         result:=result or (swaplong(longint(lo(x))) shl 32); | ||||||
|  | |||||||
| @ -82,6 +82,7 @@ interface | |||||||
|          procedure createsymtab; |          procedure createsymtab; | ||||||
|          procedure writesectionheader(s:TElf32ObjSection); |          procedure writesectionheader(s:TElf32ObjSection); | ||||||
|          procedure writesectiondata(s:TElf32ObjSection); |          procedure writesectiondata(s:TElf32ObjSection); | ||||||
|  |          procedure write_internal_symbol(astridx:longint;ainfo:byte;ashndx:word); | ||||||
|          procedure section_write_symbol(p:TObject;arg:pointer); |          procedure section_write_symbol(p:TObject;arg:pointer); | ||||||
|          procedure section_write_sh_string(p:TObject;arg:pointer); |          procedure section_write_sh_string(p:TObject;arg:pointer); | ||||||
|          procedure section_count_sections(p:TObject;arg:pointer); |          procedure section_count_sections(p:TObject;arg:pointer); | ||||||
| @ -701,6 +702,9 @@ implementation | |||||||
| 
 | 
 | ||||||
|     procedure TElf32ObjectOutput.createrelocsection(s:TElf32ObjSection); |     procedure TElf32ObjectOutput.createrelocsection(s:TElf32ObjSection); | ||||||
|       var |       var | ||||||
|  | {$ifdef ver2_0_0} | ||||||
|  |         relnative, | ||||||
|  | {$endif ver2_0_0} | ||||||
|         rel  : telfreloc; |         rel  : telfreloc; | ||||||
|         r    : TObjRelocation; |         r    : TObjRelocation; | ||||||
|         relsym,reltyp : longint; |         relsym,reltyp : longint; | ||||||
| @ -790,33 +794,54 @@ implementation | |||||||
|               rel.info:=(relsym shl 8) or reltyp; |               rel.info:=(relsym shl 8) or reltyp; | ||||||
| {$endif cpu64bit} | {$endif cpu64bit} | ||||||
|               { write reloc } |               { write reloc } | ||||||
|  | {$ifdef ver2_0_0} | ||||||
|  |               relnative:=MaybeSwapElfReloc(rel); | ||||||
|  |               s.relocsect.write(relnative,sizeof(rel)); | ||||||
|  | {$else} | ||||||
|               s.relocsect.write(MaybeSwapElfReloc(rel),sizeof(rel)); |               s.relocsect.write(MaybeSwapElfReloc(rel),sizeof(rel)); | ||||||
|  | {$endif ver2_0_0} | ||||||
|               r:=TObjRelocation(r.next); |               r:=TObjRelocation(r.next); | ||||||
|             end; |             end; | ||||||
|          end; |          end; | ||||||
|       end; |       end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     procedure TElf32ObjectOutput.section_write_symbol(p:TObject;arg:pointer); |     procedure TElf32ObjectOutput.write_internal_symbol(astridx:longint;ainfo:byte;ashndx:word); | ||||||
|       var |       var | ||||||
|  | {$ifdef ver2_0_0} | ||||||
|  |         elfsymnative, | ||||||
|  | {$endif ver2_0_0} | ||||||
|         elfsym : telfsymbol; |         elfsym : telfsymbol; | ||||||
|       begin |       begin | ||||||
|         fillchar(elfsym,sizeof(elfsym),0); |         fillchar(elfsym,sizeof(elfsym),0); | ||||||
|         elfsym.st_name:=TElf32ObjSection(p).shstridx; |         elfsym.st_name:=astridx; | ||||||
|         elfsym.st_info:=STT_SECTION; |         elfsym.st_info:=ainfo; | ||||||
|         elfsym.st_shndx:=TElf32ObjSection(p).secshidx; |         elfsym.st_shndx:=ashndx; | ||||||
|         TObjSection(p).secsymidx:=symidx; |  | ||||||
|         inc(symidx); |         inc(symidx); | ||||||
|         inc(localsyms); |         inc(localsyms); | ||||||
|  | {$ifdef ver2_0_0} | ||||||
|  |         elfsymnative:=MaybeSwapElfSymbol(elfsym); | ||||||
|  |         elf32data.symtabsect.write(elfsymnative,sizeof(elfsym)); | ||||||
|  | {$else} | ||||||
|         elf32data.symtabsect.write(MaybeSwapElfSymbol(elfsym),sizeof(elfsym)); |         elf32data.symtabsect.write(MaybeSwapElfSymbol(elfsym),sizeof(elfsym)); | ||||||
|  | {$endif ver2_0_0} | ||||||
|  |       end; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     procedure TElf32ObjectOutput.section_write_symbol(p:TObject;arg:pointer); | ||||||
|  |       begin | ||||||
|  |         TObjSection(p).secsymidx:=symidx; | ||||||
|  |         write_internal_symbol(TElf32ObjSection(p).shstridx,STT_SECTION,TElf32ObjSection(p).secshidx); | ||||||
|       end; |       end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     procedure TElf32ObjectOutput.createsymtab; |     procedure TElf32ObjectOutput.createsymtab; | ||||||
|       var |       var | ||||||
|  | {$ifdef ver2_0_0} | ||||||
|  |         elfsymnative, | ||||||
|  | {$endif} | ||||||
|         elfsym : telfsymbol; |         elfsym : telfsymbol; | ||||||
|         i, |         i      : longint; | ||||||
|         locals : longint; |  | ||||||
|         objsym : TObjSymbol; |         objsym : TObjSymbol; | ||||||
|       begin |       begin | ||||||
|         with elf32data do |         with elf32data do | ||||||
| @ -824,17 +849,9 @@ implementation | |||||||
|            symidx:=0; |            symidx:=0; | ||||||
|            localsyms:=0; |            localsyms:=0; | ||||||
|            { empty entry } |            { empty entry } | ||||||
|            fillchar(elfsym,sizeof(elfsym),0); |            write_internal_symbol(0,0,0); | ||||||
|            symtabsect.write(MaybeSwapElfSymbol(elfsym),sizeof(elfsym)); |  | ||||||
|            inc(symidx); |  | ||||||
|            inc(localsyms); |  | ||||||
|            { filename entry } |            { filename entry } | ||||||
|            elfsym.st_name:=1; |            write_internal_symbol(1,STT_FILE,SHN_ABS); | ||||||
|            elfsym.st_info:=STT_FILE; |  | ||||||
|            elfsym.st_shndx:=SHN_ABS; |  | ||||||
|            symtabsect.write(MaybeSwapElfSymbol(elfsym),sizeof(elfsym)); |  | ||||||
|            inc(symidx); |  | ||||||
|            inc(localsyms); |  | ||||||
|            { section } |            { section } | ||||||
|            ObjSectionList.ForEachCall(@section_write_symbol,nil); |            ObjSectionList.ForEachCall(@section_write_symbol,nil); | ||||||
|            { ObjSymbols } |            { ObjSymbols } | ||||||
| @ -891,7 +908,12 @@ implementation | |||||||
|                      end; |                      end; | ||||||
|                    objsym.symidx:=symidx; |                    objsym.symidx:=symidx; | ||||||
|                    inc(symidx); |                    inc(symidx); | ||||||
|  | {$ifdef ver2_0_0} | ||||||
|  |                    elfsymnative:=MaybeSwapElfSymbol(elfsym); | ||||||
|  |                    symtabsect.write(elfsymnative,sizeof(elfsym)); | ||||||
|  | {$else} | ||||||
|                    symtabsect.write(MaybeSwapElfSymbol(elfsym),sizeof(elfsym)); |                    symtabsect.write(MaybeSwapElfSymbol(elfsym),sizeof(elfsym)); | ||||||
|  | {$endif ver2_0_0} | ||||||
|                  end; |                  end; | ||||||
|              end; |              end; | ||||||
|            { update the .symtab section header } |            { update the .symtab section header } | ||||||
| @ -927,6 +949,9 @@ implementation | |||||||
| 
 | 
 | ||||||
|     procedure TElf32ObjectOutput.writesectionheader(s:TElf32ObjSection); |     procedure TElf32ObjectOutput.writesectionheader(s:TElf32ObjSection); | ||||||
|       var |       var | ||||||
|  | {$ifdef ver2_0_0} | ||||||
|  |         sechdrnative, | ||||||
|  | {$endif ver2_0_0} | ||||||
|         sechdr : telfsechdr; |         sechdr : telfsechdr; | ||||||
|       begin |       begin | ||||||
|         fillchar(sechdr,sizeof(sechdr),0); |         fillchar(sechdr,sizeof(sechdr),0); | ||||||
| @ -939,7 +964,12 @@ implementation | |||||||
|         sechdr.sh_info:=s.shinfo; |         sechdr.sh_info:=s.shinfo; | ||||||
|         sechdr.sh_addralign:=s.secalign; |         sechdr.sh_addralign:=s.secalign; | ||||||
|         sechdr.sh_entsize:=s.shentsize; |         sechdr.sh_entsize:=s.shentsize; | ||||||
|  | {$ifdef ver2_0_0} | ||||||
|  |         sechdrnative:=MaybeSwapSecHeader(sechdr); | ||||||
|  |         writer.write(sechdrnative,sizeof(sechdr)); | ||||||
|  | {$else} | ||||||
|         writer.write(MaybeSwapSecHeader(sechdr),sizeof(sechdr)); |         writer.write(MaybeSwapSecHeader(sechdr),sizeof(sechdr)); | ||||||
|  | {$endif ver2_0_0} | ||||||
|       end; |       end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -1008,6 +1038,9 @@ implementation | |||||||
| 
 | 
 | ||||||
|     function TElf32ObjectOutput.writedata(data:TObjData):boolean; |     function TElf32ObjectOutput.writedata(data:TObjData):boolean; | ||||||
|       var |       var | ||||||
|  | {$ifdef ver2_0_0} | ||||||
|  |         headernative, | ||||||
|  | {$endif ver2_0_0} | ||||||
|         header : telfheader; |         header : telfheader; | ||||||
|         shoffset, |         shoffset, | ||||||
|         datapos   : aint; |         datapos   : aint; | ||||||
| @ -1091,8 +1124,12 @@ implementation | |||||||
|            header.e_shnum:=nsections; |            header.e_shnum:=nsections; | ||||||
|            header.e_ehsize:=sizeof(telfheader); |            header.e_ehsize:=sizeof(telfheader); | ||||||
|            header.e_shentsize:=sizeof(telfsechdr); |            header.e_shentsize:=sizeof(telfsechdr); | ||||||
|  | {$ifdef ver2_0_0} | ||||||
|  |            headernative:=MaybeSwapHeader(header); | ||||||
|  |            writer.write(headernative,sizeof(header)); | ||||||
|  | {$else} | ||||||
|            writer.write(MaybeSwapHeader(header),sizeof(header)); |            writer.write(MaybeSwapHeader(header),sizeof(header)); | ||||||
| 
 | {$endif ver2_0_0} | ||||||
|            writer.writezeros($40-sizeof(header)); { align } |            writer.writezeros($40-sizeof(header)); { align } | ||||||
|          { Sections } |          { Sections } | ||||||
|            ObjSectionList.ForEachCall(@section_write_data,nil); |            ObjSectionList.ForEachCall(@section_write_data,nil); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 peter
						peter