File tree 2 files changed +7
-12
lines changed
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) {
262
262
return ;
263
263
}
264
264
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 ();
275
270
files.push_back (
276
271
make<SharedFile>(mbref, withLOption ? path::filename (path) : path));
277
272
return ;
Original file line number Diff line number Diff line change @@ -356,7 +356,7 @@ class BitcodeFile : public InputFile {
356
356
class SharedFile : public ELFFileBase {
357
357
public:
358
358
SharedFile (MemoryBufferRef m, StringRef defaultSoName)
359
- : ELFFileBase(SharedKind, m), soName(std::string( defaultSoName) ),
359
+ : ELFFileBase(SharedKind, m), soName(defaultSoName),
360
360
isNeeded (!config->asNeeded) {}
361
361
362
362
// This is actually a vector of Elf_Verdef pointers.
@@ -370,7 +370,7 @@ class SharedFile : public ELFFileBase {
370
370
static unsigned vernauxNum;
371
371
372
372
std::vector<StringRef> dtNeeded;
373
- std::string soName;
373
+ StringRef soName;
374
374
375
375
static bool classof (const InputFile *f) { return f->kind () == SharedKind; }
376
376
You can’t perform that action at this time.
0 commit comments