Hi,

On Thu, Oct 26, 2017 at 12:37 PM, Jim Hall <jh...@freedos.org> wrote:
>> On Thu, 26 Oct 2017, David McMackins wrote:
>>
>>> I have been informed that gcc has a -m16 flag that actually outputs
>>> binaries that can run in 16-bit mode. Is there then anything stopping
>>> FreeDOS from being compiled fully with gcc?

It took a bit of searching, but I vaguely remembered this being
discussed before:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59672

Long story short: it seems to be only meant to simplify automatically
using (BinUtils) ".code16gcc" in sources without resorting to messy
hacks. It's mainly used by Linux kernel devs (apparently), so only
very limited and specific use, not fully general 16-bit support.

>>> If not, why are we still using Watcom?

Nobody has put in the work to convert to other compilers. (There's
still support for TurboC and one or two others [DMC?] in the kernel
but nothing better / free-r than OpenWatcom.)

There's also little concrete advantage to using, say, DJGPP, besides
just bragging how "free" we are. It also might make the kernel 386+
only. (But, honestly, I wish somebody would indeed convert it to
GCC/DJGPP, even if 386+ only. That does not preclude us from also
supporting 16-bit builds at the same time.)

Maybe SmallerC would be a better target? It's 386+ only but fairly
good, free/libre, compiles itself ... but it doesn't support Compact
model (though it does support Huge).

> On Thu, Oct 26, 2017 at 8:48 AM, Steve Nickolas <usots...@buric.co> wrote:
>> Pretty sure that GCC, if it supports 8088/286 at all, can't handle all the
>> memory models (this was, iirc, DJ Delorie's justification for why DJGPP
>> would only do 386+ binaries - think he said it would at best only support
>> the tiny and small models, and some of the FreeDOS tools need other memory
>> models.)

Tiny and Small are better than nothing. AFAIK, DOS-C used to use Small
model. FreeCOM also uses Small model too, IIRC.

There is one guy continuing the work of another guy with experimental
(out of tree?) 8086-elf support for GCC ("GCC IA16"), and it works,
but it still has a ways to go to do better than Tiny and Small (.COM
only).

FreePascal (since 3.0.0 in 2015, currently at 3.0.2 with 3.0.4 coming
soon) has i8086-msdos cross-target nowadays. It supports all memory
models (Tiny, Small, Medium, Compact, Large ... except Huge, that's
trunk only, aka 3.1.1 or whatever, unofficial snapshots only). Since
it supports "{$mode tp}" (aka, "-Mtp") and Turbo Pascal was widely
popular in DOS circles, I think that's a reasonable choice for porting
(old or new) code to DOS. (It's cross only, for now, but you can host
the Win32 .EXEs under HX/DOS.)

> It would be interesting to try GCC in 16-bit mode. I wonder if this
> works in the DJGPP version, which is the version of GCC (5.5) that
> runs on DOS.

The latest DJGPP is 2.05 (stable/current since 2015), and their latest
GCC is 7.2.0. But they also have builds of older supported versions,
e.g. 6.4.0 and 5.5.0 (which you're referring to here), for
completeness. We're not stuck to 5.5.0, in case anyone misunderstood.
Both the Zip Picker and mini FAQ both point to 7.2.0 as latest (with
BinUtils 2.29.1). There is apparently partial (unofficial?) support
for --gc-sections now, too. But all of that is still 32-bit DPMI only
(for now). There has not been any attempt to build "GCC IA16" suite
with DJGPP as host.

> Steve raises a good point about the memory models. DOS compilers
> (including Watcom) can generate different executable memory models,
> suitable for different sizes of applications. Some FreeDOS programs
> use Tiny memory model, for example.
>
> David: would you like to try compiling some FreeDOS programs under GCC
> using -m16 flag? The Kernel is big project, so starting with some
> utilities would be a good first experiment.

All of the TurboC ports should be deprecated in lieu of OpenWatcom
(or, better yet, DJGPP). FreeDOS needs to be "Free". I know some here
have a hard time accepting this, but we really need to focus on using
Free tools. That doesn't mean you can't also support others at the
same time. It also doesn't mean that we're forcing 386+ DJGPP as
exclusive main compiler.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to