File tree Expand file tree Collapse file tree 2 files changed +7
-12
lines changed Expand file tree Collapse file tree 2 files changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -262,16 +262,11 @@ void LinkerDriver::addFile(StringRef path, bool withLOption) {
262262 return ;
263263 }
264264
265- // DSOs usually have DT_SONAME tags in their ELF headers, and the
266- // sonames are used to identify DSOs. But if they are missing,
267- // they are identified by filenames. We don't know whether the new
268- // file has a DT_SONAME or not because we haven't parsed it yet.
269- // Here, we set the default soname for the file because we might
270- // need it later.
271- //
272- // If a file was specified by -lfoo, the directory part is not
273- // significant, as a user did not specify it. This behavior is
274- // compatible with GNU.
265+ // Shared objects are identified by soname. soname is (if specified)
266+ // DT_SONAME and falls back to filename. If a file was specified by -lfoo,
267+ // the directory part is ignored. Note that path may be a temporary and
268+ // cannot be stored into SharedFile::soName.
269+ path = mbref.getBufferIdentifier ();
275270 files.push_back (
276271 make<SharedFile>(mbref, withLOption ? path::filename (path) : path));
277272 return ;
Original file line number Diff line number Diff line change @@ -356,7 +356,7 @@ class BitcodeFile : public InputFile {
356356class SharedFile : public ELFFileBase {
357357public:
358358 SharedFile (MemoryBufferRef m, StringRef defaultSoName)
359- : ELFFileBase(SharedKind, m), soName(std::string( defaultSoName) ),
359+ : ELFFileBase(SharedKind, m), soName(defaultSoName),
360360 isNeeded (!config->asNeeded) {}
361361
362362 // This is actually a vector of Elf_Verdef pointers.
@@ -370,7 +370,7 @@ class SharedFile : public ELFFileBase {
370370 static unsigned vernauxNum;
371371
372372 std::vector<StringRef> dtNeeded;
373- std::string soName;
373+ StringRef soName;
374374
375375 static bool classof (const InputFile *f) { return f->kind () == SharedKind; }
376376
You can’t perform that action at this time.
0 commit comments