From: "J.A. Magallon" <jamagallon@able.es>
To: root@chaos.analogic.com
Cc: Linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: Writable global section?
Date: Wed, 9 Oct 2002 16:24:58 +0200 [thread overview]
Message-ID: <20021009142458.GA2243@werewolf.able.es> (raw)
In-Reply-To: <Pine.LNX.3.95.1021009090703.31255B-100000@chaos.analogic.com>; from root@chaos.analogic.com on Wed, Oct 09, 2002 at 15:08:44 +0200
On 2002.10.09 Richard B. Johnson wrote:
>
>
> When using shared libraries, is there a ".section" into which
> I can put a variable that's writable? I note that when programs
> that use shared libraries start, the pages are mprotect(ed)
> PROT_READ|PROT_EXEC, but sometimes I see PROT_WRITE on some
> pages.
>
> I'd like to rip out a memory-mapped semiphore and put it directly
> in a shared library if possible.
>
A library can define global variables visible to others, has its own BSS:
int x;
void f()
{
}
built with gcc -shared, and nm'ed gives:
00000694 T f
000017f8 B x
000016f8 D y
from man nm:
"B" The symbol is in the uninitialized data section (known as BSS).
"D" The symbol is in the initialized data section.
"T" The symbol is in the text (code) section.
Was about this or I misunderstood you ?
--
J.A. Magallon <jamagallon@able.es> \ Software is like sex:
werewolf.able.es \ It's better when it's free
Mandrake Linux release 9.1 (Cooker) for i586
Linux 2.4.20-pre10-jam1 (gcc 3.2 (Mandrake Linux 9.0 3.2-2mdk))
next prev parent reply other threads:[~2002-10-09 14:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.3.95.1021009090100.31255A-100000@chaos.analogic.com>
2002-10-09 13:08 ` Richard B. Johnson
2002-10-09 14:24 ` J.A. Magallon [this message]
2002-10-09 14:49 ` Richard B. Johnson
2002-10-09 15:06 ` Brian Gerst
2002-10-09 15:46 ` Richard B. Johnson
2002-10-09 15:06 ` Andreas Schwab
2002-10-09 15:56 ` Richard B. Johnson
2002-10-09 16:01 ` Andreas Schwab
2002-10-09 23:14 ` Jamie Lokier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20021009142458.GA2243@werewolf.able.es \
--to=jamagallon@able.es \
--cc=linux-kernel@vger.kernel.org \
--cc=root@chaos.analogic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®