[llvm-dev] workaround to force LLD to make dwarf info sections mappable/loadable?

Andrew Kelley via llvm-dev llvm-dev at lists.llvm.org
Mon Dec 3 12:34:54 PST 2018


Context: https://bugs.llvm.org/show_bug.cgi?id=39862

I'm trying to enable stack traces in an OS kernel. To do that the kernel
needs access to its own debug info. I have this in my linker script:

    .debug_info : {
        __debug_info_start = .;
        KEEP(*(.debug_info))
        __debug_info_end = .;
    }
    .debug_abbrev : {
        __debug_abbrev_start = .;
        KEEP(*(.debug_abbrev))
        __debug_abbrev_end = .;
    }
    .debug_str : {
        __debug_str_start = .;
        KEEP(*(.debug_str))
        __debug_str_end = .;
    }
    .debug_line : {
        __debug_line_start = .;
        KEEP(*(.debug_line))
        __debug_line_end = .;
    }
    .debug_ranges : {
        __debug_ranges_start = .;
        KEEP(*(.debug_ranges))
        __debug_ranges_end = .;
    }

But LLD maps these sections to address 0:

00000000000003ac g       .debug_abbrev  0000000000000000 __debug_abbrev_end
0000000000000000 g       .debug_abbrev  0000000000000000
__debug_abbrev_start
0000000000009da5 g       .debug_info  0000000000000000 __debug_info_end
0000000000000000 g       .debug_info  0000000000000000 __debug_info_start
0000000000006aba g       .debug_line  0000000000000000 __debug_line_end
0000000000000000 g       .debug_line  0000000000000000 __debug_line_start
0000000000001bf0 g       .debug_ranges  0000000000000000 __debug_ranges_end
0000000000000000 g       .debug_ranges  0000000000000000
__debug_ranges_start
000000000000399f g       .debug_str 0000000000000000 __debug_str_end
0000000000000000 g       .debug_str 0000000000000000 __debug_str_start


is there a workaround to force LLD to make these sections
mappable/loadable so that the executable can access them?

Regards,
Andrew

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181203/511a078e/attachment.sig>


More information about the llvm-dev mailing list