fix .stab/.stabstr hunks, drop if not a debug version otherwise make these the last hunks
This commit is contained in:
parent
e5ab1ffedf
commit
72e25c3819
|
@ -1594,7 +1594,7 @@ amiga_write_object_contents (abfd)
|
|||
{
|
||||
long datadata_relocs = 0, bss_size = 0, idx;
|
||||
int *index_map, max_hunk = -1;
|
||||
sec_ptr data_sec, p;
|
||||
sec_ptr data_sec, p, q;
|
||||
unsigned long i, n[5];
|
||||
|
||||
/* Distinguish UNITS, LOAD Files
|
||||
|
@ -1603,6 +1603,56 @@ amiga_write_object_contents (abfd)
|
|||
|
||||
abfd->output_has_begun = TRUE; /* Output has begun */
|
||||
|
||||
if (AMIGA_DATA(abfd)->IsLoadFile)
|
||||
{
|
||||
// shuffle .stab and .stabstr to end
|
||||
for (q = abfd->sections, p = q->next; p != NULL; q = p, p = p->next)
|
||||
{
|
||||
if (0 == strcmp (p->name, ".stab"))
|
||||
{
|
||||
if (p->next)
|
||||
{
|
||||
q->next = p->next;
|
||||
if (write_debug_hunk)
|
||||
{
|
||||
q = p->next;
|
||||
while (q->next)
|
||||
q = q->next;
|
||||
q->next = p;
|
||||
p->next = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
q->next = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (q = abfd->sections, p = q->next; p != NULL; q = p, p = p->next)
|
||||
{
|
||||
if (0 == strcmp (p->name, ".stabstr"))
|
||||
{
|
||||
if (p->next)
|
||||
{
|
||||
q->next = p->next;
|
||||
if (write_debug_hunk)
|
||||
{
|
||||
q = p->next;
|
||||
while (q->next)
|
||||
q = q->next;
|
||||
q->next = p;
|
||||
p->next = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
q->next = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int n = 0;
|
||||
for (p = abfd->sections; p != NULL; p = p->next)
|
||||
p->index = n++;
|
||||
}
|
||||
|
||||
index_map = bfd_alloc (abfd, abfd->section_count * sizeof(int));
|
||||
if (!index_map)
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in New Issue