Move elf32.em and elf-generic.em functions
Many ELF linker targets support multiple "emulations" and thus have multiple copies of elf32.em being compiled and linked into ld. This patch moves much of elf32.em and elf-generic.em into files which will be compiled just once, resulting in a 20% decrease in ld size for --enable-targets=all. * Makefile.am (ALL_EMUL_EXTRA_OFILES): Add ldelf and ldelfgen. (CFILES, HFILES, EXTRA_ld_new_SOURCES): Likewise. * configure.tgt: Formatting. (targ_extra_ofiles): Init to ldelf.o ldelfgen.o, reset to just ldelfgen.o for generic ELF targets, and empty for non-ELF. * emultempl/aarch64elf.em (gldaarch64_layout_sections_again): Use ldelf_map_segments. (gld${EMULATION_NAME}_after_allocation): Likewise. (real_func, aarch64_for_each_input_file_wrapper), (aarch64_lang_for_each_input_file): Delete. (lang_for_each_input_file): Don't define. * emultempl/alphaelf.em (alpha_after_parse): Use ldelf_map_segments. * emultempl/armelf.em (gldarm_layout_sections_again): Likewise. (gld${EMULATION_NAME}_after_allocation): Likewise. (real_func, arm_for_each_input_file_wrapper), (arm_lang_for_each_input_file): Delete. (lang_for_each_input_file): Don't define. * emultempl/cr16elf.em (cr16elf_after_parse): Use ldelf_map_segments. * emultempl/crxelf.em (crxelf_after_parse): Likewise. Delete declaration. * emultempl/cskyelf.em (gldcsky_layout_sections_again): Use ldelf_map_segments. (gld${EMULATION_NAME}_after_allocation): Likewise. (real_func, csky_for_each_input_file_wrapper), (csky_lang_for_each_input_file): Delete. (lang_for_each_input_file): Don't define. * emultempl/genelf.em: Include ldelfgen.h. (gld${EMULATION_NAME}_before_allocation): Use ldelf_map_segments. * emultempl/hppaelf.em (hppaelf_after_parse): Likewise. (hppaelf_layout_sections_again): Likewise. (gld${EMULATION_NAME}_after_allocation): Likewise. (real_func, hppa_for_each_input_file_wrapper), (hppa_lang_for_each_input_file): Delete. (lang_for_each_input_file): Don't define. * emultempl/ia64elf.em (ia64elf_after_parse): Use ldelf_map_segments. * emultempl/m68hc1xelf.em (real_func), (m68hc11_for_each_input_file_wrapper), (m68hc11_lang_for_each_input_file): Delete. (lang_for_each_input_file): Don't define. * emultempl/metagelf.em (metagelf_layout_sections_again): Use ldelf_map_segments. (gld${EMULATION_NAME}_after_allocation): Likewise. (real_func, metag_for_each_input_file_wrapper), (metag_lang_for_each_input_file): Delete. (lang_for_each_input_file): Don't define. * emultempl/mipself.em (real_func), (mips_for_each_input_file_wrapper), (mips_lang_for_each_input_file): Delete. (lang_for_each_input_file): Don't define. * emultempl/mmo.em: Don't include elf-bfd.h, do include ldelfgen.h. (gld${EMULATION_NAME}_after_allocation): Use ldelf_map_segments. * emultempl/nds32elf.em (nds32_elf_after_parse): Use ldelf_after_parse. (nds32_elf_after_allocation): Comment fix. * emultempl/nios2elf.em (nios2elf_layout_sections_again): Use ldelf_map_segments. (gld${EMULATION_NAME}_after_allocation): Likewise. (real_func, nios2_for_each_input_file_wrapper), (nios2_lang_for_each_input_file): Delete. (lang_for_each_input_file): Don't define. * emultempl/ppc32elf.em (gld${EMULATION_NAME}_load_symbols): Delete declaration. (ppc_recognized_file): Call ldelf_load_symbols. * emultempl/ppc64elf.em (ppc_layout_sections_again): Likewise. (gld${EMULATION_NAME}_after_allocation): Likewise. (real_func, ppc_for_each_input_file_wrapper), (ppc_lang_for_each_input_file): Delete. (lang_for_each_input_file): Don't define. (gld${EMULATION_NAME}_load_symbols): Don't declare. (ppc64_recognized_file): Call ldelf_load_symbols. * emultempl/riscvelf.em (gld${EMULATION_NAME}_after_allocation): Use ldelf_map_segments. * emultempl/spuelf.em (spu_place_special_section): Use ldelf_place_orphan. * emultempl/tic6xdsbt.em (gld${EMULATION_NAME}_after_allocation): Use ldelf_map_segments. * emultempl/vms.em: Include ldelfgen.h. (gld${EMULATION_NAME}_after_allocation): Use ldelf_map_segments. * emultempl/elf32.em: Remove unnecessary headers, include ldelf.h and ldelfgen.h. Move much of file content to.. * ldelf.c: ..here. New file. * ldelf.h: New file. * emultempl/elf-generic.em: Move gld${EMULATION_NAME}_map_segments.. * ldelfgen.c: ..to here. * ldelfgen.h: New file. * ldlang.c (lang_for_each_input_file): Adjust to only call func on real files. (lang_for_each_file): Likewise. * po/SRC-POTFILES.in: Regenerate. * Makefile.in: Regenerate.
This commit is contained in:
parent
cb7f4b298e
commit
d871d47806
92
ld/ChangeLog
92
ld/ChangeLog
@ -1,3 +1,95 @@
|
||||
2019-09-11 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* Makefile.am (ALL_EMUL_EXTRA_OFILES): Add ldelf and ldelfgen.
|
||||
(CFILES, HFILES, EXTRA_ld_new_SOURCES): Likewise.
|
||||
* configure.tgt: Formatting.
|
||||
(targ_extra_ofiles): Init to ldelf.o ldelfgen.o, reset to just
|
||||
ldelfgen.o for generic ELF targets, and empty for non-ELF.
|
||||
* emultempl/aarch64elf.em (gldaarch64_layout_sections_again): Use
|
||||
ldelf_map_segments.
|
||||
(gld${EMULATION_NAME}_after_allocation): Likewise.
|
||||
(real_func, aarch64_for_each_input_file_wrapper),
|
||||
(aarch64_lang_for_each_input_file): Delete.
|
||||
(lang_for_each_input_file): Don't define.
|
||||
* emultempl/alphaelf.em (alpha_after_parse): Use ldelf_map_segments.
|
||||
* emultempl/armelf.em (gldarm_layout_sections_again): Likewise.
|
||||
(gld${EMULATION_NAME}_after_allocation): Likewise.
|
||||
(real_func, arm_for_each_input_file_wrapper),
|
||||
(arm_lang_for_each_input_file): Delete.
|
||||
(lang_for_each_input_file): Don't define.
|
||||
* emultempl/cr16elf.em (cr16elf_after_parse): Use ldelf_map_segments.
|
||||
* emultempl/crxelf.em (crxelf_after_parse): Likewise. Delete
|
||||
declaration.
|
||||
* emultempl/cskyelf.em (gldcsky_layout_sections_again): Use
|
||||
ldelf_map_segments.
|
||||
(gld${EMULATION_NAME}_after_allocation): Likewise.
|
||||
(real_func, csky_for_each_input_file_wrapper),
|
||||
(csky_lang_for_each_input_file): Delete.
|
||||
(lang_for_each_input_file): Don't define.
|
||||
* emultempl/genelf.em: Include ldelfgen.h.
|
||||
(gld${EMULATION_NAME}_before_allocation): Use ldelf_map_segments.
|
||||
* emultempl/hppaelf.em (hppaelf_after_parse): Likewise.
|
||||
(hppaelf_layout_sections_again): Likewise.
|
||||
(gld${EMULATION_NAME}_after_allocation): Likewise.
|
||||
(real_func, hppa_for_each_input_file_wrapper),
|
||||
(hppa_lang_for_each_input_file): Delete.
|
||||
(lang_for_each_input_file): Don't define.
|
||||
* emultempl/ia64elf.em (ia64elf_after_parse): Use ldelf_map_segments.
|
||||
* emultempl/m68hc1xelf.em (real_func),
|
||||
(m68hc11_for_each_input_file_wrapper),
|
||||
(m68hc11_lang_for_each_input_file): Delete.
|
||||
(lang_for_each_input_file): Don't define.
|
||||
* emultempl/metagelf.em (metagelf_layout_sections_again): Use
|
||||
ldelf_map_segments.
|
||||
(gld${EMULATION_NAME}_after_allocation): Likewise.
|
||||
(real_func, metag_for_each_input_file_wrapper),
|
||||
(metag_lang_for_each_input_file): Delete.
|
||||
(lang_for_each_input_file): Don't define.
|
||||
* emultempl/mipself.em (real_func),
|
||||
(mips_for_each_input_file_wrapper),
|
||||
(mips_lang_for_each_input_file): Delete.
|
||||
(lang_for_each_input_file): Don't define.
|
||||
* emultempl/mmo.em: Don't include elf-bfd.h, do include ldelfgen.h.
|
||||
(gld${EMULATION_NAME}_after_allocation): Use ldelf_map_segments.
|
||||
* emultempl/nds32elf.em (nds32_elf_after_parse): Use ldelf_after_parse.
|
||||
(nds32_elf_after_allocation): Comment fix.
|
||||
* emultempl/nios2elf.em (nios2elf_layout_sections_again): Use
|
||||
ldelf_map_segments.
|
||||
(gld${EMULATION_NAME}_after_allocation): Likewise.
|
||||
(real_func, nios2_for_each_input_file_wrapper),
|
||||
(nios2_lang_for_each_input_file): Delete.
|
||||
(lang_for_each_input_file): Don't define.
|
||||
* emultempl/ppc32elf.em (gld${EMULATION_NAME}_load_symbols): Delete
|
||||
declaration.
|
||||
(ppc_recognized_file): Call ldelf_load_symbols.
|
||||
* emultempl/ppc64elf.em (ppc_layout_sections_again): Likewise.
|
||||
(gld${EMULATION_NAME}_after_allocation): Likewise.
|
||||
(real_func, ppc_for_each_input_file_wrapper),
|
||||
(ppc_lang_for_each_input_file): Delete.
|
||||
(lang_for_each_input_file): Don't define.
|
||||
(gld${EMULATION_NAME}_load_symbols): Don't declare.
|
||||
(ppc64_recognized_file): Call ldelf_load_symbols.
|
||||
* emultempl/riscvelf.em (gld${EMULATION_NAME}_after_allocation):
|
||||
Use ldelf_map_segments.
|
||||
* emultempl/spuelf.em (spu_place_special_section): Use
|
||||
ldelf_place_orphan.
|
||||
* emultempl/tic6xdsbt.em (gld${EMULATION_NAME}_after_allocation):
|
||||
Use ldelf_map_segments.
|
||||
* emultempl/vms.em: Include ldelfgen.h.
|
||||
(gld${EMULATION_NAME}_after_allocation): Use ldelf_map_segments.
|
||||
* emultempl/elf32.em: Remove unnecessary headers, include ldelf.h
|
||||
and ldelfgen.h. Move much of file content to..
|
||||
* ldelf.c: ..here. New file.
|
||||
* ldelf.h: New file.
|
||||
* emultempl/elf-generic.em: Move gld${EMULATION_NAME}_map_segments..
|
||||
* ldelfgen.c: ..to here.
|
||||
* ldelfgen.h: New file.
|
||||
* ldlang.c (lang_for_each_input_file): Adjust to only call func
|
||||
on real files.
|
||||
(lang_for_each_file): Likewise.
|
||||
* po/SRC-POTFILES.in: Regenerate.
|
||||
* Makefile.in: Regenerate.
|
||||
|
||||
2019-09-11 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* ldmisc.c: Don't #include elf-bfd.h or coff-bfd.h.
|
||||
|
@ -467,7 +467,9 @@ ALL_64_EMULATIONS = $(ALL_64_EMULATION_SOURCES:.c=.@OBJEXT@)
|
||||
|
||||
ALL_EMUL_EXTRA_OFILES = \
|
||||
deffilep.@OBJEXT@ \
|
||||
pe-dll.@OBJEXT@
|
||||
pe-dll.@OBJEXT@ \
|
||||
ldelf.@OBJEXT@ \
|
||||
ldelfgen.@OBJEXT@
|
||||
|
||||
ALL_64_EMUL_EXTRA_OFILES = \
|
||||
pep-dll.@OBJEXT@
|
||||
@ -475,12 +477,12 @@ ALL_64_EMUL_EXTRA_OFILES = \
|
||||
CFILES = ldctor.c ldemul.c ldexp.c ldfile.c ldlang.c \
|
||||
ldmain.c ldmisc.c ldver.c ldwrite.c lexsup.c \
|
||||
mri.c ldcref.c pe-dll.c pep-dll.c ldlex-wrapper.c \
|
||||
$(PLUGIN_C) ldbuildid.c
|
||||
$(PLUGIN_C) ldbuildid.c ldelf.c ldelfgen.c
|
||||
|
||||
HFILES = ld.h ldctor.h ldemul.h ldexp.h ldfile.h \
|
||||
ldlang.h ldlex.h ldmain.h ldmisc.h ldver.h \
|
||||
ldwrite.h mri.h deffile.h pe-dll.h pep-dll.h \
|
||||
elf-hints-local.h $(PLUGIN_H) ldbuildid.h
|
||||
elf-hints-local.h $(PLUGIN_H) ldbuildid.h ldelf.h ldelfgen.h
|
||||
|
||||
GENERATED_CFILES = ldgram.c ldlex.c deffilep.c
|
||||
GENERATED_HFILES = ldgram.h ldemul-list.h deffilep.h
|
||||
@ -951,7 +953,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
|
||||
# We need this for automake to use YLWRAP.
|
||||
EXTRA_ld_new_SOURCES = deffilep.y ldlex.l
|
||||
# Allow dependency tracking to work for these files, too.
|
||||
EXTRA_ld_new_SOURCES += pep-dll.c pe-dll.c
|
||||
EXTRA_ld_new_SOURCES += pep-dll.c pe-dll.c ldelf.c ldelfgen.c
|
||||
|
||||
ld_new_SOURCES = ldgram.y ldlex-wrapper.c lexsup.c ldlang.c mri.c ldctor.c ldmain.c \
|
||||
ldwrite.c ldexp.c ldemul.c ldver.c ldmisc.c ldfile.c ldcref.c $(PLUGIN_C) \
|
||||
|
@ -952,7 +952,9 @@ ALL_64_EMULATION_SOURCES = \
|
||||
ALL_64_EMULATIONS = $(ALL_64_EMULATION_SOURCES:.c=.@OBJEXT@)
|
||||
ALL_EMUL_EXTRA_OFILES = \
|
||||
deffilep.@OBJEXT@ \
|
||||
pe-dll.@OBJEXT@
|
||||
pe-dll.@OBJEXT@ \
|
||||
ldelf.@OBJEXT@ \
|
||||
ldelfgen.@OBJEXT@
|
||||
|
||||
ALL_64_EMUL_EXTRA_OFILES = \
|
||||
pep-dll.@OBJEXT@
|
||||
@ -960,12 +962,12 @@ ALL_64_EMUL_EXTRA_OFILES = \
|
||||
CFILES = ldctor.c ldemul.c ldexp.c ldfile.c ldlang.c \
|
||||
ldmain.c ldmisc.c ldver.c ldwrite.c lexsup.c \
|
||||
mri.c ldcref.c pe-dll.c pep-dll.c ldlex-wrapper.c \
|
||||
$(PLUGIN_C) ldbuildid.c
|
||||
$(PLUGIN_C) ldbuildid.c ldelf.c ldelfgen.c
|
||||
|
||||
HFILES = ld.h ldctor.h ldemul.h ldexp.h ldfile.h \
|
||||
ldlang.h ldlex.h ldmain.h ldmisc.h ldver.h \
|
||||
ldwrite.h mri.h deffile.h pe-dll.h pep-dll.h \
|
||||
elf-hints-local.h $(PLUGIN_H) ldbuildid.h
|
||||
elf-hints-local.h $(PLUGIN_H) ldbuildid.h ldelf.h ldelfgen.h
|
||||
|
||||
GENERATED_CFILES = ldgram.c ldlex.c deffilep.c
|
||||
GENERATED_HFILES = ldgram.h ldemul-list.h deffilep.h
|
||||
@ -991,8 +993,9 @@ GEN_DEPENDS = $(srcdir)/genscripts.sh stringify.sed
|
||||
# Allow dependency tracking to work for these files, too.
|
||||
|
||||
# Dependency tracking for the generated emulation files.
|
||||
EXTRA_ld_new_SOURCES = deffilep.y ldlex.l pep-dll.c pe-dll.c \
|
||||
$(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES)
|
||||
EXTRA_ld_new_SOURCES = deffilep.y ldlex.l pep-dll.c pe-dll.c ldelf.c \
|
||||
ldelfgen.c $(ALL_EMULATION_SOURCES) \
|
||||
$(ALL_64_EMULATION_SOURCES)
|
||||
ld_new_SOURCES = ldgram.y ldlex-wrapper.c lexsup.c ldlang.c mri.c ldctor.c ldmain.c \
|
||||
ldwrite.c ldexp.c ldemul.c ldver.c ldmisc.c ldfile.c ldcref.c $(PLUGIN_C) \
|
||||
ldbuildid.c
|
||||
@ -1491,6 +1494,8 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldbuildid.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldcref.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldctor.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldelf.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldelfgen.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldemul.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldexp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldfile.Po@am__quote@
|
||||
|
677
ld/configure.tgt
677
ld/configure.tgt
File diff suppressed because it is too large
Load Diff
@ -206,7 +206,7 @@ gldaarch64_layout_sections_again (void)
|
||||
/* If we have changed sizes of the stub sections, then we need
|
||||
to recalculate all the section offsets. This may mean we need to
|
||||
add even more stubs. */
|
||||
gld${EMULATION_NAME}_map_segments (TRUE);
|
||||
ldelf_map_segments (TRUE);
|
||||
need_laying_out = -1;
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ gld${EMULATION_NAME}_after_allocation (void)
|
||||
}
|
||||
|
||||
if (need_laying_out != -1)
|
||||
gld${EMULATION_NAME}_map_segments (need_laying_out);
|
||||
ldelf_map_segments (need_laying_out);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -339,26 +339,6 @@ aarch64_elf_create_output_section_statements (void)
|
||||
ldlang_add_file (stub_file);
|
||||
}
|
||||
|
||||
/* Avoid processing the fake stub_file in vercheck, stat_needed and
|
||||
check_needed routines. */
|
||||
|
||||
static void (*real_func) (lang_input_statement_type *);
|
||||
|
||||
static void aarch64_for_each_input_file_wrapper (lang_input_statement_type *l)
|
||||
{
|
||||
if (l != stub_file)
|
||||
(*real_func) (l);
|
||||
}
|
||||
|
||||
static void
|
||||
aarch64_lang_for_each_input_file (void (*func) (lang_input_statement_type *))
|
||||
{
|
||||
real_func = func;
|
||||
lang_for_each_input_file (&aarch64_for_each_input_file_wrapper);
|
||||
}
|
||||
|
||||
#define lang_for_each_input_file aarch64_lang_for_each_input_file
|
||||
|
||||
EOF
|
||||
|
||||
# Define some shell vars to insert bits of code into the standard elf
|
||||
|
@ -82,7 +82,7 @@ alpha_after_parse (void)
|
||||
exp_nameop (SIZEOF_HEADERS, NULL)),
|
||||
NULL);
|
||||
|
||||
gld${EMULATION_NAME}_after_parse ();
|
||||
ldelf_after_parse ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -276,7 +276,7 @@ gldarm_layout_sections_again (void)
|
||||
/* If we have changed sizes of the stub sections, then we need
|
||||
to recalculate all the section offsets. This may mean we need to
|
||||
add even more stubs. */
|
||||
gld${EMULATION_NAME}_map_segments (TRUE);
|
||||
ldelf_map_segments (TRUE);
|
||||
need_laying_out = -1;
|
||||
}
|
||||
|
||||
@ -413,7 +413,7 @@ gld${EMULATION_NAME}_after_allocation (void)
|
||||
}
|
||||
|
||||
if (need_laying_out != -1)
|
||||
gld${EMULATION_NAME}_map_segments (need_laying_out);
|
||||
ldelf_map_segments (need_laying_out);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -553,26 +553,6 @@ arm_elf_create_output_section_statements (void)
|
||||
bfd_elf32_arm_get_bfd_for_interworking (stub_file->the_bfd, &link_info);
|
||||
}
|
||||
|
||||
/* Avoid processing the fake stub_file in vercheck, stat_needed and
|
||||
check_needed routines. */
|
||||
|
||||
static void (*real_func) (lang_input_statement_type *);
|
||||
|
||||
static void arm_for_each_input_file_wrapper (lang_input_statement_type *l)
|
||||
{
|
||||
if (l != stub_file)
|
||||
(*real_func) (l);
|
||||
}
|
||||
|
||||
static void
|
||||
arm_lang_for_each_input_file (void (*func) (lang_input_statement_type *))
|
||||
{
|
||||
real_func = func;
|
||||
lang_for_each_input_file (&arm_for_each_input_file_wrapper);
|
||||
}
|
||||
|
||||
#define lang_for_each_input_file arm_lang_for_each_input_file
|
||||
|
||||
EOF
|
||||
|
||||
# Define some shell vars to insert bits of code into the standard elf
|
||||
|
@ -120,7 +120,7 @@ cr16elf_after_parse (void)
|
||||
is true the link sometimes fails. */
|
||||
config.magic_demand_paged = FALSE;
|
||||
|
||||
gld${EMULATION_NAME}_after_parse ();
|
||||
ldelf_after_parse ();
|
||||
}
|
||||
|
||||
/* This is called after the sections have been attached to output
|
||||
|
@ -26,8 +26,6 @@ fragment <<EOF
|
||||
|
||||
#include "ldctor.h"
|
||||
|
||||
static void crxelf_after_parse (void);
|
||||
|
||||
static void
|
||||
crxelf_after_parse (void)
|
||||
{
|
||||
@ -42,7 +40,7 @@ crxelf_after_parse (void)
|
||||
is true the link sometimes fails. */
|
||||
config.magic_demand_paged = FALSE;
|
||||
|
||||
gld${EMULATION_NAME}_after_parse ();
|
||||
ldelf_after_parse ();
|
||||
}
|
||||
|
||||
/* This is called after the sections have been attached to output
|
||||
|
@ -208,7 +208,7 @@ gldcsky_layout_sections_again (void)
|
||||
/* If we have changed sizes of the stub sections, then we need
|
||||
to recalculate all the section offsets. This may mean we need to
|
||||
add even more stubs. */
|
||||
gld${EMULATION_NAME}_map_segments (TRUE);
|
||||
ldelf_map_segments (TRUE);
|
||||
need_laying_out = -1;
|
||||
}
|
||||
|
||||
@ -269,7 +269,7 @@ gld${EMULATION_NAME}_after_allocation (void)
|
||||
}
|
||||
|
||||
if (need_laying_out != -1)
|
||||
gld${EMULATION_NAME}_map_segments (need_laying_out);
|
||||
ldelf_map_segments (need_laying_out);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -283,26 +283,6 @@ gld${EMULATION_NAME}_finish (void)
|
||||
finish_default ();
|
||||
}
|
||||
|
||||
/* Avoid processing the fake stub_file in vercheck, stat_needed and
|
||||
check_needed routines. */
|
||||
|
||||
static void (*real_func) (lang_input_statement_type *);
|
||||
|
||||
static void csky_for_each_input_file_wrapper (lang_input_statement_type *l)
|
||||
{
|
||||
if (l != stub_file)
|
||||
(*real_func) (l);
|
||||
}
|
||||
|
||||
static void
|
||||
csky_lang_for_each_input_file (void (*func) (lang_input_statement_type *))
|
||||
{
|
||||
real_func = func;
|
||||
lang_for_each_input_file (&csky_for_each_input_file_wrapper);
|
||||
}
|
||||
|
||||
#define lang_for_each_input_file csky_lang_for_each_input_file
|
||||
|
||||
EOF
|
||||
|
||||
# This code gets inserted into the generic elf32.sc linker script
|
||||
|
@ -24,48 +24,4 @@
|
||||
#
|
||||
fragment <<EOF
|
||||
|
||||
static void
|
||||
gld${EMULATION_NAME}_map_segments (bfd_boolean need_layout)
|
||||
{
|
||||
int tries = 10;
|
||||
|
||||
do
|
||||
{
|
||||
lang_relax_sections (need_layout);
|
||||
need_layout = FALSE;
|
||||
|
||||
if (link_info.output_bfd->xvec->flavour == bfd_target_elf_flavour
|
||||
&& !bfd_link_relocatable (&link_info))
|
||||
{
|
||||
bfd_size_type phdr_size;
|
||||
|
||||
phdr_size = elf_program_header_size (link_info.output_bfd);
|
||||
/* If we don't have user supplied phdrs, throw away any
|
||||
previous linker generated program headers. */
|
||||
if (lang_phdr_list == NULL)
|
||||
elf_seg_map (link_info.output_bfd) = NULL;
|
||||
if (!_bfd_elf_map_sections_to_segments (link_info.output_bfd,
|
||||
&link_info))
|
||||
einfo (_("%F%P: map sections to segments failed: %E\n"));
|
||||
|
||||
if (phdr_size != elf_program_header_size (link_info.output_bfd))
|
||||
{
|
||||
if (tries > 6)
|
||||
/* The first few times we allow any change to
|
||||
phdr_size . */
|
||||
need_layout = TRUE;
|
||||
else if (phdr_size
|
||||
< elf_program_header_size (link_info.output_bfd))
|
||||
/* After that we only allow the size to grow. */
|
||||
need_layout = TRUE;
|
||||
else
|
||||
elf_program_header_size (link_info.output_bfd) = phdr_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (need_layout && --tries);
|
||||
|
||||
if (tries == 0)
|
||||
einfo (_("%F%P: looping in map_segments"));
|
||||
}
|
||||
EOF
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -23,6 +23,7 @@
|
||||
#
|
||||
fragment <<EOF
|
||||
#include "elf-bfd.h"
|
||||
#include "ldelfgen.h"
|
||||
|
||||
EOF
|
||||
source_em ${srcdir}/emultempl/elf-generic.em
|
||||
@ -63,7 +64,7 @@ gld${EMULATION_NAME}_before_allocation (void)
|
||||
static void
|
||||
gld${EMULATION_NAME}_after_allocation (void)
|
||||
{
|
||||
gld${EMULATION_NAME}_map_segments (FALSE);
|
||||
ldelf_map_segments (FALSE);
|
||||
}
|
||||
EOF
|
||||
# Put these extra routines in ld_${EMULATION_NAME}_emulation
|
||||
|
@ -59,7 +59,7 @@ hppaelf_after_parse (void)
|
||||
NULL);
|
||||
*/
|
||||
|
||||
gld${EMULATION_NAME}_after_parse ();
|
||||
ldelf_after_parse ();
|
||||
}
|
||||
|
||||
/* This is called before the input files are opened. We create a new
|
||||
@ -215,7 +215,7 @@ hppaelf_layout_sections_again (void)
|
||||
/* If we have changed sizes of the stub sections, then we need
|
||||
to recalculate all the section offsets. This may mean we need to
|
||||
add even more stubs. */
|
||||
gld${EMULATION_NAME}_map_segments (TRUE);
|
||||
ldelf_map_segments (TRUE);
|
||||
need_laying_out = -1;
|
||||
}
|
||||
|
||||
@ -289,7 +289,7 @@ gld${EMULATION_NAME}_after_allocation (void)
|
||||
}
|
||||
|
||||
if (need_laying_out != -1)
|
||||
gld${EMULATION_NAME}_map_segments (need_laying_out);
|
||||
ldelf_map_segments (need_laying_out);
|
||||
|
||||
if (!bfd_link_relocatable (&link_info))
|
||||
{
|
||||
@ -309,27 +309,6 @@ gld${EMULATION_NAME}_after_allocation (void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Avoid processing the fake stub_file in vercheck, stat_needed and
|
||||
check_needed routines. */
|
||||
|
||||
static void (*real_func) (lang_input_statement_type *);
|
||||
|
||||
static void hppa_for_each_input_file_wrapper (lang_input_statement_type *l)
|
||||
{
|
||||
if (l != stub_file)
|
||||
(*real_func) (l);
|
||||
}
|
||||
|
||||
static void
|
||||
hppa_lang_for_each_input_file (void (*func) (lang_input_statement_type *))
|
||||
{
|
||||
real_func = func;
|
||||
lang_for_each_input_file (&hppa_for_each_input_file_wrapper);
|
||||
}
|
||||
|
||||
#define lang_for_each_input_file hppa_lang_for_each_input_file
|
||||
|
||||
EOF
|
||||
|
||||
# Define some shell vars to insert bits of code into the standard elf
|
||||
|
@ -36,7 +36,7 @@ ia64elf_after_parse (void)
|
||||
link_info.relax_pass = 2;
|
||||
bfd_elf${ELFSIZE}_ia64_after_parse (itanium);
|
||||
|
||||
gld${EMULATION_NAME}_after_parse ();
|
||||
ldelf_after_parse ();
|
||||
}
|
||||
|
||||
EOF
|
||||
|
@ -319,27 +319,6 @@ m68hc11elf_after_allocation (void)
|
||||
gld${EMULATION_NAME}_after_allocation ();
|
||||
}
|
||||
|
||||
|
||||
/* Avoid processing the fake stub_file in vercheck, stat_needed and
|
||||
check_needed routines. */
|
||||
|
||||
static void (*real_func) (lang_input_statement_type *);
|
||||
|
||||
static void m68hc11_for_each_input_file_wrapper (lang_input_statement_type *l)
|
||||
{
|
||||
if (l != stub_file)
|
||||
(*real_func) (l);
|
||||
}
|
||||
|
||||
static void
|
||||
m68hc11_lang_for_each_input_file (void (*func) (lang_input_statement_type *))
|
||||
{
|
||||
real_func = func;
|
||||
lang_for_each_input_file (&m68hc11_for_each_input_file_wrapper);
|
||||
}
|
||||
|
||||
#define lang_for_each_input_file m68hc11_lang_for_each_input_file
|
||||
|
||||
EOF
|
||||
|
||||
# Define some shell vars to insert bits of code into the standard elf
|
||||
|
@ -191,7 +191,7 @@ metagelf_layout_sections_again (void)
|
||||
/* If we have changed sizes of the stub sections, then we need
|
||||
to recalculate all the section offsets. This may mean we need to
|
||||
add even more stubs. */
|
||||
gld${EMULATION_NAME}_map_segments (TRUE);
|
||||
ldelf_map_segments (TRUE);
|
||||
need_laying_out = -1;
|
||||
}
|
||||
|
||||
@ -264,7 +264,7 @@ gld${EMULATION_NAME}_after_allocation (void)
|
||||
}
|
||||
|
||||
if (need_laying_out != -1)
|
||||
gld${EMULATION_NAME}_map_segments (need_laying_out);
|
||||
ldelf_map_segments (need_laying_out);
|
||||
|
||||
if (!bfd_link_relocatable (&link_info))
|
||||
{
|
||||
@ -277,27 +277,6 @@ gld${EMULATION_NAME}_after_allocation (void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Avoid processing the fake stub_file in vercheck, stat_needed and
|
||||
check_needed routines. */
|
||||
|
||||
static void (*real_func) (lang_input_statement_type *);
|
||||
|
||||
static void metag_for_each_input_file_wrapper (lang_input_statement_type *l)
|
||||
{
|
||||
if (l != stub_file)
|
||||
(*real_func) (l);
|
||||
}
|
||||
|
||||
static void
|
||||
metag_lang_for_each_input_file (void (*func) (lang_input_statement_type *))
|
||||
{
|
||||
real_func = func;
|
||||
lang_for_each_input_file (&metag_for_each_input_file_wrapper);
|
||||
}
|
||||
|
||||
#define lang_for_each_input_file metag_lang_for_each_input_file
|
||||
|
||||
EOF
|
||||
|
||||
# Define some shell vars to insert bits of code into the standard elf
|
||||
|
@ -227,26 +227,6 @@ mips_before_allocation (void)
|
||||
gld${EMULATION_NAME}_before_allocation ();
|
||||
}
|
||||
|
||||
/* Avoid processing the fake stub_file in vercheck, stat_needed and
|
||||
check_needed routines. */
|
||||
|
||||
static void (*real_func) (lang_input_statement_type *);
|
||||
|
||||
static void mips_for_each_input_file_wrapper (lang_input_statement_type *l)
|
||||
{
|
||||
if (l != stub_file)
|
||||
(*real_func) (l);
|
||||
}
|
||||
|
||||
static void
|
||||
mips_lang_for_each_input_file (void (*func) (lang_input_statement_type *))
|
||||
{
|
||||
real_func = func;
|
||||
lang_for_each_input_file (&mips_for_each_input_file_wrapper);
|
||||
}
|
||||
|
||||
#define lang_for_each_input_file mips_lang_for_each_input_file
|
||||
|
||||
EOF
|
||||
|
||||
# Define some shell vars to insert bits of code into the standard elf
|
||||
|
@ -29,11 +29,10 @@ fragment <<EOF
|
||||
#define gldmmo_before_allocation before_allocation_default
|
||||
|
||||
/* We include this header *not* because we expect to handle ELF here
|
||||
but because we re-use the map_segments function in elf-generic.em,
|
||||
a file which is rightly somewhat ELF-centric. But this is only to
|
||||
but because we use the map_segments function. But this is only to
|
||||
get a weird testcase right; ld-mmix/bpo-22, forcing ELF to be
|
||||
output from the mmo emulation: -m mmo --oformat elf64-mmix! */
|
||||
#include "elf-bfd.h"
|
||||
#include "ldelfgen.h"
|
||||
|
||||
static void gld${EMULATION_NAME}_after_allocation (void);
|
||||
EOF
|
||||
@ -205,7 +204,7 @@ static void
|
||||
gld${EMULATION_NAME}_after_allocation (void)
|
||||
{
|
||||
bfd_map_over_sections (link_info.output_bfd, mmo_wipe_sec_reloc_flag, NULL);
|
||||
gld${EMULATION_NAME}_map_segments (FALSE);
|
||||
ldelf_map_segments (FALSE);
|
||||
}
|
||||
|
||||
/* To get on-demand global register allocation right, we need to parse the
|
||||
|
@ -68,7 +68,7 @@ nds32_elf_after_parse (void)
|
||||
if (!RELAXATION_ENABLED)
|
||||
relax_fp_as_gp = 0;
|
||||
|
||||
gld${EMULATION_NAME}_after_parse ();
|
||||
ldelf_after_parse ();
|
||||
}
|
||||
|
||||
static void
|
||||
@ -123,7 +123,7 @@ nds32_elf_after_allocation (void)
|
||||
{
|
||||
/* Call default after allocation callback.
|
||||
1. This is where relaxation is done.
|
||||
2. It calls gld${EMULATION_NAME}_map_segments to build ELF segment table.
|
||||
2. It calls ldelf_map_segments to build ELF segment table.
|
||||
3. Any relaxation requires relax being done must be called after it. */
|
||||
gld${EMULATION_NAME}_after_allocation ();
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ nios2elf_layout_sections_again (void)
|
||||
/* If we have changed sizes of the stub sections, then we need
|
||||
to recalculate all the section offsets. This may mean we need to
|
||||
add even more stubs. */
|
||||
gld${EMULATION_NAME}_map_segments (TRUE);
|
||||
ldelf_map_segments (TRUE);
|
||||
need_laying_out = -1;
|
||||
}
|
||||
|
||||
@ -282,7 +282,7 @@ gld${EMULATION_NAME}_after_allocation (void)
|
||||
}
|
||||
|
||||
if (need_laying_out != -1)
|
||||
gld${EMULATION_NAME}_map_segments (need_laying_out);
|
||||
ldelf_map_segments (need_laying_out);
|
||||
|
||||
if (!bfd_link_relocatable (&link_info) && RELAXATION_ENABLED)
|
||||
{
|
||||
@ -295,27 +295,6 @@ gld${EMULATION_NAME}_after_allocation (void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Avoid processing the fake stub_file in vercheck, stat_needed and
|
||||
check_needed routines. */
|
||||
|
||||
static void (*real_func) (lang_input_statement_type *);
|
||||
|
||||
static void nios2_for_each_input_file_wrapper (lang_input_statement_type *l)
|
||||
{
|
||||
if (l != stub_file)
|
||||
(*real_func) (l);
|
||||
}
|
||||
|
||||
static void
|
||||
nios2_lang_for_each_input_file (void (*func) (lang_input_statement_type *))
|
||||
{
|
||||
real_func = func;
|
||||
lang_for_each_input_file (&nios2_for_each_input_file_wrapper);
|
||||
}
|
||||
|
||||
#define lang_for_each_input_file nios2_lang_for_each_input_file
|
||||
|
||||
EOF
|
||||
|
||||
|
||||
|
@ -247,7 +247,6 @@ if grep -q 'ld_elf32_spu_emulation' ldemul-list.h; then
|
||||
fragment <<EOF
|
||||
/* Special handling for embedded SPU executables. */
|
||||
extern bfd_boolean embedded_spu_file (lang_input_statement_type *, const char *);
|
||||
static bfd_boolean gld${EMULATION_NAME}_load_symbols (lang_input_statement_type *);
|
||||
|
||||
static bfd_boolean
|
||||
ppc_recognized_file (lang_input_statement_type *entry)
|
||||
@ -255,7 +254,7 @@ ppc_recognized_file (lang_input_statement_type *entry)
|
||||
if (embedded_spu_file (entry, "-m32"))
|
||||
return TRUE;
|
||||
|
||||
return gld${EMULATION_NAME}_load_symbols (entry);
|
||||
return ldelf_load_symbols (entry);
|
||||
}
|
||||
|
||||
EOF
|
||||
|
@ -456,7 +456,7 @@ ppc_layout_sections_again (void)
|
||||
/* If we have changed sizes of the stub sections, then we need
|
||||
to recalculate all the section offsets. This may mean we need to
|
||||
add even more stubs. */
|
||||
gld${EMULATION_NAME}_map_segments (TRUE);
|
||||
ldelf_map_segments (TRUE);
|
||||
|
||||
if (!bfd_link_relocatable (&link_info))
|
||||
ppc64_elf_set_toc (&link_info, link_info.output_bfd);
|
||||
@ -565,7 +565,7 @@ gld${EMULATION_NAME}_after_allocation (void)
|
||||
unneeded, after ppc_layout_sections_again. Another call removes
|
||||
these sections from the segment map. Their presence is
|
||||
innocuous except for confusing ELF_SECTION_IN_SEGMENT. */
|
||||
gld${EMULATION_NAME}_map_segments (need_laying_out > 0);
|
||||
ldelf_map_segments (need_laying_out > 0);
|
||||
|
||||
if (need_laying_out != -1 && !bfd_link_relocatable (&link_info))
|
||||
ppc64_elf_set_toc (&link_info, link_info.output_bfd);
|
||||
@ -652,34 +652,12 @@ gld${EMULATION_NAME}_new_vers_pattern (struct bfd_elf_version_expr *entry)
|
||||
return dot_entry;
|
||||
}
|
||||
|
||||
|
||||
/* Avoid processing the fake stub_file in vercheck, stat_needed and
|
||||
check_needed routines. */
|
||||
|
||||
static void (*real_func) (lang_input_statement_type *);
|
||||
|
||||
static void ppc_for_each_input_file_wrapper (lang_input_statement_type *l)
|
||||
{
|
||||
if (l != stub_file)
|
||||
(*real_func) (l);
|
||||
}
|
||||
|
||||
static void
|
||||
ppc_lang_for_each_input_file (void (*func) (lang_input_statement_type *))
|
||||
{
|
||||
real_func = func;
|
||||
lang_for_each_input_file (&ppc_for_each_input_file_wrapper);
|
||||
}
|
||||
|
||||
#define lang_for_each_input_file ppc_lang_for_each_input_file
|
||||
|
||||
EOF
|
||||
|
||||
if grep -q 'ld_elf32_spu_emulation' ldemul-list.h; then
|
||||
fragment <<EOF
|
||||
/* Special handling for embedded SPU executables. */
|
||||
extern bfd_boolean embedded_spu_file (lang_input_statement_type *, const char *);
|
||||
static bfd_boolean gld${EMULATION_NAME}_load_symbols (lang_input_statement_type *);
|
||||
|
||||
static bfd_boolean
|
||||
ppc64_recognized_file (lang_input_statement_type *entry)
|
||||
@ -687,7 +665,7 @@ ppc64_recognized_file (lang_input_statement_type *entry)
|
||||
if (embedded_spu_file (entry, "-m64"))
|
||||
return TRUE;
|
||||
|
||||
return gld${EMULATION_NAME}_load_symbols (entry);
|
||||
return ldelf_load_symbols (entry);
|
||||
}
|
||||
EOF
|
||||
LDEMUL_RECOGNIZED_FILE=ppc64_recognized_file
|
||||
|
@ -62,7 +62,7 @@ gld${EMULATION_NAME}_after_allocation (void)
|
||||
}
|
||||
}
|
||||
|
||||
gld${EMULATION_NAME}_map_segments (need_layout);
|
||||
ldelf_map_segments (need_layout);
|
||||
}
|
||||
|
||||
/* This is a convenient point to tell BFD about target specific flags.
|
||||
|
@ -142,7 +142,7 @@ spu_place_special_section (asection *s, asection *o, const char *output_name)
|
||||
os = lang_output_section_find (output_name);
|
||||
if (os == NULL)
|
||||
{
|
||||
os = gld${EMULATION_NAME}_place_orphan (s, output_name, 0);
|
||||
os = ldelf_place_orphan (s, output_name, 0);
|
||||
os->addr_tree = NULL;
|
||||
}
|
||||
else if (params.ovly_flavour != ovly_soft_icache
|
||||
|
@ -159,7 +159,7 @@ gld${EMULATION_NAME}_after_allocation (void)
|
||||
else if (ret > 0)
|
||||
layout_changed = 1;
|
||||
|
||||
gld${EMULATION_NAME}_map_segments (layout_changed);
|
||||
ldelf_map_segments (layout_changed);
|
||||
}
|
||||
EOF
|
||||
|
||||
|
@ -174,6 +174,7 @@ if test "$OUTPUT_FORMAT" = "elf64-ia64-vms"; then
|
||||
|
||||
fragment <<EOF
|
||||
#include "elf-bfd.h"
|
||||
#include "ldelfgen.h"
|
||||
EOF
|
||||
|
||||
source_em ${srcdir}/emultempl/elf-generic.em
|
||||
@ -212,7 +213,7 @@ gld${EMULATION_NAME}_after_allocation (void)
|
||||
if (need_layout < 0)
|
||||
einfo (_("%X%P: .eh_frame/.stab edit: %E\n"));
|
||||
else
|
||||
gld${EMULATION_NAME}_map_segments (need_layout);
|
||||
ldelf_map_segments (need_layout);
|
||||
}
|
||||
|
||||
static void
|
||||
|
2135
ld/ldelf.c
Normal file
2135
ld/ldelf.c
Normal file
File diff suppressed because it is too large
Load Diff
32
ld/ldelf.h
Normal file
32
ld/ldelf.h
Normal file
@ -0,0 +1,32 @@
|
||||
/* ELF emulation code for targets using elf32.em.
|
||||
Copyright (C) 1991-2019 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Binutils.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
extern const char *ldelf_emit_note_gnu_build_id;
|
||||
|
||||
extern void ldelf_after_parse (void);
|
||||
extern bfd_boolean ldelf_load_symbols (lang_input_statement_type *);
|
||||
extern void ldelf_after_open (int, int, int, int, int);
|
||||
extern bfd_boolean ldelf_setup_build_id (bfd *);
|
||||
extern void ldelf_append_to_separated_string (char **, char *);
|
||||
extern void ldelf_before_allocation (char *, char *, const char *);
|
||||
extern bfd_boolean ldelf_open_dynamic_archive
|
||||
(const char *, search_dirs_type *, lang_input_statement_type *);
|
||||
extern lang_output_section_statement_type *ldelf_place_orphan
|
||||
(asection *, const char *, int);
|
74
ld/ldelfgen.c
Normal file
74
ld/ldelfgen.c
Normal file
@ -0,0 +1,74 @@
|
||||
/* Emulation code used by all ELF targets.
|
||||
Copyright (C) 1991-2019 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Binutils.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "bfd.h"
|
||||
#include "ld.h"
|
||||
#include "ldmain.h"
|
||||
#include "ldmisc.h"
|
||||
#include "ldexp.h"
|
||||
#include "ldlang.h"
|
||||
#include "elf-bfd.h"
|
||||
#include "ldelfgen.h"
|
||||
|
||||
void
|
||||
ldelf_map_segments (bfd_boolean need_layout)
|
||||
{
|
||||
int tries = 10;
|
||||
|
||||
do
|
||||
{
|
||||
lang_relax_sections (need_layout);
|
||||
need_layout = FALSE;
|
||||
|
||||
if (link_info.output_bfd->xvec->flavour == bfd_target_elf_flavour
|
||||
&& !bfd_link_relocatable (&link_info))
|
||||
{
|
||||
bfd_size_type phdr_size;
|
||||
|
||||
phdr_size = elf_program_header_size (link_info.output_bfd);
|
||||
/* If we don't have user supplied phdrs, throw away any
|
||||
previous linker generated program headers. */
|
||||
if (lang_phdr_list == NULL)
|
||||
elf_seg_map (link_info.output_bfd) = NULL;
|
||||
if (!_bfd_elf_map_sections_to_segments (link_info.output_bfd,
|
||||
&link_info))
|
||||
einfo (_("%F%P: map sections to segments failed: %E\n"));
|
||||
|
||||
if (phdr_size != elf_program_header_size (link_info.output_bfd))
|
||||
{
|
||||
if (tries > 6)
|
||||
/* The first few times we allow any change to
|
||||
phdr_size . */
|
||||
need_layout = TRUE;
|
||||
else if (phdr_size
|
||||
< elf_program_header_size (link_info.output_bfd))
|
||||
/* After that we only allow the size to grow. */
|
||||
need_layout = TRUE;
|
||||
else
|
||||
elf_program_header_size (link_info.output_bfd) = phdr_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (need_layout && --tries);
|
||||
|
||||
if (tries == 0)
|
||||
einfo (_("%F%P: looping in map_segments"));
|
||||
}
|
21
ld/ldelfgen.h
Normal file
21
ld/ldelfgen.h
Normal file
@ -0,0 +1,21 @@
|
||||
/* Emulation code used by all ELF targets.
|
||||
Copyright (C) 1991-2019 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Binutils.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
extern void ldelf_map_segments (bfd_boolean);
|
16
ld/ldlang.c
16
ld/ldlang.c
@ -6862,8 +6862,8 @@ lang_set_flags (lang_memory_region_type *ptr, const char *flags, int invert)
|
||||
}
|
||||
}
|
||||
|
||||
/* Call a function on each input file. This function will be called
|
||||
on an archive, but not on the elements. */
|
||||
/* Call a function on each real input file. This function will be
|
||||
called on an archive, but not on the elements. */
|
||||
|
||||
void
|
||||
lang_for_each_input_file (void (*func) (lang_input_statement_type *))
|
||||
@ -6873,19 +6873,21 @@ lang_for_each_input_file (void (*func) (lang_input_statement_type *))
|
||||
for (f = &input_file_chain.head->input_statement;
|
||||
f != NULL;
|
||||
f = f->next_real_file)
|
||||
func (f);
|
||||
if (f->flags.real)
|
||||
func (f);
|
||||
}
|
||||
|
||||
/* Call a function on each file. The function will be called on all
|
||||
the elements of an archive which are included in the link, but will
|
||||
not be called on the archive file itself. */
|
||||
/* Call a function on each real file. The function will be called on
|
||||
all the elements of an archive which are included in the link, but
|
||||
will not be called on the archive file itself. */
|
||||
|
||||
void
|
||||
lang_for_each_file (void (*func) (lang_input_statement_type *))
|
||||
{
|
||||
LANG_FOR_EACH_INPUT_STATEMENT (f)
|
||||
{
|
||||
func (f);
|
||||
if (f->flags.real)
|
||||
func (f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,10 @@ ldbuildid.h
|
||||
ldcref.c
|
||||
ldctor.c
|
||||
ldctor.h
|
||||
ldelf.c
|
||||
ldelf.h
|
||||
ldelfgen.c
|
||||
ldelfgen.h
|
||||
ldemul.c
|
||||
ldemul.h
|
||||
ldexp.c
|
||||
|
Loading…
Reference in New Issue
Block a user