* coffcode.h: Added a cast to void when a bfd_set_section_*()

macro's return value is ignored.
	* elf32-hppa.c: Likewise.
	* elf32-tic6x.c: Likewise.
	* mach-o.c: Likewise.
	* mmo.c: Likewise.
	* opncls.c: Likewise.
	* peicode.h: Likewise.
	* elf32-m32r.c: Check return value of bfd_set_section_*().
	* elfnn-ia64.c: Likewise.
	* elfxx-mips.c: Likewise.
	* vms-alpha.c: Likewise.
This commit is contained in:
Nick Clifton 2013-04-17 14:16:01 +00:00
parent 17310e568d
commit a253d456e1
13 changed files with 69 additions and 56 deletions

View file

@ -1,3 +1,18 @@
2013-04-17 Luca Pizzamiglio <luca.pizzamiglio@gmail.com>
* coffcode.h: Added a cast to void when a bfd_set_section_*()
macro's return value is ignored.
* elf32-hppa.c: Likewise.
* elf32-tic6x.c: Likewise.
* mach-o.c: Likewise.
* mmo.c: Likewise.
* opncls.c: Likewise.
* peicode.h: Likewise.
* elf32-m32r.c: Check return value of bfd_set_section_*().
* elfnn-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
* vms-alpha.c: Likewise.
2013-04-15 H.J. Lu <hongjiu.lu@intel.com> 2013-04-15 H.J. Lu <hongjiu.lu@intel.com>
PR ld/15371 PR ld/15371

View file

@ -1,7 +1,5 @@
/* Support for the generic parts of most COFF variants, for BFD. /* Support for the generic parts of most COFF variants, for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, Copyright 1990-2013 Free Software Foundation, Inc.
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Written by Cygnus Support. Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -3447,7 +3445,7 @@ coff_compute_section_file_positions (bfd * abfd)
incremented in coff_set_section_contents. This is right for incremented in coff_set_section_contents. This is right for
SVR3.2. */ SVR3.2. */
if (strcmp (current->name, _LIB) == 0) if (strcmp (current->name, _LIB) == 0)
bfd_set_section_vma (abfd, current, 0); (void) bfd_set_section_vma (abfd, current, 0);
#endif #endif
#ifdef ALIGN_SECTIONS_IN_FILE #ifdef ALIGN_SECTIONS_IN_FILE

View file

@ -45,19 +45,20 @@ decompress_contents (bfd_byte *compressed_buffer,
strm.next_in = (Bytef*) compressed_buffer + 12; strm.next_in = (Bytef*) compressed_buffer + 12;
strm.avail_out = uncompressed_size; strm.avail_out = uncompressed_size;
BFD_ASSERT (Z_OK == 0);
rc = inflateInit (&strm); rc = inflateInit (&strm);
while (strm.avail_in > 0 && strm.avail_out > 0) while (strm.avail_in > 0 && strm.avail_out > 0)
{ {
if (rc != Z_OK) if (rc != Z_OK)
return FALSE; break;
strm.next_out = ((Bytef*) uncompressed_buffer strm.next_out = ((Bytef*) uncompressed_buffer
+ (uncompressed_size - strm.avail_out)); + (uncompressed_size - strm.avail_out));
rc = inflate (&strm, Z_FINISH); rc = inflate (&strm, Z_FINISH);
if (rc != Z_STREAM_END) if (rc != Z_STREAM_END)
return FALSE; break;
rc = inflateReset (&strm); rc = inflateReset (&strm);
} }
rc = inflateEnd (&strm); rc |= inflateEnd (&strm);
return rc == Z_OK && strm.avail_out == 0; return rc == Z_OK && strm.avail_out == 0;
} }
#endif #endif

View file

@ -1,7 +1,5 @@
/* BFD back-end for HP PA-RISC ELF files. /* BFD back-end for HP PA-RISC ELF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001, Copyright 1990-2013 Free Software Foundation, Inc.
2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Original code by Original code by
Center for Software Science Center for Software Science
@ -2370,7 +2368,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
bfd_size_type mask; bfd_size_type mask;
if (gotalign > pltalign) if (gotalign > pltalign)
bfd_set_section_alignment (dynobj, sec, gotalign); (void) bfd_set_section_alignment (dynobj, sec, gotalign);
mask = ((bfd_size_type) 1 << gotalign) - 1; mask = ((bfd_size_type) 1 << gotalign) - 1;
sec->size = (sec->size + sizeof (plt_stub) + mask) & ~mask; sec->size = (sec->size + sizeof (plt_stub) + mask) & ~mask;
} }

View file

@ -1,6 +1,5 @@
/* M32R-specific support for 32-bit ELF. /* M32R-specific support for 32-bit ELF.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, Copyright 1996-2013 Free Software Foundation, Inc.
2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -1390,7 +1389,8 @@ m32r_elf_add_symbol_hook (bfd *abfd,
flags); flags);
if (s == NULL) if (s == NULL)
return FALSE; return FALSE;
bfd_set_section_alignment (abfd, s, 2); if (! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
} }
bh = bfd_link_hash_lookup (info->hash, "_SDA_BASE_", bh = bfd_link_hash_lookup (info->hash, "_SDA_BASE_",

View file

@ -1,6 +1,5 @@
/* 32-bit ELF support for TI C6X /* 32-bit ELF support for TI C6X
Copyright 2010, 2011, 2012 Copyright 2010-2013 Free Software Foundation, Inc.
Free Software Foundation, Inc.
Contributed by Joseph Myers <joseph@codesourcery.com> Contributed by Joseph Myers <joseph@codesourcery.com>
Bernd Schmidt <bernds@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com>
@ -3038,7 +3037,7 @@ elf32_tic6x_add_symbol_hook (bfd *abfd,
*secp = bfd_make_section_old_way (abfd, ".scommon"); *secp = bfd_make_section_old_way (abfd, ".scommon");
(*secp)->flags |= SEC_IS_COMMON; (*secp)->flags |= SEC_IS_COMMON;
*valp = sym->st_size; *valp = sym->st_size;
bfd_set_section_alignment (abfd, *secp, bfd_log2 (sym->st_value)); (void) bfd_set_section_alignment (abfd, *secp, bfd_log2 (sym->st_value));
break; break;
} }

View file

@ -1,6 +1,5 @@
/* IA-64 support for 64-bit ELF /* IA-64 support for 64-bit ELF
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, Copyright 1998-2013 Free Software Foundation, Inc.
2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com> Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -1546,7 +1545,8 @@ elfNN_ia64_create_dynamic_sections (bfd *abfd,
bfd_set_section_flags (abfd, ia64_info->root.sgot, bfd_set_section_flags (abfd, ia64_info->root.sgot,
SEC_SMALL_DATA | flags); SEC_SMALL_DATA | flags);
/* The .got section is always aligned at 8 bytes. */ /* The .got section is always aligned at 8 bytes. */
bfd_set_section_alignment (abfd, ia64_info->root.sgot, 3); if (! bfd_set_section_alignment (abfd, ia64_info->root.sgot, 3))
return FALSE;
} }
if (!get_pltoff (abfd, info, ia64_info)) if (!get_pltoff (abfd, info, ia64_info))
@ -1952,16 +1952,17 @@ get_got (bfd *abfd, struct bfd_link_info *info,
if (!dynobj) if (!dynobj)
ia64_info->root.dynobj = dynobj = abfd; ia64_info->root.dynobj = dynobj = abfd;
if (!_bfd_elf_create_got_section (dynobj, info)) if (!_bfd_elf_create_got_section (dynobj, info))
return 0; return NULL;
got = ia64_info->root.sgot; got = ia64_info->root.sgot;
/* The .got section is always aligned at 8 bytes. */ /* The .got section is always aligned at 8 bytes. */
if (!bfd_set_section_alignment (abfd, got, 3)) if (!bfd_set_section_alignment (abfd, got, 3))
return 0; return NULL;
flags = bfd_get_section_flags (abfd, got); flags = bfd_get_section_flags (abfd, got);
bfd_set_section_flags (abfd, got, SEC_SMALL_DATA | flags); if (! bfd_set_section_flags (abfd, got, SEC_SMALL_DATA | flags))
return NULL;
} }
return got; return got;

View file

@ -1,7 +1,5 @@
/* MIPS-specific support for ELF /* MIPS-specific support for ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, Copyright 1993-2013 Free Software Foundation, Inc.
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
Free Software Foundation, Inc.
Most of the information added by Ian Lance Taylor, Cygnus Support, Most of the information added by Ian Lance Taylor, Cygnus Support,
<ian@cygnus.com>. <ian@cygnus.com>.
@ -7265,20 +7263,24 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
/* Change alignments of some sections. */ /* Change alignments of some sections. */
s = bfd_get_linker_section (abfd, ".hash"); s = bfd_get_linker_section (abfd, ".hash");
if (s != NULL) if (s != NULL)
bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); (void) bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd));
s = bfd_get_linker_section (abfd, ".dynsym"); s = bfd_get_linker_section (abfd, ".dynsym");
if (s != NULL) if (s != NULL)
bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); (void) bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd));
s = bfd_get_linker_section (abfd, ".dynstr"); s = bfd_get_linker_section (abfd, ".dynstr");
if (s != NULL) if (s != NULL)
bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); (void) bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd));
/* ??? */ /* ??? */
s = bfd_get_section_by_name (abfd, ".reginfo"); s = bfd_get_section_by_name (abfd, ".reginfo");
if (s != NULL) if (s != NULL)
bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); (void) bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd));
s = bfd_get_linker_section (abfd, ".dynamic"); s = bfd_get_linker_section (abfd, ".dynamic");
if (s != NULL) if (s != NULL)
bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); (void) bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd));
} }
if (!info->shared) if (!info->shared)
@ -13533,7 +13535,8 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
/* Structure for saying that BFD machine EXTENSION extends BASE. */ /* Structure for saying that BFD machine EXTENSION extends BASE. */
struct mips_mach_extension { struct mips_mach_extension
{
unsigned long extension, base; unsigned long extension, base;
}; };
@ -13541,7 +13544,8 @@ struct mips_mach_extension {
/* An array describing how BFD machines relate to one another. The entries /* An array describing how BFD machines relate to one another. The entries
are ordered topologically with MIPS I extensions listed last. */ are ordered topologically with MIPS I extensions listed last. */
static const struct mips_mach_extension mips_mach_extensions[] = { static const struct mips_mach_extension mips_mach_extensions[] =
{
/* MIPS64r2 extensions. */ /* MIPS64r2 extensions. */
{ bfd_mach_mips_octeon2, bfd_mach_mips_octeonp }, { bfd_mach_mips_octeon2, bfd_mach_mips_octeonp },
{ bfd_mach_mips_octeonp, bfd_mach_mips_octeon }, { bfd_mach_mips_octeonp, bfd_mach_mips_octeon },

View file

@ -1,7 +1,5 @@
/* Mach-O support for BFD. /* Mach-O support for BFD.
Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, Copyright 1999-2013 Free Software Foundation, Inc.
2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -2693,7 +2691,7 @@ bfd_mach_o_new_section_hook (bfd *abfd, asection *sec)
s->flags = xlat->macho_sectype | xlat->macho_secattr; s->flags = xlat->macho_sectype | xlat->macho_secattr;
s->align = xlat->sectalign > bfdalign ? xlat->sectalign s->align = xlat->sectalign > bfdalign ? xlat->sectalign
: bfdalign; : bfdalign;
bfd_set_section_alignment (abfd, sec, s->align); (void) bfd_set_section_alignment (abfd, sec, s->align);
bfd_flags = bfd_get_section_flags (abfd, sec); bfd_flags = bfd_get_section_flags (abfd, sec);
if (bfd_flags == SEC_NO_FLAGS) if (bfd_flags == SEC_NO_FLAGS)
bfd_set_section_flags (abfd, sec, xlat->bfd_flags); bfd_set_section_flags (abfd, sec, xlat->bfd_flags);

View file

@ -1,6 +1,5 @@
/* BFD back-end for mmo objects (MMIX-specific object-format). /* BFD back-end for mmo objects (MMIX-specific object-format).
Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 Copyright 2001-2013 Free Software Foundation, Inc.
Free Software Foundation, Inc.
Written by Hans-Peter Nilsson (hp@bitrange.com). Written by Hans-Peter Nilsson (hp@bitrange.com).
Infrastructure and other bits originally copied from srec.c and Infrastructure and other bits originally copied from srec.c and
binary.c. binary.c.
@ -662,8 +661,9 @@ mmo_decide_section (bfd *abfd, bfd_vma vma)
if (sec == NULL) if (sec == NULL)
return NULL; return NULL;
if (! sec->user_set_vma) if (! sec->user_set_vma && ! bfd_set_section_vma (abfd, sec, vma))
bfd_set_section_vma (abfd, sec, vma); return NULL;
if (! bfd_set_section_flags (abfd, sec, if (! bfd_set_section_flags (abfd, sec,
bfd_get_section_flags (abfd, sec) bfd_get_section_flags (abfd, sec)
| SEC_CODE | SEC_LOAD | SEC_ALLOC)) | SEC_CODE | SEC_LOAD | SEC_ALLOC))
@ -676,8 +676,9 @@ mmo_decide_section (bfd *abfd, bfd_vma vma)
if (sec == NULL) if (sec == NULL)
return NULL; return NULL;
if (! sec->user_set_vma) if (! sec->user_set_vma && ! bfd_set_section_vma (abfd, sec, vma))
bfd_set_section_vma (abfd, sec, vma); return NULL;
if (! bfd_set_section_flags (abfd, sec, if (! bfd_set_section_flags (abfd, sec,
bfd_get_section_flags (abfd, sec) bfd_get_section_flags (abfd, sec)
| SEC_LOAD | SEC_ALLOC)) | SEC_LOAD | SEC_ALLOC))
@ -692,8 +693,9 @@ mmo_decide_section (bfd *abfd, bfd_vma vma)
/* If there's still no suitable section, make a new one. */ /* If there's still no suitable section, make a new one. */
sprintf (sec_name, ".MMIX.sec.%d", abfd->tdata.mmo_data->sec_no++); sprintf (sec_name, ".MMIX.sec.%d", abfd->tdata.mmo_data->sec_no++);
sec = mmo_make_section (abfd, sec_name); sec = mmo_make_section (abfd, sec_name);
if (! sec->user_set_vma)
bfd_set_section_vma (abfd, sec, vma); if (! sec->user_set_vma && ! bfd_set_section_vma (abfd, sec, vma))
return NULL;
if (! bfd_set_section_flags (abfd, sec, if (! bfd_set_section_flags (abfd, sec,
bfd_get_section_flags (abfd, sec) bfd_get_section_flags (abfd, sec)

View file

@ -1,7 +1,5 @@
/* opncls.c -- open and close a BFD. /* opncls.c -- open and close a BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, Copyright 1990-2013 Free Software Foundation, Inc.
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013
Free Software Foundation, Inc.
Written by Cygnus Support. Written by Cygnus Support.
@ -255,12 +253,13 @@ bfd_fopen (const char *filename, const char *target, const char *mode, int fd)
return NULL; return NULL;
} }
nbfd->opened_once = TRUE; nbfd->opened_once = TRUE;
/* If we opened the file by name, mark it cacheable; we can close it /* If we opened the file by name, mark it cacheable; we can close it
and reopen it later. However, if a file descriptor was provided, and reopen it later. However, if a file descriptor was provided,
then it may have been opened with special flags that make it then it may have been opened with special flags that make it
unsafe to close and reopen the file. */ unsafe to close and reopen the file. */
if (fd == -1) if (fd == -1)
bfd_set_cacheable (nbfd, TRUE); (void) bfd_set_cacheable (nbfd, TRUE);
return nbfd; return nbfd;
} }

View file

@ -1,7 +1,5 @@
/* Support for the generic parts of PE/PEI, for BFD. /* Support for the generic parts of PE/PEI, for BFD.
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, Copyright 1995-2013 Free Software Foundation, Inc.
2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Written by Cygnus Solutions. Written by Cygnus Solutions.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -610,7 +608,7 @@ pe_ILF_make_a_section (pe_ILF_vars * vars,
bfd_set_section_flags (vars->abfd, sec, flags | extra_flags); bfd_set_section_flags (vars->abfd, sec, flags | extra_flags);
bfd_set_section_alignment (vars->abfd, sec, 2); (void) bfd_set_section_alignment (vars->abfd, sec, 2);
/* Check that we will not run out of space. */ /* Check that we will not run out of space. */
BFD_ASSERT (vars->data + size < vars->bim->buffer + vars->bim->size); BFD_ASSERT (vars->data + size < vars->bim->buffer + vars->bim->size);

View file

@ -1,6 +1,5 @@
/* vms.c -- BFD back-end for EVAX (openVMS/Alpha) files. /* vms.c -- BFD back-end for EVAX (openVMS/Alpha) files.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, Copyright 1996-2013 Free Software Foundation, Inc.
2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
Initial version written by Klaus Kaempf (kkaempf@rmi.de) Initial version written by Klaus Kaempf (kkaempf@rmi.de)
Major rewrite by Adacore. Major rewrite by Adacore.
@ -9118,7 +9117,8 @@ vms_new_section_hook (bfd * abfd, asection *section)
vms_debug2 ((1, "vms_new_section_hook (%p, [%d]%s)\n", vms_debug2 ((1, "vms_new_section_hook (%p, [%d]%s)\n",
abfd, section->index, section->name)); abfd, section->index, section->name));
bfd_set_section_alignment (abfd, section, 0); if (! bfd_set_section_alignment (abfd, section, 0))
return FALSE;
vms_debug2 ((7, "%d: %s\n", section->index, section->name)); vms_debug2 ((7, "%d: %s\n", section->index, section->name));