aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2016-07-16 13:25:11 +0930
committerAlan Modra <amodra@gmail.com>2016-07-16 13:25:11 +0930
commit76e7a75123dc36dbc4ddce8a23d2acb171c2bce2 (patch)
tree4db37956bee46faf43010262730aa55fded02d33 /ld
parent235fa74903061daff9980668423860ecc760665a (diff)
downloadfsf-binutils-gdb-76e7a75123dc36dbc4ddce8a23d2acb171c2bce2.zip
fsf-binutils-gdb-76e7a75123dc36dbc4ddce8a23d2acb171c2bce2.tar.gz
fsf-binutils-gdb-76e7a75123dc36dbc4ddce8a23d2acb171c2bce2.tar.bz2
Don't include libbfd.h outside of bfd, part 1
Make BFD_ALIGN available to objcopy. Fix assertions. Don't use bfd_log2 in ppc32elf.em or bfd_malloc in xtensaelf.em and bucomm.c. bfd/ * libbfd-in.h (BFD_ALIGN): Move to.. * bfd-in.h: ..here. * elf32-ppc.h (struct ppc_elf_params): Add pagesize. * elf32-ppc.c (default_params): Adjust init. (ppc_elf_link_params): Set pagesize_p2. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. binutils/ * ar.c: Don't include libbfd.h. * objcopy.c: Likewise. * bucomm.c (bfd_get_archive_filename): Use xmalloc rather than bfd_malloc. gas/ * config/bfin-parse.y: Don't include libbfd.h. * config/tc-bfin.c: Likewise. * config/tc-rl78.c: Likewise. * config/tc-rx.c: Likewise. * config/tc-metag.c: Likewise. (create_dspreg_htabs, create_scond_htab): Use gas_assert not BFD_ASSERT. * Makefile.am: Update dependencies. * Makefile.in: Regenerate. ld/ * ldlang.c: Don't include libbfd.h. * emultempl/nds32elf.em: Likewise. * emultempl/ppc64elf.em: Likewise. * emultempl/ppc32elf.em: Likewise. (pagesize): Delete. (params): Update init. (ppc_after_open_output): Use params.pagesize. Don't call bfd_log2. (PARSE_AND_LIST_ARGS_CASES): Use params.pagesize. * emultempl/sh64elf.em: Don't include libbfd.h. (after_allocation): Use ASSERT, not BFD_ASSERT. * emultempl/xtensaelf.em: Don't include libbfd.h. (replace_insn_sec_with_prop_sec): Use xmalloc, not bfd_malloc. * Makefile.am: Update dependencies. * Makefile.in: Regenerate.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog17
-rw-r--r--ld/Makefile.am14
-rw-r--r--ld/Makefile.in14
-rw-r--r--ld/emultempl/nds32elf.em1
-rw-r--r--ld/emultempl/ppc32elf.em16
-rw-r--r--ld/emultempl/ppc64elf.em1
-rw-r--r--ld/emultempl/sh64elf.em5
-rw-r--r--ld/emultempl/xtensaelf.em8
-rw-r--r--ld/ldlang.c1
9 files changed, 40 insertions, 37 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 70c64c6..b7be656 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,20 @@
+2016-07-16 Alan Modra <amodra@gmail.com>
+
+ * ldlang.c: Don't include libbfd.h.
+ * emultempl/nds32elf.em: Likewise.
+ * emultempl/ppc64elf.em: Likewise.
+ * emultempl/ppc32elf.em: Likewise.
+ (pagesize): Delete.
+ (params): Update init.
+ (ppc_after_open_output): Use params.pagesize. Don't call bfd_log2.
+ (PARSE_AND_LIST_ARGS_CASES): Use params.pagesize.
+ * emultempl/sh64elf.em: Don't include libbfd.h.
+ (after_allocation): Use ASSERT, not BFD_ASSERT.
+ * emultempl/xtensaelf.em: Don't include libbfd.h.
+ (replace_insn_sec_with_prop_sec): Use xmalloc, not bfd_malloc.
+ * Makefile.am: Update dependencies.
+ * Makefile.in: Regenerate.
+
2016-07-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
Nick Clifton <nickc@redhat.com>
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 0598923..16d95bc 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -1306,7 +1306,7 @@ eelf32xstormy16.c: $(srcdir)/emulparams/elf32xstormy16.sh \
eelf32xtensa.c: $(srcdir)/emulparams/elf32xtensa.sh $(ELF_DEPS) \
$(srcdir)/emultempl/xtensaelf.em $(INCDIR)/xtensa-config.h \
- $(BFDDIR)/elf-bfd.h $(BFDDIR)/libbfd.h $(INCDIR)/elf/xtensa.h \
+ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/xtensa.h \
$(srcdir)/scripttempl/elfxtensa.sc ${GEN_DEPENDS}
eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \
@@ -1712,19 +1712,19 @@ eshelf.c: $(srcdir)/emulparams/shelf.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eshelf32.c: $(srcdir)/emulparams/shelf32.sh \
- $(BFDDIR)/libbfd.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/libiberty.h \
$(srcdir)/emultempl/sh64elf.em $(INCDIR)/elf/sh.h $(BFDDIR)/elf-bfd.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eshelf32_linux.c: $(srcdir)/emulparams/shelf32_linux.sh \
$(srcdir)/emulparams/shelf32.sh \
- $(BFDDIR)/libbfd.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/libiberty.h \
$(srcdir)/emultempl/sh64elf.em $(INCDIR)/elf/sh.h $(BFDDIR)/elf-bfd.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eshelf32_nbsd.c: $(srcdir)/emulparams/shelf32_nbsd.sh \
$(srcdir)/emulparams/shelf32.sh \
- $(BFDDIR)/libbfd.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/libiberty.h \
$(srcdir)/emultempl/sh64elf.em $(INCDIR)/elf/sh.h $(BFDDIR)/elf-bfd.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
@@ -1758,19 +1758,19 @@ eshlelf.c: $(srcdir)/emulparams/shlelf.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eshlelf32.c: $(srcdir)/emulparams/shlelf32.sh \
- $(BFDDIR)/libbfd.h $(INCDIR)/libiberty.h $(srcdir)/emulparams/shelf32.sh \
+ $(INCDIR)/libiberty.h $(srcdir)/emulparams/shelf32.sh \
$(srcdir)/emultempl/sh64elf.em $(INCDIR)/elf/sh.h $(BFDDIR)/elf-bfd.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eshlelf32_linux.c: $(srcdir)/emulparams/shlelf32_linux.sh \
$(srcdir)/emulparams/shelf32_linux.sh $(srcdir)/emulparams/shelf32.sh \
- $(BFDDIR)/libbfd.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/libiberty.h \
$(srcdir)/emultempl/sh64elf.em $(INCDIR)/elf/sh.h $(BFDDIR)/elf-bfd.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eshlelf32_nbsd.c: $(srcdir)/emulparams/shlelf32_nbsd.sh \
$(srcdir)/emulparams/shelf32_nbsd.sh $(srcdir)/emulparams/shelf32.sh \
- $(BFDDIR)/libbfd.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/libiberty.h \
$(srcdir)/emultempl/sh64elf.em $(INCDIR)/elf/sh.h $(BFDDIR)/elf-bfd.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 7c78198..1ce019a 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -2894,7 +2894,7 @@ eelf32xstormy16.c: $(srcdir)/emulparams/elf32xstormy16.sh \
eelf32xtensa.c: $(srcdir)/emulparams/elf32xtensa.sh $(ELF_DEPS) \
$(srcdir)/emultempl/xtensaelf.em $(INCDIR)/xtensa-config.h \
- $(BFDDIR)/elf-bfd.h $(BFDDIR)/libbfd.h $(INCDIR)/elf/xtensa.h \
+ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/xtensa.h \
$(srcdir)/scripttempl/elfxtensa.sc ${GEN_DEPENDS}
eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \
@@ -3300,19 +3300,19 @@ eshelf.c: $(srcdir)/emulparams/shelf.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eshelf32.c: $(srcdir)/emulparams/shelf32.sh \
- $(BFDDIR)/libbfd.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/libiberty.h \
$(srcdir)/emultempl/sh64elf.em $(INCDIR)/elf/sh.h $(BFDDIR)/elf-bfd.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eshelf32_linux.c: $(srcdir)/emulparams/shelf32_linux.sh \
$(srcdir)/emulparams/shelf32.sh \
- $(BFDDIR)/libbfd.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/libiberty.h \
$(srcdir)/emultempl/sh64elf.em $(INCDIR)/elf/sh.h $(BFDDIR)/elf-bfd.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eshelf32_nbsd.c: $(srcdir)/emulparams/shelf32_nbsd.sh \
$(srcdir)/emulparams/shelf32.sh \
- $(BFDDIR)/libbfd.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/libiberty.h \
$(srcdir)/emultempl/sh64elf.em $(INCDIR)/elf/sh.h $(BFDDIR)/elf-bfd.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
@@ -3346,19 +3346,19 @@ eshlelf.c: $(srcdir)/emulparams/shlelf.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eshlelf32.c: $(srcdir)/emulparams/shlelf32.sh \
- $(BFDDIR)/libbfd.h $(INCDIR)/libiberty.h $(srcdir)/emulparams/shelf32.sh \
+ $(INCDIR)/libiberty.h $(srcdir)/emulparams/shelf32.sh \
$(srcdir)/emultempl/sh64elf.em $(INCDIR)/elf/sh.h $(BFDDIR)/elf-bfd.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eshlelf32_linux.c: $(srcdir)/emulparams/shlelf32_linux.sh \
$(srcdir)/emulparams/shelf32_linux.sh $(srcdir)/emulparams/shelf32.sh \
- $(BFDDIR)/libbfd.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/libiberty.h \
$(srcdir)/emultempl/sh64elf.em $(INCDIR)/elf/sh.h $(BFDDIR)/elf-bfd.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eshlelf32_nbsd.c: $(srcdir)/emulparams/shlelf32_nbsd.sh \
$(srcdir)/emulparams/shelf32_nbsd.sh $(srcdir)/emulparams/shelf32.sh \
- $(BFDDIR)/libbfd.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/libiberty.h \
$(srcdir)/emultempl/sh64elf.em $(INCDIR)/elf/sh.h $(BFDDIR)/elf-bfd.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
diff --git a/ld/emultempl/nds32elf.em b/ld/emultempl/nds32elf.em
index 08da695..7c1ddfe 100644
--- a/ld/emultempl/nds32elf.em
+++ b/ld/emultempl/nds32elf.em
@@ -22,7 +22,6 @@
fragment <<EOF
-#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/nds32.h"
#include "bfd_stdint.h"
diff --git a/ld/emultempl/ppc32elf.em b/ld/emultempl/ppc32elf.em
index a0255cd..95df30d 100644
--- a/ld/emultempl/ppc32elf.em
+++ b/ld/emultempl/ppc32elf.em
@@ -24,7 +24,6 @@
#
fragment <<EOF
-#include "libbfd.h"
#include "elf32-ppc.h"
#include "ldlex.h"
#include "ldlang.h"
@@ -39,9 +38,7 @@ static int notlsopt = 0;
/* Choose the correct place for .got. */
static int old_got = 0;
-static bfd_vma pagesize = 0;
-
-static struct ppc_elf_params params = { PLT_UNSET, -1, 0, 0, 0, 0, 0 };
+static struct ppc_elf_params params = { PLT_UNSET, -1, 0, 0, 0, 0, 0, 0 };
static void
ppc_after_open_output (void)
@@ -49,9 +46,8 @@ ppc_after_open_output (void)
if (params.emit_stub_syms < 0)
params.emit_stub_syms = (link_info.emitrelocations
|| bfd_link_pic (&link_info));
- if (pagesize == 0)
- pagesize = config.commonpagesize;
- params.pagesize_p2 = bfd_log2 (pagesize);
+ if (params.pagesize == 0)
+ params.pagesize = config.commonpagesize;
ppc_elf_link_params (&link_info, &params);
}
@@ -331,10 +327,10 @@ PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LIST_ARGS_CASES}'
if (optarg != NULL)
{
char *end;
- pagesize = strtoul (optarg, &end, 0);
+ params.pagesize = strtoul (optarg, &end, 0);
if (*end
- || (pagesize < 4096 && pagesize != 0)
- || pagesize != (pagesize & -pagesize))
+ || (params.pagesize < 4096 && params.pagesize != 0)
+ || params.pagesize != (params.pagesize & -params.pagesize))
einfo (_("%P%F: invalid pagesize `%s'\''\n"), optarg);
}
break;
diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em
index d7c0686..eaa692d 100644
--- a/ld/emultempl/ppc64elf.em
+++ b/ld/emultempl/ppc64elf.em
@@ -25,7 +25,6 @@
fragment <<EOF
#include "ldctor.h"
-#include "libbfd.h"
#include "elf-bfd.h"
#include "elf64-ppc.h"
#include "ldlex.h"
diff --git a/ld/emultempl/sh64elf.em b/ld/emultempl/sh64elf.em
index c538f39..0d42510 100644
--- a/ld/emultempl/sh64elf.em
+++ b/ld/emultempl/sh64elf.em
@@ -29,7 +29,6 @@ LDEMUL_BEFORE_ALLOCATION=sh64_elf_${EMULATION_NAME}_before_allocation
fragment <<EOF
#include "libiberty.h"
-#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/sh.h"
#include "elf32-sh64.h"
@@ -332,7 +331,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
{
oflags_isa = SHF_SH5_ISA32_MIXED;
- BFD_ASSERT (sh64_elf_section_data (osec)->sh64_info);
+ ASSERT (sh64_elf_section_data (osec)->sh64_info);
sh64_elf_section_data (osec)->sh64_info->contents_flags
= SHF_SH5_ISA32_MIXED;
@@ -382,7 +381,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
if (cranges->contents != NULL)
free (cranges->contents);
- BFD_ASSERT (sh64_elf_section_data (cranges)->sh64_info != NULL);
+ ASSERT (sh64_elf_section_data (cranges)->sh64_info != NULL);
/* Make sure we have .cranges in memory even if there were only
assembler-generated .cranges. */
diff --git a/ld/emultempl/xtensaelf.em b/ld/emultempl/xtensaelf.em
index 01ac7a9..4a87ac4 100644
--- a/ld/emultempl/xtensaelf.em
+++ b/ld/emultempl/xtensaelf.em
@@ -26,7 +26,6 @@ fragment <<EOF
#include <xtensa-config.h>
#include "../bfd/elf-bfd.h"
-#include "../bfd/libbfd.h"
#include "elf/xtensa.h"
#include "bfd.h"
@@ -116,12 +115,7 @@ replace_insn_sec_with_prop_sec (bfd *abfd,
if (insn_sec->size != 0)
{
- insn_contents = (bfd_byte *) bfd_malloc (insn_sec->size);
- if (insn_contents == NULL)
- {
- *error_message = _("out of memory");
- goto cleanup;
- }
+ insn_contents = (bfd_byte *) xmalloc (insn_sec->size);
if (! bfd_get_section_contents (abfd, insn_sec, insn_contents,
(file_ptr) 0, insn_sec->size))
{
diff --git a/ld/ldlang.c b/ld/ldlang.c
index b841408..82d5582 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -39,7 +39,6 @@
#include "fnmatch.h"
#include "demangle.h"
#include "hashtab.h"
-#include "libbfd.h"
#include "elf-bfd.h"
#ifdef ENABLE_PLUGINS
#include "plugin.h"