diff --git a/bfd/amigaoslink.c b/bfd/amigaoslink.c index 888ef2c..92c46ec 100644 --- a/bfd/amigaoslink.c +++ b/bfd/amigaoslink.c @@ -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; diff --git a/gas/config/obj-aout.c b/gas/config/obj-aout.c index ba4a2f2..abc915c 100644 --- a/gas/config/obj-aout.c +++ b/gas/config/obj-aout.c @@ -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); } diff --git a/gas/read.c b/gas/read.c index b4458eb..28e5166 100644 --- a/gas/read.c +++ b/gas/read.c @@ -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 +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;