Skip to content

Do debug sections really have alignment requirements? #235

@benesch

Description

@benesch

I just sent up a PR to backtrace-rs (rust-lang/backtrace-rs#344) to add support for compressed debug info sections. One of the big hiccups was the alignment requirement of the CompressionHeader. Does the header really have alignment requirements? My toolchain does not align them at all, AFAICT:

 30 .debug_aranges 00030a70  0000000000000000  0000000000000000  001e8ac3  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 31 .debug_pubnames 000c6d6c  0000000000000000  0000000000000000  001f068e  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 32 .debug_info   00275c12  0000000000000000  0000000000000000  00217825  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 33 .debug_abbrev 00014d8d  0000000000000000  0000000000000000  002f1d16  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 34 .debug_line   00109f88  0000000000000000  0000000000000000  002f4a94  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 35 .debug_frame  00001368  0000000000000000  0000000000000000  00344170  2**3
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 36 .debug_str    0020bbcf  0000000000000000  0000000000000000  003444c2  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 37 .debug_loc    0000b48c  0000000000000000  0000000000000000  003a2514  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 38 .debug_macinfo 00000106  0000000000000000  0000000000000000  003a43b5  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 39 .debug_pubtypes 0010101b  0000000000000000  0000000000000000  003a43da  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 40 .debug_ranges 0009cab0  0000000000000000  0000000000000000  003cb50b  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS

(GCC 9.3.0, stock Ubuntu Eoan.)

I tracked down some related discussion in #230 and so that backtrace PR flips on the new unaligned feature (great timing, so thanks!). But I'm not it's the right solution in this case—maybe there is no alignment requirement for the compression headers? And if so disabling alignment checks everywhere seems heavyweight. I tried looking through the DWARF standard but couldn't find anything one way or another.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions