@@ -355,7 +355,9 @@ void LinkerDriver::addFile(StringRef path, bool withLOption) {
355
355
356
356
// Add a given library by searching it from input search paths.
357
357
void LinkerDriver::addLibrary (StringRef name) {
358
- if (std::optional<std::string> path = searchLibrary (name))
358
+ if (name.size () > 0 && name[0 ] == ' /' )
359
+ addFile (saver ().save (name), /* withLOption=*/ true );
360
+ else if (std::optional<std::string> path = searchLibrary (name))
359
361
addFile (saver ().save (*path), /* withLOption=*/ true );
360
362
else
361
363
error (" unable to find library -l" + name, ErrorTag::LibNotFound, {name});
@@ -2555,8 +2557,13 @@ static std::vector<WrappedSymbol> addWrappedSymbols(opt::InputArgList &args) {
2555
2557
if (!sym)
2556
2558
continue ;
2557
2559
2558
- Symbol *wrap =
2559
- symtab.addUnusedUndefined (saver ().save (" __wrap_" + name), sym->binding );
2560
+ // If __wrap_ is lazy force load it - its sym->binding might be
2561
+ // weak, in which case the wrapped symbol will not get loaded.
2562
+ StringRef wrapName = saver ().save (" __wrap_" + name);
2563
+ Symbol *existingWrap = symtab.find (wrapName);
2564
+ if (existingWrap && existingWrap->isLazy ())
2565
+ existingWrap->extract ();
2566
+ Symbol *wrap = symtab.addUnusedUndefined (wrapName, sym->binding );
2560
2567
2561
2568
// If __real_ is referenced, pull in the symbol if it is lazy. Do this after
2562
2569
// processing __wrap_ as that may have referenced __real_.
0 commit comments