This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add SHF_COMPRESSED support to gas and objcopy


On Mon, Apr 06, 2015 at 12:32:08PM -0700, H.J. Lu wrote:
> diff --git a/bfd/elf.c b/bfd/elf.c
> index cbc0c91..2335eb6 100644
> --- a/bfd/elf.c
> +++ b/bfd/elf.c
> @@ -1069,6 +1078,8 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
>  		 abfd, name);
>  	      return FALSE;
>  	    }
> +	  if ((abfd->flags & BFD_COMPRESS_GABI) != 0)
> +	    goto remove_z;
>  	  /* PR binutils/18087: Compression does not always make a section
>  	     smaller.  So only rename the section when compression has
>  	     actually taken place.  */
> @@ -1095,6 +1106,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
>  		 abfd, name);
>  	      return FALSE;
>  	    }
> +remove_z:
>  	  if (name[1] == 'z')
>  	    {
>  	      unsigned int len = strlen (name);

I think this would be better if you moved the new_name code out of the
switch.

      new_name = NULL;
      if (action == decompress
	  || (action == compress && (abfd->flags & BFD_COMPRESS_GABI) != 0))
	{
	  remove z code
	}
      else if (action == compress)
	{
	  add z code
	}
      if (new_name != NULL)
	bfd_rename_section (abfd, newsect, new_name);

With this change the patch is OK.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]