-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior
Milestone
Description
Zig Version
0.14.0 (d30d37e)
Steps to Reproduce and Observed Behavior
compile @linux host
const STRUCT = struct {
fn Interface(comptime T: type, foo: []const u8) type {
_ = foo; // autofix
return struct {
pub fn disasmme(self: T) void {
_ = self; // autofix
}
};
}
pub usingnamespace Interface(@This(), "foo");
};
pub fn main() void {
(STRUCT{}).disasmme();
}try disassemble with llvm
$ llvm-objdump-18 --disassemble-symbols=main.STRUCT.Interface\(main.STRUCT,\"foo\"[0..3]\).disasmme output.elf
output.elf: file format elf64-x86-64
llvm-objdump-18: warning: 'output.elf': failed to disassemble missing symbol "foo"[0..3]).disasmme
llvm-objdump-18: warning: 'output.elf': failed to disassemble missing symbol main.STRUCT.Interface(main.STRUCT
meanwhile, disassemble with system's objdump works as expected:
objdump --disassemble=main.STRUCT.Interface\(main.STRUCT,\"foo\"[0..3]\).disasmme output.elf
output.elf: file format elf64-x86-64
Disassembly of section .text:
0000000001036430 <main.STRUCT.Interface(main.STRUCT,"foo"[0..3]).disasmme>:
1036430: 55 push %rbp
1036431: 48 89 e5 mov %rsp,%rbp
1036434: 5d pop %rbp
1036435: c3 ret
No matter how I tried to escape the comma in symbol name, llvm's objdump treats it as a symbols list separator, so there is no option for disassembly with llvm's toolchain.
This is not a big problem, just a matter of convenience to use already available llvm's toolchain to look through all cross-compiled binaries without the need to install toolchains for other architectures for this purpose.
Expected Behavior
with a minor fix llvm-objdump works as expected:
llvm-objdump-18 --disassemble-symbols=main.STRUCT.Interface\(main.STRUCT\~\"foo\"[0..3]\).disasmme output.elf
output.elf: file format elf64-x86-64
Disassembly of section .text:
0000000001036430 <main.STRUCT.Interface(main.STRUCT~"foo"[0..3]).disasmme>:
1036430: 55 pushq %rbp
1036431: 48 89 e5 movq %rsp, %rbp
1036434: 5d popq %rbp
1036435: c3 retq
1036436: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:(%rax,%rax)
I chosen tilda for the sake of good-looking (at my taste) output. I don't think it is good idea to use underscore to escape everything, because symbol then looks ugly and unreadable
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior