commit 2b04296

Michael Forney  ·  2014-11-01 07:07:40 +0000 UTC
parent 5192aff
Use partial linking and objcopy --localize-hidden for libswc.a

This way, we don't expose internal symbols in the static library.
3 files changed,  +9, -1
+1, -0
1@@ -88,6 +88,7 @@ Q_AR      = $(call quiet,AR     )
2 Q_CC      = $(call quiet,CC     )
3 Q_CCLD    = $(call quiet,CCLD   )
4 Q_GEN     = $(call quiet,GEN    )
5+Q_OBJCOPY = $(call quiet,OBJCOPY)
6 Q_SYM     = $(call quiet,SYM    )
7 
8 compile   = $(Q_CC)$(CC) $(FINAL_CPPFLAGS) $(FINAL_CFLAGS) -I . -c -o $@ $< \
+1, -0
1@@ -11,6 +11,7 @@
2 
3 CC              = gcc
4 CFLAGS          = -pipe
5+OBJCOPY         = objcopy
6 # PKG_CONFIG      = pkg-config
7 # WAYLAND_SCANNER = wayland-scanner
8 
+7, -1
 1@@ -83,7 +83,13 @@ $(call objects,drm drm_buffer): protocol/wayland-drm-server-protocol.h
 2 $(call objects,xdg_shell xdg_surface xdg_popup): protocol/xdg-shell-server-protocol.h
 3 $(call objects,pointer): cursor/cursor_data.h
 4 
 5-$(dir)/libswc.a: $(SWC_STATIC_OBJECTS)
 6+$(dir)/libswc-internal.o: $(SWC_STATIC_OBJECTS)
 7+	$(link) -nostdlib -r
 8+
 9+$(dir)/libswc.o: $(dir)/libswc-internal.o
10+	$(Q_OBJCOPY)$(OBJCOPY) --localize-hidden $< $@
11+
12+$(dir)/libswc.a: $(dir)/libswc.o
13 	$(Q_AR)$(AR) cru $@ $^
14 
15 $(dir)/$(LIBSWC_LIB): $(SWC_SHARED_OBJECTS)