[PATCH 1/2] LD: Export relative-from-absolute symbol marking to BFD

Alan Modra amodra@gmail.com
Mon Jul 16 13:54:00 GMT 2018


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



More information about the Binutils mailing list