/* POWER/PowerPC XCOFF linker support.
- Copyright (C) 1995-2018 Free Software Foundation, Inc.
+ Copyright (C) 1995-2019 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
#include "libcoff.h"
#include "libxcoff.h"
#include "libiberty.h"
+#include "xcofflink.h"
/* This file holds the XCOFF linker code. */
if (EXTERN_SYM_P (sym.n_sclass))
{
- bfd_boolean copy;
+ bfd_boolean copy, ok;
flagword flags;
BFD_ASSERT (section != NULL);
BFD_ASSERT (last_real->next == first_csect);
last_real->next = NULL;
flags = (sym.n_sclass == C_EXT ? BSF_GLOBAL : BSF_WEAK);
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, name, flags, section, value,
- NULL, copy, TRUE,
- (struct bfd_link_hash_entry **) sym_hash)))
- goto error_return;
+ ok = (_bfd_generic_link_add_one_symbol
+ (info, abfd, name, flags, section, value, NULL, copy, TRUE,
+ (struct bfd_link_hash_entry **) sym_hash));
last_real->next = first_csect;
+ if (!ok)
+ goto error_return;
if (smtyp == XTY_CM)
{
for (o = abfd->sections; o != first_csect; o = o->next)
{
/* Debugging sections have no csects. */
- if (bfd_get_section_flags (abfd, o) & SEC_DEBUGGING)
+ if (bfd_section_flags (o) & SEC_DEBUGGING)
continue;
/* Reset the section size and the line number count, since the
data is now attached to the csects. Don't reset the size of
the .debug section, since we need to read it below in
bfd_xcoff_size_dynamic_sections. */
- if (strcmp (bfd_get_section_name (abfd, o), ".debug") != 0)
+ if (strcmp (bfd_section_name (o), ".debug") != 0)
o->size = 0;
o->lineno_count = 0;
|| o == xcoff_hash_table (info)->loader_section
|| o == xcoff_hash_table (info)->linkage_section
|| o == xcoff_hash_table (info)->descriptor_section
- || (bfd_get_section_flags (sub, o) & SEC_DEBUGGING)
+ || (bfd_section_flags (o) & SEC_DEBUGGING)
|| strcmp (o->name, ".debug") == 0)
o->flags |= SEC_MARK;
else
BFD_ASSERT (bfd_is_abs_symbol (&h->root));
isym.n_value = h->root.u.def.value;
isym.n_scnum = N_UNDEF;
- if (h->root.type == bfd_link_hash_undefweak
+ if (h->root.type == bfd_link_hash_defweak
&& C_WEAKEXT == C_AIX_WEAKEXT)
isym.n_sclass = C_WEAKEXT;
else
/* We just output an SD symbol. Now output an LD symbol. */
h->indx += 2;
- if (h->root.type == bfd_link_hash_undefweak
+ if (h->root.type == bfd_link_hash_defweak
&& C_WEAKEXT == C_AIX_WEAKEXT)
isym.n_sclass = C_WEAKEXT;
else
goto error_return;
}
- /* Setting bfd_get_symcount to 0 will cause write_object_contents to
+ /* Setting symcount to 0 will cause write_object_contents to
not try to write out the symbols. */
- bfd_get_symcount (abfd) = 0;
+ abfd->symcount = 0;
return TRUE;