attestation: Export protobufs in libattestation.so.
BUG=brillo:737
TEST=unit, manually linked against the lib with a project outside of
platform2
Change-Id: Ie8fdbc5f629fa06a44c109aef58b3a4dbf0231ed
Reviewed-on: https://chromium-review.googlesource.com/269525
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Darren Krahn <dkrahn@chromium.org>
Tested-by: Darren Krahn <dkrahn@chromium.org>
diff --git a/attestation.gyp b/attestation.gyp
index a3cc9ba..cc6c837 100644
--- a/attestation.gyp
+++ b/attestation.gyp
@@ -17,6 +17,12 @@
{
'target_name': 'proto_library',
'type': 'static_library',
+ # Use -fPIC so this code can be linked into a shared library.
+ 'cflags!': ['-fPIE'],
+ 'cflags': [
+ '-fPIC',
+ '-fvisibility=default',
+ ],
'variables': {
'proto_in_dir': 'common',
'proto_out_dir': 'include/attestation/common',
@@ -33,9 +39,6 @@
{
'target_name': 'common_library',
'type': 'static_library',
- # Use -fPIC so this code can be linked into a shared library.
- 'cflags!': ['-fPIE'],
- 'cflags': ['-fPIC'],
'sources': [
'common/crypto_utility_impl.cc',
'common/tpm_utility_v1.cc',
@@ -60,7 +63,10 @@
'type': 'static_library',
# Use -fPIC so this code can be linked into a shared library.
'cflags!': ['-fPIE'],
- 'cflags': ['-fPIC'],
+ 'cflags': [
+ '-fPIC',
+ '-fvisibility=default',
+ ],
'sources': [
'client/dbus_proxy.cc',
],
@@ -72,6 +78,7 @@
{
'target_name': 'libattestation',
'type': 'shared_library',
+ 'cflags': ['-fvisibility=default'],
'sources': [
],
'dependencies': [
diff --git a/client/dbus_proxy.h b/client/dbus_proxy.h
index 2ae1b59..c1419d7 100644
--- a/client/dbus_proxy.h
+++ b/client/dbus_proxy.h
@@ -13,15 +13,13 @@
#include <dbus/bus.h>
#include <dbus/object_proxy.h>
-#include "attestation/common/export.h"
-
namespace attestation {
// An implementation of AttestationInterface that forwards requests over D-Bus.
// Usage:
// std::unique_ptr<AttestationInterface> attestation = new DBusProxy();
// attestation->CreateGoogleAttestedKey(...);
-class ATTESTATION_EXPORT DBusProxy : public AttestationInterface {
+class DBusProxy : public AttestationInterface {
public:
DBusProxy();
virtual ~DBusProxy();
diff --git a/common/attestation_interface.h b/common/attestation_interface.h
index eb68b53..a07fa6e 100644
--- a/common/attestation_interface.h
+++ b/common/attestation_interface.h
@@ -9,7 +9,6 @@
#include <base/callback_forward.h>
-#include "attestation/common/export.h"
#include "attestation/common/interface.pb.h"
namespace attestation {
@@ -17,7 +16,7 @@
// The main attestation interface implemented by proxies and services. The
// anticipated flow looks like this:
// [APP] -> AttestationInterface -> [IPC] -> AttestationInterface
-class ATTESTATION_EXPORT AttestationInterface {
+class AttestationInterface {
public:
virtual ~AttestationInterface() = default;
diff --git a/common/export.h b/common/export.h
deleted file mode 100644
index 3acc959..0000000
--- a/common/export.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2015 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ATTESTATION_COMMON_EXPORT_H_
-#define ATTESTATION_COMMON_EXPORT_H_
-
-// Use this for any class or function that needs to be exported from
-// libattestation.so.
-// E.g. ATTESTATION_EXPORT void foo();
-#define ATTESTATION_EXPORT __attribute__((__visibility__("default")))
-
-#endif // ATTESTATION_COMMON_EXPORT_H_