Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ ifeq ($(shell uname -s), Darwin)
SONAME = lib$(TARGET).$(SO_VERSION).dylib
SOLIBVER = lib$(TARGET).$(SO_VERSION).$(VERSION_PATCH).dylib
SOFLAG = -install_name
SO_EXPORTS = -Wl,-exported_symbols_list,$(root_dir)/pg_query.exp
SO_EXPORTS_FILE = pg_query.exp
else
SOLIB = lib$(TARGET).so
SONAME = $(SOLIB).$(SO_VERSION)
SOLIBVER = $(SONAME).$(VERSION_PATCH)
SOFLAG = -soname
SO_EXPORTS = -Wl,--version-script=$(root_dir)/pg_query.map
SO_EXPORTS_FILE = pg_query.map
endif

SRC_FILES := $(wildcard src/*.c src/postgres/*.c) vendor/protobuf-c/protobuf-c.c vendor/xxhash/xxhash.c protobuf/pg_query.pb-c.c
Expand Down Expand Up @@ -190,8 +194,8 @@ extract_source: $(PGDIR)
$(ARLIB): $(OBJ_FILES) Makefile
@$(AR) $(ARFLAGS) $@ $(OBJ_FILES)

$(SOLIB): $(OBJ_FILES) Makefile
@$(CC) $(CFLAGS) -shared -Wl,$(SOFLAG),$(SONAME) $(LDFLAGS) -o $@ $(OBJ_FILES) $(LIBS)
$(SOLIB): $(OBJ_FILES) Makefile $(SO_EXPORTS_FILE)
@$(CC) $(CFLAGS) -shared -Wl,$(SOFLAG),$(SONAME) $(SO_EXPORTS) $(LDFLAGS) -o $@ $(OBJ_FILES) $(LIBS)

protobuf/pg_query.pb-c.c protobuf/pg_query.pb-c.h: protobuf/pg_query.proto
ifneq ($(shell which protoc-gen-c), )
Expand Down
5 changes: 5 additions & 0 deletions pg_query.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Mach-O exported symbols list, companion to pg_query.map for ELF.
# Mach-O prefixes C symbols with a leading underscore.
_pg_query_*
_deparseRawStmt
_deparseRawStmtOpts
12 changes: 12 additions & 0 deletions pg_query.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# GNU ld version script. Restricts the libpg_query shared library to the
# documented public API (pg_query.h, postgres_deparse.h) and hides bundled
# PostgreSQL internals so they don't conflict when libpg_query is embedded
# inside a PostgreSQL extension (TLS vs non-TLS CurrentMemoryContext).
{
global:
pg_query_*;
deparseRawStmt;
deparseRawStmtOpts;
local:
*;
};
Loading