....and the patch

Index: ogcoff.pas
===================================================================
--- ogcoff.pas  (revision 8466)
+++ ogcoff.pas  (working copy)
@@ -1763,6 +1763,7 @@
              end;
            if header.mach<>COFF_MAGIC then
              begin
+               WriteLn('Should be: ', COFF_MAGIC,' Found: ', header.mach);
                InputError('Illegal COFF Magic');
                exit;
              end;
@@ -2149,7 +2150,7 @@
         else
           header.flag:=COFF_FLAG_AR32WR or COFF_FLAG_EXE or COFF_FLAG_NORELOCS or COFF_FLAG_NOLINES;
 
-        if target_info.system in [system_i386_win32,system_arm_wince,system_i386_wince] then
+        if target_info.system in [system_i386_win32,system_arm_wince,system_i386_wince, system_i386_xbox] then
           header.flag:=header.flag or PE_FILE_32BIT_MACHINE;
 
         FWriter.write(header,sizeof(header));
@@ -2437,7 +2438,17 @@
             result:=internalobjdata.SymbolDefine(amangledname,AB_GLOBAL,AT_DATA)
           else
             idata5label:=internalobjdata.SymbolDefine('__imp_'+amangledname,AB_LOCAL,AT_DATA);
-          internalobjdata.writereloc(0,sizeof(longint),idata6label,RELOC_RVA);
+          if AOrdNr < 0 then
+            begin
+              internalobjdata.writereloc(0,sizeof(longint),idata6label,RELOC_RVA);
+            end
+          else
+            begin
+              emptyint:=AOrdNr or longint($80000000);
+              internalobjdata.writebytes(emptyint,sizeof(emptyint));              
+              emptyint:=0;
+            end;
+          
           if target_info.system=system_x86_64_win64 then
             internalobjdata.writebytes(emptyint,sizeof(emptyint));
           { text, jmp }
@@ -2754,6 +2765,18 @@
             labelprefix : '.L';
             comment : '';
           );
+          
+       as_i386_pecoffxbox_info : tasminfo =
+          (
+            id     : as_i386_pecoff;
+            idtxt  : 'PECOFF';
+            asmbin : '';
+            asmcmd : '';
+            supported_target : system_i386_xbox;
+            flags : [af_outputbinary,af_smartlink_sections];
+            labelprefix : '.L';
+            comment : '';
+          );
 
        as_i386_pecoffwdosx_info : tasminfo =
           (
@@ -2831,6 +2854,7 @@
 {$ifdef i386}
   RegisterAssembler(as_i386_coff_info,TDJCoffAssembler);
   RegisterAssembler(as_i386_pecoff_info,TPECoffAssembler);
+  RegisterAssembler(as_i386_pecoffxbox_info,TPECoffAssembler);
   RegisterAssembler(as_i386_pecoffwdosx_info,TPECoffAssembler);
   RegisterAssembler(as_i386_pecoffwince_info,TPECoffAssembler);
 {$endif i386}
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to