Author Topic: GoRc coff compatibility ??  (Read 4141 times)

jcfuller

  • Member
  • **
  • Posts: 182
GoRc coff compatibility ??
« on: October 20, 2012, 12:05:08 AM »
I think I am doing this correctly.

I am currently doing some testing with Tiny C. http://bellard.org/tcc/
According to it's doc it will link res files created with windres using:

windres -O coff app.rc -o appres.obj
tcc app.c appres.obj -o app.exe

This does in fact work quite well but means you need the whole MinGW package.

I tried using GoRc.
According to the GoRc help file the object type of the /o /fo output is coff.

GoRc /fo appres.obj app.rc


I get an unrecognized file type from tcc


James
 

Vortex

  • Member
  • *****
  • Posts: 1989
Re: GoRc coff compatibility ??
« Reply #1 on: October 20, 2012, 04:08:47 AM »
Not sure 100% but it might be a COFF relocation information issue. Does the MinGW package provides a tool to convert .res to COFF?

jcfuller

  • Member
  • **
  • Posts: 182
Re: GoRc coff compatibility ??
« Reply #2 on: October 20, 2012, 04:55:59 AM »
Vortex,
I really have no idea.
I guess a coff is not always a coff :)

I used Steve's MASM32 editor and created these from the two obj files

GoRc:
Code: [Select]

; C:\BcxRadAsm3\Bcx\Examples\Bc9\Gui_Demo\App_Ico\res\testgo.obj  1026 bytes

00000000 :4C 01 01 00 6F 44 81 50 - EC 03 00 00 01 00 00 00
00000010 :00 00 00 01 2E 72 73 72 - 63 24 30 31 00 00 00 00
00000020 :00 00 00 00 9C 03 00 00 - 3C 00 00 00 D8 03 00 00
00000030 :00 00 00 00 02 00 00 00 - 40 00 00 40 00 00 00 00
00000040 :6F 44 81 50 49 41 30 34 - 00 00 02 00 03 00 00 00
00000050 :20 00 00 80 0E 00 00 00 - 38 00 00 80 00 00 00 00
00000060 :6F 44 81 50 00 00 00 00 - 00 00 01 00 01 00 00 00
00000070 :50 00 00 80 00 00 00 00 - 6F 44 81 50 00 00 00 00
00000080 :00 00 01 00 39 30 00 00 - 68 00 00 80 00 00 00 00
00000090 :6F 44 81 50 00 00 00 00 - 00 00 01 00 09 04 00 00
000000A0 :80 00 00 00 00 00 00 00 - 6F 44 81 50 00 00 00 00
000000B0 :00 00 01 00 09 04 00 00 - 90 00 00 00 A0 00 00 00
000000C0 :E8 02 00 00 00 00 00 00 - 00 00 00 00 88 03 00 00
000000D0 :14 00 00 00 00 00 00 00 - 00 00 00 00 28 00 00 00
000000E0 :20 00 00 00 40 00 00 00 - 01 00 04 00 00 00 00 00
000000F0 :80 02 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00000100 :00 00 00 00 00 00 00 00 - 00 00 80 00 00 80 00 00
00000110 :00 80 80 00 80 00 00 00 - 80 00 80 00 80 80 00 00
00000120 :C0 C0 C0 00 80 80 80 00 - 00 00 FF 00 00 FF 00 00
00000130 :00 FF FF 00 FF 00 00 00 - FF 00 FF 00 FF FF 00 00
00000140 :FF FF FF 00 77 7F BB BB - BB BB BB B9 99 BB BB BB
00000150 :BB FF FA AA 77 7B BB BB - BB BB BB B9 99 BB BB BB
00000160 :BB BF FA AA 77 7B BB BB - BB BB BB B9 99 BB BB BB
00000170 :BB BF FA AA FF BB BB FF - FF FF FF F9 99 FF AA AF
00000180 :BB BF FA AA FF FF FF FF - FF FF FF F7 77 FF AA AF
00000190 :BB 77 7F FF FF FF FF F7 - 77 FF FF 97 77 FF AA AF
000001A0 :BB 77 7F FF FF FF FF F7 - 77 FF FF 97 77 FF FF FB
000001B0 :BB 77 7F FF FF FF FF F7 - 77 BB BB 99 9B BB BB BB
000001C0 :BB BF FF FF 99 FF FF FF - BB BB BB 99 9B BB BB BB
000001D0 :BB BF FF FF 99 99 99 9F - BB BB BB 99 9B BB BB BB
000001E0 :BF FF FF FF 99 99 99 9F - BB BB FF 99 9F FF FA AA
000001F0 :A9 9F FF FF 99 99 99 9F - BB BB BF 99 9F FF FA AA
00000200 :A9 99 99 FF FF FF FF FF - BB BB BB 99 99 BB BA AA
00000210 :A9 99 99 99 FF FF FF FF - FB BB BB 99 99 BB BB BF
00000220 :F9 99 99 99 FF FF FF FF - FF FB BB B9 99 BB BB BF
00000230 :FF FF 99 99 AA AF FF FF - AA AF FF FF FF FB BB BF
00000240 :AA AA AF FF AA AF F9 99 - AA AF FF FF FF FF BB BF
00000250 :AA AA AF FF AA AF 99 99 - AA A9 FF FF FF FB BB AA
00000260 :AA AA AF FF FF F9 99 99 - 99 99 FF FF FF BB BB AA
00000270 :AF FF FF FF FF F9 99 99 - 99 99 FF FF FB BB BB AA
00000280 :AF FF 77 7F FF 99 99 9F - FF FF FF BB BB BB BF FF
00000290 :FF FF 77 7F FF 99 99 BB - BB BB BB B7 77 BB BF FF
000002A0 :FF FF 77 7F FF 99 99 BB - BB BB BB B7 77 BF 99 9F
000002B0 :FF FF FF FF FF 99 9F BB - BB BB BB B7 77 FF 99 99
000002C0 :9F FF FF FF FF 99 9F BB - BB FF FF FF FF FF 99 99
000002D0 :99 9F FF FF FF 99 9F BB - BB FF FF FF FF FF 99 99
000002E0 :99 99 FF FF FF FA AA FB - BB FF FF FF FF FF FF 99
000002F0 :99 99 9F FF FF FA AA FB - BB BF FF FF FF FF FF FF
00000300 :F9 99 9F FF FF FA AA FB - B7 77 BF FF FF FB BB FF
00000310 :F9 99 9F FF FF FF FF FF - B7 77 BB BB BB B7 77 FF
00000320 :FF 99 9F FF F7 77 FF FF - F7 77 BB BB BB B7 77 FF
00000330 :FF 99 9F FF F7 77 FF FF - FF FB BB BB BB B7 77 FF
00000340 :FF FF FF FF 00 00 00 00 - 00 00 00 00 00 00 00 00
00000350 :00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00000360 :00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00000370 :00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00000380 :00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00000390 :00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
000003A0 :00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
000003B0 :00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
000003C0 :00 00 00 00 00 00 01 00 - 01 00 20 20 10 00 01 00
000003D0 :04 00 E8 02 00 00 01 00 - 80 00 00 00 00 00 00 00
000003E0 :07 00 90 00 00 00 00 00 - 00 00 07 00 2E 72 73 72
000003F0 :63 24 30 31 00 00 00 00 - 01 00 00 00 03 00 00 00
00000400 :00 00

And windres:

Code: [Select]

; C:\BcxRadAsm3\Bcx\Examples\Bc9\Gui_Demo\App_Ico\res\testgw.obj  1026 bytes

00000000 :4C 01 01 00 00 00 00 00 - EC 03 00 00 01 00 00 00
00000010 :00 00 04 01 2E 72 73 72 - 63 00 00 00 00 00 00 00
00000020 :00 00 00 00 9C 03 00 00 - 3C 00 00 00 D8 03 00 00
00000030 :00 00 00 00 02 00 00 00 - 40 00 30 C0 00 00 00 00
00000040 :57 7D 81 50 00 00 00 00 - 00 00 02 00 03 00 00 00
00000050 :20 00 00 80 0E 00 00 00 - 50 00 00 80 00 00 00 00
00000060 :57 7D 81 50 00 00 00 00 - 00 00 01 00 01 00 00 00
00000070 :38 00 00 80 00 00 00 00 - 57 7D 81 50 00 00 00 00
00000080 :00 00 01 00 09 04 00 00 - 80 00 00 00 00 00 00 00
00000090 :57 7D 81 50 00 00 00 00 - 00 00 01 00 39 30 00 00
000000A0 :68 00 00 80 00 00 00 00 - 57 7D 81 50 00 00 00 00
000000B0 :00 00 01 00 09 04 00 00 - 90 00 00 00 A0 00 00 00
000000C0 :E8 02 00 00 00 00 00 00 - 00 00 00 00 88 03 00 00
000000D0 :14 00 00 00 00 00 00 00 - 00 00 00 00 28 00 00 00
000000E0 :20 00 00 00 40 00 00 00 - 01 00 04 00 00 00 00 00
000000F0 :80 02 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00000100 :00 00 00 00 00 00 00 00 - 00 00 80 00 00 80 00 00
00000110 :00 80 80 00 80 00 00 00 - 80 00 80 00 80 80 00 00
00000120 :C0 C0 C0 00 80 80 80 00 - 00 00 FF 00 00 FF 00 00
00000130 :00 FF FF 00 FF 00 00 00 - FF 00 FF 00 FF FF 00 00
00000140 :FF FF FF 00 77 7F BB BB - BB BB BB B9 99 BB BB BB
00000150 :BB FF FA AA 77 7B BB BB - BB BB BB B9 99 BB BB BB
00000160 :BB BF FA AA 77 7B BB BB - BB BB BB B9 99 BB BB BB
00000170 :BB BF FA AA FF BB BB FF - FF FF FF F9 99 FF AA AF
00000180 :BB BF FA AA FF FF FF FF - FF FF FF F7 77 FF AA AF
00000190 :BB 77 7F FF FF FF FF F7 - 77 FF FF 97 77 FF AA AF
000001A0 :BB 77 7F FF FF FF FF F7 - 77 FF FF 97 77 FF FF FB
000001B0 :BB 77 7F FF FF FF FF F7 - 77 BB BB 99 9B BB BB BB
000001C0 :BB BF FF FF 99 FF FF FF - BB BB BB 99 9B BB BB BB
000001D0 :BB BF FF FF 99 99 99 9F - BB BB BB 99 9B BB BB BB
000001E0 :BF FF FF FF 99 99 99 9F - BB BB FF 99 9F FF FA AA
000001F0 :A9 9F FF FF 99 99 99 9F - BB BB BF 99 9F FF FA AA
00000200 :A9 99 99 FF FF FF FF FF - BB BB BB 99 99 BB BA AA
00000210 :A9 99 99 99 FF FF FF FF - FB BB BB 99 99 BB BB BF
00000220 :F9 99 99 99 FF FF FF FF - FF FB BB B9 99 BB BB BF
00000230 :FF FF 99 99 AA AF FF FF - AA AF FF FF FF FB BB BF
00000240 :AA AA AF FF AA AF F9 99 - AA AF FF FF FF FF BB BF
00000250 :AA AA AF FF AA AF 99 99 - AA A9 FF FF FF FB BB AA
00000260 :AA AA AF FF FF F9 99 99 - 99 99 FF FF FF BB BB AA
00000270 :AF FF FF FF FF F9 99 99 - 99 99 FF FF FB BB BB AA
00000280 :AF FF 77 7F FF 99 99 9F - FF FF FF BB BB BB BF FF
00000290 :FF FF 77 7F FF 99 99 BB - BB BB BB B7 77 BB BF FF
000002A0 :FF FF 77 7F FF 99 99 BB - BB BB BB B7 77 BF 99 9F
000002B0 :FF FF FF FF FF 99 9F BB - BB BB BB B7 77 FF 99 99
000002C0 :9F FF FF FF FF 99 9F BB - BB FF FF FF FF FF 99 99
000002D0 :99 9F FF FF FF 99 9F BB - BB FF FF FF FF FF 99 99
000002E0 :99 99 FF FF FF FA AA FB - BB FF FF FF FF FF FF 99
000002F0 :99 99 9F FF FF FA AA FB - BB BF FF FF FF FF FF FF
00000300 :F9 99 9F FF FF FA AA FB - B7 77 BF FF FF FB BB FF
00000310 :F9 99 9F FF FF FF FF FF - B7 77 BB BB BB B7 77 FF
00000320 :FF 99 9F FF F7 77 FF FF - F7 77 BB BB BB B7 77 FF
00000330 :FF 99 9F FF F7 77 FF FF - FF FB BB BB BB B7 77 FF
00000340 :FF FF FF FF 00 00 00 00 - 00 00 00 00 00 00 00 00
00000350 :00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00000360 :00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00000370 :00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00000380 :00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00000390 :00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
000003A0 :00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
000003B0 :00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
000003C0 :00 00 00 00 00 00 01 00 - 01 00 20 20 10 00 01 00
000003D0 :04 00 E8 02 00 00 01 00 - 80 00 00 00 00 00 00 00
000003E0 :07 00 90 00 00 00 00 00 - 00 00 07 00 2E 72 73 72
000003F0 :63 00 00 00 00 00 00 00 - 01 00 00 00 03 00 04 00
00000400 :00 00

I use DiffMerge and there are quite a few differences but I have no knowledge of coff file formats so it does me
little good :)


James

wjr

  • Member
  • **
  • Posts: 207
    • WJR's website
Re: GoRc coff compatibility ??
« Reply #3 on: October 20, 2012, 06:35:59 AM »
The GoRC COFF format is fine. Most of the differences you will see with DiffMerge are slight differences in the TimeDate stamp.

However, TCC expects a section name of ".rsrc" and GoRC uses ".rsrc$01" (same as Microsoft CVTRES). So you can try changing the "$01" to 00 00 00 to see if the rest works with TCC. If so, I suppose you can modify TCC (line 1322 of tccpe.c) to also allow the ".rsrc$01" case. While there, the assumption of only 1 for NumberOfSections is fine for GoRC, but not for CVTRES (have seen at least a second one ".rsrc$02").

jcfuller

  • Member
  • **
  • Posts: 182
Re: GoRc coff compatibility ??
« Reply #4 on: October 20, 2012, 07:25:12 AM »
Thanks wjr but no-go.

I have a utility that adds a res file after the fact but it throws a fault on xp. Works fine on Win7. This was what I was using when my original idea of using gorc failed.

James

jcfuller

  • Member
  • **
  • Posts: 182
Re: GoRc coff compatibility ??
« Reply #5 on: October 20, 2012, 08:11:21 AM »
Operator problem.

It appears LinlRes2Exe is working fine. Bad line in bat file

I had a lot of double colons I used instead of REM's which were fine on Win7 but I kept getting strange error messages under xp until I tracked
down to use REM's with xp. But in the meantime with all the moving of things around I phucked up the bat file!!!


James

jcfuller

  • Member
  • **
  • Posts: 182
Re: GoRc coff compatibility ??
« Reply #6 on: October 22, 2012, 07:40:27 AM »

As a matter of fact it was not the bat file but still an operator problem :)

I am able to use GoRc -> res to  a tcc exe with LinkRes2Exe.

I forgot to add:
// Tiny C support for LinkRes2Exe
#ifdef __TINYC__
  int dummy __attribute__ ((section(".rsrc")));
#endif

To my "c" source.

The funny thing is it worked fine on Win7-64 with out it ???

James