[PATCH] D39950: [DebugInfo] Stable sort symbols to remove non-deterministic ordering

Mandeep Singh Grang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 13 16:52:56 PST 2017


mgrang added a comment.

In https://reviews.llvm.org/D39950#923525, @probinson wrote:

> So there can be multiple symbols with the same offset, in this list?  This change implies that the insertion order in the list is important and worth preserving.  Why do we know that's true?


Here is the run-to-run difference in the output of DebugInfo/X86/multiple-aranges.ll with shuffling enabled for std::sort:

Run 1:

  .Lsec_end0:
  	.section	.debug_aranges,"", at progbits
  	.long	44                      # Length of ARange Set
  	.short	2                       # DWARF Arange version number
  	.long	.Lcu_begin0             # Offset Into Debug Info Section
  	.byte	8                       # Address Size (in bytes)
  	.byte	0                       # Segment Size (in bytes)
  	.zero	4,255
  	.quad	kittens
  	.quad	.Lsec_end0-kittens                                          <---------------------------------------------------
  	.quad	0                       # ARange terminator
  	.quad	0
  	.long	44                      # Length of ARange Set
  	.short	2                       # DWARF Arange version number
  	.long	.Lcu_begin1             # Offset Into Debug Info Section
  	.byte	8                       # Address Size (in bytes)
  	.byte	0                       # Segment Size (in bytes)
  	.zero	4,255
  	.quad	rainbows
  	.quad	kittens-rainbows                                            <---------------------------------------------------
  	.quad	0                       # ARange terminator
  	.quad	0
  	.section	.debug_ranges,"", at progbits
  	.section	.debug_macinfo,"", at progbits

Run 2:

  .Lsec_end0:
  	.section	.debug_aranges,"", at progbits
  	.long	44                      # Length of ARange Set
  	.short	2                       # DWARF Arange version number
  	.long	.Lcu_begin0             # Offset Into Debug Info Section
  	.byte	8                       # Address Size (in bytes)
  	.byte	0                       # Segment Size (in bytes)
  	.zero	4,255
  	.quad	kittens
  	.quad	rainbows-kittens                                           <---------------------------------------------------
  	.quad	0                       # ARange terminator
  	.quad	0
  	.long	44                      # Length of ARange Set
  	.short	2                       # DWARF Arange version number
  	.long	.Lcu_begin1             # Offset Into Debug Info Section
  	.byte	8                       # Address Size (in bytes)
  	.byte	0                       # Segment Size (in bytes)
  	.zero	4,255
  	.quad	rainbows
  	.quad	.Lsec_end0-rainbows                                       <---------------------------------------------------
  	.quad	0                       # ARange terminator
  	.quad	0
  	.section	.debug_ranges,"", at progbits
  	.section	.debug_macinfo,"", at progbits


Repository:
  rL LLVM

https://reviews.llvm.org/D39950





More information about the llvm-commits mailing list