static inline bool
bfd_set_section_alignment (asection *sec, unsigned int val)
{
+ if (val >= sizeof (bfd_vma) * 8 - 1)
+ return false;
sec->alignment_power = val;
return true;
}
#ifdef COFF_IMAGE_WITH_PE
sofar = BFD_ALIGN (sofar, page_size);
#else
- sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
+ sofar = BFD_ALIGN (sofar, (bfd_vma) 1 << current->alignment_power);
#endif
#ifdef RS6000COFF_C
old_size = current->size;
current->size = BFD_ALIGN (current->size,
- 1 << current->alignment_power);
+ (bfd_vma) 1 << current->alignment_power);
align_adjust = current->size != old_size;
sofar += current->size - old_size;
}
#ifdef COFF_IMAGE_WITH_PE
sofar = BFD_ALIGN (sofar, page_size);
#else
- sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
+ sofar = BFD_ALIGN (sofar, (bfd_vma) 1 << current->alignment_power);
#endif
align_adjust = sofar != old_sofar;
current->size += sofar - old_sofar;
/* Make sure the relocations are aligned. We don't need to make
sure that this byte exists, because it will only matter if there
really are relocs. */
- sofar = BFD_ALIGN (sofar, 1 << COFF_DEFAULT_SECTION_ALIGNMENT_POWER);
+ sofar = BFD_ALIGN (sofar,
+ (bfd_vma) 1 << COFF_DEFAULT_SECTION_ALIGNMENT_POWER);
obj_relocbase (abfd) = sofar;
abfd->output_has_begun = true;
.static inline bool
.bfd_set_section_alignment (asection *sec, unsigned int val)
.{
+. if (val >= sizeof (bfd_vma) * 8 - 1)
+. return false;
. sec->alignment_power = val;
. return true;
.}
bfd_vma vma;
bfd_vma lma;
flagword flags;
- const char *err;
+ const char *err = NULL;
const char * name;
const char * new_name;
char *prefix = NULL;
else if (extract_symbol)
size = 0;
if (!bfd_set_section_size (osection, size))
- {
- err = _("failed to set size");
- goto loser;
- }
+ err = _("failed to set size");
vma = bfd_section_vma (isection);
p = find_section_list (bfd_section_name (isection), false,
vma += change_section_address;
if (!bfd_set_section_vma (osection, vma))
- {
- err = _("failed to set vma");
- goto loser;
- }
+ err = _("failed to set vma");
lma = isection->lma;
p = find_section_list (bfd_section_name (isection), false,
/* FIXME: This is probably not enough. If we change the LMA we
may have to recompute the header for the file as well. */
if (!bfd_set_section_alignment (osection, alignment))
- {
- err = _("failed to set alignment");
- goto loser;
- }
+ err = _("failed to set alignment");
/* Copy merge entity size. */
osection->entsize = isection->entsize;
/* Allow the BFD backend to copy any private data it understands
from the input section to the output section. */
if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection))
- {
- err = _("failed to copy private data");
- goto loser;
- }
+ err = _("failed to copy private data");
if (make_nobits)
elf_section_type (osection) = SHT_NOBITS;
- /* All went well. */
- return;
+ if (!err)
+ return;
loser:
status = 1;