Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #2525

The different groups and segments of object files

From Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.com>
Newsgroups comp.compilers
Subject The different groups and segments of object files
Date 2020-06-19 23:22 +0800
Organization Easynews - www.easynews.com
Message-ID <20-06-004@comp.compilers> (permalink)

Show all headers | View raw


Dear c.compilers,

The short story is that I've been playing with the OpenWatcom code
generator.  I can use it to make a custom object file.  The platform
is 32bit x86, though I'm happy to know how things work in 16bit and
64bit modes as well.

The code generator has options I do not fully understand, and I do
not know where I can find information on this subject.  To further
complicate matters I'm unsure what questions I should be asking.

Here, I'm /exclusively/ asking about object files, as I'm at the
moment generating 32bit code without considerations for physical
segments [1].

What are segment groups for?  The Watcom compiler interface seems to
be based on the Microsoft documentation, so I've been reading old MS
manuals as well.  There we have the following paragraph:

 > All segments with the same group name must fit into a single physical
 > segĀ­ment, which is up to 64K long. This allows all segments in a group
 > to be acĀ­cessed through the same segment register. The Microsoft C
 > Compiler defines one group named DGROUP.

As far as I can tell, Watcom also defines this DGROUP in 32bit mode, but
I still don't know if it has any purpose anymore.

When I am defining my own compiler, do the traditional names of object
file segments, _TEXT, _DATA, STACK, _BSS, CONST (to name a few from the
MS manual) any meaning?  When I place my code in a _TEXT segment, the
disassembler will show a list of the instructions; this does not happen
if I name the segment FOO.  Is there any particular reason I want my
code in a _TEXT segment rather than FOO?

If this subject is covered in the Linkers & Loaders book in sufficient
details to answer my questions, I have not come across it yet.  Please
refere to a specific chapter if there's something I should read there.

[1] Or if I am, I'm not aware of it.

--
Johann | email: invalid -> com | www.myrkraverk.com/blog/
I'm not from the Internet, I just work there. | twitter: @myrkraverk

[Segment groups were useful on the '286 but are pointless on later
machines since a single segment can be the full size of the address
space. My dim recollection is that some software treated segment names
like _TEXT and _DATA specially so your life will likely be easier if
you put the code in _TEXT, the static data in _DATA, and the
uninitialized or zero initialized data in _BSS. I didn't say anything
about this in Linkers and Loaders since by that time segmented
addressing was just an historical curiosity. -John]

Back to comp.compilers | Previous | NextNext in thread | Find similar


Thread

The different groups and segments of object files Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.com> - 2020-06-19 23:22 +0800
  Re: The different groups and segments of object files gah4@u.washington.edu - 2020-06-19 14:12 -0700
    Re: The different groups and segments of object files gah4@u.washington.edu - 2020-06-21 01:50 -0700
    Re: The different groups and segments of object files Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2020-06-25 22:41 +0800
    Re: The different groups and segments of object files Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2020-06-25 22:40 +0200
      Re: The different groups and segments of object files Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2020-06-26 00:09 +0200
        Re: The different groups and segments of object files gah4@u.washington.edu - 2020-07-02 00:36 -0700
  Re: The different groups and segments of object files Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2020-06-20 16:01 +0200
    Re: The different groups and segments of object files Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2020-06-25 23:13 +0800
      Re: The different groups and segments of object files Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2020-06-25 22:52 +0200

csiph-web