- Notifications
You must be signed in to change notification settings - Fork28
Commitdddfc4c
committed
Prevent accidental linking of system-supplied copies of libpq.so etc.
We were being careless in some places about the order of -L switches inlink command lines, such that -L switches referring to external directoriescould come before those referring to directories within the build tree.This made it possible to accidentally link a system-supplied library, forexample /usr/lib/libpq.so, in place of the one built in the build tree.Hilarity ensued, the more so the older the system-supplied library is.To fix, break LDFLAGS into two parts, a sub-variable LDFLAGS_INTERNALand the main LDFLAGS variable, both of which are "recursively expanded"so that they can be incrementally adjusted by different makefiles.Establish a policy that -L switches for directories in the build treemust always be added to LDFLAGS_INTERNAL, while -L switches for externaldirectories must always be added to LDFLAGS. This is sufficient toensure a safe search order. For simplicity, we typically also put -lswitches for the respective libraries into those same variables.(Traditional make usage would have us put -l switches into LIBS, butcleaning that up is a project for another day, as there's no clearneed for it.)This turns out to also require separating SHLIB_LINK into two variables,SHLIB_LINK and SHLIB_LINK_INTERNAL, with a similar rule about whichswitches go into which variable. And likewise for PG_LIBS.Although this change might appear to affect external users of pgxs.mk,I think it doesn't; they shouldn't have any need to touch the _INTERNALvariables.In passing, tweak src/common/Makefile so that the value of CPPFLAGSrecorded in pg_config lacks "-DFRONTEND" and the recorded value ofLDFLAGS lacks "-L../../../src/common". Both of those things aremistakes, apparently introduced during prior code rearrangements,as old versions of pg_config don't print them. In general we don'twant anything that's specific to the src/common subdirectory toappear in those outputs.This is certainly a bug fix, but in view of the lack of fieldcomplaints, I'm unsure whether it's worth the risk of back-patching.In any case it seems wise to see what the buildfarm makes of it first.Discussion:https://postgr.es/m/25214.1522604295@sss.pgh.pa.us1 parentd4a4c3d commitdddfc4c
File tree
32 files changed
+66
-49
lines changed- contrib
- dblink
- hstore_plperl
- hstore_plpython
- jsonb_plperl
- jsonb_plpython
- ltree_plpython
- oid2name
- postgres_fdw
- spi
- vacuumlo
- src
- backend/replication/libpqwalreceiver
- bin
- initdb
- pg_basebackup
- pg_ctl
- pg_dump
- pg_rewind
- pg_upgrade
- pgbench
- psql
- scripts
- common
- interfaces
- ecpg
- compatlib
- ecpglib
- pgtypeslib
- test
- compat_informix
- libpq/test
- makefiles
- test/examples
- tools/findoidjoins
32 files changed
+66
-49
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
6 |
| - | |
| 6 | + | |
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
31 |
| - | |
| 31 | + | |
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
26 | 26 |
| |
27 | 27 |
| |
28 | 28 |
| |
29 |
| - | |
| 29 | + | |
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
30 |
| - | |
| 30 | + | |
31 | 31 |
| |
32 | 32 |
| |
33 | 33 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
26 | 26 |
| |
27 | 27 |
| |
28 | 28 |
| |
29 |
| - | |
| 29 | + | |
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
26 | 26 |
| |
27 | 27 |
| |
28 | 28 |
| |
29 |
| - | |
| 29 | + | |
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 |
| - | |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5 | 5 |
| |
6 | 6 |
| |
7 | 7 |
| |
8 |
| - | |
| 8 | + | |
9 | 9 |
| |
10 | 10 |
| |
11 | 11 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
20 |
| - | |
21 |
| - | |
22 | 20 |
| |
23 | 21 |
| |
24 | 22 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 |
| - | |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
|
0 commit comments
Comments
(0)