[PATCH] D103131: support debug info for alias variable
kamlesh kumar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 28 20:18:18 PDT 2021
kamleshbhalui added a comment.
$cat test.h
int oldname;
$cat test.c
#include "test.h"
int oldname;
__asm__ (
"movq oldname, %rsp\n\t"
);
extern int newname __attribute__((alias("oldname")));
debug info from gcc:
test.o: file format elf64-x86-64
.debug_info contents:
0x00000000: Compile Unit: length = 0x00000044, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000048)
0x0000000c: DW_TAG_compile_unit
DW_AT_producer ("GNU C17 12.0.0 20210529 (experimental) -g")
DW_AT_language (DW_LANG_C11)
DW_AT_name ("test.c")
DW_AT_comp_dir ("/folk/kkumar/tcgcc/build/")
DW_AT_stmt_list (0x00000000)
0x0000001e: DW_TAG_variable
DW_AT_name ("oldname")
DW_AT_decl_file ("test.h")
DW_AT_decl_line (1)
DW_AT_decl_column (0x05)
DW_AT_type (0x00000034 "int")
DW_AT_external (true)
DW_AT_location (DW_OP_addr 0x0)
0x00000034: DW_TAG_base_type
DW_AT_byte_size (0x04)
DW_AT_encoding (DW_ATE_signed)
DW_AT_name ("int")
0x0000003b: DW_TAG_variable
DW_AT_name ("newname")
DW_AT_decl_file ("test.c")
DW_AT_decl_line (7)
DW_AT_decl_column (0x0c)
DW_AT_type (0x00000034 "int")
DW_AT_external (true)
0x00000047: NULL
debug info from clang:
test1.o: file format elf64-x86-64
.debug_info contents:
0x00000000: Compile Unit: length = 0x00000042, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000046)
0x0000000b: DW_TAG_compile_unit
DW_AT_producer ("clang version 13.0.0 (git at github.com:llvm/llvm-project.git b22ff948a94edc7573d226fe404a77b9a7380398)")
DW_AT_language (DW_LANG_C99)
DW_AT_name ("test.c")
DW_AT_stmt_list (0x00000000)
DW_AT_comp_dir ("/folk/kkumar/tcgcc/build")
0x0000001e: DW_TAG_variable
DW_AT_name ("newname")
DW_AT_type (0x00000029 "int")
DW_AT_external (true)
DW_AT_decl_file ("test.c")
DW_AT_decl_line (7)
0x00000029: DW_TAG_base_type
DW_AT_name ("int")
DW_AT_encoding (DW_ATE_signed)
DW_AT_byte_size (0x04)
0x00000030: DW_TAG_variable
DW_AT_name ("oldname")
DW_AT_type (0x00000029 "int")
DW_AT_external (true)
DW_AT_decl_file ("test.c")
DW_AT_decl_line (2)
DW_AT_location (DW_OP_addr 0x0)
0x00000045: NULL
so debug info looks same to me in gcc and clang .
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103131/new/
https://reviews.llvm.org/D103131
More information about the cfe-commits
mailing list