[llvm] r325528 - [llvm-objcopy] Use the full filename in --add-gnu-debuglink

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 19 11:53:44 PST 2018


Author: arichardson
Date: Mon Feb 19 11:53:44 2018
New Revision: 325528

URL: http://llvm.org/viewvc/llvm-project?rev=325528&view=rev
Log:
[llvm-objcopy] Use the full filename in --add-gnu-debuglink

Summary:
The current implementation was writing the file name without the extension
whereas GNU objcopy writes the full filename. With this change GDB will now
load the .debug file instead of silently ignoring it.

Reviewers: jakehehrlich, jhenderson

Reviewed By: jakehehrlich

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D43474

Modified:
    llvm/trunk/test/tools/llvm-objcopy/add-gnu-debuglink.test
    llvm/trunk/tools/llvm-objcopy/Object.cpp

Modified: llvm/trunk/test/tools/llvm-objcopy/add-gnu-debuglink.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/add-gnu-debuglink.test?rev=325528&r1=325527&r2=325528&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/add-gnu-debuglink.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/add-gnu-debuglink.test Mon Feb 19 11:53:44 2018
@@ -16,12 +16,13 @@ FileHeader:
 # CHECK-NEXT:  ]
 # CHECK-NEXT:  Address: 0x0
 # CHECK-NEXT:  Offset:
-# CHECK-NEXT:  Size: 32
+# CHECK-NEXT:  Size: 36
 # CHECK-NEXT:  Link: 0
 # CHECK-NEXT:  Info: 0
 # CHECK-NEXT:  AddressAlignment: 4
 # CHECK-NEXT:  EntrySize: 0
 # CHECK-NEXT:  SectionData (
 # CHECK-NEXT:      0000: 6164642D 676E752D 64656275 676C696E  |add-gnu-debuglin|
-# CHECK-NEXT:      0010: 6B2E7465 73742E74 6D700000 72C49B0C  |k.test.tmp..r...|
+# CHECK-NEXT:      0010: 6B2E7465 73742E74 6D702E62 6C6F6200  |k.test.tmp.blob.|
+# CHECK-NEXT:      0020: 72C49B0C                             |r...|
 # CHECK-NEXT:  )

Modified: llvm/trunk/tools/llvm-objcopy/Object.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/Object.cpp?rev=325528&r1=325527&r2=325528&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/Object.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/Object.cpp Mon Feb 19 11:53:44 2018
@@ -371,8 +371,8 @@ void SectionWithStrTab::initialize(Secti
 void SectionWithStrTab::finalize() { this->Link = StrTab->Index; }
 
 void GnuDebugLinkSection::init(StringRef File, StringRef Data) {
-  FileName = sys::path::stem(File);
-  // The format for the .gnu_debuglink starts with the stemmed file name and is
+  FileName = sys::path::filename(File);
+  // The format for the .gnu_debuglink starts with the file name and is
   // followed by a null terminator and then the CRC32 of the file. The CRC32
   // should be 4 byte aligned. So we add the FileName size, a 1 for the null
   // byte, and then finally push the size to alignment and add 4.




More information about the llvm-commits mailing list