[PATCH] D46502: [ELF] - Fix for "LLD can create incorrect debug PC ranges for functions in Comdat groups."

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 6 07:14:56 PDT 2018


grimar created this revision.
grimar added a reviewer: ruiu.
Herald added subscribers: fedor.sergeev, arichardson, emaste.
Herald added a reviewer: espindola.

This is an attempt to fix the https://bugs.llvm.org//show_bug.cgi?id=37212.

The issue is about code like:

  .section .text.foo,"axG", at progbits,bar,comdat
  .Lfoo:
  
  .section .debug_info,"", at progbits
    .quad	.Lfoo



  llvm-mc -filetype=obj -triple=x86_64-pc-linux t.s -o t.o
  ld t.o t.o -o ld.out

LLD currently ignores the relocations to discarded COMDAT sections and hence out output is different from GNU linkers output.
What LLD do is valid from the spec point of view (https://docs.oracle.com/cd/E19120-01/open.solaris/819-0690/chapter7-11598/index.html),
but unfortunately, modern compilers produce technically incorrect ELF and this patch is an attempt
to work around it. It is a bit hacky but seems to be more or less isolated.


https://reviews.llvm.org/D46502

Files:
  ELF/Driver.cpp
  ELF/InputFiles.cpp
  ELF/InputFiles.h
  ELF/InputSection.cpp
  ELF/InputSection.h
  ELF/SymbolTable.cpp
  ELF/SymbolTable.h
  ELF/Writer.cpp
  test/ELF/comdat-debug.s
  test/ELF/comdat.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46502.145399.patch
Type: text/x-patch
Size: 12468 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180506/d8f5ebb3/attachment.bin>


More information about the llvm-commits mailing list