This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Making a symbol dynamic in executable
- To: "H . J . Lu" <hjl at valinux dot com>
- Subject: Re: Making a symbol dynamic in executable
- From: "Zack Weinberg" <zackw at Stanford dot EDU>
- Date: Fri, 23 Feb 2001 21:12:38 -0800
- Cc: gcc at gcc dot gnu dot org, binutils at sourceware dot cygnus dot com
- References: <20010223183610.A23476@valinux.com>
On Fri, Feb 23, 2001 at 06:36:10PM -0800, H . J . Lu wrote:
> On Fri, Feb 23, 2001 at 06:16:01PM -0800, Zack Weinberg wrote:
> >
> > That implies, to me, that there might be a way to force just one
> > symbol into the dynamic symbol table. I know very little about this.
> > Worst case (in ELF), couldn't we bodge an entry into .dynsym by hand?
> >
>
> Funny you asked. The short answer is no. But we did get a request to add
> STV_EXPORT to the ELF visibility in gABI.
Heh. I don't think you appreciated what I meant by "bodge an entry
into .dynsym by hand." This is what I meant:
.globl __frame_objects
.data
.type __frame_objects,@object
.size __frame_objects,4
__frame_objects:
.long 0
.section .dynstr
.Lname:
.asciz "__frame_objects"
.section .dynsym
.long .Lname-.dynstr # st_name
.long __frame_objects-.data # st_value
.long 4 # st_size
.byte (1 << 4) + 1 # st_info: (STB_GLOBAL, STT_OBJECT)
.byte 0 # st_other
.word 2 # st_shndx (assumed data==2)
This generates an object file with an apparently correct dynamic
symbol table, but the linker strips it when you try to put it into an
executable. Oh well.
zw