This is an archive of the discontinued LLVM Phabricator instance.

Export the required symbol from DynamicLibraryTests
ClosedPublic

Authored by chill on Jun 1 2017, 10:35 AM.

Details

Summary

Running unittests/Support/DynamicLibrary/DynamicLibraryTests fails
when LLVM is configured with -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON, because
the test's version script only contains symbols extracted from the static libraries,
that the test links with, but not those from the main object/executable itself.

The patch moves the one symbol, needed by the test, to its own static library.

Fixes https://bugs.llvm.org/show_bug.cgi?id=32893

Diff Detail

Repository
rL LLVM

Event Timeline

chill created this revision.Jun 1 2017, 10:35 AM
chapuni added a subscriber: chapuni.Jun 1 2017, 2:26 PM
rogfer01 edited edge metadata.Jun 5 2017, 4:06 AM

This LGTM, @marsupial what do you think?

marsupial added inline comments.Jun 5 2017, 10:07 AM
unittests/Support/DynamicLibrary/DynamicLibraryLib.cxx
1–12 ↗(On Diff #101048)

Perhaps a more general filename (TestA.cpp) and use macros to determine the return value so this implementation can be used in other modules. This would allow for more testing/coverage in the future of other aspects of the DynamicLibrary manager (i.e. symbol resolution across multiple libs).

extern "C" PIPSQUEAK_EXPORT const char *TestA() {
#ifndef PIPSQUEAK_TESTA_RETURN
  return "ProcessCall";
#else
  return PIPSQUEAK_TESTA_RETURN;
#endif
}

PipSqueak.cxx

#define PIPSQUEAK_TESTA_RETURN "LibCall"
#include "TestA.cpp"
unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
23 ↗(On Diff #101048)

Might as well move this declaration to PipSqueak.h.

marsupial added inline comments.Jun 5 2017, 10:11 AM
unittests/Support/DynamicLibrary/DynamicLibraryLib.cxx
1–12 ↗(On Diff #101048)

Actually ExportedSyms.cpp is probably a bit than TestA.cpp for when other functions/symbols are added.

chill updated this revision to Diff 101548.Jun 6 2017, 5:50 AM
chill marked 2 inline comments as done.
This revision was automatically updated to reflect the committed changes.