fi
fragment <<EOF
/* This file is part of GLD, the Gnu Linker.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU Binutils.
#include "bfdlink.h"
#include "getopt.h"
#include "libiberty.h"
+#include "filenames.h"
#include "ld.h"
#include "ldmain.h"
#include "ldexp.h"
#define OPTION_MINOR_OS_VERSION (OPTION_MINOR_IMAGE_VERSION + 1)
#define OPTION_MINOR_SUBSYSTEM_VERSION (OPTION_MINOR_OS_VERSION + 1)
#define OPTION_SECTION_ALIGNMENT (OPTION_MINOR_SUBSYSTEM_VERSION + 1)
-#define OPTION_STACK (OPTION_SECTION_ALIGNMENT + 1)
-#define OPTION_SUBSYSTEM (OPTION_STACK + 1)
+#define OPTION_STACK (OPTION_SECTION_ALIGNMENT + 1)
+#define OPTION_SUBSYSTEM (OPTION_STACK + 1)
#define OPTION_HEAP (OPTION_SUBSYSTEM + 1)
static void
set_pe_name ("__minor_subsystem_version__",
strtoul (end + 1, &end, 0));
if (*end != '\0')
- einfo ("%P: warning: bad version number in -subsystem option\n");
+ einfo (_("%P: warning: bad version number in -subsystem option\n"));
}
for (i = 0; v[i].name; i++)
return;
}
}
- einfo ("%P%F: invalid subsystem type %s\n", optarg);
+ einfo (_("%F%P: invalid subsystem type %s\n"), optarg);
}
set_pe_name (name, strtoul (optarg, &end, 0));
if (end == optarg)
{
- einfo ("%P%F: invalid hex number for PE parameter '%s'\n", optarg);
+ einfo (_("%F%P: invalid hex number for PE parameter '%s'\n"), optarg);
}
optarg = end;
}
else if (*optarg)
{
- einfo ("%P%F: strange hex info for PE parameter '%s'\n", optarg);
+ einfo (_("%F%P: strange hex info for PE parameter '%s'\n"), optarg);
}
}
case OPTION_BASE_FILE:
link_info.base_file = fopen (optarg, FOPEN_WB);
if (link_info.base_file == NULL)
- {
- fprintf (stderr, "%s: Can't open base file %s\n",
- program_name, optarg);
- xexit (1);
- }
+ einfo (_("%F%P: cannot open base file %s\n"), optarg);
break;
/* PE options */
if (!init[IMAGEBASEOFF].inited)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
init[IMAGEBASEOFF].value = 0;
else if (init[DLLOFF].value)
init[IMAGEBASEOFF].value = BEOS_DLL_IMAGE_BASE;
}
/* Don't do any symbol assignments if this is a relocatable link. */
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return;
/* Glue the assignments into the abs section */
for (j = 0; init[j].ptr; j++)
{
long val = init[j].value;
- lang_add_assignment (exp_assop ('=', init[j].symbol, exp_intop (val)));
+ lang_add_assignment (exp_assign (init[j].symbol, exp_intop (val),
+ FALSE));
if (init[j].size == sizeof(short))
*(short *)init[j].ptr = val;
else if (init[j].size == sizeof(int))
if (pe.FileAlignment >
pe.SectionAlignment)
{
- einfo ("%P: warning, file alignment > section alignment.\n");
+ einfo (_("%P: warning, file alignment > section alignment\n"));
}
}
static void
gld_${EMULATION_NAME}_after_open (void)
{
+ after_open_default ();
+
/* Pass the wacky PE command line options into the output bfd.
FIXME: This should be done via a function, rather than by
including an internal BFD header. */
if (!coff_data(link_info.output_bfd)->pe)
{
- einfo ("%F%P: PE operations on non PE file.\n");
+ einfo (_("%F%P: PE operations on non PE file\n"));
}
pe_data(link_info.output_bfd)->pe_opthdr = pe;
const lang_statement_union_type *const *rb = b;
int i, a_sec, b_sec;
- i = strcmp ((*ra)->input_section.section->owner->my_archive->filename,
- (*rb)->input_section.section->owner->my_archive->filename);
+ i = filename_cmp ((*ra)->input_section.section->owner->my_archive->filename,
+ (*rb)->input_section.section->owner->my_archive->filename);
if (i != 0)
return i;
- i = strcmp ((*ra)->input_section.section->owner->filename,
- (*rb)->input_section.section->owner->filename);
+ i = filename_cmp ((*ra)->input_section.section->owner->filename,
+ (*rb)->input_section.section->owner->filename);
if (i != 0)
return i;
/* the tail idata4/5 are the only ones without relocs to an
and HNT properly. if no reloc this one is import by ordinal
so we have to sort by section contents */
- if ( ((*ra)->input_section.section->reloc_count + (*rb)->input_section.section->reloc_count) )
+ if ((*ra)->input_section.section->reloc_count
+ + (*rb)->input_section.section->reloc_count)
{
- i = (((*ra)->input_section.section->reloc_count >
- (*rb)->input_section.section->reloc_count) ? -1 : 0);
- if ( i != 0)
- return i;
+ i = ((*ra)->input_section.section->reloc_count
+ > (*rb)->input_section.section->reloc_count) ? -1 : 0;
+ if (i != 0)
+ return i;
- return (((*ra)->input_section.section->reloc_count >
- (*rb)->input_section.section->reloc_count) ? 0 : 1);
+ return ((*ra)->input_section.section->reloc_count
+ > (*rb)->input_section.section->reloc_count) ? 0 : 1;
}
else
{
- if ( (strcmp( (*ra)->input_section.section->name, ".idata$6") == 0) )
- return 0; /* don't sort .idata$6 or .idata$7 FIXME dlltool eliminate .idata$7 */
-
- if (! bfd_get_section_contents ((*ra)->input_section.section->owner,
- (*ra)->input_section.section, &a_sec, (file_ptr) 0, (bfd_size_type)sizeof(a_sec)))
- einfo ("%F%B: Can't read contents of section .idata: %E\n",
- (*ra)->input_section.section->owner);
-
- if (! bfd_get_section_contents ((*rb)->input_section.section->owner,
- (*rb)->input_section.section, &b_sec, (file_ptr) 0, (bfd_size_type)sizeof(b_sec) ))
- einfo ("%F%B: Can't read contents of section .idata: %E\n",
- (*rb)->input_section.section->owner);
-
- i = ((a_sec < b_sec) ? -1 : 0);
- if ( i != 0)
- return i;
- return ((a_sec < b_sec) ? 0 : 1);
- }
-return 0;
+ /* don't sort .idata$6 or .idata$7 FIXME dlltool eliminate .idata$7 */
+ if ((strcmp ((*ra)->input_section.section->name, ".idata$6") == 0))
+ return 0;
+
+ if (!bfd_get_section_contents ((*ra)->input_section.section->owner,
+ (*ra)->input_section.section, &a_sec,
+ (file_ptr) 0,
+ (bfd_size_type) sizeof(a_sec)))
+ einfo (_("%F%P: %pB: can't read contents of section .idata: %E\n"),
+ (*ra)->input_section.section->owner);
+
+ if (!bfd_get_section_contents ((*rb)->input_section.section->owner,
+ (*rb)->input_section.section, &b_sec,
+ (file_ptr) 0,
+ (bfd_size_type) sizeof(b_sec)))
+ einfo (_("%F%P: %pB: can't read contents of section .idata: %E\n"),
+ (*rb)->input_section.section->owner);
+
+ i = a_sec < b_sec ? -1 : 0;
+ if (i != 0)
+ return i;
+ return a_sec < b_sec ? 0 : 1;
+ }
+ return 0;
}
static int
if (i != 0)
{
if ((CONST_STRNEQ ((*ra)->input_section.section->name, ".stab"))
- && (! CONST_STRNEQ ((*rb)->input_section.section->name, ".stab")))
- return 1;
+ && (! CONST_STRNEQ ((*rb)->input_section.section->name, ".stab")))
+ return 1;
}
return i;
}
/* Here we rummage through the found bfds to collect toc information */
{
LANG_FOR_EACH_INPUT_STATEMENT (is)
- {
- if (!ppc_process_before_allocation(is->the_bfd, &link_info))
- {
- einfo("Errors encountered processing file %s\n", is->filename);
- }
- }
+ {
+ if (!ppc_process_before_allocation(is->the_bfd, &link_info))
+ {
+ einfo (_("%P: errors encountered processing file %s\n"),
+ is->filename);
+ }
+ }
}
/* We have seen it all. Allocate it, and carry on */
option? krk@cygnus.com */
{
LANG_FOR_EACH_INPUT_STATEMENT (is)
- {
- if (!arm_process_before_allocation (is->the_bfd, & link_info))
- {
- einfo ("Errors encountered processing file %s", is->filename);
- }
- }
+ {
+ if (!arm_process_before_allocation (is->the_bfd, & link_info))
+ {
+ einfo (_("%P: errors encountered processing file %s\n"),
+ is->filename);
+ }
+ }
}
/* We have seen it all. Allocate it, and carry on */
If they're marked as COMDAT sections, we don't want .text\$foo to
end up in .text and then have .text disappear because it's marked
link-once-discard. */
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return NULL;
/* Everything from the '\$' on gets deleted so don't allow '\$' as the
first character. */
if (*secname == '\$')
- einfo ("%P%F: section %s has '\$' as first character\n", secname);
+ einfo (_("%F%P: section %s has '\$' as first character\n"), secname);
if (strchr (secname + 1, '\$') == NULL)
return NULL;
}
ps[0] = 0;
if (l == NULL)
- einfo ("%P%F: *(%s\$) missing from linker script\n", output_secname);
+ einfo (_("%F%P: *(%s\$) missing from linker script\n"), output_secname);
/* Link the input section in and we're done for now.
The sections still have to be sorted, but that has to wait until
all such sections have been processed by us. The sorting is done by
sort_sections. */
- lang_add_section (&l->wild_statement.children, s, os);
+ lang_add_section (&l->wild_statement.children, s, NULL, os);
return os;
}
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
hll_default,
after_parse_default,
gld_${EMULATION_NAME}_after_open,
+ after_check_relocs_default,
after_allocation_default,
set_output_arch_default,
ldemul_default_target,
NULL, /* list options */
NULL, /* recognized file */
NULL, /* find_potential_libraries */
- NULL /* new_vers_pattern */
+ NULL, /* new_vers_pattern */
+ NULL /* extra_map_file_text */
};
EOF