Custom options for building extensions with --with--llvm

From: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Andres Freund <andres(at)anarazel(dot)de>
Subject: Custom options for building extensions with --with--llvm
Date: 2020-09-24 16:15:22
Message-ID: 9373f6b4-90d0-54ef-2be7-73b12476beee@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

In my extension I want to define some custom options for compiler.
I do it in the following way:

ifdef USE_DISK
CUSTOM_COPT += -DIMCS_DISK_SUPPORT
endif

So if I want to enable disk support, I am building my extension as

make USE_DISK=1 clean all install

and it normally works... unless Postgres is built with --enable-llvm.
In this case it tries to build llvm code using clang and is not using
CUSTOM_COPTS:

gcc -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Werror=vla -Wendif-labels
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
-fwrapv -fexcess-precision=standard -g -O3 -Wall -pthread
-DIMCS_DISK_SUPPORT -fPIC -I. -I. -I../../src/include -D_GNU_SOURCE   -c
-o disk.o disk.c

vs.

/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2 
-I. -I. -I../../src/include  -D_GNU_SOURCE  -flto=thin -emit-llvm -c -o
disk.bc disk.c

I wonder is there any way to pass custom compile options to clang?
Thanks in advance,

--
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2020-09-24 16:21:44 Re: scram-sha-256 broken with FIPS and OpenSSL 1.0.2
Previous Message Bruce Momjian 2020-09-24 15:43:40 Re: "cert" + clientcert=verify-ca in pg_hba.conf?