This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Add SHF_COMPRESSED support to gas and objcopy
- From: Alan Modra <amodra at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Wed, 8 Apr 2015 22:48:20 +0930
- Subject: Re: [PATCH] Add SHF_COMPRESSED support to gas and objcopy
- Authentication-results: sourceware.org; auth=none
- References: <20150406193208 dot GA29473 at intel dot com>
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