This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH 1/2] LD: Export relative-from-absolute symbol marking to BFD
- From: Alan Modra <amodra at gmail dot com>
- To: "Maciej W. Rozycki" <macro at mips dot com>
- Cc: Nick Clifton <nickc at redhat dot com>, Richard Earnshaw <rearnsha at arm dot com>, Marcus Shawcroft <marcus dot shawcroft at arm dot com>, Kuan-Lin Chen <kuanlinchentw at gmail dot com>, Wei-Cheng Wang <cole945 at gmail dot com>, Richard Sandiford <rdsandiford at googlemail dot com>, binutils at sourceware dot org
- Date: Mon, 16 Jul 2018 23:12:52 +0930
- Subject: Re: [PATCH 1/2] LD: Export relative-from-absolute symbol marking to BFD
- References: <alpine.DEB.2.00.1807142224150.30992@tp.orcam.me.uk> <alpine.DEB.2.00.1807152306090.30992@tp.orcam.me.uk>
On Mon, Jul 16, 2018 at 06:42:09AM +0100, Maciej W. Rozycki wrote:
> --- binutils.orig/bfd/linker.c 2018-07-06 01:38:47.000000000 +0100
> +++ binutils/bfd/linker.c 2018-07-13 02:30:30.552331879 +0100
> @@ -484,7 +484,19 @@ _bfd_link_hash_table_init
>
> /* Look up a symbol in a link hash table. If follow is TRUE, we
> follow bfd_link_hash_indirect and bfd_link_hash_warning links to
> - the real symbol. */
> + the real symbol.
> +
> +.{* Return TRUE if the symbol described by a linker hash entry H
> +. is going to be absolute. Linker-script defined symbols can be
> +. converted from absolute to section-relative ones late in the
> +. link. Use this macro to correctly determine whether the symbol
> +. will actually end up absolute in output. *}
> +.#define bfd_is_abs_symbol(H) \
> +. ((H)->type == bfd_link_hash_defined \
Either test both bfd_link_hash_defined and bfd_link_hash_defweak here
or test neither, relying on the tests to be done before using this
macro. I'm inclined to do the latter, given that the macro is a
replacement for a test of h->u.def.section.
> +. && bfd_is_abs_section ((H)->u.def.section) \
> +. && !((H)->ldscript_def && (H)->rel_from_abs))
Testing ldscript_def is superfluous.
Other than that, the patch looks OK.
--
Alan Modra
Australia Development Lab, IBM