This is an archive of the discontinued LLVM Phabricator instance.

Set hidden attribute on lprofMergeValueProfData
ClosedPublic

Authored by apazos on Dec 19 2018, 11:16 AM.

Details

Summary

The changes in https://reviews.llvm.org/D44847 cause load time failure
due to lprofMergeValueProfData in Android libs enabled with profile generation:

"dlopen failed: cannot locate symbol "lprofMergeValueProfData" referenced by..."

Marking lprofMergeValueProfData as hidden so the correct in-module definition
is picked by the linker.

Diff Detail

Repository
rL LLVM

Event Timeline

apazos created this revision.Dec 19 2018, 11:16 AM

A test would need to dump the contents of the symbol table and verify the hidden attribute for that symbol. Do you have something else in mind?

Can you write a test case with a shared library that is instrumented and write a main program with dlopen to demonstrate the problem if the fix is not there?

I observed the issue with instrumented libs in Android. I have not been successful in reducing a test case that would fail on x86 linux.
I can write a test case that shows I can do a dlopen/dlsym of lprofMergeValueProfData from a different library, but with the hidden attribute set on the function, the dlsym call will fail.
Shouldn't we prevent lprofMergeValueProfData from being accessed outside a module?

apazos updated this revision to Diff 186570.Feb 12 2019, 5:26 PM

I added a test case to verify the fix prevents lprofMergeValueProfData from another module from being accessed.

davidxl accepted this revision.Feb 13 2019, 9:11 AM

lgtm

This revision is now accepted and ready to land.Feb 13 2019, 9:11 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 14 2019, 1:38 PM