Bug 23971 - gold: Seg-fault when running a plugin with no inputs
Summary: gold: Seg-fault when running a plugin with no inputs
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.32
: P2 normal
Target Milestone: ---
Assignee: Cary Coutant
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-10 11:56 UTC by Nick Clifton
Modified: 2018-12-10 11:56 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Proposed patch (313 bytes, patch)
2018-12-10 11:56 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clifton 2018-12-10 11:56:45 UTC
Created attachment 11447 [details]
Proposed patch

Running gold with a plugin but no input files results in a segmentation fault:

 % ld.gold -plugin /usr/lib64/LLVMgold.so  does-not-exist.o
 ld.gold: error: cannot open does-not-exist.o: No such file or directory
 Segmentation fault (core dumped)

 % ld.gold -plugin /usr/libexec/gcc/x86_64-redhat-linux/8/liblto_plugin.so.0.0.0  does-not-exist.o
  ld.gold: error: cannot open does-not-exist.o: No such file or directory
  Segmentation fault (core dumped)

It appears that plugin.cc:Plugin_hook assumes that the entry parameter will always be set.  The uploaded patch is a suggestion for how this might be fixed.