[llvm-commits] patch: pick direct or indirect strings in DWARF

Nick Lewycky nicholas at mxc.ca
Tue Oct 25 01:11:54 PDT 2011


Updated patch, this one works on Darwin now too.

I have tested this patch on Darwin in both -m32 and -m64 modes. The 
difference from the previous patch is that I now use DIEDelta to compute 
a section offset against the string pool, instead of DIELabel to refer 
to the string directly (hey, it worked for me on Linux).

Please review!

Nick

Nick Lewycky wrote:
> DWARF allows string to be specified in one of two ways, either by
> writing them literally (DW_FORM_string) or by including a pointer into
> the .debug_str section and putting the NUL-terminated string there.
>
> The attached patch removes the Form argument from CompileUnit::AddString
> and changes addString to emit either a DIEString or a DIELabel depending
> on how long the string is. If the string would fit in 4 bytes in the
> direct encoding, do that. Otherwise, hoist it out into .debug_str so
> that it can be interned.
>
> This is a major issue on linux where the linker does not turn direct
> strings into indirect strings, but does merge the string tables. On
> Darwin, the linker will turn direct strings into indirect strings as
> needed. However, this change should probably be enabled on all platforms
> as it generally makes .o files smaller.
>
> Please review! The one thing I don't like about this patch is that we
> emit the bytes (via .ascii) and then emit the NUL (via. ".zero 1"). The
> alternatives I see are either to create a copy of the string, or to
> create a new emitBytesWithNUL API in MCStreamer.
>
> Nick
>
> PS. If this patch doesn't work on Darwin out-of-the-box, please try one
> thing for me: comment out the change to DIELabel::SizeOf (adding a case
> for DW_FORM_strp), and let me know whether that fixes things.
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dwarf-indirect-string-2.patch
Type: text/x-patch
Size: 11979 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111025/388dc334/attachment.bin>


More information about the llvm-commits mailing list