forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc95275f
committed
Fix broken link-command-line ordering for libpgfeutils.
In the frontend Makefiles that pull in libpgfeutils, we'd generallydone it like this:LDFLAGS += -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport)That method is badly broken, as seen in bug #14742 from Chris Ruprecht.The -L flag for src/fe_utils ends up being placed after whatever random-L flags are in LDFLAGS already. That puts us at risk of pulling inlibpgfeutils.a from some previous installation rather than the freshlybuilt one in src/fe_utils. Also, the lack of an "override" is hazardousif someone tries to specify some LDFLAGS on the make command line.The correct way to do it is like this:override LDFLAGS := -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport) $(LDFLAGS)so that libpgfeutils, along with libpq, libpgport, and libpgcommon, areguaranteed to be pulled in from the build tree and not from any referencedsystem directory, because their -L flags will appear first.In some places we'd been even lazier and done it like this:LDFLAGS += -L$(top_builddir)/src/fe_utils -lpgfeutils -lpqwhich is subtly wrong in an additional way: on platforms where we can'trestrict the symbols exported by libpq.so, it allows libpgfeutils tolatch onto libpgport and libpgcommon symbols from libpq.so, rather thandirectly from those static libraries as intended. This carries hazardslike those explained in the comments for the libpq_pgport macro.In addition to fixing the broken libpgfeutils usages, I tried tostandardize on using $(libpq_pgport) like so:override LDFLAGS := $(libpq_pgport) $(LDFLAGS)even where libpgfeutils is not in the picture. This makes no differenceright now but will hopefully discourage future mistakes of the same ilk.And it's more like the way we handle CPPFLAGS in libpq-using Makefiles.In passing, just for consistency, make pgbench include PTHREAD_LIBS thesame way everyplace else does, ie just after LIBS rather than in somerandom place in the command line. This might have practical effect ifthere are -L switches in that macro on some platform.It looks to me like the MSVC build scripts are not affected by thiserror, but someone more familiar with them than I might want to doublecheck.Back-patch to 9.6 where libpgfeutils was introduced. In 9.6, the hazardthis error creates is that a reinstallation might link to the priorinstallation's copy of libpgfeutils.a and thereby fail to absorb aminor-version bug fix.Discussion:https://postgr.es/m/20170714125106.9231.13772@wrigleys.postgresql.org1 parent8046465 commitc95275f
10 files changed
+24
-24
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
22 |
| - | |
| 22 | + | |
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
|
Lines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
22 |
| - | |
| 22 | + | |
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
28 | 28 |
| |
29 |
| - | |
| 29 | + | |
30 | 30 |
| |
31 | 31 |
| |
32 |
| - | |
| 32 | + | |
33 | 33 |
| |
34 | 34 |
| |
35 |
| - | |
| 35 | + | |
36 | 36 |
| |
37 | 37 |
| |
38 | 38 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
| 23 | + | |
23 | 24 |
| |
24 |
| - | |
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
32 |
| - | |
| 32 | + | |
33 | 33 |
| |
34 | 34 |
| |
35 | 35 |
| |
|
Lines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
20 |
| - | |
| 20 | + | |
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
| |||
26 | 26 |
| |
27 | 27 |
| |
28 | 28 |
| |
29 |
| - | |
| 29 | + | |
30 | 30 |
| |
31 | 31 |
| |
32 |
| - | |
| 32 | + | |
33 | 33 |
| |
34 | 34 |
| |
35 |
| - | |
| 35 | + | |
36 | 36 |
| |
37 | 37 |
| |
38 | 38 |
| |
|
Lines changed: 2 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
18 |
| - | |
19 |
| - | |
20 |
| - | |
21 | 18 |
| |
| 19 | + | |
22 | 20 |
| |
23 | 21 |
| |
24 | 22 |
| |
| |||
29 | 27 |
| |
30 | 28 |
| |
31 | 29 |
| |
32 |
| - | |
| 30 | + | |
33 | 31 |
| |
34 | 32 |
| |
35 | 33 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
15 |
| - | |
| 15 | + | |
16 | 16 |
| |
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
21 |
| - | |
| 21 | + | |
22 | 22 |
| |
23 | 23 |
| |
24 | 24 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
13 |
| - | |
| 13 | + | |
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
| 18 | + | |
18 | 19 |
| |
19 | 20 |
| |
20 | 21 |
| |
21 | 22 |
| |
22 | 23 |
| |
23 |
| - | |
| 24 | + | |
24 | 25 |
| |
25 | 26 |
| |
26 | 27 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
22 |
| - | |
| 22 | + | |
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
| |||
31 | 31 |
| |
32 | 32 |
| |
33 | 33 |
| |
34 |
| - | |
| 34 | + | |
35 | 35 |
| |
36 | 36 |
| |
37 | 37 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
22 |
| - | |
| 22 | + | |
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
27 |
| - | |
| 27 | + | |
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
13 | 13 |
| |
14 | 14 |
| |
15 | 15 |
| |
| 16 | + | |
16 | 17 |
| |
17 | 18 |
| |
18 | 19 |
| |
19 | 20 |
| |
20 | 21 |
| |
21 | 22 |
| |
22 |
| - | |
| 23 | + | |
23 | 24 |
| |
24 | 25 |
| |
25 | 26 |
|
0 commit comments
Comments
(0)