with COFF based x86 ports.
+2004-04-20 DJ Delorie <dj@redhat.com>
+
+ * reloc.c: Add BFD_RELOC_32_SECREL.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Likewise.
+ * coff-i386.c (howto_table) [COFF_WITH_PE]: Add R_SECREL32.
+ (coff_i386_rtype_to_howto) [COFF_WITH_PE]: Handle it.
+ (coff_i386_reloc_type_lookup) [COFF_WITH_PE]: Likewise.
+
2004-04-19 Jakub Jelinek <jakub@redhat.com>
* elf32-sparc.c (elf32_sparc_relocate_section): Handle
BFD_RELOC_12_PCREL,
BFD_RELOC_8_PCREL,
+/* Section relative relocations. Some targets need this for DWARF2. */
+ BFD_RELOC_32_SECREL,
+
/* For ELF. */
BFD_RELOC_32_GOT_PCREL,
BFD_RELOC_16_GOT_PCREL,
EMPTY_HOWTO (010),
EMPTY_HOWTO (011),
EMPTY_HOWTO (012),
+#ifdef COFF_WITH_PE
+ /* 32-bit longword section relative relocation (013). */
+ HOWTO (R_SECREL32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_i386_reloc, /* special_function */
+ "secrel32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+#else
EMPTY_HOWTO (013),
+#endif
EMPTY_HOWTO (014),
EMPTY_HOWTO (015),
EMPTY_HOWTO (016),
{
*addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase;
}
+
+ if (rel->r_type == R_SECREL32)
+ {
+ bfd_vma osect_vma;
+
+ if (h && (h->type == bfd_link_hash_defined
+ || h->type == bfd_link_hash_defweak))
+ osect_vma = h->root.u.def.section->output_section->vma;
+ else
+ {
+ asection *sec;
+ int i;
+
+ /* Sigh, the only way to get the section to offset against
+ is to find it the hard way. */
+
+ for (sec = abfd->sections, i = 1; i < sym->n_scnum; i++)
+ sec = sec->next;
+
+ osect_vma = sec->output_section->vma;
+ }
+
+ *addendp -= osect_vma;
+ }
#endif
return howto;
return howto_table + R_RELBYTE;
case BFD_RELOC_8_PCREL:
return howto_table + R_PCRBYTE;
+#ifdef COFF_WITH_PE
+ case BFD_RELOC_32_SECREL:
+ return howto_table + R_SECREL32;
+#endif
default:
BFD_FAIL ();
return 0;
"BFD_RELOC_16_PCREL",
"BFD_RELOC_12_PCREL",
"BFD_RELOC_8_PCREL",
+ "BFD_RELOC_32_SECREL",
"BFD_RELOC_32_GOT_PCREL",
"BFD_RELOC_16_GOT_PCREL",
"BFD_RELOC_8_GOT_PCREL",
The 24-bit relocation is used in some Intel 960 configurations.
+ENUM
+ BFD_RELOC_32_SECREL
+ENUMDOC
+ Section relative relocations. Some targets need this for DWARF2.
+
ENUM
BFD_RELOC_32_GOT_PCREL
ENUMX
+2004-04-20 DJ Delorie <dj@redhat.com>
+
+ * config/tc-i386.h [TE_PE] (TC_CONS_FIX_NEW): Define.
+ * config/tc-i386.c (md_pseudo_table) [TE_PE]: Add "secrel32".
+ [TE_PE] (O_secrel): Define.
+ [TE_PE] (x86_pe_cons_fix_new): New.
+ [TE_PE] (pe_directive_secrel): Likewise.
+ (tc_gen_reloc) [TE_PE]: Support BFD_RELOC_32_SECREL.
+
2004-04-19 Eric Christopher <echristo@redhat.com>
* config/tc-mips.c (mips_dwarf2_addr_size): Revert part
static void set_16bit_gcc_code_flag PARAMS ((int));
static void set_intel_syntax PARAMS ((int));
static void set_cpu_arch PARAMS ((int));
+#ifdef TE_PE
+static void pe_directive_secrel PARAMS ((int));
+#endif
static char *output_invalid PARAMS ((int c));
static int i386_operand PARAMS ((char *operand_string));
static int i386_intel_operand PARAMS ((char *operand_string, int got_a_float));
{"att_syntax", set_intel_syntax, 0},
{"file", (void (*) PARAMS ((int))) dwarf2_directive_file, 0},
{"loc", dwarf2_directive_loc, 0},
+#ifdef TE_PE
+ {"secrel32", pe_directive_secrel, 0},
+#endif
{0, 0, 0}
};
}
#endif
+#ifdef TE_PE
+
+#define O_secrel (O_max + 1)
+
+void
+x86_pe_cons_fix_new (frag, off, len, exp)
+ fragS *frag;
+ unsigned int off;
+ unsigned int len;
+ expressionS *exp;
+{
+ enum bfd_reloc_code_real r = reloc (len, 0, 0, NO_RELOC);
+
+ if (exp->X_op == O_secrel)
+ {
+ exp->X_op = O_symbol;
+ r = BFD_RELOC_32_SECREL;
+ }
+
+ fix_new_exp (frag, off, len, exp, 0, r);
+}
+
+static void
+pe_directive_secrel (dummy)
+ int dummy ATTRIBUTE_UNUSED;
+{
+ expressionS exp;
+
+ do
+ {
+ expression (&exp);
+ if (exp.X_op == O_symbol)
+ exp.X_op = O_secrel;
+
+ emit_expr (&exp, 4);
+ }
+ while (*input_line_pointer++ == ',');
+
+ input_line_pointer--;
+ demand_empty_rest_of_line ();
+}
+
+#endif
+
static int i386_immediate PARAMS ((char *));
static int
case BFD_RELOC_RVA:
case BFD_RELOC_VTABLE_ENTRY:
case BFD_RELOC_VTABLE_INHERIT:
+#ifdef TE_PE
+ case BFD_RELOC_32_SECREL:
+#endif
code = fixp->fx_r_type;
break;
default:
PARAMS ((fragS *, unsigned int, unsigned int, expressionS *));
#endif
+#ifdef TE_PE
+#define TC_CONS_FIX_NEW(FRAG,OFF,LEN,EXP) x86_pe_cons_fix_new(FRAG, OFF, LEN, EXP)
+extern void x86_pe_cons_fix_new
+ PARAMS ((fragS *, unsigned int, unsigned int, expressionS *));
+#endif
+
#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */
#define NO_RELOC BFD_RELOC_NONE
+2004-04-20 Brian Ford <ford@vss.fsi.com>
+ DJ Delorie <dj@redhat.com>
+
+ * gas/i386/secrel.s: New test for .secrel32.
+ * gas/i386/secrel.d: Likewise.
+ * gas/i386/i386.exp: Call it for PE targets.
+
2004-04-19 Jakub Jelinek <jakub@redhat.com>
* gas/cfi/cfi-sparc64-1.d: Update.
run_dump_test "tlsnopic"
}
+ # This is a PE specific test.
+ if { [istarget "*-*-cygwin*"] || [istarget "*-*-pe"]
+ || [istarget "*-*-mingw*"]
+ } then {
+ run_dump_test "secrel"
+ }
+
set ASFLAGS "$old_ASFLAGS"
}
--- /dev/null
+#objdump: -rs\r
+#name: i386 secrel reloc\r
+\r
+.*: +file format pe-i386\r
+\r
+RELOCATION RECORDS FOR \[\.data\]:\r
+OFFSET TYPE VALUE \r
+00000024 secrel32 \.text\r
+00000029 secrel32 \.text\r
+0000002e secrel32 \.text\r
+00000033 secrel32 \.text\r
+00000044 secrel32 \.data\r
+00000049 secrel32 \.data\r
+0000004e secrel32 \.data\r
+00000053 secrel32 \.data\r
+00000064 secrel32 \.rdata\r
+00000069 secrel32 \.rdata\r
+0000006e secrel32 \.rdata\r
+00000073 secrel32 \.rdata\r
+00000084 secrel32 ext24\r
+00000089 secrel32 ext2d\r
+0000008e secrel32 ext36\r
+00000093 secrel32 ext3f\r
+\r
+\r
+Contents of section \.text:\r
+ 0000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<\r
+ 0010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><\r
+Contents of section \.data:\r
+ 0000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<\r
+ 0010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><\r
+ 0020 3e3e3e3e 04000000 110d0000 00111600 >>>>............\r
+ 0030 0000111f 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<\r
+ 0040 3e3e3e3e 04000000 110d0000 00111600 >>>>............\r
+ 0050 0000111f 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<\r
+ 0060 3e3e3e3e 04000000 110d0000 00111600 >>>>............\r
+ 0070 0000111f 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<\r
+ 0080 3e3e3e3e 00000000 11000000 00110000 >>>>............\r
+ 0090 00001100 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<\r
+Contents of section \.rdata:\r
+ 0000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<\r
+ 0010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><\r
+ 0020 3e3e3e3e >>>> \r
--- /dev/null
+.text\r
+\r
+ .ascii ">>>>"\r
+pre04: .ascii "<<<<"\r
+ .ascii ">>>>>"\r
+pre0d: .ascii "<<<"\r
+ .ascii ">>>>>>"\r
+pre16: .ascii "<<"\r
+ .ascii ">>>>>>>"\r
+pre1f: .ascii "<"\r
+\r
+.data\r
+\r
+ .ascii ">>>>"\r
+sam04: .ascii "<<<<"\r
+ .ascii ">>>>>"\r
+sam0d: .ascii "<<<"\r
+ .ascii ">>>>>>"\r
+sam16: .ascii "<<"\r
+ .ascii ">>>>>>>"\r
+sam1f: .ascii "<"\r
+\r
+ .ascii ">>>>"\r
+ .secrel32 pre04\r
+ .byte 0x11\r
+ .secrel32 pre0d\r
+ .byte 0x11\r
+ .secrel32 pre16\r
+ .byte 0x11\r
+ .secrel32 pre1f\r
+ .byte 0x11\r
+ .ascii "<<<<<<<<"\r
+\r
+ .ascii ">>>>"\r
+ .secrel32 sam04\r
+ .byte 0x11\r
+ .secrel32 sam0d\r
+ .byte 0x11\r
+ .secrel32 sam16\r
+ .byte 0x11\r
+ .secrel32 sam1f\r
+ .byte 0x11\r
+ .ascii "<<<<<<<<"\r
+\r
+ .ascii ">>>>"\r
+ .secrel32 nex04\r
+ .byte 0x11\r
+ .secrel32 nex0d\r
+ .byte 0x11\r
+ .secrel32 nex16\r
+ .byte 0x11\r
+ .secrel32 nex1f\r
+ .byte 0x11\r
+ .ascii "<<<<<<<<"\r
+\r
+ .ascii ">>>>"\r
+ .secrel32 ext24\r
+ .byte 0x11\r
+ .secrel32 ext2d\r
+ .byte 0x11\r
+ .secrel32 ext36\r
+ .byte 0x11\r
+ .secrel32 ext3f\r
+ .byte 0x11\r
+ .ascii "<<<<<<<<"\r
+\r
+.section .rdata\r
+\r
+ .ascii ">>>>"\r
+nex04: .ascii "<<<<"\r
+ .ascii ">>>>>"\r
+nex0d: .ascii "<<<"\r
+ .ascii ">>>>>>"\r
+nex16: .ascii "<<"\r
+ .ascii ">>>>>>>"\r
+nex1f: .ascii "<"\r
+ .ascii ">>>>"\r
+2004-04-20 DJ Delorie <dj@redhat.com>
+
+ * internal.h (R_SECREL32): Add.
For older changes see ChangeLog-9103
\f
#define R_REL24 5
#define R_DIR32 6
#define R_IMAGEBASE 7
+#define R_SECREL32 11
#define R_RELBYTE 15
#define R_RELWORD 16
#define R_RELLONG 17
+2004-04-14 Brian Ford <ford@vss.fsi.com>
+ DJ Delorie <dj@redhat.com>
+
+ * ld-pe/pe.exp: New, tests for i?86 PE.
+ * ld-pe/secrel1.s: New, test R_SECREL32 reloc.
+ * ld-pe/secrel2.s: Likewise.
+ * ld-pe/secrel.d: Likewise.
+
2004-04-19 Jakub Jelinek <jakub@redhat.com>
* ld-elfvsb/elfvsb.exp: XFAIL some tests on sparc64.
--- /dev/null
+# Expect script for export table in executables tests\r
+# Copyright 2004\r
+# Free Software Foundation, Inc.\r
+#\r
+# This file is free software; you can redistribute it and/or modify\r
+# it under the terms of the GNU General Public License as published by\r
+# the Free Software Foundation; either version 2 of the License, or\r
+# (at your option) any later version.\r
+# \r
+# This program is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU General Public License for more details.\r
+# \r
+# You should have received a copy of the GNU General Public License\r
+# along with this program; if not, write to the Free Software\r
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
+#\r
+ \r
+# This test can only be run on i386 PE/COFF platforms.\r
+if { ![istarget i*86-*-cygwin*] && ![istarget i*86-*-pe]\r
+ && ![istarget i*86-*-mingw*] } {\r
+ return\r
+}\r
+\r
+set pe_tests {\r
+ {".secrel32" "" "" {secrel1.s secrel2.s}\r
+ {{objdump -s secrel.d}} "secrel.x"}\r
+}\r
+\r
+run_ld_link_tests $pe_tests\r
--- /dev/null
+\r
+tmpdir/secrel\.x: file format pei-i386\r
+\r
+Contents of section \.text:\r
+ 401000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<\r
+ 401010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><\r
+ 401020 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<\r
+ 401030 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><\r
+ 401040 ........ ........ ........ ........ ................\r
+Contents of section \.data:\r
+ 402000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<\r
+ 402010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><\r
+ 402020 3e3e3e3e 04000000 110d0000 00111600 >>>>............\r
+ 402030 0000111f 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<\r
+ 402040 3e3e3e3e 04000000 110d0000 00111600 >>>>............\r
+ 402050 0000111f 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<\r
+ 402060 3e3e3e3e 04000000 110d0000 00111600 >>>>............\r
+ 402070 0000111f 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<\r
+ 402080 3e3e3e3e 24000000 112d0000 00113600 >>>>\$....-....6.\r
+ 402090 0000113f 00000011 3c3c3c3c 3c3c3c3c ...\?....<<<<<<<<\r
+Contents of section \.rdata:\r
+ 403000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<\r
+ 403010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><\r
+ 403020 3e3e3e3e >>>> \r
+Contents of section \.idata:\r
+ 404000 00000000 00000000 00000000 00000000 ................\r
+ 404010 00000000 .... \r
--- /dev/null
+.text\r
+\r
+ .ascii ">>>>"\r
+pre04: .ascii "<<<<"\r
+ .ascii ">>>>>"\r
+pre0d: .ascii "<<<"\r
+ .ascii ">>>>>>"\r
+pre16: .ascii "<<"\r
+ .ascii ">>>>>>>"\r
+pre1f: .ascii "<"\r
+\r
+.data\r
+\r
+ .ascii ">>>>"\r
+sam04: .ascii "<<<<"\r
+ .ascii ">>>>>"\r
+sam0d: .ascii "<<<"\r
+ .ascii ">>>>>>"\r
+sam16: .ascii "<<"\r
+ .ascii ">>>>>>>"\r
+sam1f: .ascii "<"\r
+\r
+ .ascii ">>>>"\r
+ .secrel32 pre04\r
+ .byte 0x11\r
+ .secrel32 pre0d\r
+ .byte 0x11\r
+ .secrel32 pre16\r
+ .byte 0x11\r
+ .secrel32 pre1f\r
+ .byte 0x11\r
+ .ascii "<<<<<<<<"\r
+\r
+ .ascii ">>>>"\r
+ .secrel32 sam04\r
+ .byte 0x11\r
+ .secrel32 sam0d\r
+ .byte 0x11\r
+ .secrel32 sam16\r
+ .byte 0x11\r
+ .secrel32 sam1f\r
+ .byte 0x11\r
+ .ascii "<<<<<<<<"\r
+\r
+ .ascii ">>>>"\r
+ .secrel32 nex04\r
+ .byte 0x11\r
+ .secrel32 nex0d\r
+ .byte 0x11\r
+ .secrel32 nex16\r
+ .byte 0x11\r
+ .secrel32 nex1f\r
+ .byte 0x11\r
+ .ascii "<<<<<<<<"\r
+\r
+ .ascii ">>>>"\r
+ .secrel32 ext24\r
+ .byte 0x11\r
+ .secrel32 ext2d\r
+ .byte 0x11\r
+ .secrel32 ext36\r
+ .byte 0x11\r
+ .secrel32 ext3f\r
+ .byte 0x11\r
+ .ascii "<<<<<<<<"\r
+\r
+.section .rdata\r
+\r
+ .ascii ">>>>"\r
+nex04: .ascii "<<<<"\r
+ .ascii ">>>>>"\r
+nex0d: .ascii "<<<"\r
+ .ascii ">>>>>>"\r
+nex16: .ascii "<<"\r
+ .ascii ">>>>>>>"\r
+nex1f: .ascii "<"\r
+ .ascii ">>>>"\r
--- /dev/null
+.text\r
+\r
+ .ascii ">>>>"\r
+.global ext24\r
+ext24: .ascii "<<<<"\r
+ .ascii ">>>>>"\r
+.global ext2d\r
+ext2d: .ascii "<<<"\r
+ .ascii ">>>>>>"\r
+.global ext36\r
+ext36: .ascii "<<"\r
+ .ascii ">>>>>>>"\r
+.global ext3f\r
+ext3f: .ascii "<"\r