@@ -315,7 +315,9 @@ void LinkerDriver::addFile(StringRef path, bool withLOption) {
315315
316316// Add a given library by searching it from input search paths.
317317void LinkerDriver::addLibrary (StringRef name) {
318- if (std::optional<std::string> path = searchLibrary (name))
318+ if (name.size () > 0 && name[0 ] == ' /' )
319+ addFile (saver ().save (name), /* withLOption=*/ true );
320+ else if (std::optional<std::string> path = searchLibrary (name))
319321 addFile (saver ().save (*path), /* withLOption=*/ true );
320322 else
321323 error (" unable to find library -l" + name, ErrorTag::LibNotFound, {name});
@@ -2252,8 +2254,13 @@ static std::vector<WrappedSymbol> addWrappedSymbols(opt::InputArgList &args) {
22522254 if (!sym)
22532255 continue ;
22542256
2255- Symbol *wrap =
2256- addUnusedUndefined (saver ().save (" __wrap_" + name), sym->binding );
2257+ // If __wrap_ is lazy force load it - its sym->binding might be
2258+ // weak, in which case the wrapped symbol will not get loaded.
2259+ StringRef wrapName = saver ().save (" __wrap_" + name);
2260+ Symbol *existingWrap = symtab.find (wrapName);
2261+ if (existingWrap && existingWrap->isLazy ())
2262+ existingWrap->extract ();
2263+ Symbol *wrap = addUnusedUndefined (wrapName, sym->binding );
22572264
22582265 // If __real_ is referenced, pull in the symbol if it is lazy. Do this after
22592266 // processing __wrap_ as that may have referenced __real_.
0 commit comments