[1/2] gas: Add CodeView constant for aarch64

Message ID 20230126003820.28482-1-mark@harmstone.com
State Accepted
Headers
Series [1/2] gas: Add CodeView constant for aarch64 |

Checks

Context Check Description
snail/binutils-gdb-check success Github commit url

Commit Message

Mark Harmstone Jan. 26, 2023, 12:38 a.m. UTC
  Adds the correct constant to the S_COMPILE3 CodeView record when
assembling aarch64-w64-mingw32 with the -gcodeview flag.

---
 gas/codeview.c | 19 +++++++++++++------
 gas/codeview.h |  1 +
 2 files changed, 14 insertions(+), 6 deletions(-)
  

Comments

Jan Beulich Jan. 26, 2023, 9:26 a.m. UTC | #1
On 26.01.2023 01:38, Mark Harmstone wrote:
> Adds the correct constant to the S_COMPILE3 CodeView record when
> assembling aarch64-w64-mingw32 with the -gcodeview flag.

I'd be happy to approve this, but I'd really like to know where this number
is coming from. Web search looks to produce results only for properly
outdated or LLVM pages, neither of which can really be taken as a canonical
reference for something with MS origin. (I find it particularly interesting
that the wikipedia page on CodeView says "Operating system	MS-DOS",
calling out 386 mode and monochrome monitor support as something noteworthy.
Nevertheless at the bottom there is "This page was last edited on
25 December 2022, at 04:29 (UTC).")

Jan
  
Mark Harmstone Jan. 26, 2023, 12:41 p.m. UTC | #2
Hi Jan,

 > I'd be happy to approve this, but I'd really like to know where this number
 > is coming from.

Have a look at the top of gas/codeview.h, which includes the URL of the GitHub
repository this comes from.

 > (I find it particularly interesting
 > that the wikipedia page on CodeView says "Operating system  MS-DOS",
 > calling out 386 mode and monochrome monitor support as something noteworthy.
 > Nevertheless at the bottom there is "This page was last edited on
 > 25 December 2022, at 04:29 (UTC).")

Yes, CodeView the program is long dead, but its format lives on in the PDBs
generated by MSVC.

Mark
  
Jan Beulich Jan. 26, 2023, 12:53 p.m. UTC | #3
On 26.01.2023 13:41, Mark Harmstone wrote:
>  > I'd be happy to approve this, but I'd really like to know where this number
>  > is coming from.
> 
> Have a look at the top of gas/codeview.h, which includes the URL of the GitHub
> repository this comes from.

Thanks. Having looked there, the patch is okay to commit.

Jan
  

Patch

diff --git a/gas/codeview.c b/gas/codeview.c
index 2d96d4467fc..0d5f82848a5 100644
--- a/gas/codeview.c
+++ b/gas/codeview.c
@@ -286,13 +286,20 @@  write_lines_info (void)
 static uint16_t
 target_processor (void)
 {
-  if (stdoutput->arch_info->arch != bfd_arch_i386)
-    return 0;
+  switch (stdoutput->arch_info->arch)
+    {
+    case bfd_arch_i386:
+      if (stdoutput->arch_info->mach & bfd_mach_x86_64)
+	return CV_CFL_X64;
+      else
+	return CV_CFL_80386;
 
-  if (stdoutput->arch_info->mach & bfd_mach_x86_64)
-    return CV_CFL_X64;
-  else
-    return CV_CFL_80386;
+    case bfd_arch_aarch64:
+      return CV_CFL_ARM64;
+
+    default:
+      return 0;
+    }
 }
 
 /* Write the CodeView symbols, describing the object name and
diff --git a/gas/codeview.h b/gas/codeview.h
index def2a395748..2a3d8fc15e1 100644
--- a/gas/codeview.h
+++ b/gas/codeview.h
@@ -38,6 +38,7 @@ 
 
 #define CV_CFL_80386		0x03
 #define CV_CFL_X64		0xD0
+#define CV_CFL_ARM64		0xF6
 
 #define CHKSUM_TYPE_MD5		1