if (relas == NULL)
{
free (erelas);
- error (_("out of memory parsing relocs"));
+ error (_("out of memory parsing relocs\n"));
return 0;
}
if (relas == NULL)
{
free (erelas);
- error (_("out of memory parsing relocs"));
+ error (_("out of memory parsing relocs\n"));
return 0;
}
if (rels == NULL)
{
free (erels);
- error (_("out of memory parsing relocs"));
+ error (_("out of memory parsing relocs\n"));
return 0;
}
if (rels == NULL)
{
free (erels);
- error (_("out of memory parsing relocs"));
+ error (_("out of memory parsing relocs\n"));
return 0;
}
new_dump_sects = calloc (section + 1, 1);
if (new_dump_sects == NULL)
- error (_("Out of memory allocating dump request table."));
+ error (_("Out of memory allocating dump request table.\n"));
else
{
/* Copy current flag settings. */
new_request = malloc (sizeof (struct dump_list_entry));
if (!new_request)
- error (_("Out of memory allocating dump request table."));
+ error (_("Out of memory allocating dump request table.\n"));
new_request->name = strdup (section);
if (!new_request->name)
- error (_("Out of memory allocating dump request table."));
+ error (_("Out of memory allocating dump request table.\n"));
new_request->type = type;
sec = find_section (".dynamic");
if (sec == NULL || sec->sh_size == 0)
{
- error (_("no .dynamic section in the dynamic segment"));
+ error (_("no .dynamic section in the dynamic segment\n"));
break;
}
if (dynamic_addr < segment->p_offset
|| dynamic_addr > segment->p_offset + segment->p_filesz)
- warn (_("the .dynamic section is not contained within the dynamic segment"));
+ warn (_("the .dynamic section is not contained within the dynamic segment\n"));
else if (dynamic_addr > segment->p_offset)
- warn (_("the .dynamic section is not the first section in the dynamic segment."));
+ warn (_("the .dynamic section is not the first section in the dynamic segment.\n"));
}
else
{
int ret = snprintf (fmt, sizeof (fmt), "%%%ds", PATH_MAX);
if (ret >= (int) sizeof (fmt) || ret < 0)
- error (_("Internal error: failed to create format string to display program interpreter"));
+ error (_("Internal error: failed to create format string to display program interpreter\n"));
program_interpreter[0] = 0;
if (fscanf (file, fmt, program_interpreter) <= 0)
else
{
if (fseek (file, 0, SEEK_END))
- error (_("Unable to seek to end of file!"));
+ error (_("Unable to seek to end of file!\n"));
section.sh_size = ftell (file) - section.sh_offset;
}
sizeof nb + sizeof nc)),
SEEK_SET))
{
- error (_("Unable to seek to start of dynamic information"));
+ error (_("Unable to seek to start of dynamic information\n"));
return 0;
}
check_def = 0;
}
else if (! is_nobits)
- error (_("bad dynamic symbol"));
+ error (_("bad dynamic symbol\n"));
else
check_def = 1;
}
lengths = calloc (nbuckets, sizeof (*lengths));
if (lengths == NULL)
{
- error (_("Out of memory"));
+ error (_("Out of memory\n"));
return 0;
}
for (hn = 0; hn < nbuckets; ++hn)
counts = calloc (maxlength + 1, sizeof (*counts));
if (counts == NULL)
{
- error (_("Out of memory"));
+ error (_("Out of memory\n"));
return 0;
}
sizeof nb)),
SEEK_SET))
{
- error (_("Unable to seek to start of dynamic information"));
+ error (_("Unable to seek to start of dynamic information\n"));
return 0;
}
+ offset_from_vma (file, buckets_vma, 4)),
SEEK_SET))
{
- error (_("Unable to seek to start of dynamic information"));
+ error (_("Unable to seek to start of dynamic information\n"));
return 0;
}
+ 4 * (ngnubuckets + maxchain), 4)),
SEEK_SET))
{
- error (_("Unable to seek to start of dynamic information"));
+ error (_("Unable to seek to start of dynamic information\n"));
return 0;
}
+ offset_from_vma (file, buckets_vma + 4 * ngnubuckets, 4)),
SEEK_SET))
{
- error (_("Unable to seek to start of dynamic information"));
+ error (_("Unable to seek to start of dynamic information\n"));
return 0;
}
lengths = calloc (ngnubuckets, sizeof (*lengths));
if (lengths == NULL)
{
- error (_("Out of memory"));
+ error (_("Out of memory\n"));
return 0;
}
counts = calloc (maxlength + 1, sizeof (*counts));
if (counts == NULL)
{
- error (_("Out of memory"));
+ error (_("Out of memory\n"));
return 0;
}
iopt = cmalloc ((sect->sh_size / sizeof (eopt)), sizeof (*iopt));
if (iopt == NULL)
{
- error (_("Out of memory"));
+ error (_("Out of memory\n"));
return 0;
}
if (dynamic_symbols == NULL)
{
- error (_("conflict list found without a dynamic symbol table"));
+ error (_("conflict list found without a dynamic symbol table\n"));
return 0;
}
iconf = cmalloc (conflictsno, sizeof (*iconf));
if (iconf == NULL)
{
- error (_("Out of memory"));
+ error (_("Out of memory\n"));
return 0;
}
/* Make a copy of the dump_sects array. */
cmdline_dump_sects = malloc (num_dump_sects);
if (cmdline_dump_sects == NULL)
- error (_("Out of memory allocating dump request table."));
+ error (_("Out of memory allocating dump request table.\n"));
else
{
memcpy (cmdline_dump_sects, dump_sects, num_dump_sects);
return dot;
}
-/* Callback routine that is used in _bfd_elf_map_sections_to_segments. */
+/* Callback routine that is used in _bfd_elf_map_sections_to_segments.
+ The BFD library has set NEW_SEGMENT to TRUE iff it thinks that
+ CURRENT_SECTION and PREVIOUS_SECTION ought to be placed into different
+ segments. We are allowed an opportunity to override this decision. */
bfd_boolean
ldlang_override_segment_assignment (struct bfd_link_info * info ATTRIBUTE_UNUSED,
{
lang_output_section_statement_type * cur;
lang_output_section_statement_type * prev;
-
+
+ /* The checks below are only necessary when the BFD library has decided
+ that the two sections ought to be placed into the same segment. */
if (new_segment)
return TRUE;
/* Find the memory regions associated with the two sections.
We call lang_output_section_find() here rather than scanning the list
of output sections looking for a matching section pointer because if
- we have a large number of sections a hash lookup is faster. */
+ we have a large number of sections then a hash lookup is faster. */
cur = lang_output_section_find (current_section->name);
prev = lang_output_section_find (previous_section->name);
+ /* More paranoia. */
if (cur == NULL || prev == NULL)
return new_segment;
/* If the regions are different then force the sections to live in
- different segments. See the email thread starting here for the
- reasons why this is necessary:
+ different segments. See the email thread starting at the following
+ URL for the reasons why this is necessary:
http://sourceware.org/ml/binutils/2007-02/msg00216.html */
return cur->region != prev->region;
}
alc = 10;
secs = xmalloc (alc * sizeof (asection *));
last = NULL;
+
for (l = lang_phdr_list; l != NULL; l = l->next)
{
unsigned int c;
|| os->bfd_section == NULL
|| (os->bfd_section->flags & SEC_ALLOC) == 0)
continue;
- pl = last;
+
+ if (last)
+ pl = last;
+ else
+ {
+ lang_output_section_statement_type * tmp_os;
+
+ /* If we have not run across a section with a program
+ header assigned to it yet, then scan forwards to find
+ one. This prevents inconsistencies in the linker's
+ behaviour when a script has specified just a single
+ header and there are sections in that script which are
+ not assigned to it, and which occur before the first
+ use of that header. See here for more details:
+ http://sourceware.org/ml/binutils/2007-02/msg00291.html */
+ for (tmp_os = os; tmp_os; tmp_os = tmp_os->next)
+ if (tmp_os->phdrs)
+ break;
+ pl = tmp_os->phdrs;
+ }
}
if (os->bfd_section == NULL)
an LMA region was specified. */
if (l->next == 0)
l->os->load_base = lma_expr;
-
if (phdrs != NULL && l->os->phdrs == NULL)
l->os->phdrs = phdrs;