This is an archive of the discontinued LLVM Phabricator instance.

[ELF] --exclude-libs: don't assign VER_NDX_LOCAL to undefined symbols
ClosedPublic

Authored by MaskRay on Jan 13 2020, 10:08 PM.

Details

Summary

Suggested by Peter Collingbourne.

Non-VER_NDX_GLOBAL versions should not be assigned to defined symbols. --exclude-libs violates this and can cause a spurious error "cannot refer to absolute symbol" after D71795.

excludeLibs incorrectly assigns VER_NDX_LOCAL to an undefined weak symbol =>
isPreemptible is false =>
R_PLT_PC is optimized to R_PC =>
in isStaticLinkTimeConstant, an error is emitted.

Diff Detail

Event Timeline

MaskRay created this revision.Jan 13 2020, 10:08 PM

Unit tests: pass. 61800 tests passed, 0 failed and 781 were skipped.

clang-tidy: unknown.

clang-format: pass.

Build artifacts: diff.json, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

I think this is fine.
I'd suggest to add a comment to the test case (its generally helpfull in a long term, though I know we often do not add them in LLDs tests.)

lld/test/ELF/exclude-libs-undef.s
7

Do you need both t.a and %t.dir/t.a?

MaskRay updated this revision to Diff 237877.Jan 14 2020, 1:18 AM

Add comment

grimar accepted this revision.Jan 14 2020, 1:33 AM

LGTM, but please wait for another possible comments too.

lld/test/ELF/exclude-libs-undef.s
4

"we do" I think.

This revision is now accepted and ready to land.Jan 14 2020, 1:33 AM

Unit tests: fail. 61801 tests passed, 1 failed and 781 were skipped.

failed: libc++.std/thread/thread_mutex/thread_mutex_requirements/thread_sharedtimedmutex_requirements/thread_sharedtimedmutex_class/try_lock.pass.cpp

clang-tidy: unknown.

clang-format: pass.

Build artifacts: diff.json, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

pcc accepted this revision.Jan 14 2020, 10:07 AM

LGTM

MaskRay updated this revision to Diff 238026.Jan 14 2020, 10:12 AM

Fix comment

This revision was automatically updated to reflect the committed changes.

Unit tests: pass. 61848 tests passed, 0 failed and 781 were skipped.

clang-tidy: unknown.

clang-format: pass.

Build artifacts: diff.json, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml