Skip to content

Commit

Permalink
[libmce-glib] Hide internal symbols. JB#43321
Browse files Browse the repository at this point in the history
If nothing else, this makes the library file smaller by reducing
the size of the dynamic symbol table.
  • Loading branch information
monich committed May 24, 2020
1 parent fb4d97c commit c60c134
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 28 deletions.
17 changes: 5 additions & 12 deletions Makefile
Expand Up @@ -63,25 +63,20 @@ RELEASE_BUILD_DIR = $(BUILD_DIR)/release
# Tools and flags
#

ifndef CC
CC = $(CROSS_COMPILE)gcc
endif

CC ?= $(CROSS_COMPILE)gcc
LD = $(CC)
DEFINES += -DGLIB_DISABLE_DEPRECATION_WARNINGS
WARNINGS = -Wall -Wno-unused-parameter -Wno-multichar
INCLUDES = -I$(INCLUDE_DIR) -I$(GEN_DIR)
BASE_FLAGS = -fPIC $(CFLAGS)
FULL_CFLAGS = $(BASE_FLAGS) $(DEFINES) $(WARNINGS) $(INCLUDES) -MMD -MP \
$(shell pkg-config --cflags $(PKGS))
FULL_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS) -shared -Wl,-soname -Wl,$(LIB_SONAME)
FULL_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS) -shared -Wl,-soname -Wl,$(LIB_SONAME) \
-Wl,--version-script=$(LIB_NAME).map
DEBUG_FLAGS = -g
RELEASE_FLAGS =

ifndef KEEP_SYMBOLS
KEEP_SYMBOLS = 0
endif

KEEP_SYMBOLS ?= 0
ifneq ($(KEEP_SYMBOLS),0)
RELEASE_FLAGS += -g
endif
Expand Down Expand Up @@ -193,11 +188,9 @@ $(PKGCONFIG): $(LIB_NAME).pc.in Makefile
# Install
#

INSTALL_PERM = 644

INSTALL = install
INSTALL_DIRS = $(INSTALL) -d
INSTALL_FILES = $(INSTALL) -m $(INSTALL_PERM)
INSTALL_FILES = $(INSTALL) -m 644

INSTALL_LIB_DIR = $(DESTDIR)/usr/lib
INSTALL_INCLUDE_DIR = $(DESTDIR)/usr/include/$(LIB_NAME)
Expand Down
6 changes: 6 additions & 0 deletions libmce-glib.map
@@ -0,0 +1,6 @@
{
global:
mce_*;
local:
*;
};
11 changes: 6 additions & 5 deletions src/mce_proxy.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2016-2020 Jolla Ltd.
* Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
Expand All @@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
* 3. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Expand Down Expand Up @@ -60,6 +60,7 @@ enum mce_proxy_signal {
static guint mce_proxy_signals[SIGNAL_COUNT] = { 0 };

typedef GObjectClass MceProxyClass;
GType mce_proxy_get_type() MCE_INTERNAL;
G_DEFINE_TYPE(MceProxy, mce_proxy, G_TYPE_OBJECT)
#define PARENT_CLASS mce_proxy_parent_class
#define MCE_PROXY_TYPE (mce_proxy_get_type())
Expand Down
27 changes: 16 additions & 11 deletions src/mce_proxy.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2016-2020 Jolla Ltd.
* Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
Expand All @@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
* 3. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Expand All @@ -37,7 +37,7 @@
#ifndef MCE_PROXY_H
#define MCE_PROXY_H

#include "mce_types.h"
#include "mce_types_p.h"

typedef struct mce_proxy_priv MceProxyPriv;
struct _ComNokiaMceSignal;
Expand All @@ -58,26 +58,31 @@ typedef void

MceProxy*
mce_proxy_new(
void);
void)
MCE_INTERNAL;

MceProxy*
mce_proxy_ref(
MceProxy* proxy);
MceProxy* proxy)
MCE_INTERNAL;

void
mce_proxy_unref(
MceProxy* proxy);
MceProxy* proxy)
MCE_INTERNAL;

gulong
mce_proxy_add_valid_changed_handler(
MceProxy* proxy,
MceProxyFunc fn,
void* arg);
void* arg)
MCE_INTERNAL;

void
mce_proxy_remove_handler(
MceProxy* proxy,
gulong id);
gulong id)
MCE_INTERNAL;

#endif /* MCE_PROXY_H */

Expand Down
53 changes: 53 additions & 0 deletions src/mce_types_p.h
@@ -0,0 +1,53 @@
/*
* Copyright (C) 2020 Jolla Ltd.
* Copyright (C) 2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
* any official policies, either expressed or implied.
*/

#ifndef MCE_TYPES_PRIVATE_H
#define MCE_TYPES_PRIVATE_H

#include <mce_types.h>

/* Macros */
#define MCE_INTERNAL G_GNUC_INTERNAL

#endif /* MCE_TYPES_PRIVATE_H */

/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/

0 comments on commit c60c134

Please sign in to comment.