bug-binutils
[Top][All Lists]
Advanced

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

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


From: nickc at redhat dot com
Subject: [Bug ld/20528] ld -r doesn't handle SHF_EXCLUDE section properly
Date: Wed, 28 Sep 2016 11:46:24 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=20528

--- Comment #2 from Nick Clifton <nickc at redhat dot com> ---
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

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

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