From 76e7a75123dc36dbc4ddce8a23d2acb171c2bce2 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sat, 16 Jul 2016 13:25:11 +0930 Subject: [PATCH] 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. --- bfd/ChangeLog | 10 ++++++++++ bfd/bfd-in.h | 12 ++++++++++-- bfd/bfd-in2.h | 12 ++++++++++-- bfd/elf32-ppc.c | 4 +++- bfd/elf32-ppc.h | 2 ++ bfd/libbfd-in.h | 9 --------- bfd/libbfd.h | 9 --------- binutils/ChangeLog | 7 +++++++ binutils/ar.c | 1 - binutils/bucomm.c | 9 +-------- binutils/objcopy.c | 1 - gas/ChangeLog | 11 +++++++++++ gas/Makefile.am | 6 +++--- gas/Makefile.in | 6 +++--- gas/config/bfin-parse.y | 1 - gas/config/tc-bfin.c | 1 - gas/config/tc-metag.c | 7 +++---- gas/config/tc-rl78.c | 1 - gas/config/tc-rx.c | 1 - ld/ChangeLog | 17 +++++++++++++++++ ld/Makefile.am | 14 +++++++------- ld/Makefile.in | 14 +++++++------- ld/emultempl/nds32elf.em | 1 - ld/emultempl/ppc32elf.em | 16 ++++++---------- ld/emultempl/ppc64elf.em | 1 - ld/emultempl/sh64elf.em | 5 ++--- ld/emultempl/xtensaelf.em | 8 +------- ld/ldlang.c | 1 - 28 files changed, 103 insertions(+), 84 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ec8fd85..2c67bd7 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,13 @@ +2016-07-16 Alan Modra + + * 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. + 2016-07-15 Thomas Preud'homme * elf-bfd.h (elf_backend_filter_implib_symbols): Declare backend hook. diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index a7532c5..99cafba 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -256,7 +256,7 @@ struct orl /* Output ranlib. */ } u; /* bfd* or file position. */ int namidx; /* Index into string table. */ }; - + /* Linenumber stuff. */ typedef struct lineno_cache_entry { @@ -270,11 +270,19 @@ typedef struct lineno_cache_entry alent; /* Object and core file sections. */ +typedef struct bfd_section *sec_ptr; #define align_power(addr, align) \ (((addr) + ((bfd_vma) 1 << (align)) - 1) & (-((bfd_vma) 1 << (align)))) -typedef struct bfd_section *sec_ptr; +/* Align an address upward to a boundary, expressed as a number of bytes. + E.g. align to an 8-byte boundary with argument of 8. Take care never + to wrap around if the address is within boundary-1 of the end of the + address space. */ +#define BFD_ALIGN(this, boundary) \ + ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \ + ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \ + : ~ (bfd_vma) 0) #define bfd_get_section_name(bfd, ptr) ((void) bfd, (ptr)->name) #define bfd_get_section_vma(bfd, ptr) ((void) bfd, (ptr)->vma) diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 3f2d93b..5fffc46 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -263,7 +263,7 @@ struct orl /* Output ranlib. */ } u; /* bfd* or file position. */ int namidx; /* Index into string table. */ }; - + /* Linenumber stuff. */ typedef struct lineno_cache_entry { @@ -277,11 +277,19 @@ typedef struct lineno_cache_entry alent; /* Object and core file sections. */ +typedef struct bfd_section *sec_ptr; #define align_power(addr, align) \ (((addr) + ((bfd_vma) 1 << (align)) - 1) & (-((bfd_vma) 1 << (align)))) -typedef struct bfd_section *sec_ptr; +/* Align an address upward to a boundary, expressed as a number of bytes. + E.g. align to an 8-byte boundary with argument of 8. Take care never + to wrap around if the address is within boundary-1 of the end of the + address space. */ +#define BFD_ALIGN(this, boundary) \ + ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \ + ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \ + : ~ (bfd_vma) 0) #define bfd_get_section_name(bfd, ptr) ((void) bfd, (ptr)->name) #define bfd_get_section_vma(bfd, ptr) ((void) bfd, (ptr)->vma) diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 95ce1dc..b1c75a6 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -3365,7 +3365,8 @@ static struct bfd_link_hash_table * ppc_elf_link_hash_table_create (bfd *abfd) { struct ppc_elf_link_hash_table *ret; - static struct ppc_elf_params default_params = { PLT_OLD, 0, 1, 0, 0, 12, 0 }; + static struct ppc_elf_params default_params + = { PLT_OLD, 0, 1, 0, 0, 12, 0, 0 }; ret = bfd_zmalloc (sizeof (struct ppc_elf_link_hash_table)); if (ret == NULL) @@ -3411,6 +3412,7 @@ ppc_elf_link_params (struct bfd_link_info *info, struct ppc_elf_params *params) if (htab) htab->params = params; + params->pagesize_p2 = bfd_log2 (params->pagesize); } /* Create .got and the related sections. */ diff --git a/bfd/elf32-ppc.h b/bfd/elf32-ppc.h index dd26bd6..5f3a88b 100644 --- a/bfd/elf32-ppc.h +++ b/bfd/elf32-ppc.h @@ -48,6 +48,8 @@ struct ppc_elf_params /* The bfd backend detected a non-PIC reference to a protected symbol defined in a shared library. */ int pic_fixup; + + bfd_vma pagesize; }; void ppc_elf_link_params (struct bfd_link_info *, struct ppc_elf_params *); diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 8644d8d..cde3aad 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -28,15 +28,6 @@ extern "C" { #endif -/* Align an address upward to a boundary, expressed as a number of bytes. - E.g. align to an 8-byte boundary with argument of 8. Take care never - to wrap around if the address is within boundary-1 of the end of the - address space. */ -#define BFD_ALIGN(this, boundary) \ - ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \ - ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \ - : ~ (bfd_vma) 0) - /* If you want to read and write large blocks, you might want to do it in quanta of this amount */ #define DEFAULT_BUFFERSIZE 8192 diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 2b1777e..eb6312b 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -33,15 +33,6 @@ extern "C" { #endif -/* Align an address upward to a boundary, expressed as a number of bytes. - E.g. align to an 8-byte boundary with argument of 8. Take care never - to wrap around if the address is within boundary-1 of the end of the - address space. */ -#define BFD_ALIGN(this, boundary) \ - ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \ - ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \ - : ~ (bfd_vma) 0) - /* If you want to read and write large blocks, you might want to do it in quanta of this amount */ #define DEFAULT_BUFFERSIZE 8192 diff --git a/binutils/ChangeLog b/binutils/ChangeLog index bbf94d2..94ec445 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,10 @@ +2016-07-16 Alan Modra + + * ar.c: Don't include libbfd.h. + * objcopy.c: Likewise. + * bucomm.c (bfd_get_archive_filename): Use xmalloc rather than + bfd_malloc. + 2016-07-15 Alan Modra * testsuite/binutils-all/remove-relocs-01.s: Use .dc.a, not .word. diff --git a/binutils/ar.c b/binutils/ar.c index 3afa253..1337710 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -29,7 +29,6 @@ #include "progress.h" #include "getopt.h" #include "aout/ar.h" -#include "libbfd.h" #include "bucomm.h" #include "arsup.h" #include "filenames.h" diff --git a/binutils/bucomm.c b/binutils/bucomm.c index 8ecd7f2..e719cd3 100644 --- a/binutils/bucomm.c +++ b/binutils/bucomm.c @@ -616,14 +616,7 @@ bfd_get_archive_filename (const bfd *abfd) if (curr) free (buf); curr = needed + (needed >> 1); - buf = (char *) bfd_malloc (curr); - /* If we can't malloc, fail safe by returning just the file name. - This function is only used when building error messages. */ - if (!buf) - { - curr = 0; - return bfd_get_filename (abfd); - } + buf = (char *) xmalloc (curr); } sprintf (buf, "%s(%s)", bfd_get_filename (abfd->my_archive), bfd_get_filename (abfd)); diff --git a/binutils/objcopy.c b/binutils/objcopy.c index cf3f983..2e8ff27 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -28,7 +28,6 @@ #include "filenames.h" #include "fnmatch.h" #include "elf-bfd.h" -#include "libbfd.h" #include "coff/internal.h" #include "libcoff.h" diff --git a/gas/ChangeLog b/gas/ChangeLog index 50f7cd9..582655e 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,14 @@ +2016-07-16 Alan Modra + + * 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. + 2016-07-14 Maciej W. Rozycki * config/tc-mips.h (TC_FORCE_RELOCATION_ABS): New macro. diff --git a/gas/Makefile.am b/gas/Makefile.am index 596e469..7e302fb 100644 --- a/gas/Makefile.am +++ b/gas/Makefile.am @@ -484,7 +484,7 @@ bfin-parse.c: $(srcdir)/config/bfin-parse.y bfin-parse.h: bfin-parse.c bfin-parse.@OBJEXT@: bfin-parse.c \ $(srcdir)/config/bfin-aux.h $(srcdir)/config/bfin-defs.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/bfin.h $(BFDDIR)/libbfd.h + $(INCDIR)/elf/common.h $(INCDIR)/elf/bfin.h bfin-parse.h: ; @true $(srcdir)/config/bfin-parse.h: ; @true @@ -507,7 +507,7 @@ rl78-parse.c: $(srcdir)/config/rl78-parse.y $(SHELL) $(YLWRAP) $(srcdir)/config/rl78-parse.y y.tab.c rl78-parse.c y.tab.h rl78-parse.h -- $(YACCCOMPILE) -d ; rl78-parse.h: rl78-parse.c rl78-parse.@OBJEXT@: rl78-parse.c rl78-parse.h $(srcdir)/config/rl78-defs.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/rl78.h $(BFDDIR)/libbfd.h + $(INCDIR)/elf/common.h $(INCDIR)/elf/rl78.h rl78-defs.h: ; @true @@ -515,7 +515,7 @@ rx-parse.c: $(srcdir)/config/rx-parse.y $(SHELL) $(YLWRAP) $(srcdir)/config/rx-parse.y y.tab.c rx-parse.c y.tab.h rx-parse.h -- $(YACCCOMPILE) -d ; rx-parse.h: rx-parse.c rx-parse.@OBJEXT@: rx-parse.c rx-parse.h $(srcdir)/config/rx-defs.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/rx.h $(BFDDIR)/libbfd.h + $(INCDIR)/elf/common.h $(INCDIR)/elf/rx.h rx-defs.h: ; @true $(srcdir)/config/rx-defs.h: ; @true diff --git a/gas/Makefile.in b/gas/Makefile.in index 59746f3..19b63f3 100644 --- a/gas/Makefile.in +++ b/gas/Makefile.in @@ -2590,7 +2590,7 @@ bfin-parse.c: $(srcdir)/config/bfin-parse.y bfin-parse.h: bfin-parse.c bfin-parse.@OBJEXT@: bfin-parse.c \ $(srcdir)/config/bfin-aux.h $(srcdir)/config/bfin-defs.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/bfin.h $(BFDDIR)/libbfd.h + $(INCDIR)/elf/common.h $(INCDIR)/elf/bfin.h bfin-parse.h: ; @true $(srcdir)/config/bfin-parse.h: ; @true @@ -2608,7 +2608,7 @@ rl78-parse.c: $(srcdir)/config/rl78-parse.y $(SHELL) $(YLWRAP) $(srcdir)/config/rl78-parse.y y.tab.c rl78-parse.c y.tab.h rl78-parse.h -- $(YACCCOMPILE) -d ; rl78-parse.h: rl78-parse.c rl78-parse.@OBJEXT@: rl78-parse.c rl78-parse.h $(srcdir)/config/rl78-defs.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/rl78.h $(BFDDIR)/libbfd.h + $(INCDIR)/elf/common.h $(INCDIR)/elf/rl78.h rl78-defs.h: ; @true @@ -2616,7 +2616,7 @@ rx-parse.c: $(srcdir)/config/rx-parse.y $(SHELL) $(YLWRAP) $(srcdir)/config/rx-parse.y y.tab.c rx-parse.c y.tab.h rx-parse.h -- $(YACCCOMPILE) -d ; rx-parse.h: rx-parse.c rx-parse.@OBJEXT@: rx-parse.c rx-parse.h $(srcdir)/config/rx-defs.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/rx.h $(BFDDIR)/libbfd.h + $(INCDIR)/elf/common.h $(INCDIR)/elf/rx.h rx-defs.h: ; @true $(srcdir)/config/rx-defs.h: ; @true diff --git a/gas/config/bfin-parse.y b/gas/config/bfin-parse.y index a2eaa4c..87abd21 100644 --- a/gas/config/bfin-parse.y +++ b/gas/config/bfin-parse.y @@ -22,7 +22,6 @@ #include "as.h" #include "bfin-aux.h" /* Opcode generating auxiliaries. */ -#include "libbfd.h" #include "elf/common.h" #include "elf/bfin.h" diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c index 334dce4..1dc88fc 100644 --- a/gas/config/tc-bfin.c +++ b/gas/config/tc-bfin.c @@ -26,7 +26,6 @@ #ifdef OBJ_ELF #include "dwarf2dbg.h" #endif -#include "libbfd.h" #include "elf/common.h" #include "elf/bfin.h" diff --git a/gas/config/tc-metag.c b/gas/config/tc-metag.c index a6c7152..bbc34f7 100644 --- a/gas/config/tc-metag.c +++ b/gas/config/tc-metag.c @@ -24,7 +24,6 @@ #include "symcat.h" #include "safe-ctype.h" #include "hashtab.h" -#include "libbfd.h" #include @@ -6416,7 +6415,7 @@ create_dspreg_htabs (void) /* Make sure there are no hash table collisions, which would require chaining entries. */ - BFD_ASSERT (*slot == NULL); + gas_assert (*slot == NULL); *slot = reg; } @@ -6439,7 +6438,7 @@ create_dspreg_htabs (void) /* Make sure there are no hash table collisions, which would require chaining entries. */ - BFD_ASSERT (*slot == NULL); + gas_assert (*slot == NULL); *slot = reg; } } @@ -6486,7 +6485,7 @@ create_scond_htab (void) scond, INSERT); /* Make sure there are no hash table collisions, which would require chaining entries. */ - BFD_ASSERT (*slot == NULL); + gas_assert (*slot == NULL); *slot = scond; } } diff --git a/gas/config/tc-rl78.c b/gas/config/tc-rl78.c index 8ab35ec..815a10c 100644 --- a/gas/config/tc-rl78.c +++ b/gas/config/tc-rl78.c @@ -22,7 +22,6 @@ #include "struc-symbol.h" #include "safe-ctype.h" #include "dwarf2dbg.h" -#include "libbfd.h" #include "elf/common.h" #include "elf/rl78.h" #include "rl78-defs.h" diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c index a9beec7..bb0f689 100644 --- a/gas/config/tc-rx.c +++ b/gas/config/tc-rx.c @@ -22,7 +22,6 @@ #include "struc-symbol.h" #include "safe-ctype.h" #include "dwarf2dbg.h" -#include "libbfd.h" #include "elf/common.h" #include "elf/rx.h" #include "rx-defs.h" 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 + + * 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 Nick Clifton 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 <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 < #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" -- 2.7.4