Két lényegi változás van a coff-i386.c-hez képest: A DISP8 DISP16 DISP32 kódok PC relatív flag-et kaptak, valamint a PC relatív számoláskor figyelembe kell venni az adat hosszát is:
*** coff-i386.c Sat Oct 22 03:03:58 1994
--- coff-i386nt.c Fri Jun 7 13:59:26 1996
***************
*** 47,54 ****
bfd_perform_relocation function. This function is called by every
reloc type to make any required adjustments. */
static bfd_reloc_status_type
! coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
error_message)
bfd *abfd;
arelent *reloc_entry;
--- 47,59 ----
bfd_perform_relocation function. This function is called by every
reloc type to make any required adjustments. */
+ /* It seems to me that Windows NT style COFF does NOT change the value
+ of any reference: it's always 0.
+ I havn't been thinking of what to do with relocateable output...
+ Istvan Marosi, Recosoft Ltd., recosoft KUKAC axelero PONT hu */
+
static bfd_reloc_status_type
! coff_i386NT_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
error_message)
bfd *abfd;
arelent *reloc_entry;
***************
*** 145,151 ****
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
! coff_i386_reloc, /* special_function */
"dir32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
--- 150,156 ----
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
! coff_i386NT_reloc, /* special_function */
"dir32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
***************
*** 166,172 ****
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
! coff_i386_reloc, /* special_function */
"8", /* name */
true, /* partial_inplace */
0x000000ff, /* src_mask */
--- 171,177 ----
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
! coff_i386NT_reloc, /* special_function */
"8", /* name */
true, /* partial_inplace */
0x000000ff, /* src_mask */
***************
*** 179,185 ****
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
! coff_i386_reloc, /* special_function */
"16", /* name */
true, /* partial_inplace */
0x0000ffff, /* src_mask */
--- 184,190 ----
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
! coff_i386NT_reloc, /* special_function */
"16", /* name */
true, /* partial_inplace */
0x0000ffff, /* src_mask */
***************
*** 192,198 ****
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
! coff_i386_reloc, /* special_function */
"32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
--- 197,203 ----
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
! coff_i386NT_reloc, /* special_function */
"32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
***************
*** 205,216 ****
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
! coff_i386_reloc, /* special_function */
"DISP8", /* name */
true, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
! false), /* pcrel_offset */
HOWTO (R_PCRWORD, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
--- 210,221 ----
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
! coff_i386NT_reloc, /* special_function */
"DISP8", /* name */
true, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
! true), /* pcrel_offset */
HOWTO (R_PCRWORD, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
***************
*** 218,229 ****
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
! coff_i386_reloc, /* special_function */
"DISP16", /* name */
true, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
! false), /* pcrel_offset */
HOWTO (R_PCRLONG, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
--- 223,234 ----
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
! coff_i386NT_reloc, /* special_function */
"DISP16", /* name */
true, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
! true), /* pcrel_offset */
HOWTO (R_PCRLONG, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
***************
*** 231,242 ****
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
! coff_i386_reloc, /* special_function */
"DISP32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
! false) /* pcrel_offset */
};
/* Turn a howto into a reloc nunmber */
--- 236,247 ----
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
! coff_i386NT_reloc, /* special_function */
"DISP32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
! true) /* pcrel_offset */
};
/* Turn a howto into a reloc nunmber */
***************
*** 258,277 ****
STYP_NOLOAD. */
#define BSS_NOLOAD_IS_SHARED_LIBRARY
! /* Compute the addend of a reloc. If the reloc is to a common symbol,
! the object file contains the value of the common symbol. By the
time this is called, the linker may be using a different symbol
from a different object file with a different value. Therefore, we
hack wildly to locate the original symbol from this file so that we
can make the correct adjustment. This macro sets coffsym to the
symbol from the original file, and uses it to set the addend value
! correctly. If this is not a common symbol, the usual addend
calculation is done, except that an additional tweak is needed for
PC relative relocs.
FIXME: This macro refers to symbols and asect; these are from the
calling function, not the macro arguments. */
! #define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
{ \
coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \
if (ptr && bfd_asymbol_bfd (ptr) != abfd) \
--- 263,282 ----
STYP_NOLOAD. */
#define BSS_NOLOAD_IS_SHARED_LIBRARY
! /* Compute the addend of a reloc. [false: If the reloc is to a common symbol,
! the object file contains the value of the common symbol.] By the
time this is called, the linker may be using a different symbol
from a different object file with a different value. Therefore, we
hack wildly to locate the original symbol from this file so that we
can make the correct adjustment. This macro sets coffsym to the
symbol from the original file, and uses it to set the addend value
! correctly. [If this is not a common symbol,] the usual addend
calculation is done, except that an additional tweak is needed for
PC relative relocs.
FIXME: This macro refers to symbols and asect; these are from the
calling function, not the macro arguments. */
! #define OLD_CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
{ \
coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \
if (ptr && bfd_asymbol_bfd (ptr) != abfd) \
***************
*** 290,295 ****
--- 295,312 ----
if (ptr && howto_table[reloc.r_type].pc_relative) \
cache_ptr->addend += asect->vma; \
}
+ #define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) coffNT_Addend(abfd, ptr, reloc, cache_ptr)
+
+ void coffNT_Addend(abfd, ptr, reloc, cache_ptr)
+ bfd * abfd;
+ asymbol *ptr;
+ struct internal_reloc reloc;
+ arelent *cache_ptr;
+ {
+ cache_ptr->addend = 0;
+ if (ptr && howto_table[reloc.r_type].pc_relative)
+ cache_ptr->addend -= howto_table[reloc.r_type].bitsize / 8;
+ }
/* We use the special COFF backend linker. */
#define coff_relocate_section _bfd_coff_generic_relocate_section
***************
*** 345,357 ****
#ifdef TARGET_SYM
TARGET_SYM =
#else
! i386coff_vec =
#endif
{
#ifdef TARGET_NAME
TARGET_NAME,
#else
! "coff-i386", /* name */
#endif
bfd_target_coff_flavour,
false, /* data byte order is little */
--- 362,374 ----
#ifdef TARGET_SYM
TARGET_SYM =
#else
! i386coffNT_vec =
#endif
{
#ifdef TARGET_NAME
TARGET_NAME,
#else
! "coff-i386NT", /* name */
#endif
bfd_target_coff_flavour,
false, /* data byte order is little */