bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug ld/20528] ld -r doesn't handle SHF_EXCLUDE section properly


From: Nick Clifton
Subject: Re: [Bug ld/20528] ld -r doesn't handle SHF_EXCLUDE section properly
Date: Wed, 28 Sep 2016 12:45:47 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0

Hi H.J.

> This works:
> 
> diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
> index dd4d35a..6ce4e00 100644
> --- a/ld/emultempl/elf32.em
> +++ b/ld/emultempl/elf32.em
> @@ -1903,9 +1903,16 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
>       lang_insert_orphan to create a new output section.  */
>    constraint = SPECIAL;
> 
> +  /* SEC_EXCLUDE is ignored when doing a relocatable link.  But
> +     we can't merge 2 input sections with the same name when only
> +     one of them has SHF_EXCLUDE.  */
>    if (os->bfd_section != NULL
>        && (os->bfd_section->flags == 0
> -     || (((s->flags ^ os->bfd_section->flags)
> +     || ((!bfd_link_relocatable (&link_info)
> +          || (((elf_section_flags (s)
> +          ^ elf_section_flags (os->bfd_section))
> +         & SHF_EXCLUDE) == 0))
> +         && ((s->flags ^ os->bfd_section->flags)
>            & (SEC_LOAD | SEC_ALLOC)) == 0
>           && _bfd_elf_match_sections_by_type (link_info.output_bfd,
>                      os->bfd_section,

Looks good to me too - please consider the patch approved.

Cheers
  Nick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]