Obsolete tic30-aout, and linker segmentation faults
See also the FIXME. tic30-aout linker support is so bad (and has been that way since the initial tic30-aout commit) that I'm obsoleting the target. This patch fixes numerous linker testsuite segmentation faults. PR 24596 * aout-tic30.c (MY_bfd_final_link): Don't segfault on missing create_object_symbols_section, obj_textsec, obj_datasec or obj_bsssec. Fix other errors in placement. * config.bfd: Obsolete tic30-aout.
This commit is contained in:
parent
0eb32b6e1d
commit
a7b34aba62
@ -1,3 +1,11 @@
|
|||||||
|
2019-05-28 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
PR 24596
|
||||||
|
* aout-tic30.c (MY_bfd_final_link): Don't segfault on missing
|
||||||
|
create_object_symbols_section, obj_textsec, obj_datasec or
|
||||||
|
obj_bsssec. Fix other errors in placement.
|
||||||
|
* config.bfd: Obsolete tic30-aout.
|
||||||
|
|
||||||
2019-05-28 Alan Modra <amodra@gmail.com>
|
2019-05-28 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
PR 24596
|
PR 24596
|
||||||
|
@ -710,28 +710,42 @@ static bfd_boolean
|
|||||||
MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
|
MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||||
{
|
{
|
||||||
struct internal_exec *execp = exec_hdr (abfd);
|
struct internal_exec *execp = exec_hdr (abfd);
|
||||||
|
asection *objsym_section;
|
||||||
file_ptr pos;
|
file_ptr pos;
|
||||||
bfd_vma vma = 0;
|
bfd_vma vma = 0;
|
||||||
int pad;
|
|
||||||
|
|
||||||
/* Set the executable header size to 0, as we don't want one for an
|
/* Set the executable header size to 0, as we don't want one for an
|
||||||
output. */
|
output. FIXME: Really? tic30_aout_object_p doesn't accept such
|
||||||
|
an executable! */
|
||||||
adata (abfd).exec_bytes_size = 0;
|
adata (abfd).exec_bytes_size = 0;
|
||||||
|
|
||||||
pos = adata (abfd).exec_bytes_size;
|
pos = adata (abfd).exec_bytes_size;
|
||||||
|
/* ??? Why are we looking at create_object_symbols_section? */
|
||||||
|
objsym_section = info->create_object_symbols_section;
|
||||||
|
if (objsym_section != NULL)
|
||||||
|
vma = objsym_section->vma;
|
||||||
|
|
||||||
/* Text. */
|
/* Text. */
|
||||||
vma = info->create_object_symbols_section->vma;
|
if (obj_textsec (abfd) != NULL)
|
||||||
|
{
|
||||||
pos += vma;
|
pos += vma;
|
||||||
obj_textsec (abfd)->filepos = pos;
|
obj_textsec (abfd)->filepos = pos;
|
||||||
obj_textsec (abfd)->vma = vma;
|
obj_textsec (abfd)->vma = vma;
|
||||||
obj_textsec (abfd)->user_set_vma = 1;
|
obj_textsec (abfd)->user_set_vma = 1;
|
||||||
|
execp->a_text = obj_textsec (abfd)->size;
|
||||||
pos += obj_textsec (abfd)->size;
|
pos += obj_textsec (abfd)->size;
|
||||||
vma += obj_textsec (abfd)->size;
|
vma += obj_textsec (abfd)->size;
|
||||||
|
}
|
||||||
|
|
||||||
/* Data. */
|
/* Data. */
|
||||||
|
if (obj_datasec (abfd) != NULL)
|
||||||
|
{
|
||||||
if (abfd->flags & D_PAGED)
|
if (abfd->flags & D_PAGED)
|
||||||
{
|
{
|
||||||
if (info->create_object_symbols_section->next->vma > 0)
|
if (objsym_section != NULL
|
||||||
obj_datasec (abfd)->vma = info->create_object_symbols_section->next->vma;
|
&& objsym_section->next != NULL
|
||||||
|
&& objsym_section->next->vma != 0)
|
||||||
|
obj_datasec (abfd)->vma = objsym_section->next->vma;
|
||||||
else
|
else
|
||||||
obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size);
|
obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size);
|
||||||
}
|
}
|
||||||
@ -741,22 +755,42 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
|
|||||||
if (obj_datasec (abfd)->vma < vma)
|
if (obj_datasec (abfd)->vma < vma)
|
||||||
obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4);
|
obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4);
|
||||||
|
|
||||||
|
pos += obj_datasec (abfd)->vma - vma;
|
||||||
|
obj_datasec (abfd)->filepos = pos;
|
||||||
obj_datasec (abfd)->user_set_vma = 1;
|
obj_datasec (abfd)->user_set_vma = 1;
|
||||||
|
|
||||||
vma = obj_datasec (abfd)->vma;
|
vma = obj_datasec (abfd)->vma;
|
||||||
obj_datasec (abfd)->filepos = vma + adata (abfd).exec_bytes_size;
|
if (obj_textsec (abfd) != NULL)
|
||||||
|
{
|
||||||
execp->a_text = vma - obj_textsec (abfd)->vma;
|
execp->a_text = vma - obj_textsec (abfd)->vma;
|
||||||
obj_textsec (abfd)->size = execp->a_text;
|
obj_textsec (abfd)->size = execp->a_text;
|
||||||
|
}
|
||||||
|
execp->a_data = obj_datasec (abfd)->size;
|
||||||
|
vma += obj_datasec (abfd)->size;
|
||||||
|
}
|
||||||
|
|
||||||
/* Since BSS follows data immediately, see if it needs alignment. */
|
/* Since BSS follows data immediately, see if it needs alignment. */
|
||||||
vma += obj_datasec (abfd)->size;
|
if (obj_bsssec (abfd) != NULL)
|
||||||
|
{
|
||||||
|
int pad;
|
||||||
|
|
||||||
pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma;
|
pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma;
|
||||||
|
if (obj_datasec (abfd) != NULL)
|
||||||
|
{
|
||||||
obj_datasec (abfd)->size += pad;
|
obj_datasec (abfd)->size += pad;
|
||||||
pos += obj_datasec (abfd)->size;
|
execp->a_data += pad;
|
||||||
execp->a_data = obj_datasec (abfd)->size;
|
}
|
||||||
|
else if (obj_textsec (abfd) != NULL)
|
||||||
|
{
|
||||||
|
obj_textsec (abfd)->size += pad;
|
||||||
|
execp->a_text += pad;
|
||||||
|
}
|
||||||
|
|
||||||
/* BSS. */
|
/* BSS. */
|
||||||
|
vma += pad;
|
||||||
obj_bsssec (abfd)->vma = vma;
|
obj_bsssec (abfd)->vma = vma;
|
||||||
obj_bsssec (abfd)->user_set_vma = 1;
|
obj_bsssec (abfd)->user_set_vma = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* We are fully resized, so don't readjust in final_link. */
|
/* We are fully resized, so don't readjust in final_link. */
|
||||||
adata (abfd).magic = z_magic;
|
adata (abfd).magic = z_magic;
|
||||||
|
@ -53,6 +53,7 @@ case $targ in
|
|||||||
echo "*** Use or1k-*-elf or or1k-*-linux as the target instead" >&2
|
echo "*** Use or1k-*-elf or or1k-*-linux as the target instead" >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
c30-*-*aout* | tic30-*-*aout* | \
|
||||||
null)
|
null)
|
||||||
if test "x$enable_obsolete" != xyes; then
|
if test "x$enable_obsolete" != xyes; then
|
||||||
echo "*** Configuration $targ is obsolete." >&2
|
echo "*** Configuration $targ is obsolete." >&2
|
||||||
|
Loading…
Reference in New Issue
Block a user