star-sf

Set of surface and volume scattering functions
git clone git://git.meso-star.fr/star-sf.git
Log | Files | Refs | README | LICENSE

commit c72ef7410990aec4b72c20910b1fcd1dd4ffbefc
parent 53feb1c137831ae026b3d2d7b05aad673b94d473
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri, 27 Oct 2023 14:50:41 +0200

Partially link static library object files

Make hidden symbols local to the relocatable object to avoid conflicts
with internal symbols in another static library. In release mode, delete
all symbols not required for relocation processing, but keep them in
debug mode.

Diffstat:
MMakefile | 9+++++++--
Mconfig.mk | 6++++++
2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile @@ -65,10 +65,14 @@ $(DEP) $(OBJ): config.mk .simd $(LIBNAME_SHARED): $(OBJ) $(CC) $(CFLAGS) $(CFLAGS_SIMD) $(DPDC_CFLAGS) -o $@ $(OBJ) $(LDFLAGS) $(SOFLAGS) $(DPDC_LIBS) -$(LIBNAME_STATIC): $(OBJ) +$(LIBNAME_STATIC): libssf.o $(AR) -rc $@ $? $(RANLIB) $@ +libssf.o: $(OBJ) + $(LD) -r $(OBJ) -o $@ + $(OBJCOPY) $(OCPFLAGS) $@ + .config: config.mk .simd @if [ "$(SIMD_WIDTH)" = "128" ] || [ "$(SIMD_WIDTH)" = "256" ]; then \ if ! $(PKG_CONFIG) --atleast-version $(RSIMD_VERSION) rsimd; then \ @@ -95,7 +99,8 @@ $(LIBNAME_STATIC): $(OBJ) all: build_library build_tests clean: clean_test - rm -f $(OBJ) $(TEST_OBJ) $(LIBNAME) .config .simd .test ssf.pc ssf-local.pc + rm -f $(OBJ) $(TEST_OBJ) $(LIBNAME) + rm -f .config .simd .test libssf.o ssf.pc ssf-local.pc distclean: clean rm -f $(DEP) $(TEST_DEP) diff --git a/config.mk b/config.mk @@ -17,6 +17,8 @@ BUILD_TYPE = RELEASE ################################################################################ AR = ar CC = cc +LD = ld +OBJCOPY = objcopy PKG_CONFIG = pkg-config RANLIB = ranlib @@ -84,3 +86,7 @@ SOFLAGS = -shared -Wl,--no-undefined LDFLAGS_DEBUG = LDFLAGS_RELEASE = -s LDFLAGS = $(LDFLAGS_$(BUILD_TYPE)) + +OCPFLAGS_DEBUG = --localize-hidden +OCPFLAGS_RELEASE = --localize-hidden --strip-unneeded +OCPFLAGS = $(OCPFLAGS_$(BUILD_TYPE))