This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] [MIPS] PR gas/14798: Limit IRIX5 specific default typing to IRIX targets
- From: Faraz Shahbazker <fshahbazker at wavecomp dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Cc: Faraz Shahbazker <fshahbazker at wavecomp dot com>
- Date: Mon, 6 May 2019 16:09:02 +0000
- Subject: [PATCH] [MIPS] PR gas/14798: Limit IRIX5 specific default typing to IRIX targets
On IRIX 5, every global symbol that is not explicitly labelled as
being a function is assumed to be an object. There is no reason
why IRIX behaviour should extend to all MIPS targets, so limit this
to only IRIX targets.
gas/
PR gas/14798
* config/tc-mips.c (s_mips_globl): Only treat symbols that are
not explicitly labelled as BSF_OBJECTs for IRIX targets.
* testsuite/gas/mips/pr14798.s: New test source.
* testsuite/gas/mips/pr14798-irix.d: New test.
* testsuite/gas/mips/pr14798.d: Likewise.
* testsuite/gas/mips/mips.exp: Run the new tests.
binutils/
PR gas/14798
* testsuite/binutils-all/readelf.ss-mips: Update reference output.
* testsuite/binutils-all/readelf.ss-tmips: Likewise.
ld/
PR gas/14798
* testsuite/ld-mips-elf/reloc-6a.s: Specify .text section for
global code symbols.
* testsuite/ld-mips-elf/reloc-6b.s: Likewise.
---
binutils/testsuite/binutils-all/readelf.ss-mips | 8 ++++----
binutils/testsuite/binutils-all/readelf.ss-tmips | 8 ++++----
gas/config/tc-mips.c | 4 ++++
gas/testsuite/gas/mips/mips.exp | 6 ++++++
gas/testsuite/gas/mips/pr14798-irix.d | 6 ++++++
gas/testsuite/gas/mips/pr14798.d | 5 +++++
gas/testsuite/gas/mips/pr14798.s | 5 +++++
ld/testsuite/ld-mips-elf/reloc-6a.s | 4 ++--
ld/testsuite/ld-mips-elf/reloc-6b.s | 4 ++--
9 files changed, 38 insertions(+), 12 deletions(-)
create mode 100644 gas/testsuite/gas/mips/pr14798-irix.d
create mode 100644 gas/testsuite/gas/mips/pr14798.d
create mode 100644 gas/testsuite/gas/mips/pr14798.s
diff --git a/binutils/testsuite/binutils-all/readelf.ss-mips b/binutils/testsuite/binutils-all/readelf.ss-mips
index 9f4cfa5..c49416b 100644
--- a/binutils/testsuite/binutils-all/readelf.ss-mips
+++ b/binutils/testsuite/binutils-all/readelf.ss-mips
@@ -9,11 +9,11 @@ Symbol table '.symtab' contains 16 entries:
+5: 00000000 +0 +SECTION +LOCAL +DEFAULT +. (|\.MIPS\.abiflags)
+6: 00000000 +0 +SECTION +LOCAL +DEFAULT +. (|\.pdr)
+7: 00000000 +0 +SECTION +LOCAL +DEFAULT +. (|\.gnu\.attributes)
- +8: 00000000 +0 +OBJECT +GLOBAL +DEFAULT +. text_symbol
+ +8: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol
+9: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +. static_text_symbol
+10: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol
- +11: 00000000 +0 +OBJECT +GLOBAL +DEFAULT +. data_symbol
+ +11: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +. data_symbol
+12: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +. static_data_symbol
+13: 00000004 +4 +(COMMON|OBJECT) +GLOBAL +DEFAULT +(PRC|COM) common_symbol
- +14: 00000008 +0 +OBJECT +GLOBAL +DEFAULT +. text_symbol2
- +15: 0000000c +0 +OBJECT +GLOBAL +DEFAULT +. text_symbol3
+ +14: 00000008 +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol2
+ +15: 0000000c +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol3
diff --git a/binutils/testsuite/binutils-all/readelf.ss-tmips b/binutils/testsuite/binutils-all/readelf.ss-tmips
index d22fc08..4fd7fe0 100644
--- a/binutils/testsuite/binutils-all/readelf.ss-tmips
+++ b/binutils/testsuite/binutils-all/readelf.ss-tmips
@@ -11,9 +11,9 @@ Symbol table '.symtab' contains 16 entries:
+7: 00000000 +0 +SECTION +LOCAL +DEFAULT +6
+8: 00000000 +0 +SECTION +LOCAL +DEFAULT +7
+9: 00000000 +0 +SECTION +LOCAL +DEFAULT +8
- +10: 00000000 +0 +OBJECT +GLOBAL +DEFAULT +1 text_symbol
+ +10: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 text_symbol
+11: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol
- +12: 00000000 +0 +OBJECT +GLOBAL +DEFAULT +3 data_symbol
+ +12: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +3 data_symbol
+13: 00000004 +4 +(COMMON|OBJECT) +GLOBAL +DEFAULT +(PRC|COM) common_symbol
- +14: 00000008 +0 +OBJECT +GLOBAL +DEFAULT +. text_symbol2
- +15: 0000000c +0 +OBJECT +GLOBAL +DEFAULT +. text_symbol3
+ +14: 00000008 +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol2
+ +15: 0000000c +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol3
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 6a945e3..df8196b 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -16446,9 +16446,13 @@ s_mips_globl (int x ATTRIBUTE_UNUSED)
*input_line_pointer = c;
SKIP_WHITESPACE_AFTER_NAME ();
+#ifdef TE_IRIX
/* On Irix 5, every global symbol that is not explicitly labelled as
being a function is apparently labelled as being an object. */
flag = BSF_OBJECT;
+#else
+ flag = BSF_NO_FLAGS;
+#endif
if (!is_end_of_line[(unsigned char) *input_line_pointer]
&& (*input_line_pointer != ','))
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index 3e66fcf..f4c3097 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -2086,4 +2086,10 @@ if { [istarget mips*-*-vxworks*] } {
run_dump_test_arches "llpscp-32" [mips_arch_list_matching mips32r6]
run_dump_test_arch "llpscp-64" "" mips64r6
+
+ if [istarget *-*-irix*] {
+ run_dump_test "pr14798-irix"
+ } else {
+ run_dump_test "pr14798"
+ }
}
diff --git a/gas/testsuite/gas/mips/pr14798-irix.d b/gas/testsuite/gas/mips/pr14798-irix.d
new file mode 100644
index 0000000..4407a9b
--- /dev/null
+++ b/gas/testsuite/gas/mips/pr14798-irix.d
@@ -0,0 +1,6 @@
+#DUMPPROG: readelf
+#readelf: -s
+#source: pr14798.s
+#...
+ *[0-9]+: +[0-9]+ +[0-9]+ +OBJECT +GLOBAL +DEFAULT +[0-9]+ foo
+#pass
\ No newline at end of file
diff --git a/gas/testsuite/gas/mips/pr14798.d b/gas/testsuite/gas/mips/pr14798.d
new file mode 100644
index 0000000..e43f513
--- /dev/null
+++ b/gas/testsuite/gas/mips/pr14798.d
@@ -0,0 +1,5 @@
+#DUMPPROG: readelf
+#readelf: -s
+#...
+ *[0-9]+: +[0-9]+ +[0-9]+ +NOTYPE +GLOBAL +DEFAULT +[0-9]+ foo
+#pass
\ No newline at end of file
diff --git a/gas/testsuite/gas/mips/pr14798.s b/gas/testsuite/gas/mips/pr14798.s
new file mode 100644
index 0000000..4093c21
--- /dev/null
+++ b/gas/testsuite/gas/mips/pr14798.s
@@ -0,0 +1,5 @@
+ .text
+ .globl foo
+foo:
+ nop
+
diff --git a/ld/testsuite/ld-mips-elf/reloc-6a.s b/ld/testsuite/ld-mips-elf/reloc-6a.s
index 4d84e83..da8ec11 100644
--- a/ld/testsuite/ld-mips-elf/reloc-6a.s
+++ b/ld/testsuite/ld-mips-elf/reloc-6a.s
@@ -1,5 +1,5 @@
- .globl us
- .globl gs
+ .globl us .text
+ .globl gs .text
us:
gs:
ls:
diff --git a/ld/testsuite/ld-mips-elf/reloc-6b.s b/ld/testsuite/ld-mips-elf/reloc-6b.s
index aa2a726..ae4e9bc 100644
--- a/ld/testsuite/ld-mips-elf/reloc-6b.s
+++ b/ld/testsuite/ld-mips-elf/reloc-6b.s
@@ -1,5 +1,5 @@
- .globl __start
- .globl gs
+ .globl __start .text
+ .globl gs .text
__start:
gs:
ls:
--
2.9.5