aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2021-05-03 13:28:30 +0200
committerJan Beulich <jbeulich@suse.com>2021-05-03 13:28:30 +0200
commit5e0a033bd2927a027a5fb2c93d9e403c4f505bd0 (patch)
treefdc1c442126f599f958e27df0f7f262ac9b06e4e
parent3e301ce0b54002d92808f6bba08b8f793a5cdfa5 (diff)
downloadfsf-binutils-gdb-5e0a033bd2927a027a5fb2c93d9e403c4f505bd0.zip
fsf-binutils-gdb-5e0a033bd2927a027a5fb2c93d9e403c4f505bd0.tar.gz
fsf-binutils-gdb-5e0a033bd2927a027a5fb2c93d9e403c4f505bd0.tar.bz2
x86: allow @secrel32 also in data definitions
Now that lex_got() is uniform for all targets using it, permit COFF targets to also use @secrel32 with, in particular, .long. This is more natural than the custom .secrel32 directive, and also allows more flexibility (the "+six" form of the two added test lines doesn't work with a .secrel32 equivalent, in that it silently produces an unintended relocation type). As an extra benefit this also makes sure that data definitions in Intel syntax mode would get treated like they do for e.g. ELF targets.
-rw-r--r--gas/ChangeLog8
-rw-r--r--gas/config/tc-i386.h3
-rw-r--r--gas/testsuite/gas/i386/secrel.d6
-rw-r--r--gas/testsuite/gas/i386/secrel.s12
4 files changed, 22 insertions, 7 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 9442a3e..0ec2886 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,13 @@
2021-05-03 Jan Beulich <jbeulich@suse.com>
+ * config/tc-i386.h (TC_PARSE_CONS_EXPRESSION): Adjust surrounding
+ #if.
+ * testsuite/gas/i386/secrel.s: Convert some .secrel32 to .long.
+ Add two further .long and an .equ.
+ * testsuite/gas/i386/secrel.d: Adjust expecations.
+
+2021-05-03 Jan Beulich <jbeulich@suse.com>
+
* testsuite/gas/i386/secrel.d, testsuite/gas/i386/secrel.s:
Convert Windows to UNIX EOL.
diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h
index 5516a16..9ca9727 100644
--- a/gas/config/tc-i386.h
+++ b/gas/config/tc-i386.h
@@ -126,7 +126,8 @@ extern const char *i386_comment_chars;
#define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_"
#endif
-#if (defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) && !defined (LEX_AT)
+#if ((defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) \
+ && !defined (LEX_AT)) || defined (TE_PE)
#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) x86_cons (EXP, NBYTES)
#endif
extern bfd_reloc_code_real_type x86_cons (expressionS *, int);
diff --git a/gas/testsuite/gas/i386/secrel.d b/gas/testsuite/gas/i386/secrel.d
index 1753086..f6e31c7 100644
--- a/gas/testsuite/gas/i386/secrel.d
+++ b/gas/testsuite/gas/i386/secrel.d
@@ -21,7 +21,9 @@ OFFSET[ ]+TYPE[ ]+VALUE *
0+89 secrel32 ext2d
0+8e secrel32 ext36
0+93 secrel32 ext3f
-0+a2 secrel32 bar
+0+a0 secrel32 \.text
+0+a4 secrel32 \.text
+0+aa secrel32 bar
Contents of section \.text:
0000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<
@@ -37,7 +39,7 @@ Contents of section \.data:
0070 0000111f 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<
0080 3e3e3e3e 00000000 11000000 00110000 >>>>............
0090 00001100 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<
- 00a0 8d902c00 00000000 ..,..... *
+ 00a0 10000000 1c000000 8d902c00 00000000 ..........,.....
Contents of section \.rdata:
0000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<
0010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><
diff --git a/gas/testsuite/gas/i386/secrel.s b/gas/testsuite/gas/i386/secrel.s
index e7de678..c43ad92 100644
--- a/gas/testsuite/gas/i386/secrel.s
+++ b/gas/testsuite/gas/i386/secrel.s
@@ -27,7 +27,7 @@ sam1f: .ascii "<"
.byte 0x11
.secrel32 pre16
.byte 0x11
- .secrel32 pre1f
+ .long pre1f@secrel32
.byte 0x11
.ascii "<<<<<<<<"
@@ -36,7 +36,7 @@ sam1f: .ascii "<"
.byte 0x11
.secrel32 sam0d
.byte 0x11
- .secrel32 sam16
+ .long sam16@secrel32
.byte 0x11
.secrel32 sam1f
.byte 0x11
@@ -45,7 +45,7 @@ sam1f: .ascii "<"
.ascii ">>>>"
.secrel32 nex04
.byte 0x11
- .secrel32 nex0d
+ .long nex0d@secrel32
.byte 0x11
.secrel32 nex16
.byte 0x11
@@ -54,7 +54,7 @@ sam1f: .ascii "<"
.ascii "<<<<<<<<"
.ascii ">>>>"
- .secrel32 ext24
+ .long ext24@secrel32
.byte 0x11
.secrel32 ext2d
.byte 0x11
@@ -64,6 +64,9 @@ sam1f: .ascii "<"
.byte 0x11
.ascii "<<<<<<<<"
+ .long pre0d@secrel32+3
+ .long pre16@secrel32+six
+
leal bar@SECREL32+44(%eax), %edx
.section .rdata
@@ -79,3 +82,4 @@ nex1f: .ascii "<"
.ascii ">>>>"
.p2align 4,0
+ .equ six,6