@D added more debug output, @B reintroduced an old bug to make the

linker work again!?!
This commit is contained in:
bebbo 2017-01-31 20:18:46 +01:00
parent fd791101b6
commit 78fa84d0b7
3 changed files with 39 additions and 6 deletions

View File

@ -593,7 +593,7 @@ aout_perform_reloc (abfd, r, data, sec, obfd, error_message)
relocation=0; flags=RELOC_SIGNED; copy=FALSE; ret=bfd_reloc_ok;
DPRINT(10,("RELOC: %s: size=%u\n",r->howto->name,bfd_get_reloc_size(r->howto)));
DPRINT(10,("RELOC: %s, %d: size=%u\n",r->howto->name,r->howto->type,bfd_get_reloc_size(r->howto)));
switch (r->howto->type)
{
case H_ABS8: /* 8/16 bit reloc, pc relative or absolute */
@ -609,7 +609,11 @@ aout_perform_reloc (abfd, r, data, sec, obfd, error_message)
}
else if (sec->output_section!=target_section->output_section)
{
if ((target_section->output_section->flags&SEC_DATA)!=0)
// SBF: the if statement has been fixed, but the linker does no longer work.
// if ((target_section->output_section->flags&SEC_DATA)!=0)
// I replaced it with the old (obvious bogus) statement
// TODO: a better fix
if (target_section->output_section->flags & (SEC_DATA != 0))
goto baserel; /* Dirty, but no code duplication.. */
bfd_msg ("pc relative relocation out-of-range in section %s. "
"Relocation was to symbol %s",sec->name,sym->name);
@ -654,10 +658,17 @@ aout_perform_reloc (abfd, r, data, sec, obfd, error_message)
case H_PC8: /* pcrel */
case H_PC16:
case H_PC32:
DPRINT(10,("pcrel: %s\n", sym->name));
if (bfd_is_abs_section(target_section)) /* Ref to absolute hunk */
relocation=sym->value;
else if (sec->output_section!=target_section->output_section) /* Error */
{
DPRINT(10,("target->out=%s(%lx), sec->out=%s(%lx), symbol=%s\n",
target_section->output_section->name,
target_section->output_section,
sec->output_section->name,
sec->output_section,
sym->name));
DPRINT(5,("pc relative, but out-of-range\n"));
ret=bfd_reloc_outofrange;
}
@ -671,6 +682,7 @@ aout_perform_reloc (abfd, r, data, sec, obfd, error_message)
case H_SD16: /* baserel */
case H_SD32:
baserel:
DPRINT(10,("baserel: %s\n", sym->name));
/* We use the symbol ___a4_init as base */
if (bfd_is_abs_section(target_section))
relocation=sym->value;

View File

@ -287,11 +287,13 @@ static void obj_section(int push) {
char const * name = obj_section_name();
if (name == NULL)
return;
if (0 == strcmp(".rodata", name))
s_text(push);
//printf("section: %s\r\n", name);
if (0 == strcmp(".rodata", name)
//|| 0 == strncmp(".text", name, 5)
)
s_text(push);
else
s_data(push);
s_data(push);
}

View File

@ -19,6 +19,22 @@ along with GAS; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
//#define DEBUG_READ 1
#if DEBUG_READ
#include <stdarg.h>
static void
error_print (const char *fmt, ...)
{
va_list args;
va_start (args, fmt);
vfprintf (stderr, fmt, args);
va_end (args);
}
#define DPRINT(L,x) if (L>=DEBUG_READ) error_print x
#else
#define DPRINT(L,x)
#endif
#if 0
/* If your chars aren't 8 bits, you will change this a bit.
But then, GNU isn't spozed to run on your machine anyway.
@ -768,6 +784,8 @@ read_a_source_file (name)
if (pop == NULL)
pop = (pseudo_typeS *) hash_find (po_hash, s + 1);
DPRINT(10, ("s=%s -> %p\r\n", s, pop));
/* In MRI mode, we may need to insert an
automatic alignment directive. What a hack
this is. */
@ -2503,6 +2521,7 @@ void
s_mri_sect (type)
char *type ATTRIBUTE_UNUSED;
{
DPRINT(10, ("s_mri_sect type=%s\r\n", type));
#ifdef TC_M68K
char *name;