This is the mail archive of the
mailing list for the binutils project.
Re: Controlling dynsym/symtab output
- From: Michael Matz <matz at suse dot de>
- To: Evan Klitzke <evan at eklitzke dot org>
- Cc: binutils at sourceware dot org
- Date: Tue, 10 May 2016 16:08:14 +0200 (CEST)
- Subject: Re: Controlling dynsym/symtab output
- Authentication-results: sourceware.org; auth=none
- References: <CAKuwthhcUQLL=-eDB=L66huDwhFxYfd=Le_4dm99CgkXKT5Yvw at mail dot gmail dot com>
On Mon, 9 May 2016, Evan Klitzke wrote:
> I'm interested in creating an executable that can be loaded by dlopen as
> a DSO. My understanding is that it is possible to do this if the
> executable is compiled as a PIE, and indeed I can dlopen executables
> compiled with gcc -fPIC -pie. However, when I do this all of my symbols
> end up in the .symtab section even if they are marked with default
> visibility and are not static, and it appears that dlopen will only load
> symbols from the .dynsym section.
ld doesn't export any symbols for executables by default (except those
required for correctness, like e.g. destination of copy relocs). Use -E
aka --export-dynamic to change this (if you do that you should be able to
use the various ld options to manipulate the dynamic symbol list)P.