Re: Writable global section?

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Wed Oct 09 2002 - 10:56:00 EST


On Wed, 9 Oct 2002, Andreas Schwab wrote:

> "Richard B. Johnson" <root@chaos.analogic.com> writes:
>
> |> If a variable is in the ".data" section, it is "seen" by all procedures
> |> that are linked to the shared library, but any attempt to write to this
> |> variable will seg-fault the task that attempts to modify it.
>
> Your tests must be flawed, because a .data section *is* writable. The
> only difference between .data and .bss is that the latter has no
> allocation in the image file, but they are mapped to the same, writable
> segment.
>
> Andreas.

Well, yes I found out.. This anomaly with the assembler.....

.section .data
.global pars
.type pars,@object
.size pars,4
.align 4
pars: .long 0
.end

I accidentally left out .size, guess what? Even though I had an
offset recognized and a ".long", initialized to 0, there was no
space allocated and therefore the seg-fault. I would have seen
this, but the problem doesn't exist if the ".section" is ".bss",
the first section I was messing with. Go figure?

And the writable, is a COW. It isn't seen by others. It's a shame.
It would be very useful to have a writable global section available
like VAXen did.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
The US military has given us many words, FUBAR, SNAFU, now ENRON.
Yes, top management were graduates of West Point and Annapolis.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Oct 15 2002 - 22:00:31 EST