Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 4c57596b authored by Jiyong Park's avatar Jiyong Park
Browse files

Don't enable version lib for libadb_sysdeps

When use_version_lib is set to true, but build::GetBuildNumber() isn't
used, the library can't be processed by symbol_inject. For example,

$ m out/soong/.intermediates/system/core/adb/libadb_sysdeps/android/arm64_armv8-a_shared/versioned/libadb_sysdeps.so

FAILED:
out/soong/.intermediates/system/core/adb/libadb_sysdeps/android_arm64_armv8-a_shared/versioned/libadb_sysdeps.so
out/soong/host/linux-x86/bin/symbol_inject -i
out/soong/.intermediates/system/core/adb/libadb_sysdeps/android_arm64_armv8-a_shared/unstripped/libadb_sysdeps.so
-o
out/soong/.intermediates/system/core/adb/libadb_sysdeps/android_arm64_armv8-a_shared/versioned/libadb_sysdeps.so
-s soong_build_number -from 'SOONG BUILD NUMBER PLACEHOLDER' -v $(cat
out/soong/build_number.txt)
symbol not found
17:09:10 ninja failed with: exit status 1

This is because the visibility of the symbol `soong_build_number` in
libbuildversion.a is hidden via the -fvisibility=hidden flag for the
library. In addition, -Wl,--gc-sections strips the hidden symbol when
it is not referenced.

This fortunately hasn't caused a problem because, for the device target,
the output of symbol_inject was used only for dist outputs.
libadb_sysdeps wasn't registered as dists. So
versioned/libadb_sysprops.so never had a chance to be built. For the
host target, in the other hand, the output of symbol_inject is used
always, but --gc-sections is not used for host targets. So the symbol
wasn't stripped and therefore symbol_inject could always find the
symbol.

This however is expected to cause a problem when the support for
LinuxCross is added. It is one of the host targets, therefore
symbol_inject is always used. However, unlike other host targets,
--gc-sections is turned on because it inherits most of the flags from
Android/ARM64.

To avoid the problem, we might want to disable --gc-sections for the
target. But regardless of the decision, having a build rule that always
fails is not desirable - even though the build rule is essentially never
triggered. Therefore, we choose to not use version lib for
libadb_sysdeps because GetBuildNumber() is not used in the lib.

Bug: 159685774
Test: m \
out/soong/.intermediates/system/core/adb/libadb_sysdeps/android/\
arm64_armv8-a_shared/versioned/libadb_sysdeps.so

Change-Id: Ide1056b5b55e409ab809e302a697d10d759c92ce
parent bb81b778
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment