diff --git a/lld/COFF/Config.h b/lld/COFF/Config.h --- a/lld/COFF/Config.h +++ b/lld/COFF/Config.h @@ -43,6 +43,7 @@ struct Export { StringRef name; // N in /export:N or /export:E=N StringRef extName; // E in /export:E=N + StringRef aliasTarget; // GNU specific: N in "alias == N" Symbol *sym = nullptr; uint16_t ordinal = 0; bool noname = false; @@ -63,6 +64,7 @@ bool operator==(const Export &e) { return (name == e.name && extName == e.extName && + aliasTarget == e.aliasTarget && ordinal == e.ordinal && noname == e.noname && data == e.data && isPrivate == e.isPrivate); } diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -815,6 +815,7 @@ e2.Name = std::string(e1.name); e2.SymbolName = std::string(e1.symbolName); e2.ExtName = std::string(e1.extName); + e2.AliasTarget = std::string(e1.aliasTarget); e2.Ordinal = e1.ordinal; e2.Noname = e1.noname; e2.Data = e1.data; @@ -913,6 +914,7 @@ } e2.name = saver.save(e1.Name); e2.extName = saver.save(e1.ExtName); + e2.aliasTarget = saver.save(e1.AliasTarget); e2.ordinal = e1.Ordinal; e2.noname = e1.Noname; e2.data = e1.Data; diff --git a/lld/test/COFF/Inputs/library.def b/lld/test/COFF/Inputs/library.def --- a/lld/test/COFF/Inputs/library.def +++ b/lld/test/COFF/Inputs/library.def @@ -1,5 +1,6 @@ LIBRARY library EXPORTS function + alias == function data DATA constant CONSTANT diff --git a/lld/test/COFF/lib.test b/lld/test/COFF/lib.test --- a/lld/test/COFF/lib.test +++ b/lld/test/COFF/lib.test @@ -1,6 +1,16 @@ # RUN: lld-link /machine:x64 /def:%S/Inputs/library.def /out:%t.lib # RUN: llvm-nm %t.lib | FileCheck %s +CHECK: 00000000 a @comp.id +CHECK: 00000000 a @feat.00 +CHECK: 00000000 W alias +CHECK: U function + +CHECK: 00000000 a @comp.id +CHECK: 00000000 a @feat.00 +CHECK: 00000000 W __imp_alias +CHECK: U __imp_function + CHECK: 00000000 R __imp_constant CHECK: 00000000 R constant