Roland Mainz wrote:

> Ok...
> ... is it possible to make "elfwrap" tag the data as "shareable between
> processes" (e.g. read-only) by default ? Otherwise we have a similar
> issue like the current Sun Studio 10/11 "cc" behaviour for string
> literals which eat memory per process instead of being shared between
> processes (unless you use "-xstrconst") ...

It is read-only.  For example, from a standard ELF relocatable object:

   Section Header[4]:  sh_name: .rodata
     sh_addr:      0               sh_flags:   [ SHF_ALLOC ]
     sh_size:      0               sh_type:    [ SHT_PROGBITS ]

   Section Header[5]:  sh_name: .data
     sh_addr:      0               sh_flags:   [ SHF_WRITE SHF_ALLOC ]
     sh_size:      0               sh_type:    [ SHT_PROGBITS ]

The .rodata (read-only data) section only has SHF_ALLOC flag set.  The
.data section is writable (and non-sharable) having the SHF_WRITE flag set.


elfwrap(1) produces:

Section Header[1]:  sh_name: .passwd
     sh_addr:      0               sh_flags:   [ SHF_ALLOC ]
     sh_size:      0x395           sh_type:    [ SHT_PROGBITS ]

All allocatable, non-writable sections are combined by ld(1) into the
text segment, which is read-only and sharable between all processes.

-- 

Rod.

Reply via email to