/* Motorola 68HC11/HC12-specific support for 32-bit ELF
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
- 2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2016 Free Software Foundation, Inc.
Contributed by Stephane Carrez (stcarrez@nerim.fr)
This file is part of BFD, the Binary File Descriptor library.
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include "alloca-conf.h"
#include "sysdep.h"
+#include "alloca-conf.h"
#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf32-m68hc1x.h"
#include "elf/m68hc11.h"
#include "opcode/m68hc11.h"
-
+#include "libiberty.h"
#define m68hc12_stub_hash_lookup(table, string, create, copy) \
((struct elf32_m68hc11_stub_hash_entry *) \
static bfd_boolean m68hc11_elf_export_one_stub
(struct bfd_hash_entry *gen_entry, void *in_arg);
-static void scan_sections_for_abi (bfd*, asection*, PTR);
+static void scan_sections_for_abi (bfd*, asection*, void *);
struct m68hc11_scan_param
{
};
+/* Destroy a 68HC11/68HC12 ELF linker hash table. */
+
+static void
+m68hc11_elf_bfd_link_hash_table_free (bfd *obfd)
+{
+ struct m68hc11_elf_link_hash_table *ret
+ = (struct m68hc11_elf_link_hash_table *) obfd->link.hash;
+
+ bfd_hash_table_free (ret->stub_hash_table);
+ free (ret->stub_hash_table);
+ _bfd_elf_link_hash_table_free (obfd);
+}
+
/* Create a 68HC11/68HC12 ELF linker hash table. */
struct m68hc11_elf_link_hash_table*
struct m68hc11_elf_link_hash_table *ret;
bfd_size_type amt = sizeof (struct m68hc11_elf_link_hash_table);
- ret = (struct m68hc11_elf_link_hash_table *) bfd_malloc (amt);
+ ret = (struct m68hc11_elf_link_hash_table *) bfd_zmalloc (amt);
if (ret == (struct m68hc11_elf_link_hash_table *) NULL)
return NULL;
- memset (ret, 0, amt);
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
_bfd_elf_link_hash_newfunc,
- sizeof (struct elf_link_hash_entry)))
+ sizeof (struct elf_link_hash_entry),
+ M68HC11_ELF_DATA))
{
free (ret);
return NULL;
ret->stub_hash_table = (struct bfd_hash_table*) bfd_malloc (amt);
if (ret->stub_hash_table == NULL)
{
- free (ret);
+ _bfd_elf_link_hash_table_free (abfd);
return NULL;
}
if (!bfd_hash_table_init (ret->stub_hash_table, stub_hash_newfunc,
sizeof (struct elf32_m68hc11_stub_hash_entry)))
- return NULL;
-
- ret->stub_bfd = NULL;
- ret->stub_section = 0;
- ret->add_stub_section = NULL;
- ret->sym_sec.abfd = NULL;
+ {
+ free (ret->stub_hash_table);
+ _bfd_elf_link_hash_table_free (abfd);
+ return NULL;
+ }
+ ret->root.root.hash_table_free = m68hc11_elf_bfd_link_hash_table_free;
return ret;
}
-/* Free the derived linker hash table. */
-
-void
-m68hc11_elf_bfd_link_hash_table_free (struct bfd_link_hash_table *hash)
-{
- struct m68hc11_elf_link_hash_table *ret
- = (struct m68hc11_elf_link_hash_table *) hash;
-
- bfd_hash_table_free (ret->stub_hash_table);
- free (ret->stub_hash_table);
- _bfd_generic_link_hash_table_free (hash);
-}
-
/* Assorted hash table functions. */
/* Initialize an entry in the stub hash table. */
TRUE, FALSE);
if (stub_entry == NULL)
{
- (*_bfd_error_handler) (_("%B: cannot create stub entry %s"),
- section->owner, stub_name);
+ /* xgettext:c-format */
+ _bfd_error_handler (_("%B: cannot create stub entry %s"),
+ section->owner, stub_name);
return NULL;
}
return TRUE;
}
+/* Merge non-visibility st_other attributes, STO_M68HC12_FAR and
+ STO_M68HC12_INTERRUPT. */
+
+void
+elf32_m68hc11_merge_symbol_attribute (struct elf_link_hash_entry *h,
+ const Elf_Internal_Sym *isym,
+ bfd_boolean definition,
+ bfd_boolean dynamic ATTRIBUTE_UNUSED)
+{
+ if (definition)
+ h->other = ((isym->st_other & ~ELF_ST_VISIBILITY (-1))
+ | ELF_ST_VISIBILITY (h->other));
+}
+
/* External entry points for sizing and building linker stubs. */
/* Set up various things so that we can make a list of input sections
{
bfd *input_bfd;
unsigned int bfd_count;
- int top_id, top_index;
+ unsigned int top_id, top_index;
asection *section;
asection **input_list, **list;
bfd_size_type amt;
struct m68hc11_elf_link_hash_table *htab;
htab = m68hc11_elf_hash_table (info);
+ if (htab == NULL)
+ return -1;
if (bfd_get_flavour (info->output_bfd) != bfd_target_elf_flavour)
return 0;
text_section = 0;
for (input_bfd = info->input_bfds, bfd_count = 0, top_id = 0;
input_bfd != NULL;
- input_bfd = input_bfd->link_next)
+ input_bfd = input_bfd->link.next)
{
bfd_count += 1;
for (section = input_bfd->sections;
unsigned int bfd_indx, bfd_count;
bfd_size_type amt;
asection *stub_sec;
-
struct m68hc11_elf_link_hash_table *htab = m68hc11_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
/* Stash our params away. */
htab->stub_bfd = stub_bfd;
htab->add_stub_section = add_stub_section;
/* Count the number of input BFDs and find the top input section id. */
for (input_bfd = info->input_bfds, bfd_count = 0;
input_bfd != NULL;
- input_bfd = input_bfd->link_next)
- {
- bfd_count += 1;
- }
+ input_bfd = input_bfd->link.next)
+ bfd_count += 1;
/* We want to read in symbol extension records only once. To do this
we need to read in the local symbols in parallel and save them for
/* Walk over all the input BFDs, swapping in local symbols. */
for (input_bfd = info->input_bfds, bfd_indx = 0;
input_bfd != NULL;
- input_bfd = input_bfd->link_next, bfd_indx++)
+ input_bfd = input_bfd->link.next, bfd_indx++)
{
Elf_Internal_Shdr *symtab_hdr;
for (input_bfd = info->input_bfds, bfd_indx = 0;
input_bfd != NULL;
- input_bfd = input_bfd->link_next, bfd_indx++)
+ input_bfd = input_bfd->link.next, bfd_indx++)
{
Elf_Internal_Shdr *symtab_hdr;
- Elf_Internal_Sym *local_syms;
struct elf_link_hash_entry ** sym_hashes;
sym_hashes = elf_sym_hashes (input_bfd);
info = (struct bfd_link_info *) in_arg;
htab = m68hc11_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* Massage our args to the form they really have. */
stub_entry = (struct elf32_m68hc11_stub_hash_entry *) gen_entry;
result = (* htab->build_one_stub) (gen_entry, in_arg);
/* Make a printable name that does not conflict with the real function. */
- name = alloca (strlen (stub_entry->root.string) + 16);
- sprintf (name, "tramp.%s", stub_entry->root.string);
+ name = concat ("tramp.", stub_entry->root.string, NULL);
/* Export the symbol for debugging/disassembling. */
m68hc11_elf_set_symbol (htab->stub_bfd, info, name,
stub_entry->stub_offset,
stub_entry->stub_sec);
+ free (name);
return result;
}
m68hc11_elf_get_bank_parameters (info);
htab = m68hc11_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
for (stub_sec = htab->stub_bfd->sections;
stub_sec != NULL;
/* Build the stubs as directed by the stub hash table. */
table = htab->stub_hash_table;
bfd_hash_traverse (table, m68hc11_elf_export_one_stub, info);
-
+
/* Scan the output sections to see if we use the memory banks.
If so, export the symbols that define how the memory banks
are mapped. This is used by gdb and the simulator to obtain
unsigned i;
struct m68hc11_page_info *pinfo;
struct bfd_link_hash_entry *h;
+ struct m68hc11_elf_link_hash_table *htab;
+
+ htab = m68hc11_elf_hash_table (info);
+ if (htab == NULL)
+ return;
- pinfo = &m68hc11_elf_hash_table (info)->pinfo;
+ pinfo = & htab->pinfo;
if (pinfo->bank_param_initialized)
return;
const Elf_Internal_Rela * rel;
const Elf_Internal_Rela * rel_end;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
symtab_hdr = & elf_tdata (abfd)->symtab_hdr;
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ /* PR15323, ref flags aren't set for references in the same
+ object. */
+ h->root.non_ir_ref = 1;
}
switch (ELF32_R_TYPE (rel->r_info))
const char *name = NULL;
struct m68hc11_page_info *pinfo;
const struct elf_backend_data * const ebd = get_elf_backend_data (input_bfd);
+ struct m68hc11_elf_link_hash_table *htab;
+ unsigned long e_flags;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
+ e_flags = elf_elfheader (input_bfd)->e_flags;
+
+ htab = m68hc11_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* Get memory bank parameters. */
m68hc11_elf_get_bank_parameters (info);
- pinfo = &m68hc11_elf_hash_table (info)->pinfo;
+ pinfo = & htab->pinfo;
rel = relocs;
relend = relocs + input_section->reloc_count;
+
for (; rel < relend; rel++)
{
int r_type;
bfd_vma insn_addr;
bfd_vma insn_page;
bfd_boolean is_far = FALSE;
+ bfd_boolean is_xgate_symbol = FALSE;
+ bfd_boolean is_section_symbol = FALSE;
struct elf_link_hash_entry *h;
- const char* stub_name = 0;
+ bfd_vma val;
+ const char * msg;
+ char * buf;
r_symndx = ELF32_R_SYM (rel->r_info);
r_type = ELF32_R_TYPE (rel->r_info);
if (r_type == R_M68HC11_GNU_VTENTRY
- || r_type == R_M68HC11_GNU_VTINHERIT )
+ || r_type == R_M68HC11_GNU_VTINHERIT)
continue;
(*ebd->elf_info_to_howto_rel) (input_bfd, &arel, rel);
+ sec->output_offset
+ sym->st_value);
is_far = (sym && (sym->st_other & STO_M68HC12_FAR));
- if (is_far)
- stub_name = (bfd_elf_string_from_elf_section
- (input_bfd, symtab_hdr->sh_link,
- sym->st_name));
+ is_xgate_symbol = (sym && (sym->st_target_internal));
+ is_section_symbol = ELF_ST_TYPE (sym->st_info) & STT_SECTION;
}
else
{
- bfd_boolean unresolved_reloc, warned;
+ bfd_boolean unresolved_reloc, warned, ignored;
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
r_symndx, symtab_hdr, sym_hashes,
h, sec, relocation, unresolved_reloc,
- warned);
+ warned, ignored);
is_far = (h && (h->other & STO_M68HC12_FAR));
- stub_name = h->root.root.string;
+ is_xgate_symbol = (h && (h->target_internal));
}
- if (sec != NULL && elf_discarded_section (sec))
- {
- /* For relocs against symbols from removed linkonce sections,
- or sections discarded by a linker script, we just want the
- section contents zeroed. Avoid any special processing. */
- _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
- rel->r_info = 0;
- rel->r_addend = 0;
- continue;
- }
+ if (sec != NULL && discarded_section (sec))
+ RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
+ rel, 1, relend, howto, 0, contents);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
/* This is a relocatable link. We don't have to change
anything, unless the reloc is against a section symbol,
if (is_far && ELF32_R_TYPE (rel->r_info) == R_M68HC11_16)
{
struct elf32_m68hc11_stub_hash_entry* stub;
- struct m68hc11_elf_link_hash_table *htab;
- htab = m68hc11_elf_hash_table (info);
stub = m68hc12_stub_hash_lookup (htab->stub_hash_table,
name, FALSE, FALSE);
if (stub)
phys_page = m68hc11_phys_page (pinfo, relocation + rel->r_addend);
switch (r_type)
{
+ case R_M68HC12_LO8XG:
+ /* This relocation is specific to XGATE IMM16 calls and will precede
+ a HI8. tc-m68hc11 only generates them in pairs.
+ Leave the relocation to the HI8XG step. */
+ r = bfd_reloc_ok;
+ r_type = R_M68HC11_NONE;
+ break;
+
+ case R_M68HC12_HI8XG:
+ /* This relocation is specific to XGATE IMM16 calls and must follow
+ a LO8XG. Does not actually check that it was a LO8XG.
+ Adjusts high and low bytes. */
+ relocation = phys_addr;
+ if ((e_flags & E_M68HC11_XGATE_RAMOFFSET)
+ && (relocation >= 0x2000))
+ relocation += 0xc000; /* HARDCODED RAM offset for XGATE. */
+
+ /* Fetch 16 bit value including low byte in previous insn. */
+ val = (bfd_get_8 (input_bfd, (bfd_byte*) contents + rel->r_offset) << 8)
+ | bfd_get_8 (input_bfd, (bfd_byte*) contents + rel->r_offset - 2);
+
+ /* Add on value to preserve carry, then write zero to high byte. */
+ relocation += val;
+
+ /* Write out top byte. */
+ bfd_put_8 (input_bfd, (relocation >> 8) & 0xff,
+ (bfd_byte*) contents + rel->r_offset);
+
+ /* Write out low byte to previous instruction. */
+ bfd_put_8 (input_bfd, relocation & 0xff,
+ (bfd_byte*) contents + rel->r_offset - 2);
+
+ /* Mark as relocation completed. */
+ r = bfd_reloc_ok;
+ r_type = R_M68HC11_NONE;
+ break;
+
+ /* The HI8 and LO8 relocs are generated by %hi(expr) %lo(expr)
+ assembler directives. %hi does not support carry. */
+ case R_M68HC11_HI8:
+ case R_M68HC11_LO8:
+ relocation = phys_addr;
+ break;
+
case R_M68HC11_24:
/* Reloc used by 68HC12 call instruction. */
bfd_put_16 (input_bfd, phys_addr,
/* Get virtual address of instruction having the relocation. */
if (is_far)
{
- const char* msg;
- char* buf;
msg = _("Reference to the far symbol `%s' using a wrong "
"relocation may result in incorrect execution");
- buf = alloca (strlen (msg) + strlen (name) + 10);
+ buf = xmalloc (strlen (msg) + strlen (name) + 10);
sprintf (buf, msg, name);
-
- (* info->callbacks->warning)
- (info, buf, name, input_bfd, NULL, rel->r_offset);
+
+ (*info->callbacks->warning)
+ (info, buf, name, input_bfd, NULL, rel->r_offset);
+ free (buf);
}
/* Get virtual address of instruction having the relocation. */
insn_page = m68hc11_phys_page (pinfo, insn_addr);
+ /* If we are linking an S12 instruction against an XGATE symbol, we
+ need to change the offset of the symbol value so that it's correct
+ from the S12's perspective. */
+ if (is_xgate_symbol)
+ {
+ /* The ram in the global space is mapped to 0x2000 in the 16-bit
+ address space for S12 and 0xE000 in the 16-bit address space
+ for XGATE. */
+ if (relocation >= 0xE000)
+ {
+ /* We offset the address by the difference
+ between these two mappings. */
+ relocation -= 0xC000;
+ break;
+ }
+ else
+ {
+ msg = _("XGATE address (%lx) is not within shared RAM"
+ "(0xE000-0xFFFF), therefore you must manually offset "
+ "the address, and possibly manage the page, in your "
+ "code.");
+ buf = xmalloc (strlen (msg) + 128);
+ sprintf (buf, msg, phys_addr);
+ (*info->callbacks->warning) (info, buf, name, input_bfd,
+ input_section, insn_addr);
+ free (buf);
+ break;
+ }
+ }
+
if (m68hc11_addr_is_banked (pinfo, relocation + rel->r_addend)
&& m68hc11_addr_is_banked (pinfo, insn_addr)
- && phys_page != insn_page)
+ && phys_page != insn_page && !(e_flags & E_M68HC11_NO_BANK_WARNING))
{
- const char* msg;
- char* buf;
-
+ /* xgettext:c-format */
msg = _("banked address [%lx:%04lx] (%lx) is not in the same bank "
"as current banked address [%lx:%04lx] (%lx)");
-
- buf = alloca (strlen (msg) + 128);
+ buf = xmalloc (strlen (msg) + 128);
sprintf (buf, msg, phys_page, phys_addr,
(long) (relocation + rel->r_addend),
insn_page, m68hc11_phys_addr (pinfo, insn_addr),
(long) (insn_addr));
- if (!((*info->callbacks->warning)
- (info, buf, name, input_bfd, input_section,
- rel->r_offset)))
- return FALSE;
+ (*info->callbacks->warning) (info, buf, name, input_bfd,
+ input_section, rel->r_offset);
+ free (buf);
break;
}
+
if (phys_page != 0 && insn_page == 0)
{
- const char* msg;
- char* buf;
-
+ /* xgettext:c-format */
msg = _("reference to a banked address [%lx:%04lx] in the "
"normal address space at %04lx");
-
- buf = alloca (strlen (msg) + 128);
+ buf = xmalloc (strlen (msg) + 128);
sprintf (buf, msg, phys_page, phys_addr, insn_addr);
- if (!((*info->callbacks->warning)
- (info, buf, name, input_bfd, input_section,
- insn_addr)))
- return FALSE;
-
+ (*info->callbacks->warning) (info, buf, name, input_bfd,
+ input_section, insn_addr);
+ free (buf);
relocation = phys_addr;
break;
}
relocation = phys_addr;
break;
}
+
+ /* If we are linking an XGATE instruction against an S12 symbol, we
+ need to change the offset of the symbol value so that it's correct
+ from the XGATE's perspective. */
+ if (!strcmp (howto->name, "R_XGATE_IMM8_LO")
+ || !strcmp (howto->name, "R_XGATE_IMM8_HI"))
+ {
+ /* We can only offset S12 addresses that lie within the non-paged
+ area of RAM. */
+ if (!is_xgate_symbol && !is_section_symbol)
+ {
+ /* The ram in the global space is mapped to 0x2000 and stops at
+ 0x4000 in the 16-bit address space for S12 and 0xE000 in the
+ 16-bit address space for XGATE. */
+ if (relocation >= 0x2000 && relocation < 0x4000)
+ /* We offset the address by the difference
+ between these two mappings. */
+ relocation += 0xC000;
+ else
+ {
+ /* Get virtual address of instruction having the relocation. */
+ insn_addr = input_section->output_section->vma
+ + input_section->output_offset + rel->r_offset;
+
+ msg = _("S12 address (%lx) is not within shared RAM"
+ "(0x2000-0x4000), therefore you must manually "
+ "offset the address in your code");
+ buf = xmalloc (strlen (msg) + 128);
+ sprintf (buf, msg, phys_addr);
+ (*info->callbacks->warning) (info, buf, name, input_bfd,
+ input_section, insn_addr);
+ free (buf);
+ break;
+ }
+ }
+ }
+
if (r_type != R_M68HC11_NONE)
- r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+ {
+ if ((r_type == R_M68HC12_PCREL_9) || (r_type == R_M68HC12_PCREL_10))
+ r = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, rel->r_offset,
- relocation, rel->r_addend);
+ relocation - 2, rel->r_addend);
+ else
+ r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+ contents, rel->r_offset,
+ relocation, rel->r_addend);
+ }
if (r != bfd_reloc_ok)
{
- const char * msg = (const char *) 0;
-
switch (r)
{
case bfd_reloc_overflow:
- if (!((*info->callbacks->reloc_overflow)
- (info, NULL, name, howto->name, (bfd_vma) 0,
- input_bfd, input_section, rel->r_offset)))
- return FALSE;
+ (*info->callbacks->reloc_overflow)
+ (info, NULL, name, howto->name, (bfd_vma) 0,
+ input_bfd, input_section, rel->r_offset);
break;
case bfd_reloc_undefined:
- if (!((*info->callbacks->undefined_symbol)
- (info, name, input_bfd, input_section,
- rel->r_offset, TRUE)))
- return FALSE;
+ (*info->callbacks->undefined_symbol)
+ (info, name, input_bfd, input_section, rel->r_offset, TRUE);
break;
case bfd_reloc_outofrange:
/* fall through */
common_error:
- if (!((*info->callbacks->warning)
- (info, msg, name, input_bfd, input_section,
- rel->r_offset)))
- return FALSE;
+ (*info->callbacks->warning) (info, msg, name, input_bfd,
+ input_section, rel->r_offset);
break;
}
}
object file when linking. */
bfd_boolean
-_bfd_m68hc11_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
+_bfd_m68hc11_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
{
+ bfd *obfd = info->output_bfd;
flagword old_flags;
flagword new_flags;
bfd_boolean ok = TRUE;
- /* Check if we have the same endianess */
- if (!_bfd_generic_verify_endian_match (ibfd, obfd))
+ /* Check if we have the same endianness */
+ if (!_bfd_generic_verify_endian_match (ibfd, info))
return FALSE;
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
/* Check ABI compatibility. */
if ((new_flags & E_M68HC11_I32) != (old_flags & E_M68HC11_I32))
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: linking files compiled for 16-bit integers (-mshort) "
"and others for 32-bit integers"), ibfd);
ok = FALSE;
}
if ((new_flags & E_M68HC11_F64) != (old_flags & E_M68HC11_F64))
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: linking files compiled for 32-bit double (-fshort-double) "
"and others for 64-bit double"), ibfd);
ok = FALSE;
/* Processor compatibility. */
if (!EF_M68HC11_CAN_MERGE_MACH (new_flags, old_flags))
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: linking files compiled for HCS12 with "
"others compiled for HC12"), ibfd);
ok = FALSE;
/* Warn about any other mismatches */
if (new_flags != old_flags)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
+ /* xgettext:c-format */
(_("%B: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"),
ibfd, (unsigned long) new_flags, (unsigned long) old_flags);
ok = FALSE;
else if (elf_elfheader (abfd)->e_flags & EF_M68HCS12_MACH)
fprintf (file, _("cpu=HCS12]"));
else
- fprintf (file, _("cpu=HC12]"));
+ fprintf (file, _("cpu=HC12]"));
if (elf_elfheader (abfd)->e_flags & E_M68HC12_BANKS)
fprintf (file, _(" [memory=bank-model]"));
else
fprintf (file, _(" [memory=flat]"));
+ if (elf_elfheader (abfd)->e_flags & E_M68HC11_XGATE_RAMOFFSET)
+ fprintf (file, _(" [XGATE RAM offsetting]"));
+
fputc ('\n', file);
return TRUE;
if (asect->vma >= p->pinfo->bank_virtual)
p->use_memory_banks = TRUE;
}
-
+
/* Tweak the OSABI field of the elf header. */
void
elf32_m68hc11_post_process_headers (bfd *abfd, struct bfd_link_info *link_info)
{
struct m68hc11_scan_param param;
+ struct m68hc11_elf_link_hash_table *htab;
+
+ if (link_info == NULL)
+ return;
- if (link_info == 0)
+ htab = m68hc11_elf_hash_table (link_info);
+ if (htab == NULL)
return;
m68hc11_elf_get_bank_parameters (link_info);
param.use_memory_banks = FALSE;
- param.pinfo = &m68hc11_elf_hash_table (link_info)->pinfo;
+ param.pinfo = & htab->pinfo;
+
bfd_map_over_sections (abfd, scan_sections_for_abi, ¶m);
+
if (param.use_memory_banks)
{
Elf_Internal_Ehdr * i_ehdrp;
i_ehdrp->e_flags |= E_M68HC12_BANKS;
}
}
-