|
Message-ID: <20150515173132.GA18390@alex-ThinkPad-L530> Date: Fri, 15 May 2015 19:31:32 +0200 From: Alex Dowad <alexinbeijing@...il.com> To: musl@...ts.openwall.com Subject: Re: [PATCH v3] Build process uses script to add CFI directives to x86 asm Dear Szabolcs Nagy (and other interested parties), > you can use > > .file "foo.s" Thanks for the idea! Unfortunately, implementing it has proved very troublesome. The GAS documentation does refer to ".file <source file>". There's just a tiny little problem with it -- it doesn't actually work for the desired purpose. It does register <source file> as a dependency, so it will be included in the dependency file which is written out if you invoke GAS with the --MD option. But that's about it. If you look at asm generated by GCC, it includes a ".file <source file>" line at the top, but it *also* includes a ".file <number> <source file>" line. Which actually sets the "source file" in the debugging info! (Yay!) Subsequent ".loc" directives use the source file number when identifying source lines. So we just use ".file <number> <source file>" and everybody is happy, right? Yes? Good? Right? Wrong. Allow me to quote gas/dwarf2dbg.c:596-598 from the binutils repo: /* A .file directive implies compiler generated debug information is being supplied. Turn off gas generated debug info. */ debug_type = DEBUG_NONE; Snap. Normally, GAS automatically generates debug info on source line numbers, and a few other basic things. As soon as you use a ".file <number> <source file>" directive, all that automatic debugging output is shut off, and you have to use explicit assembler directives for *everything*. I guess this makes sense, because if the "source file" is a completely different file from the input asm file, the automatically generated line number info will be completely wrong. What a pain! Well, I guess I'll just have to use my own, explicit ".loc" directives. > i think passing down the build command that way is not ok It does seem like a hack -- but I'm not sure what a better way to do it is. (I'm not a "real" shell programmer, if you hadn't noticed yet. I just fake it using some combination of Stack Overflow and manpages.) > i think > > pushl $123 > push $123 > > are different 'push %eax' and 'pushl %eax' assemble to exactly the same machine code. Likewise, 'push $1' and 'pushl $1' assemble just the same. Interestingly, 'pushl %ax' assembles to 'push %eax', 'push %ax' is just 'push %ax'. > set LC_ALL=C because you depend on collation order > in the awk script Please see if I did this right in the v4. > add new lines at the end Done. Thanks for other enhancements to the awk script (I will credit you in the commit log message). Kind regards, AD
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.