/* Support for 32-bit Alpha NLM (NetWare Loadable Module)
- Copyright 1993, 1994, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
static bfd_boolean nlm_alpha_read_reloc
PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *));
static bfd_boolean nlm_alpha_mangle_relocs
- PARAMS ((bfd *, asection *, PTR, bfd_vma, bfd_size_type));
+ PARAMS ((bfd *, asection *, const PTR, bfd_vma, bfd_size_type));
static bfd_boolean nlm_alpha_read_import
PARAMS ((bfd *, nlmNAME(symbol_type) *));
static bfd_boolean nlm_alpha_write_import
return TRUE;
}
\f
+#define ONES(n) (((bfd_vma) 1 << ((n) - 1) << 1) - 1)
+
/* How to process the various reloc types. */
static reloc_howto_type nlm32_alpha_howto_table[] =
0, /* special_function */
"REFQUAD", /* name */
TRUE, /* partial_inplace */
- 0xffffffffffffffff, /* src_mask */
- 0xffffffffffffffff, /* dst_mask */
+ ONES (64), /* src_mask */
+ ONES (64), /* dst_mask */
FALSE), /* pcrel_offset */
/* A 32 bit GP relative offset. This is just like REFLONG except
0, /* special_function */
"SREL64", /* name */
TRUE, /* partial_inplace */
- 0xffffffffffffffff, /* src_mask */
- 0xffffffffffffffff, /* dst_mask */
+ ONES (64), /* src_mask */
+ ONES (64), /* dst_mask */
FALSE), /* pcrel_offset */
/* Push a value on the reloc evaluation stack. */
"OP_STORE", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
- 0xffffffffffffffff, /* dst_mask */
+ ONES (64), /* dst_mask */
FALSE), /* pcrel_offset */
/* Subtract the reloc address from the value on the top of the
or .data section. R_NW_RELOC relocs don't really have a section,
so we put them in .text. */
if (r_type == ALPHA_R_NW_RELOC
- || r_vaddr < bfd_section_size (abfd, code_sec))
+ || r_vaddr < code_sec->size)
{
*secp = code_sec;
rel->address = r_vaddr;
else
{
*secp = data_sec;
- rel->address = r_vaddr - bfd_section_size (abfd, code_sec);
+ rel->address = r_vaddr - code_sec->size;
}
/* We must adjust the addend based on the type. */
nlm_alpha_mangle_relocs (abfd, sec, data, offset, count)
bfd *abfd ATTRIBUTE_UNUSED;
asection *sec ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
+ const PTR data ATTRIBUTE_UNUSED;
bfd_vma offset ATTRIBUTE_UNUSED;
bfd_size_type count ATTRIBUTE_UNUSED;
{
{
r_vaddr = bfd_get_section_vma (abfd, sec) + rel->address;
if ((sec->flags & SEC_CODE) == 0)
- r_vaddr += bfd_section_size (abfd,
- bfd_get_section_by_name (abfd,
- NLM_CODE_NAME));
+ r_vaddr += bfd_get_section_by_name (abfd, NLM_CODE_NAME) -> size;
if (bfd_is_und_section (bfd_get_section (sym)))
{
r_extern = 1;
code_sec = bfd_get_section_by_name (abfd, NLM_CODE_NAME);
data_sec = bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
- if (sym->symbol.value < bfd_section_size (abfd, code_sec))
+ if (sym->symbol.value < code_sec->size)
{
sym->symbol.section = code_sec;
sym->symbol.flags |= BSF_FUNCTION;
else
{
sym->symbol.section = data_sec;
- sym->symbol.value -= bfd_section_size (abfd, code_sec);
+ sym->symbol.value -= code_sec->size;
/* The data segment had better be aligned. */
- BFD_ASSERT ((bfd_section_size (abfd, code_sec) & 0xf) == 0);
+ BFD_ASSERT ((code_sec->size & 0xf) == 0);
}
return TRUE;
}