This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Allow R_PLT_PC (R_PC) to a hidden undefined weak symbol
ClosedPublic

Authored by MaskRay on Jan 17 2020, 12:00 PM.

Details

Summary

This essentially reverts b841e119d77ed0502e3a2e710f26a899bef28b3c.

Such code construct can be used in the following way:

// glibc/stdlib/exit.c
// clang -fuse-ld=lld => succeeded
// clang -fuse-ld=lld -fpie -pie => relocation R_PLT_PC cannot refer to absolute symbol
__attribute__((weak, visibility("hidden"))) extern void __call_tls_dtors();
void __run_exit_handlers() {
  if (__call_tls_dtors)
      __call_tls_dtors();
}

Since we allow R_PLT_PC in -no-pie mode, it makes sense to allow it in
-pie mode as well.

Diff Detail

Event Timeline

MaskRay created this revision.Jan 17 2020, 12:00 PM
pcc accepted this revision.Jan 17 2020, 12:07 PM

LGTM

This revision is now accepted and ready to land.Jan 17 2020, 12:07 PM

Unit tests: fail. 61975 tests passed, 1 failed and 783 were skipped.

failed: LLVM.Bindings/Go/go.test

clang-tidy: unknown.

clang-format: pass.

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

This revision was automatically updated to reflect the committed changes.

rGb841e119d77ed0502e3a2e710f26a899bef28b3c is in the 10.0 branch. Should this be cherry picked to 10.0? CC @hans

rGb841e119d77ed0502e3a2e710f26a899bef28b3c is in the 10.0 branch. Should this be cherry picked to 10.0? CC @hans

This commit is in release/10.x

git branch origin/release/10.x --contains 9aacec8331d9bc1f80046e5954be1f5e0e0acd42 => success

rGb841e119d77ed0502e3a2e710f26a899bef28b3c is in the 10.0 branch. Should this be cherry picked to 10.0? CC @hans

This commit is in release/10.x

git branch origin/release/10.x --contains 9aacec8331d9bc1f80046e5954be1f5e0e0acd42 => success

Ah, you cherry-picked to 10.0 already. Thanks.