[llvm-bugs] [Bug 50160] New: --only-keep-debug crash with no section header table
    via llvm-bugs 
    llvm-bugs at lists.llvm.org
       
    Wed Apr 28 20:06:05 PDT 2021
    
    
  
https://bugs.llvm.org/show_bug.cgi?id=50160
            Bug ID: 50160
           Summary: --only-keep-debug crash with no section header table
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: llvm-objcopy/strip
          Assignee: unassignedbugs at nondot.org
          Reporter: rupprecht at google.com
                CC: alexander.v.shaposhnikov at gmail.com,
                    jake.h.ehrlich at gmail.com,
                    jh7370.2008 at my.bristol.ac.uk,
                    llvm-bugs at lists.llvm.org, rupprecht at google.com
Found this on an internal binary. llvm-objcopy --only-keep-debug crashes here,
although the input file is weird -- we should probably have a similar error
message as GNU objcopy.
$ cat /tmp/x.yaml 
--- !ELF
FileHeader:
  Class:           ELFCLASS64
  Data:            ELFDATA2LSB
  Type:            ET_EXEC
Sections:
  - Name:    .foo
    Type:    SHT_PROGBITS
    Flags:   [ SHF_ALLOC ]
    Size:    0x01000
ProgramHeaders:
  - Type:            PT_NULL
    Flags:           [  ]
    FileSize:        0x01000
$ bin/yaml2obj /tmp/x.yaml > /tmp/x.o
$ bin/llvm-strip --strip-sections /tmp/x.o
$ bin/llvm-objcopy --only-keep-debug /tmp/x.o /tmp/y.o
<crash>
$ objcopy /tmp/x.o /tmp/y.o  # Note: GNU objcopy
objcopy: error: the input file '/tmp/x.o' has no sections
-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210429/78d53ded/attachment.html>
    
    
More information about the llvm-bugs
mailing list