Author Topic: Tiny "c" info  (Read 212 times)

jcfuller

  • Full Member
  • ***
  • Posts: 167
    • View Profile
Tiny "c" info
« on: August 26, 2020, 04:55:23 AM »
From a post on the FreeBasic forum that might be interest some here?

https://www.freebasic.net/forum/viewtopic.php?f=17&t=28775

James

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 538
    • View Profile
Re: Tiny "c" info
« Reply #1 on: August 26, 2020, 10:53:32 AM »
Quote
(by D.J.Peters Aug 26, 2020 2:33 )
I tested the tiny c compiler "tcc" version 0.9.27
One of the new TinyCC features are the compiler option -m32/-m64

To be clear, there is nothing "new" here.

Everything inside those zips are dated 2017 and I suspect the headers and libs are older still. 



Robert

  • Sr. Member
  • ****
  • Posts: 449
    • View Profile
Re: Tiny "c" info
« Reply #2 on: August 26, 2020, 01:21:16 PM »
Quote
(by D.J.Peters Aug 26, 2020 2:33 )
I tested the tiny c compiler "tcc" version 0.9.27
One of the new TinyCC features are the compiler option -m32/-m64

To be clear, there is nothing "new" here.

Everything inside those zips are dated 2017 and I suspect the headers and libs are older still.

"New", last change, Fri, 21 Aug 2020 13:47:56 -0700 (21 22:47 +0200)

is at Git URL

git://repo.or.cz/tinycc.git


MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 538
    • View Profile
Re: Tiny "c" info
« Reply #3 on: August 26, 2020, 01:56:26 PM »
Robert,

Yes ... I visited github before I responded to JC's post.

I observed a number of forks (mirrors)

https://github.com/search?o=desc&q=tinycc&s=updated&type=Repositories

Frankly, I don't see the allure with so many better alternatives available.

Yes ... it's fast, small, and free.

Reminds me of an old engineering joke:  Cheap, fast, and correct ... pick two.

Robert

  • Sr. Member
  • ****
  • Posts: 449
    • View Profile
Re: Tiny "c" info
« Reply #4 on: August 26, 2020, 02:26:25 PM »
Robert,

Yes ... I visited github before I responded to JC's post.

I observed a number of forks (mirrors)

https://github.com/search?o=desc&q=tinycc&s=updated&type=Repositories

Frankly, I don't see the allure with so many better alternatives available.

Yes ... it's fast, small, and free.

Reminds me of an old engineering joke:  Cheap, fast, and correct ... pick two.

Hi MrBCX:

If I recall correctly, claims were made in the past that tcc would compile 64 bit inlne assembly code. I never tried it. It would be interesting to see if BCX_DYNACALL worked as a 64 bit tcc compile.

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 538
    • View Profile
Re: Tiny "c" info
« Reply #5 on: August 26, 2020, 03:04:00 PM »

Hi MrBCX:

If I recall correctly, claims were made in the past that tcc would compile 64 bit inlne assembly code. I never tried it. It would be interesting to see if BCX_DYNACALL worked as a 64 bit tcc compile.

Maybe I'll take up that challenge just to satisfy curiosity.   

The MakeGuidFromString () that I posted yesterday was initially much easier to
implement but limited to 32-bit apps only because of its dependency on Dynacall:

FUNCTION MakeGuidFromString (MyStr$, MyGUID AS LPGUID)
  FUNCTION = UuidFromString (LIB "Rpcrt4.dll", MyStr$, MyGUID)
END FUNCTION


Overcoming that 32-bit limitation is why I decided rewrite it thusly :


'FUNCTION MakeGuidFromString (MyStr$, MyGUID AS LPGUID)
'  '***************************************************
'! typedef int( __stdcall *UIDFS )(PCHAR,LPGUID);
'  '***************************************************
'  DIM hDll AS HMODULE
'  DIM MakeUUID AS UIDFS
'  LOCAL RetCode

'  hDll = LOADLIBRARY("Rpcrt4.dll")
'  IF hDll = NULL THEN
'    PRINT  "Could not load Rpcrt4.dll"
'    FUNCTION = 0
'  END IF

'  $IFDEF UNICODE
'    MakeUUID = GetProcAddress(hDll, "UuidFromStringW")
'  $ELSE
'    MakeUUID = GetProcAddress(hDll, "UuidFromStringA")
'  $ENDIF

'  IF MakeUUID = NULL THEN
'    PRINT  "Could not locate the function: UuidFromString()"
'    FreeLibrary(hDll)
'    FUNCTION = 0
'  END IF

'  RetCode = MakeUUID (MyStr$, MyGUID)
'  FreeLibrary(hDll)
'  FUNCTION = RetCode
'END FUNCTION

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 538
    • View Profile
Re: Tiny "c" info
« Reply #6 on: August 26, 2020, 03:22:14 PM »
And the answer is: NO

C:\Temp\tcc-win64>tcc -c  test.c -m64

test.c:239: error: bad operand with opcode 'pushl'


SOURCE OF ERROR:

#elif defined( __MINGW32__ ) || defined( __TINYC__)
__asm__("pushl %0" : : "r" (arg));     <<<-------------------------------------

Robert

  • Sr. Member
  • ****
  • Posts: 449
    • View Profile
Re: Tiny "c" info
« Reply #7 on: August 26, 2020, 03:32:47 PM »
And the answer is: NO

C:\Temp\tcc-win64>tcc -c  test.c -m64

test.c:239: error: bad operand with opcode 'pushl'


SOURCE OF ERROR:

#elif defined( __MINGW32__ ) || defined( __TINYC__)
__asm__("pushl %0" : : "r" (arg));     <<<-------------------------------------

Instead of "pushl" try "pushq"

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 538
    • View Profile
Re: Tiny "c" info
« Reply #8 on: August 26, 2020, 04:10:50 PM »
Sorry ... still no love ...

error: bad operand with opcode 'pushq'

Robert

  • Sr. Member
  • ****
  • Posts: 449
    • View Profile
Re: Tiny "c" info
« Reply #9 on: August 26, 2020, 04:51:41 PM »
Sorry ... still no love ...

error: bad operand with opcode 'pushq'

Thanks for that.

I had tcc setup a few years ago and am trying again but am having trouble with complaints about the Windows headers. I don't know if I have that patience for this anymore. It used to be fun but after a few times it gets old real fast.

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 538
    • View Profile
Re: Tiny "c" info
« Reply #10 on: August 26, 2020, 05:03:11 PM »
Tcc has a fraction of the headers and libs that one finds in other compiler systems.