Fixing the segfault is easy with this bandaid, but further work is
needed to teach dwp about DW_AT_dwo_name and dwo id in the cu header.
At the moment dwp only handles DW_AT_GNU_dwo_name and DW_AT_GNU_dwo_id.
PR 32032
* dwp.cc (Dwp_output_file::finalize): Return immediately on
no output file.
{
unsigned char* buf;
+ if (this->fd_ == NULL)
+ return;
+
// Write the accumulated output sections.
for (unsigned int i = 0; i < this->sections_.size(); i++)
{
this->write_ehdr();
// Close the file.
- if (this->fd_ != NULL)
- {
- if (::fclose(this->fd_) != 0)
- gold_fatal(_("%s: %s"), this->name_, strerror(errno));
- }
+ if (::fclose(this->fd_) != 0)
+ gold_fatal(_("%s: %s"), this->name_, strerror(errno));
this->fd_ = NULL;
}