libbinder: support exporting fewer symbols
This commit explicitly marks symbols in the code with default visibility
if they should be part of the libbinder ABI. Later, we'll set the
default symbol visibility to hidden and so any symbols not explicitly
marked as exported will be hidden.
We are still overexporting symbols a bit. When `LIBBINDER_EXPORTED` is
applied to a class, it exports all of that class's symbols. I've tried
to only export class members, but in a few cases it didn't seem worth
the trouble, e.g. where all the members need to be exported.
Additionally, we are exporting some symbols only needed by binder test
binaries. Since those tests run against the standard libbinder.so, we
need to include the symbols as part of the ABI.
On aarch64, this reduces the size of libbinder_on_trusty_mock.so by
10.7% and libbinder.so by 7.5%, primarily in the .text, .dynstr, and
.dynsym sections (but none of this takes effect until we actually
enabled it in a later commit).
Bug: 338458975
Test: TH
Change-Id: Idc348c2b12124a8bbcebeea49920267a995367b6
diff --git a/libs/binder/BufferedTextOutput.h b/libs/binder/BufferedTextOutput.h
index 57e03cb..1c074e6 100644
--- a/libs/binder/BufferedTextOutput.h
+++ b/libs/binder/BufferedTextOutput.h
@@ -24,8 +24,7 @@
// ---------------------------------------------------------------------------
namespace android {
-class BufferedTextOutput : public TextOutput
-{
+class LIBBINDER_INTERNAL_EXPORTED BufferedTextOutput : public TextOutput {
public:
//** Flags for constructor */
enum {