This is the mail archive of the
mailing list for the binutils project.
Re: Custom symbol table with linker plugin
- From: Nick Clifton <nickc at redhat dot com>
- To: "Smets, Jan (Nokia - BE/Antwerp)" <jan dot smets at nokia dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Mon, 10 Apr 2017 13:28:49 +0100
- Subject: Re: Custom symbol table with linker plugin
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=nickc at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 59E48624B0
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 59E48624B0
- References: <VI1PR0701MB22378B6F6F1417EB3688C248E0340@VI1PR0701MB2237.eurprd07.prod.outlook.com>
> The only documentation I found about linker plugins is the GCC WHOPR @ https://gcc.gnu.org/wiki/whopr/driver
> Is there any other documentation available? I've also found some test plugins in the testsuites. (and the gcc lto plugin)
Sadly no. Linker plugins are a very under-developed part of the binutils.
> To access the linker's view of the symbol table I first assumed that I only had to subscribe to the "all symbols read" event and that I could access it from there.
> I've tried to record the file handles from each input file (claim_file_hook) and tried to use get_symbols(), without success. (I didn't claim the file as I just want the linker to handle it)
Hmm, I would have expected that to work. Maybe you do need to claim the files, just so that the symbol lookup will work.
> If there is another way make the standard SYMTAB/STRTAB loadable and
> place it in the data segment, before bss, that would work too and be a lot easier as well.
I assume that you have tried doing this with a linker script ?
You may be able to use objcopy to adjust the attributes of the symtab and strtab sections.
You may also be able to use objcopy to adjust the lma's of these sections too, although I am not sure how well that will work.