🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.asm.x86
Article #89

Re: DOSSEG and TLINK

#89
From: Bob Smith
Date: Sat, 15 May 1999 00:00
123 lines
4644 bytes
assassin17@rocketmail.com wrote:
> 
> i'm a little confused about how linkers (mainly TLINK) handle the DOSSEG
> directive.  several documents state that DOSSEG causes the segments
> to be ordered this way:
> 
> 1. All segments with a class name ending in CODE
> 2. Far data segments (segments outside DGROUP)
> 3. Near data (DGROUP) segments, in the following order:
>       a. Segments of class BEGDATA (reserved for Microsoft use)
>       b. Any segments not of class BEGDATA, BSS, or STACK
>       c. Segments of class BSS
>       d. Segments of class STACK
> 
> however, TLINK seems to always put segments with class 'STACK' at the
> end, even if they're _not_ in DGROUP.  MASM's LINK behaves according to
> the above list.  is there any standard to how other linkers handle
> DOSSEG, or can they arrange the different classed segments however they
> want?

The standard is the set of rules you mentioned above.  TLINK just
doesn't observe them.

> the next question is a little longer..  i was experimenting with this
> file:
> ----------
> DOSSEG
> 
> DGROUP GROUP OERP,AAAA,xaaa,LOPE,FBSS,DARK
> 
> xaaa SEGMENT 'CODE'
> xaaa ENDS
> 
> CBF SEGMENT
> CBF ENDS
> 
> FBSS SEGMENT 'DATA'
> FBSS ENDS
> 
> LOSER SEGMENT 'STACK'
> LOSER ENDS
> 
> ztr SEGMENT 'DATA'
> ztr ENDS
> 
> aab SEGMENT 'BSS'
> aab ENDS
> 
> OERP SEGMENT 'BEGDATA'
> OERP ENDS
> 
> AAAA SEGMENT 'ARPA'
> AAAA ENDS
> 
> LOPE SEGMENT 'STACK'
> LOPE ENDS
> 
> ZZZU SEGMENT 'ARPA'
> ZZZU ENDS
> 
> DARK SEGMENT 'CODE'
> DARK ENDS
> 
> END
> -----
> 
> strangely, TLINK outputted the segments in this order:
> 
>  00000H 00000H 00000H XAAA               CODE
>  00000H 00000H 00000H DARK               CODE
>  00000H 00000H 00000H CBF
>  00000H 00000H 00000H ZTR                DATA
>  00000H 00000H 00000H AAB                BSS
>  00000H 00000H 00000H AAAA               ARPA
>  00000H 00000H 00000H ZZZU               ARPA
>  00000H 00000H 00000H OERP               BEGDATA
>  00000H 00000H 00000H FBSS               DATA
>  00000H 00000H 00000H LOSER              STACK
>  00000H 00000H 00000H LOPE               STACK
> 
> segment AAAA is a member of DGROUP, and *should* be after OERP based on
> the aforementioned DOSSEG list.  even stranger, the segments will be
> outputted in the expected order if segment AAB is moved to the end of
> the source file:
> 
>  00000H 00000H 00000H XAAA               CODE
>  00000H 00000H 00000H DARK               CODE
>  00000H 00000H 00000H CBF
>  00000H 00000H 00000H ZTR                DATA
>  00000H 00000H 00000H ZZZU               ARPA
>  00000H 00000H 00000H AAB                BSS
>  00000H 00000H 00000H OERP               BEGDATA
>  00000H 00000H 00000H FBSS               DATA
>  00000H 00000H 00000H AAAA               ARPA
>  00000H 00000H 00000H LOSER              STACK
>  00000H 00000H 00000H LOPE               STACK
> 
> any idea what steps TLINK is going through when ordering these segments?
>  sometimes its behavior matches the documentation on DOSSEG; other times
> not.  very confusing..

According to the rules, the correct order (for the original segments) is
as follows:

Name	Class	Rule
--------------------
xaaa	CODE	1
DARK	CODE	1
CBF		2
ztr	DATA	2
LOSER	STACK	2
aab	BSS	2
ZZZU	ARPA	2
OERP	BEGDATA	3a
FBSS	DATA	3b
AAAA	ARPA	3b
LOPE	STACK	3d
_________________________________________
Bob Smith -- bsmith@sudleyplacedespam.com
a.k.a.       bsmith@qualitasdespam.com

I've been getting a lot of junk e-mail lately,
so to reply to me directly, delete "despam".
Technical Details
Message-ID: <7hih7k$8vb$2@autumn.news.rcn.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7hg7kq$ksb$1@autumn.news.rcn.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: feaef,dda8022d1c19bc63
X-Google-Attributes: gidfeaef,public
X-Google-Thread: f7d8d,dda8022d1c19bc63
X-Google-Attributes: gidf7d8d,public
X-Google-Thread: 114917,dda8022d1c19bc63
X-Google-Attributes: gid114917,public
From: Bob Smith <jsmith98@frontiernet.net>
Subject: Re: DOSSEG and TLINK
Date: 1999/05/15
Message-ID: <7hih7k$8vb$2@autumn.news.rcn.net>
X-Deja-AN: 478016137
Content-Transfer-Encoding: 7bit
Approved: <johnfine@erols.com>
References: <7hg7kq$ksb$1@autumn.news.rcn.net>
X-Accept-Language: en
X-Authentication-Warning: backdraft.briar.org: smap set sender to <news@node17.cwnet.frontiernet.net> using -f
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@rcn.com
X-Trace: wYHw/NDG9yBOdhC8IdtZtONzvOmGUjYFtQxsTKsT/8g=
Organization: Qualitas, Inc.
Mime-Version: 1.0
Reply-To: bsmith@sudleyplacedespam.com
NNTP-Posting-Date: 15 May 1999 01:04:52 GMT
Newsgroups: comp.lang.asm.x86,borland.public.tasm,alt.lang.asm