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)) - 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