This is an archive of the discontinued LLVM Phabricator instance.

[libc] undefined reference in LibcTest.cpp
ClosedPublic

Authored by gchatelet on Feb 8 2022, 6:55 AM.

Details

Summary

GCC complains about undefined reference in LibcTest.cpp and indeed the wrong version of the template has been explicitly instanciated.
This is necessary to get llvm-libc compile with GCC.

Mentionning D119002 here for navigability.

Diff Detail

Event Timeline

gchatelet created this revision.Feb 8 2022, 6:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 8 2022, 6:55 AM
gchatelet requested review of this revision.Feb 8 2022, 6:55 AM
sivachandra accepted this revision.Feb 9 2022, 9:48 AM
sivachandra added inline comments.
libc/utils/UnitTest/LibcTest.cpp
200

I think what is happening is this: We were instantiating the member functions which call these non-member internal functions. So, the member function instantiation triggered the instantiation of these non-member functions. My guess is that, your GCC is probably not going through the call graph and instantiating the internal functions. Hence you are running into the undefined reference problem. That said though, instantiating these internal functions is more appropriate. So, your change LGTM.

This revision is now accepted and ready to land.Feb 9 2022, 9:48 AM
This revision was automatically updated to reflect the committed changes.