[4/5] Make sure CodeView symbols are aligned

Message ID 20240629220653.4445-4-mark@harmstone.com
State Committed
Commit 800e06c4b2635d1b709625ec2830c6c5594c6988
Headers
Series [1/5] Add CodeView enum cv_leaf_type |

Commit Message

Mark Harmstone June 29, 2024, 10:06 p.m. UTC
  CodeView symbols have to be multiples of four bytes; add an alignment
directive to write_data_symbol to ensure this.

Note that these can be zeroes, so we can rely on GAS to do this for us;
it's only types that need f3, f2, f1 values.

    gcc/
            * dwarf2codeview.cc (write_data_symbol): Add alignment directive.
---
 gcc/dwarf2codeview.cc | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Jeff Law July 8, 2024, 6:07 p.m. UTC | #1
On 6/29/24 4:06 PM, Mark Harmstone wrote:
> CodeView symbols have to be multiples of four bytes; add an alignment
> directive to write_data_symbol to ensure this.
> 
> Note that these can be zeroes, so we can rely on GAS to do this for us;
> it's only types that need f3, f2, f1 values.
> 
>      gcc/
>              * dwarf2codeview.cc (write_data_symbol): Add alignment directive.
OK
jeff
  

Patch

diff --git a/gcc/dwarf2codeview.cc b/gcc/dwarf2codeview.cc
index 71049ccf878..5a33b439b14 100644
--- a/gcc/dwarf2codeview.cc
+++ b/gcc/dwarf2codeview.cc
@@ -958,6 +958,8 @@  write_data_symbol (codeview_symbol *s)
   ASM_OUTPUT_ASCII (asm_out_file, s->data_symbol.name,
 		    strlen (s->data_symbol.name) + 1);
 
+  ASM_OUTPUT_ALIGN (asm_out_file, 2);
+
   targetm.asm_out.internal_label (asm_out_file, SYMBOL_END_LABEL, label_num);
 
 end: