From ac2599c44788ae34a6b26b5dc42848d176f99a5d Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 30 Jul 2020 04:56:46 -0700
Subject: [PATCH] x86: Pass --gdwarf-3 to assembler

Pass --gdwarf-3 to assembler for

commit 4d8ee860737005517be588f4771c358593fa421c
Author: Nick Clifton <nickc@redhat.com>
Date:   Thu Jul 30 08:39:14 2020 +0100

    Prevent the generation of DWARF level 0 line number tables...

binutils/

	* testsuite/binutils-all/i386/compressed-1a.d: Pass --gdwarf-3
	to assembler.
	* testsuite/binutils-all/i386/compressed-1b.d: Likewise.
	* testsuite/binutils-all/i386/compressed-1c.d: Likewise.
	* testsuite/binutils-all/x86-64/compressed-1a.d: Likewise.
	* testsuite/binutils-all/x86-64/compressed-1b.d: Likewise.
	* testsuite/binutils-all/x86-64/compressed-1c.d: Likewise.

gas/

	* testsuite/gas/elf/dwarf2-3.d:Pass --gdwarf-3 to assembler.
	* testsuite/gas/elf/dwarf2-5.d: Likewise.
	* testsuite/gas/i386/dw2-compress-3a.d: Likewise.
	* testsuite/gas/i386/dw2-compress-3b.d: Likewise.
	* testsuite/gas/i386/dw2-compressed-3a.d: Likewise.
	* testsuite/gas/i386/dw2-compressed-3b.d: Likewise.
---
 binutils/ChangeLog                                     | 10 ++++++++++
 binutils/testsuite/binutils-all/i386/compressed-1a.d   |  2 +-
 binutils/testsuite/binutils-all/i386/compressed-1b.d   |  2 +-
 binutils/testsuite/binutils-all/i386/compressed-1c.d   |  2 +-
 binutils/testsuite/binutils-all/x86-64/compressed-1a.d |  2 +-
 binutils/testsuite/binutils-all/x86-64/compressed-1b.d |  2 +-
 binutils/testsuite/binutils-all/x86-64/compressed-1c.d |  2 +-
 gas/ChangeLog                                          |  9 +++++++++
 gas/testsuite/gas/elf/dwarf2-3.d                       |  1 +
 gas/testsuite/gas/elf/dwarf2-5.d                       |  2 +-
 gas/testsuite/gas/i386/dw2-compress-3a.d               |  2 +-
 gas/testsuite/gas/i386/dw2-compress-3b.d               |  2 +-
 gas/testsuite/gas/i386/dw2-compressed-3a.d             |  2 +-
 gas/testsuite/gas/i386/dw2-compressed-3b.d             |  2 +-
 14 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 4e66a1361fc..dc369d3ba00 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,13 @@
+2020-07-30  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* testsuite/binutils-all/i386/compressed-1a.d: Pass --gdwarf-3
+	to assembler.
+	* testsuite/binutils-all/i386/compressed-1b.d: Likewise.
+	* testsuite/binutils-all/i386/compressed-1c.d: Likewise.
+	* testsuite/binutils-all/x86-64/compressed-1a.d: Likewise.
+	* testsuite/binutils-all/x86-64/compressed-1b.d: Likewise.
+	* testsuite/binutils-all/x86-64/compressed-1c.d: Likewise.
+
 2020-07-29  Maciej W. Rozycki  <macro@linux-mips.org>
 
 	* testsuite/binutils-all/mips/global-local-symtab-sort-o32.d:
diff --git a/binutils/testsuite/binutils-all/i386/compressed-1a.d b/binutils/testsuite/binutils-all/i386/compressed-1a.d
index 70b13cee5d6..bf04974a894 100644
--- a/binutils/testsuite/binutils-all/i386/compressed-1a.d
+++ b/binutils/testsuite/binutils-all/i386/compressed-1a.d
@@ -1,6 +1,6 @@
 #PROG: objcopy
 #source: compressed-1.s
-#as: --32 --compress-debug-sections
+#as: --32 --compress-debug-sections --gdwarf-3
 #objcopy:
 #readelf: -w
 #name: objcopy on compressed debug sections
diff --git a/binutils/testsuite/binutils-all/i386/compressed-1b.d b/binutils/testsuite/binutils-all/i386/compressed-1b.d
index 9ed82caf60f..6e45e552fc8 100644
--- a/binutils/testsuite/binutils-all/i386/compressed-1b.d
+++ b/binutils/testsuite/binutils-all/i386/compressed-1b.d
@@ -1,6 +1,6 @@
 #PROG: strip
 #source: compressed-1.s
-#as: --32 -mx86-used-note=no
+#as: --32 -mx86-used-note=no --gdwarf-3
 #strip:
 #readelf: -S --wide
 #name: strip on uncompressed debug sections
diff --git a/binutils/testsuite/binutils-all/i386/compressed-1c.d b/binutils/testsuite/binutils-all/i386/compressed-1c.d
index dc96dd7dcf6..1e1a18e7786 100644
--- a/binutils/testsuite/binutils-all/i386/compressed-1c.d
+++ b/binutils/testsuite/binutils-all/i386/compressed-1c.d
@@ -1,6 +1,6 @@
 #PROG: strip
 #source: compressed-1.s
-#as: --32 --compress-debug-sections -mx86-used-note=no
+#as: --32 --compress-debug-sections -mx86-used-note=no --gdwarf-3
 #strip:
 #readelf: -S --wide
 #name: strip on compressed debug sections
diff --git a/binutils/testsuite/binutils-all/x86-64/compressed-1a.d b/binutils/testsuite/binutils-all/x86-64/compressed-1a.d
index 3c8eb545024..c4898d7748d 100644
--- a/binutils/testsuite/binutils-all/x86-64/compressed-1a.d
+++ b/binutils/testsuite/binutils-all/x86-64/compressed-1a.d
@@ -1,6 +1,6 @@
 #PROG: objcopy
 #source: compressed-1.s
-#as: --64 --compress-debug-sections
+#as: --64 --compress-debug-sections --gdwarf-3
 #objcopy:
 #readelf: -w
 #name: objcopy on compressed debug sections
diff --git a/binutils/testsuite/binutils-all/x86-64/compressed-1b.d b/binutils/testsuite/binutils-all/x86-64/compressed-1b.d
index c041a532600..517c8145397 100644
--- a/binutils/testsuite/binutils-all/x86-64/compressed-1b.d
+++ b/binutils/testsuite/binutils-all/x86-64/compressed-1b.d
@@ -1,6 +1,6 @@
 #PROG: strip
 #source: compressed-1.s
-#as: --64 -mx86-used-note=no
+#as: --64 -mx86-used-note=no --gdwarf-3
 #strip:
 #readelf: -S --wide
 #name: strip on uncompressed debug sections
diff --git a/binutils/testsuite/binutils-all/x86-64/compressed-1c.d b/binutils/testsuite/binutils-all/x86-64/compressed-1c.d
index 2039cd676ea..ba692bdb857 100644
--- a/binutils/testsuite/binutils-all/x86-64/compressed-1c.d
+++ b/binutils/testsuite/binutils-all/x86-64/compressed-1c.d
@@ -1,6 +1,6 @@
 #PROG: strip
 #source: compressed-1.s
-#as: --64 --compress-debug-sections -mx86-used-note=no
+#as: --64 --compress-debug-sections -mx86-used-note=no --gdwarf-3
 #strip:
 #readelf: -S --wide
 #name: strip on compressed debug sections
diff --git a/gas/ChangeLog b/gas/ChangeLog
index c2595b48c3f..27ebd233297 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,12 @@
+2020-07-30  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* testsuite/gas/elf/dwarf2-3.d:Pass --gdwarf-3 to assembler.
+	* testsuite/gas/elf/dwarf2-5.d: Likewise.
+	* testsuite/gas/i386/dw2-compress-3a.d: Likewise.
+	* testsuite/gas/i386/dw2-compress-3b.d: Likewise.
+	* testsuite/gas/i386/dw2-compressed-3a.d: Likewise.
+	* testsuite/gas/i386/dw2-compressed-3b.d: Likewise.
+
 2020-07-30  Nick Clifton  <nickc@redhat.com>
 
 	* as.c (dwarf_level): Initialise to 4 in case this is not set on
diff --git a/gas/testsuite/gas/elf/dwarf2-3.d b/gas/testsuite/gas/elf/dwarf2-3.d
index 594c9a6d973..62dbe54ce00 100644
--- a/gas/testsuite/gas/elf/dwarf2-3.d
+++ b/gas/testsuite/gas/elf/dwarf2-3.d
@@ -1,3 +1,4 @@
+#as: --gdwarf-3
 #readelf: -wl
 #name: DWARF2 3
 #xfail: ft32*-* h8300-*-*
diff --git a/gas/testsuite/gas/elf/dwarf2-5.d b/gas/testsuite/gas/elf/dwarf2-5.d
index 4e22e79c644..257bb55a017 100644
--- a/gas/testsuite/gas/elf/dwarf2-5.d
+++ b/gas/testsuite/gas/elf/dwarf2-5.d
@@ -1,4 +1,4 @@
-#as:
+#as: --gdwarf-3
 #readelf: -x.rodata -wlL
 #name: DWARF2 5
 # The am33 cr16 crx ft32 mn10 msp430 nds32 rl78 and rx targets do not evaluate the subtraction of symbols at assembly time.
diff --git a/gas/testsuite/gas/i386/dw2-compress-3a.d b/gas/testsuite/gas/i386/dw2-compress-3a.d
index c6de0d6f57c..50a1e28fa87 100644
--- a/gas/testsuite/gas/i386/dw2-compress-3a.d
+++ b/gas/testsuite/gas/i386/dw2-compress-3a.d
@@ -1,5 +1,5 @@
 #source: dw2-compress-3.s
-#as: --compress-debug-sections --elf-stt-common=no
+#as: --compress-debug-sections --elf-stt-common=no --gdwarf-3
 #readelf: -w
 #name: DWARF2 debugging information 3 w/o STT_COMMON
 
diff --git a/gas/testsuite/gas/i386/dw2-compress-3b.d b/gas/testsuite/gas/i386/dw2-compress-3b.d
index a78e1e25e9f..798d5532c33 100644
--- a/gas/testsuite/gas/i386/dw2-compress-3b.d
+++ b/gas/testsuite/gas/i386/dw2-compress-3b.d
@@ -1,5 +1,5 @@
 #source: dw2-compress-3.s
-#as: --compress-debug-sections --elf-stt-common=yes
+#as: --compress-debug-sections --elf-stt-common=yes --gdwarf-3
 #readelf: -w
 #name: DWARF2 debugging information 3 with STT_COMMON
 
diff --git a/gas/testsuite/gas/i386/dw2-compressed-3a.d b/gas/testsuite/gas/i386/dw2-compressed-3a.d
index b8b4434a51e..e4fcf535b6e 100644
--- a/gas/testsuite/gas/i386/dw2-compressed-3a.d
+++ b/gas/testsuite/gas/i386/dw2-compressed-3a.d
@@ -1,5 +1,5 @@
 #source: dw2-compress-3.s
-#as: --compress-debug-sections=zlib-gabi --elf-stt-common=no
+#as: --compress-debug-sections=zlib-gabi --elf-stt-common=no --gdwarf-3
 #readelf: -w
 #name: DWARF2 debugging information 3 with SHF_COMPRESSED w/o STT_COMMON
 
diff --git a/gas/testsuite/gas/i386/dw2-compressed-3b.d b/gas/testsuite/gas/i386/dw2-compressed-3b.d
index ac51238a96d..37f6b7effb0 100644
--- a/gas/testsuite/gas/i386/dw2-compressed-3b.d
+++ b/gas/testsuite/gas/i386/dw2-compressed-3b.d
@@ -1,5 +1,5 @@
 #source: dw2-compress-3.s
-#as: --compress-debug-sections=zlib-gabi --elf-stt-common=yes
+#as: --compress-debug-sections=zlib-gabi --elf-stt-common=yes --gdwarf-3
 #readelf: -w
 #name: DWARF2 debugging information 3 with SHF_COMPRESSED with STT_COMMON