delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/31/14:46:33

Xref: news2.mv.net comp.os.msdos.djgpp:6626
From: alaric AT abwillms DOT demon DOT co DOT uk (Alaric B. Williams)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: __attribute__((section))
Date: Mon, 29 Jul 1996 10:29:49 GMT
Lines: 47
Message-ID: <838636083.9947.0@abwillms.demon.co.uk>
References: <838478248 DOT 10640 DOT 0 AT abwillms DOT demon DOT co DOT uk> <Dv838w DOT KIE AT world DOT std DOT com>
NNTP-Posting-Host: abwillms.demon.co.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

tob AT world DOT std DOT com (Tom Breton) wrote:

>If I understand right, the linking part of what you suggest should
>not only be possible but easy,

Exactly!

>since constructors and destructors are
>already handled similarly. They put pointers to themselves in special
>sections (.ctor, .dtor), which djgpp.lnk and some code in crt0 handle
>specially. ".lock" would want entire functions and every variable they
>touched.

Yes, you'd need to manually check which variables and other functions
your function touched, but the act of marking them for locking would
be trivial, no need to go somewhere else in your source to put int
"_go32_dpmi_...". Just use two #defines:

#define LOCKED_VAR section (".lock"), nocommon
#define LOCKED_FUNC section (".lock")

int hello __attribute__ ((LOCKED_VAR));

void my_int() __attribute__ ((LOCKED_FUNC)) {
	hello = 1;
}

I would make #defines for the whole __attribute__ ((xx)), but the
above usage is kinda consistent with the other attribute types.

The "nocommon" on variables stops them going into the common segment
if they're not initialised.

>        Tom

Does anybody know why section("") doesn't work???

Regards,


ABW
--
I have become... Comfortably numb...

Alaric B. Williams Internet : alaric AT abwillms DOT demon DOT co DOT uk
<A HREF="http://www.hardcafe.co.uk/Alaric/">http://www.hardcafe.co.uk/Alaric/</A>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019