Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to index page
Thread view  Board view
roytam

03.01.2022, 09:44
 

FreeDOS/FreeCOM: which compiler produces smallest binary? (Developers)

Since FreeDOS kernel and/or FreeCOM supports different C compilers, I wonder if there is a comparison for those compilers for compiling FreeDOS/FreeCOM?

Guti

Homepage

03.01.2022, 15:34

@ roytam
 

FreeDOS/FreeCOM: which compiler produces smallest binary?

> Since FreeDOS kernel and/or FreeCOM supports different C compilers, I
> wonder if there is a comparison for those compilers for compiling
> FreeDOS/FreeCOM?

Great work!

---
Visit my personal blog at https://www.javiergutierrezchamorro.com

tom

Homepage

Germany (West),
03.01.2022, 16:10

@ roytam
 

FreeDOS/FreeCOM: which compiler produces smallest binary?

> Since FreeDOS kernel and/or FreeCOM supports different C compilers, I
> wonder if there is a comparison for those compilers for compiling
> FreeDOS/FreeCOM?

smallest code usually Watcom, gcc similar, Turbo ~15% larger.

however UPX compresses Turbo code better, so often the binary is smaller.

of course this depends a lot on

a) the amount of runtime library pulled in by your code
b) the memory model
c) CPU type
d) calling conventions
e) the kind of code that you wrote (watcom optimizer optimizes much better then turbo)

so you have to do your own experiments.

glennmcc

Homepage E-mail

North Jackson, Ohio (USA),
03.01.2022, 17:58

@ tom
 

FreeDOS/FreeCOM: which compiler produces smallest binary?

> > Since FreeDOS kernel and/or FreeCOM supports different C compilers, I
> > wonder if there is a comparison for those compilers for compiling
> > FreeDOS/FreeCOM?
>
> smallest code usually Watcom, gcc similar, Turbo ~15% larger.
>
> however UPX compresses Turbo code better, so often the binary is smaller.
>
> of course this depends a lot on
>
> a) the amount of runtime library pulled in by your code
> b) the memory model
> c) CPU type
> d) calling conventions
> e) the kind of code that you wrote (watcom optimizer optimizes much better
> then turbo)
>
> so you have to do your own experiments.

IMO,

Way back when storage space was very expensive, file size was quite important.

However, now that storage space is 'dirt cheap'... file size is pretty-much irrelevant.

It's the actual efficiency of operation of the resulting binary that matters most.
(speed, memory usage, etc...)

In the early 1990's I bought a 250meg HDD for $300
(1TB would have required 4,000 of those at a total cost of $1,200,000)

A year ago I bought a 1TB USB HDD for $28

---
--
http://glennmcc.org/

roytam

04.01.2022, 03:50

@ glennmcc
 

FreeDOS/FreeCOM: which compiler produces smallest binary?

> > > Since FreeDOS kernel and/or FreeCOM supports different C compilers, I
> > > wonder if there is a comparison for those compilers for compiling
> > > FreeDOS/FreeCOM?
> >
> > smallest code usually Watcom, gcc similar, Turbo ~15% larger.
> >
> > however UPX compresses Turbo code better, so often the binary is
> smaller.
> >
> > of course this depends a lot on
> >
> > a) the amount of runtime library pulled in by your code
> > b) the memory model
> > c) CPU type
> > d) calling conventions
> > e) the kind of code that you wrote (watcom optimizer optimizes much
> better
> > then turbo)
> >
> > so you have to do your own experiments.
>
> IMO,
>
> Way back when storage space was very expensive, file size was quite
> important.
>
> However, now that storage space is 'dirt cheap'... file size is pretty-much
> irrelevant.
>
> It's the actual efficiency of operation of the resulting binary that
> matters most.
> (speed, memory usage, etc...)

totally agreed, and this is what I really asked for originally.

RayeR

Homepage

CZ,
04.01.2022, 05:38

@ glennmcc
 

FreeDOS/FreeCOM: which compiler produces smallest binary?

> However, now that storage space is 'dirt cheap'... file size is pretty-much
> irrelevant.
>
> It's the actual efficiency of operation of the resulting binary that
> matters most.
> (speed, memory usage, etc...)

Except embedded. In my ROMOS I had to fit FD kernel inside less than 64kB of ROM segment (I had to throw away some FD kernel code). Also there are still machines with very small "SSD" e.g. I have one with 2MB DiskOnChip so every (k)B counts :)
http://oldcomp.cz/download/file.php?id=13787&mode=view
So this comparison of compilers may still be relevant for somebody...

---
DOS gives me freedom to unlimited HW access.

marcov

04.01.2022, 11:04

@ RayeR
 

FreeDOS/FreeCOM: which compiler produces smallest binary?

> Except embedded. In my ROMOS I had to fit FD kernel inside less than 64kB
> of ROM segment (I had to throw away some FD kernel code). Also there are
> still machines with very small "SSD" e.g. I have one with 2MB DiskOnChip so
> every (k)B counts :)
> http://oldcomp.cz/download/file.php?id=13787&mode=view
> So this comparison of compilers may still be relevant for somebody...

People with extreme needs should always do their own research for their exact circumstances (minimal processor etc), and not rely on generic lists for generic processors.

Ringding

04.01.2022, 12:13

@ glennmcc
 

FreeDOS/FreeCOM: which compiler produces smallest binary?

For DOS, it’s irrelevant how much it costs. The amount of available memory is fixed, and every byte that’s consumed by the system is one byte less that’s available for user programs.

bretjohn

Homepage E-mail

Rio Rancho, NM,
04.01.2022, 18:12

@ Ringding
 

FreeDOS/FreeCOM: which compiler produces smallest binary?

There are three different things being talked about here: size on disk, size in memory, and speed. While those are all interrelated, they are somewhat independent. In general, small disk size = small memory size = faster, but that is not ALWAYS true. There is a fourth category to add to the list also, which is maintainability. All of those things matter to different degrees for different situations (e.g., there are still floppy distributions being made for FreeDOS where size on disk matters A LOT.

When you're writing and compiling/assembling/linking programs, there are always tradeoffs between the different categories, and which one is more important depends on the situation and environment.

marcov

04.01.2022, 23:21

@ tom
 

FreeDOS/FreeCOM: which compiler produces smallest binary?

> smallest code usually Watcom, gcc similar, Turbo ~15% larger.
>
Strange btw that a 32-bit compiler (gcc) generates smaller code than a 16-bit compiler (turbo).

tom

Homepage

Germany (West),
04.01.2022, 23:55

@ marcov
 

FreeDOS/FreeCOM: which compiler produces smallest binary?

> > smallest code usually Watcom, gcc similar, Turbo ~15% larger.
> >
> Strange btw that a 32-bit compiler (gcc) generates smaller code than a
> 16-bit compiler (turbo).

not strange at all.

both generate 16-bit code.

and with much more memory available (and 15+ years of development),
~2019 gcc has all the chances to be better than ~1995 TC.

RayeR

Homepage

CZ,
06.01.2022, 03:27

@ marcov
 

FreeDOS/FreeCOM: which compiler produces smallest binary?

> Strange btw that a 32-bit compiler (gcc) generates smaller code than a
> 16-bit compiler (turbo).

I think it's meant GCC IA-16
https://github.com/tkchia/build-ia16/releases
that is probably better optimized for 16b targets...
BTW I didn't know that FD kernel can be compiled with it, are there prepared makefiles for it in FDK package?

---
DOS gives me freedom to unlimited HW access.

Oso2k

06.01.2022, 04:27

@ RayeR
 

FreeDOS/FreeCOM: which compiler produces smallest binary?

> > Strange btw that a 32-bit compiler (gcc) generates smaller code than a
> > 16-bit compiler (turbo).
>
> I think it's meant GCC IA-16
> https://github.com/tkchia/build-ia16/releases
> that is probably better optimized for 16b targets...
> BTW I didn't know that FD kernel can be compiled with it, are there
> prepared makefiles for it in FDK package?

A regular gcc can also produce 16 bit COM file if you know the right flags and linker inputs. However Tk Chia’s work does that more naturally with a bunch of support code for libc, memory models, and other things one would expect from a 16 bit DOS compiler.


https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html

https://nullprogram.com/blog/2014/12/09/

tkchia

Homepage

06.01.2022, 14:29

@ Oso2k
 

FreeDOS/FreeCOM: which compiler produces smallest binary?

Hello Oso2k,

> A regular gcc can also produce 16 bit COM file if you know the right flags
> and linker inputs. However Tk Chia’s work does that more naturally with

Not exactly. Mainline GCC's -m16 flag will output code that requires an 80386 or above. The code will essentially be 32-bit code — with 32-bit registers etc. — except that it runs in 16-bit real/protected/V86 mode.

gcc-ia16 in contrast will output code that can run on an 8086, 80186, or 80286.

Thank you!

---
https://gitlab.com/tkchia · https://codeberg.org/tkchia · 😴 "MOV AX,0D500H+CMOS_REG_D+NMI"

RayeR

Homepage

CZ,
07.01.2022, 04:33

@ tkchia
 

FreeDOS/FreeCOM: which compiler produces smallest binary?

OK, and is FreeDOS kernel source ready to compile with it out of the box or do I need mess with alternate makefile? I guess it use GNU make that is not compatible with BC/WC makefiles from FD...

---
DOS gives me freedom to unlimited HW access.

roytam

07.01.2022, 15:30

@ RayeR
 

FreeDOS/FreeCOM: which compiler produces smallest binary?

> OK, and is FreeDOS kernel source ready to compile with it out of the box or
> do I need mess with alternate makefile? I guess it use GNU make that is not
> compatible with BC/WC makefiles from FD...

it works in cross-compile from linux, but DJGPP make + precompiled i16gcc doesn't work.

RayeR

Homepage

CZ,
07.01.2022, 18:56

@ roytam
 

FreeDOS/FreeCOM: which compiler produces smallest binary?

> it works in cross-compile from linux, but DJGPP make + precompiled i16gcc
> doesn't work.

Aha, that's a pity, DOS stuff should be buildable under DOS, thanks for info.

---
DOS gives me freedom to unlimited HW access.

andrewbird

Cornwall, UK,
07.01.2022, 19:38

@ RayeR
 

FreeDOS/FreeCOM: which compiler produces smallest binary?

> > it works in cross-compile from linux, but DJGPP make + precompiled
> i16gcc
> > doesn't work.
>
> Aha, that's a pity, DOS stuff should be buildable under DOS, thanks for
> info.

I don't see any reason why it won't work for the kernel, but FreeCOM's gcc Makefiles that are used for cross-compilation are created on the fly from the Watcom one using Unix tools. Some interested party would need to do the work for that to make it happen on DOS. Personally I'd prefer to have GNU make used for all the compiler flavours, but I expect there are reasons why not.

tom

Homepage

Germany (West),
08.01.2022, 22:33

@ RayeR
 

FreeDOS/FreeCOM: which compiler produces smallest binary?

> > it works in cross-compile from linux, but DJGPP make + precompiled
> i16gcc
> > doesn't work.
>
> Aha, that's a pity, DOS stuff should be buildable under DOS, thanks for
> info.

yes absolutely.

and since this is a 16-bit operating system, it should be buildable by a 16-bit compiler, not requiring a 386+ CPU and multiple MBs of memory.

:-P

Back to index page
Thread view  Board view
22049 Postings in 2034 Threads, 396 registered users, 185 users online (0 registered, 185 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum