* libbfd-in.h (BFD_ASSERT, BFD_FAIL): Wrap macro body in do while.

* libbfd.h: Regnerate.
	* elf32-cris.c: Add missing semicolon to BFD_ASSERTs.
	* elf32-frv.c: Likewise.
	* elf32-m32r.c: Likewise.
	* elf32-ppc.c: Likewise.
	* elf64-hppa.c: Likewise.
	* elfxx-ia64.c: Likewise.
	* opncls.c: Likewise.
This commit is contained in:
Alan Modra 2004-10-10 13:58:05 +00:00
parent 3472e2e999
commit f12123c0d5
10 changed files with 72 additions and 60 deletions

View file

@ -1,3 +1,15 @@
2004-10-10 Alan Modra <amodra@bigpond.net.au>
* libbfd-in.h (BFD_ASSERT, BFD_FAIL): Wrap macro body in do while.
* libbfd.h: Regnerate.
* elf32-cris.c: Add missing semicolon to BFD_ASSERTs.
* elf32-frv.c: Likewise.
* elf32-m32r.c: Likewise.
* elf32-ppc.c: Likewise.
* elf64-hppa.c: Likewise.
* elfxx-ia64.c: Likewise.
* opncls.c: Likewise.
2004-10-10 Alan Modra <amodra@bigpond.net.au> 2004-10-10 Alan Modra <amodra@bigpond.net.au>
* elf-bfd.h (struct eh_frame_hdr_info): Add offsets_adjusted. * elf-bfd.h (struct eh_frame_hdr_info): Add offsets_adjusted.

View file

@ -2960,7 +2960,7 @@ cris_elf_print_private_bfd_data (abfd, ptr)
{ {
FILE *file = (FILE *) ptr; FILE *file = (FILE *) ptr;
BFD_ASSERT (abfd != NULL && ptr != NULL) BFD_ASSERT (abfd != NULL && ptr != NULL);
_bfd_elf_print_private_bfd_data (abfd, ptr); _bfd_elf_print_private_bfd_data (abfd, ptr);

View file

@ -832,7 +832,7 @@ frvfdpic_relocs_info_for_global (struct htab *ht,
/* Obtain the address of the entry in HT associated with the SYMNDXth /* Obtain the address of the entry in HT associated with the SYMNDXth
local symbol of the input bfd ABFD, plus the addend, creating a new local symbol of the input bfd ABFD, plus the addend, creating a new
entry if none existed. */ entry if none existed. */
inline static struct frvfdpic_relocs_info * inline static struct frvfdpic_relocs_info *
frvfdpic_relocs_info_for_local (struct htab *ht, frvfdpic_relocs_info_for_local (struct htab *ht,
bfd *abfd, bfd *abfd,
@ -1021,7 +1021,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
asection *sec, asection *sec,
Elf_Internal_Sym *sym, Elf_Internal_Sym *sym,
bfd_vma addend) bfd_vma addend)
{ {
bfd_vma fd_lazy_rel_offset = (bfd_vma)-1; bfd_vma fd_lazy_rel_offset = (bfd_vma)-1;
int dynindx = -1; int dynindx = -1;
@ -1099,7 +1099,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
->output_section->vma ->output_section->vma
+ frvfdpic_got_section (info)->output_offset, + frvfdpic_got_section (info)->output_offset,
R_FRV_32, idx, ad, entry); R_FRV_32, idx, ad, entry);
bfd_put_32 (output_bfd, ad, bfd_put_32 (output_bfd, ad,
frvfdpic_got_section (info)->contents frvfdpic_got_section (info)->contents
+ frvfdpic_got_initial_offset (info) + frvfdpic_got_initial_offset (info)
@ -1112,7 +1112,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
{ {
int reloc, idx; int reloc, idx;
bfd_vma ad = 0; bfd_vma ad = 0;
if (! (entry->symndx == -1 if (! (entry->symndx == -1
&& entry->d.h->root.type == bfd_link_hash_undefweak && entry->d.h->root.type == bfd_link_hash_undefweak
&& FRVFDPIC_SYM_LOCAL (info, entry->d.h))) && FRVFDPIC_SYM_LOCAL (info, entry->d.h)))
@ -1285,7 +1285,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
{ {
if (ad) if (ad)
return FALSE; return FALSE;
fd_lazy_rel_offset = ofst; fd_lazy_rel_offset = ofst;
/* A function descriptor used for lazy or local resolving is /* A function descriptor used for lazy or local resolving is
@ -1297,7 +1297,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
lowword = entry->lzplt_entry + 4 lowword = entry->lzplt_entry + 4
+ frvfdpic_plt_section (info)->output_offset + frvfdpic_plt_section (info)->output_offset
+ frvfdpic_plt_section (info)->output_section->vma; + frvfdpic_plt_section (info)->output_section->vma;
highword = _frvfdpic_osec_to_segment highword = _frvfdpic_osec_to_segment
(output_bfd, frvfdpic_plt_section (info)->output_section); (output_bfd, frvfdpic_plt_section (info)->output_section);
} }
else else
@ -2095,14 +2095,14 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
relocation = picrel->got_entry; relocation = picrel->got_entry;
check_segment[0] = check_segment[1] = got_segment; check_segment[0] = check_segment[1] = got_segment;
break; break;
case R_FRV_FUNCDESC_GOT12: case R_FRV_FUNCDESC_GOT12:
case R_FRV_FUNCDESC_GOTHI: case R_FRV_FUNCDESC_GOTHI:
case R_FRV_FUNCDESC_GOTLO: case R_FRV_FUNCDESC_GOTLO:
relocation = picrel->fdgot_entry; relocation = picrel->fdgot_entry;
check_segment[0] = check_segment[1] = got_segment; check_segment[0] = check_segment[1] = got_segment;
break; break;
case R_FRV_GOTOFFHI: case R_FRV_GOTOFFHI:
case R_FRV_GOTOFF12: case R_FRV_GOTOFF12:
case R_FRV_GOTOFFLO: case R_FRV_GOTOFFLO:
@ -2479,7 +2479,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
if (! IS_FDPIC (output_bfd) || ! picrel->plt) if (! IS_FDPIC (output_bfd) || ! picrel->plt)
break; break;
/* Fall through. */ /* Fall through. */
/* When referencing a GOT entry, a function descriptor or a /* When referencing a GOT entry, a function descriptor or a
PLT, we don't want the addend to apply to the reference, PLT, we don't want the addend to apply to the reference,
but rather to the referenced symbol. The actual entry but rather to the referenced symbol. The actual entry
@ -2497,7 +2497,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
/* Note that we only want GOTOFFHI, not GOTOFFLO or GOTOFF12 /* Note that we only want GOTOFFHI, not GOTOFFLO or GOTOFF12
here, since we do want to apply the addend to the others. here, since we do want to apply the addend to the others.
Note that we've applied the addend to GOTOFFHI before we Note that we've applied the addend to GOTOFFHI before we
shifted it right. */ shifted it right. */
case R_FRV_GOTOFFHI: case R_FRV_GOTOFFHI:
relocation -= rel->r_addend; relocation -= rel->r_addend;
break; break;
@ -3147,7 +3147,7 @@ _frvfdpic_compute_got_alloc_data (struct _frvfdpic_dynamic_got_alloc_data *gad,
odd = cur + got; odd = cur + got;
got += 4; got += 4;
} }
/* Compute the tentative boundaries of this range. */ /* Compute the tentative boundaries of this range. */
gad->max = cur + got; gad->max = cur + got;
gad->min = fdcur - fd; gad->min = fdcur - fd;
@ -3222,7 +3222,7 @@ inline static bfd_signed_vma
_frvfdpic_get_got_entry (struct _frvfdpic_dynamic_got_alloc_data *gad) _frvfdpic_get_got_entry (struct _frvfdpic_dynamic_got_alloc_data *gad)
{ {
bfd_signed_vma ret; bfd_signed_vma ret;
if (gad->odd) if (gad->odd)
{ {
/* If there was an odd word left behind, use it. */ /* If there was an odd word left behind, use it. */
@ -3301,7 +3301,7 @@ _frvfdpic_assign_got_entries (void **entryp, void *info_)
} }
else if (entry->privfd) else if (entry->privfd)
entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gothilo); entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gothilo);
return 1; return 1;
} }
@ -3331,7 +3331,7 @@ _frvfdpic_assign_plt_entries (void **entryp, void *info_)
} }
else else
{ {
BFD_ASSERT (dinfo->gothilo.fdplt) BFD_ASSERT (dinfo->gothilo.fdplt);
entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gothilo); entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gothilo);
dinfo->gothilo.fdplt -= 8; dinfo->gothilo.fdplt -= 8;
} }
@ -3370,9 +3370,9 @@ _frvfdpic_assign_plt_entries (void **entryp, void *info_)
== FRVFDPIC_LZPLT_RESOLV_LOC) == FRVFDPIC_LZPLT_RESOLV_LOC)
dinfo->g.lzplt += 4; dinfo->g.lzplt += 4;
} }
return 1; return 1;
} }
/* Follow indirect and warning hash entries so that each got entry /* Follow indirect and warning hash entries so that each got entry
points to the final symbol definition. P must point to a pointer points to the final symbol definition. P must point to a pointer
@ -3540,7 +3540,7 @@ elf32_frvfdpic_size_dynamic_sections (bfd *output_bfd,
if (frvfdpic_got_section (info)->contents == NULL) if (frvfdpic_got_section (info)->contents == NULL)
return FALSE; return FALSE;
} }
if (elf_hash_table (info)->dynamic_sections_created) if (elf_hash_table (info)->dynamic_sections_created)
/* Subtract the number of lzplt entries, since those will generate /* Subtract the number of lzplt entries, since those will generate
relocations in the pltrel section. */ relocations in the pltrel section. */
@ -3571,7 +3571,7 @@ elf32_frvfdpic_size_dynamic_sections (bfd *output_bfd,
if (frvfdpic_gotfixup_section (info)->contents == NULL) if (frvfdpic_gotfixup_section (info)->contents == NULL)
return FALSE; return FALSE;
} }
if (elf_hash_table (info)->dynamic_sections_created) if (elf_hash_table (info)->dynamic_sections_created)
{ {
frvfdpic_pltrel_section (info)->size = frvfdpic_pltrel_section (info)->size =
@ -3587,7 +3587,7 @@ elf32_frvfdpic_size_dynamic_sections (bfd *output_bfd,
return FALSE; return FALSE;
} }
} }
/* Add 4 bytes for every block of at most 65535 lazy PLT entries, /* Add 4 bytes for every block of at most 65535 lazy PLT entries,
such that there's room for the additional instruction needed to such that there's room for the additional instruction needed to
call the resolver. Since _frvfdpic_assign_got_entries didn't call the resolver. Since _frvfdpic_assign_got_entries didn't
@ -4145,14 +4145,14 @@ elf32_frv_check_relocs (abfd, info, sec, relocs)
picrel = NULL; picrel = NULL;
break; break;
} }
switch (ELF32_R_TYPE (rel->r_info)) switch (ELF32_R_TYPE (rel->r_info))
{ {
case R_FRV_LABEL24: case R_FRV_LABEL24:
if (IS_FDPIC (abfd)) if (IS_FDPIC (abfd))
picrel->call = 1; picrel->call = 1;
break; break;
case R_FRV_FUNCDESC_VALUE: case R_FRV_FUNCDESC_VALUE:
picrel->relocsfdv++; picrel->relocsfdv++;
if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
@ -4167,11 +4167,11 @@ elf32_frv_check_relocs (abfd, info, sec, relocs)
if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
picrel->relocs32++; picrel->relocs32++;
break; break;
case R_FRV_GOT12: case R_FRV_GOT12:
picrel->got12 = 1; picrel->got12 = 1;
break; break;
case R_FRV_GOTHI: case R_FRV_GOTHI:
case R_FRV_GOTLO: case R_FRV_GOTLO:
picrel->gothilo = 1; picrel->gothilo = 1;
@ -4180,32 +4180,32 @@ elf32_frv_check_relocs (abfd, info, sec, relocs)
case R_FRV_FUNCDESC_GOT12: case R_FRV_FUNCDESC_GOT12:
picrel->fdgot12 = 1; picrel->fdgot12 = 1;
break; break;
case R_FRV_FUNCDESC_GOTHI: case R_FRV_FUNCDESC_GOTHI:
case R_FRV_FUNCDESC_GOTLO: case R_FRV_FUNCDESC_GOTLO:
picrel->fdgothilo = 1; picrel->fdgothilo = 1;
break; break;
case R_FRV_GOTOFF12: case R_FRV_GOTOFF12:
case R_FRV_GOTOFFHI: case R_FRV_GOTOFFHI:
case R_FRV_GOTOFFLO: case R_FRV_GOTOFFLO:
picrel->gotoff = 1; picrel->gotoff = 1;
break; break;
case R_FRV_FUNCDESC_GOTOFF12: case R_FRV_FUNCDESC_GOTOFF12:
picrel->fdgoff12 = 1; picrel->fdgoff12 = 1;
break; break;
case R_FRV_FUNCDESC_GOTOFFHI: case R_FRV_FUNCDESC_GOTOFFHI:
case R_FRV_FUNCDESC_GOTOFFLO: case R_FRV_FUNCDESC_GOTOFFLO:
picrel->fdgoffhilo = 1; picrel->fdgoffhilo = 1;
break; break;
case R_FRV_FUNCDESC: case R_FRV_FUNCDESC:
picrel->fd = 1; picrel->fd = 1;
picrel->relocsfd++; picrel->relocsfd++;
break; break;
/* This relocation describes the C++ object vtable hierarchy. /* This relocation describes the C++ object vtable hierarchy.
Reconstruct it for later use during GC. */ Reconstruct it for later use during GC. */
case R_FRV_GNU_VTINHERIT: case R_FRV_GNU_VTINHERIT:
@ -4723,7 +4723,7 @@ frv_elf_print_private_bfd_data (abfd, ptr)
if (flags & EF_FRV_FDPIC) if (flags & EF_FRV_FDPIC)
fprintf (file, " -mfdpic"); fprintf (file, " -mfdpic");
if (flags & EF_FRV_NON_PIC_RELOCS) if (flags & EF_FRV_NON_PIC_RELOCS)
fprintf (file, " non-pic relocations"); fprintf (file, " non-pic relocations");

View file

@ -1350,7 +1350,7 @@ m32r_info_to_howto_rel (abfd, cache_ptr, dst)
unsigned int r_type; unsigned int r_type;
r_type = ELF32_R_TYPE (dst->r_info); r_type = ELF32_R_TYPE (dst->r_info);
BFD_ASSERT (ELF32_R_TYPE(dst->r_info) <= (unsigned int) R_M32R_GNU_VTENTRY) BFD_ASSERT (ELF32_R_TYPE(dst->r_info) <= (unsigned int) R_M32R_GNU_VTENTRY);
cache_ptr->howto = &m32r_elf_howto_table[r_type]; cache_ptr->howto = &m32r_elf_howto_table[r_type];
} }
@ -2828,7 +2828,7 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section,
case R_M32R_GOTOFF: case R_M32R_GOTOFF:
/* Relocation is relative to the start of the global offset /* Relocation is relative to the start of the global offset
table (for ld24 rx, #uimm24). eg access at label+addend table (for ld24 rx, #uimm24). eg access at label+addend
ld24 rx. #label@GOTOFF + addend ld24 rx. #label@GOTOFF + addend
sub rx, r12. */ sub rx, r12. */
@ -4271,7 +4271,7 @@ m32r_elf_print_private_bfd_data (abfd, ptr)
{ {
FILE * file = (FILE *) ptr; FILE * file = (FILE *) ptr;
BFD_ASSERT (abfd != NULL && ptr != NULL) BFD_ASSERT (abfd != NULL && ptr != NULL);
_bfd_elf_print_private_bfd_data (abfd, ptr); _bfd_elf_print_private_bfd_data (abfd, ptr);

View file

@ -5473,7 +5473,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
BFD_ASSERT (sec != NULL); BFD_ASSERT (sec != NULL);
BFD_ASSERT (bfd_is_und_section (sec) BFD_ASSERT (bfd_is_und_section (sec)
|| strcmp (bfd_get_section_name (abfd, sec), ".got") == 0 || strcmp (bfd_get_section_name (abfd, sec), ".got") == 0
|| strcmp (bfd_get_section_name (abfd, sec), ".cgot") == 0) || strcmp (bfd_get_section_name (abfd, sec), ".cgot") == 0);
addend -= sec->output_section->vma + sec->output_offset + 0x8000; addend -= sec->output_section->vma + sec->output_offset + 0x8000;
break; break;

View file

@ -1969,7 +1969,7 @@ elf64_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
the original values (in elf64_hppa_link_output_symbol_hook). */ the original values (in elf64_hppa_link_output_symbol_hook). */
if (dyn_h && dyn_h->want_opd) if (dyn_h && dyn_h->want_opd)
{ {
BFD_ASSERT (sopd != NULL) BFD_ASSERT (sopd != NULL);
/* Save away the original value and section index so that we /* Save away the original value and section index so that we
can restore them later. */ can restore them later. */
@ -1993,7 +1993,7 @@ elf64_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
Elf_Internal_Rela rel; Elf_Internal_Rela rel;
bfd_byte *loc; bfd_byte *loc;
BFD_ASSERT (splt != NULL && spltrel != NULL) BFD_ASSERT (splt != NULL && spltrel != NULL);
/* We do not actually care about the value in the PLT entry /* We do not actually care about the value in the PLT entry
if we are creating a shared library and the symbol is if we are creating a shared library and the symbol is
@ -2043,7 +2043,7 @@ elf64_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
int insn; int insn;
unsigned int max_offset; unsigned int max_offset;
BFD_ASSERT (stub != NULL) BFD_ASSERT (stub != NULL);
/* Install the generic stub template. /* Install the generic stub template.

View file

@ -924,7 +924,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
location of interest is just "sym". */ location of interest is just "sym". */
if (symtype == STT_SECTION) if (symtype == STT_SECTION)
toff += irel->r_addend; toff += irel->r_addend;
toff = _bfd_merged_section_offset (abfd, &tsec, toff = _bfd_merged_section_offset (abfd, &tsec,
elf_section_data (tsec)->sec_info, elf_section_data (tsec)->sec_info,
toff); toff);
@ -1125,7 +1125,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
enough that the data segment moves, which will change the GP. enough that the data segment moves, which will change the GP.
Reset the GP so that we re-calculate next round. We need to Reset the GP so that we re-calculate next round. We need to
do this at the _beginning_ of the next round; now will not do. */ do this at the _beginning_ of the next round; now will not do. */
/* Clean up and go home. */ /* Clean up and go home. */
while (fixups) while (fixups)
{ {
@ -2458,7 +2458,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
if (!pltoff) if (!pltoff)
return FALSE; return FALSE;
} }
dyn_i->want_pltoff = 1; dyn_i->want_pltoff = 1;
} }
if ((need_entry & NEED_DYNREL) && (sec->flags & SEC_ALLOC)) if ((need_entry & NEED_DYNREL) && (sec->flags & SEC_ALLOC))
@ -4178,7 +4178,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE); dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE);
if (dyn_i->want_fptr) if (dyn_i->want_fptr)
{ {
BFD_ASSERT (h == NULL || h->dynindx == -1) BFD_ASSERT (h == NULL || h->dynindx == -1);
if (!undef_weak_ref) if (!undef_weak_ref)
value = set_fptr_entry (output_bfd, info, dyn_i, value); value = set_fptr_entry (output_bfd, info, dyn_i, value);
dynindx = -1; dynindx = -1;
@ -4262,7 +4262,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
case R_IA64_PCREL64I: case R_IA64_PCREL64I:
/* The PCREL21BI reloc is specifically not intended for use with /* The PCREL21BI reloc is specifically not intended for use with
dynamic relocs. PCREL21F and PCREL21M are used for speculation dynamic relocs. PCREL21F and PCREL21M are used for speculation
fixup code, and thus probably ought not be dynamic. The fixup code, and thus probably ought not be dynamic. The
PCREL22 and PCREL64I relocs aren't emitted as dynamic relocs. */ PCREL22 and PCREL64I relocs aren't emitted as dynamic relocs. */
if (dynamic_symbol_p) if (dynamic_symbol_p)
{ {

View file

@ -595,10 +595,10 @@ void bfd_assert
(const char*,int); (const char*,int);
#define BFD_ASSERT(x) \ #define BFD_ASSERT(x) \
{ if (!(x)) bfd_assert(__FILE__,__LINE__); } do { if (!(x)) bfd_assert(__FILE__,__LINE__); } while (0)
#define BFD_FAIL() \ #define BFD_FAIL() \
{ bfd_assert(__FILE__,__LINE__); } do { bfd_assert(__FILE__,__LINE__); } while (0)
extern void _bfd_abort extern void _bfd_abort
(const char *, int, const char *) ATTRIBUTE_NORETURN; (const char *, int, const char *) ATTRIBUTE_NORETURN;

View file

@ -600,10 +600,10 @@ void bfd_assert
(const char*,int); (const char*,int);
#define BFD_ASSERT(x) \ #define BFD_ASSERT(x) \
{ if (!(x)) bfd_assert(__FILE__,__LINE__); } do { if (!(x)) bfd_assert(__FILE__,__LINE__); } while (0)
#define BFD_FAIL() \ #define BFD_FAIL() \
{ bfd_assert(__FILE__,__LINE__); } do { bfd_assert(__FILE__,__LINE__); } while (0)
extern void _bfd_abort extern void _bfd_abort
(const char *, int, const char *) ATTRIBUTE_NORETURN; (const char *, int, const char *) ATTRIBUTE_NORETURN;

View file

@ -859,9 +859,9 @@ bfd_release (bfd *abfd, void *block)
} }
/* /*
GNU Extension: separate debug-info files GNU Extension: separate debug-info files
The idea here is that a special section called .gnu_debuglink might be The idea here is that a special section called .gnu_debuglink might be
embedded in a binary file, which indicates that some *other* file embedded in a binary file, which indicates that some *other* file
contains the real debugging information. This special section contains a contains the real debugging information. This special section contains a
@ -889,7 +889,7 @@ DESCRIPTION
RETURNS RETURNS
Return the updated CRC32 value. Return the updated CRC32 value.
*/ */
unsigned long unsigned long
bfd_calc_gnu_debuglink_crc32 (unsigned long crc, bfd_calc_gnu_debuglink_crc32 (unsigned long crc,
@ -1092,19 +1092,19 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
return NULL; return NULL;
} }
BFD_ASSERT (strlen (dir) != 0); BFD_ASSERT (strlen (dir) != 0);
/* Strip off filename part. */ /* Strip off filename part. */
for (i = strlen (dir) - 1; i >= 0; i--) for (i = strlen (dir) - 1; i >= 0; i--)
if (IS_DIR_SEPARATOR (dir[i])) if (IS_DIR_SEPARATOR (dir[i]))
break; break;
dir[i + 1] = '\0'; dir[i + 1] = '\0';
BFD_ASSERT (dir[i] == '/' || dir[0] == '\0') BFD_ASSERT (dir[i] == '/' || dir[0] == '\0');
debugfile = malloc (strlen (debug_file_directory) + 1 debugfile = malloc (strlen (debug_file_directory) + 1
+ strlen (dir) + strlen (dir)
+ strlen (".debug/") + strlen (".debug/")
+ strlen (basename) + strlen (basename)
+ 1); + 1);
if (debugfile == NULL) if (debugfile == NULL)
{ {
@ -1211,7 +1211,7 @@ DESCRIPTION
RETURNS RETURNS
A pointer to the new section is returned if all is ok. Otherwise <<NULL>> is A pointer to the new section is returned if all is ok. Otherwise <<NULL>> is
returned and bfd_error is set. returned and bfd_error is set.
*/ */
asection * asection *
@ -1228,7 +1228,7 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename)
/* Strip off any path components in filename. */ /* Strip off any path components in filename. */
filename = lbasename (filename); filename = lbasename (filename);
sect = bfd_get_section_by_name (abfd, GNU_DEBUGLINK); sect = bfd_get_section_by_name (abfd, GNU_DEBUGLINK);
if (sect) if (sect)
{ {
@ -1246,7 +1246,7 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename)
/* XXX Should we delete the section from the bfd ? */ /* XXX Should we delete the section from the bfd ? */
return NULL; return NULL;
debuglink_size = strlen (filename) + 1; debuglink_size = strlen (filename) + 1;
debuglink_size += 3; debuglink_size += 3;
debuglink_size &= ~3; debuglink_size &= ~3;
@ -1255,7 +1255,7 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename)
if (! bfd_set_section_size (abfd, sect, debuglink_size)) if (! bfd_set_section_size (abfd, sect, debuglink_size))
/* XXX Should we delete the section from the bfd ? */ /* XXX Should we delete the section from the bfd ? */
return NULL; return NULL;
return sect; return sect;
} }
@ -1277,7 +1277,7 @@ DESCRIPTION
RETURNS RETURNS
<<TRUE>> is returned if all is ok. Otherwise <<FALSE>> is returned <<TRUE>> is returned if all is ok. Otherwise <<FALSE>> is returned
and bfd_error is set. and bfd_error is set.
*/ */
bfd_boolean bfd_boolean
@ -1320,7 +1320,7 @@ bfd_fill_in_gnu_debuglink_section (bfd *abfd,
/* Strip off any path components in filename, /* Strip off any path components in filename,
now that we no longer need them. */ now that we no longer need them. */
filename = lbasename (filename); filename = lbasename (filename);
debuglink_size = strlen (filename) + 1; debuglink_size = strlen (filename) + 1;
debuglink_size += 3; debuglink_size += 3;
debuglink_size &= ~3; debuglink_size &= ~3;