/[packages]/cauldron/pcre/current/SOURCES/pcre-pcreposix-glibc-conflict.patch
ViewVC logotype

Contents of /cauldron/pcre/current/SOURCES/pcre-pcreposix-glibc-conflict.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 323571 - (show annotations) (download)
Fri Nov 30 22:37:37 2012 UTC (7 years, 1 month ago) by fwang
File size: 4202 byte(s)
new version 8.32
1 the goal of the patch is to fix the following problem:
2
3 "Dan Nicholson" <dbn.lists@gmail.com> writes:
4
5 [...]
6
7 > And now I've come upon this old thread:
8 >
9 > http://rpm5.org/community/rpm-devel/1554.html
10 >
11 > This is definitely the problem. When --as-needed is used, libc is
12 > bound first to tmire, causing regcomp and friends to be resolved
13 > through libc rather than libpcreposix.
14
15 the symbol conflict is a mess. pcreposix better be fixed
16 (http://rpm5.org/community/rpm-devel/1562.html)
17
18 it's hard to beat libc... here is what happens:
19
20 % echo 'int f() { regcomp(); }' > liba.c
21 % gcc -shared -o liba.so liba.c -lpcreposix
22 % ldd liba.so
23 libpcreposix.so.0 => /usr/lib/libpcreposix.so.0 (0xb7f76000)
24 libc.so.6 => /lib/i686/libc.so.6 (0xb7e28000)
25 libpcre.so.0 => /lib/libpcre.so.0 (0xb7e00000)
26 % gcc -shared -o liba_.so liba.so
27 % LD_LIBRARY_PATH=`pwd` ldd liba_.so
28 liba.so => /tmp/liba.so (0xb7f44000)
29 libc.so.6 => /lib/i686/libc.so.6 (0xb7de2000)
30 libpcreposix.so.0 => /usr/lib/libpcreposix.so.0 (0xb7de0000)
31 libpcre.so.0 => /lib/libpcre.so.0 (0xb7db8000)
32
33 one can see -lc has been added. confirmed by:
34
35 % gcc -nostdlib -shared -o liba_.so liba.so
36 % LD_LIBRARY_PATH=`pwd` ldd liba_.so
37 liba.so => /tmp/liba.so (0xb7f19000)
38 libpcreposix.so.0 => /usr/lib/libpcreposix.so.0 (0xb7f03000)
39 libc.so.6 => /lib/i686/libc.so.6 (0xb7db5000)
40 libpcre.so.0 => /lib/libpcre.so.0 (0xb7d8d000)
41
42 but using -nostdlib is harder when building a binary... hence the need
43 to force -lpcreposix at each linking steps:
44
45 % gcc -shared -o liba_.so liba.so -lpcreposix
46 % LD_LIBRARY_PATH=`pwd` ldd liba_.so
47 liba.so => /tmp/liba.so (0xb7f9f000)
48 libpcreposix.so.0 => /usr/lib/libpcreposix.so.0 (0xb7f89000)
49 libc.so.6 => /lib/i686/libc.so.6 (0xb7e3b000)
50 libpcre.so.0 => /lib/libpcre.so.0 (0xb7e13000)
51
52
53 which defeats the idea of DSO which should handle their deps themselves.
54 and such hacks do not play well with --as-needed:
55
56 export LD_LIBRARY_PATH=/tmp
57 cd /tmp
58 echo 'int f() { printf("fa "); }' > liba.c
59 echo 'int f() { printf("fb "); }' > libb.c
60 echo 'int g() { }' >> libb.c
61 echo 'int h() { f(); g(); }' > libx.c
62 echo 'main() { h(); g(); printf("\n"); }' > t.c
63 gcc -o liba.so -shared liba.c
64 gcc -o libb.so -shared libb.c
65 gcc -o libx.so -shared libx.c -L. -la -lb
66 gcc t.c -L. -lx ; ./a.out # fb
67 gcc t.c -L. -lx -la; ./a.out # fa
68 gcc -Wl,--as-needed t.c -L. -lx -la; ./a.out # fb
69
70
71 i wonder if ld could have a warning to detect about multiple symbols
72 in DSO and so tell about possible issues with --as-needed.
73
74 diff -Naurp pcre-8.31/configure.ac pcre-8.31.oden/configure.ac
75 --- pcre-8.31/configure.ac 2012-07-06 11:01:42.000000000 +0200
76 +++ pcre-8.31.oden/configure.ac 2012-07-09 11:22:03.000000000 +0200
77 @@ -19,7 +19,7 @@ m4_define(pcre_date, [2012-07-06])
78 m4_define(libpcre_version, [3:0:2])
79 m4_define(libpcre16_version, [2:0:2])
80 m4_define(libpcre32_version, [0:0:0])
81 -m4_define(libpcreposix_version, [0:1:0])
82 +m4_define(libpcreposix_version, [1:0:0])
83 m4_define(libpcrecpp_version, [0:0:0])
84
85 AC_PREREQ(2.57)
86 diff -Naurp pcre-8.31/pcreposix.h pcre-8.31.oden/pcreposix.h
87 --- pcre-8.31/pcreposix.h 2012-07-09 11:22:23.000000000 +0200
88 +++ pcre-8.31.oden/pcreposix.h 2012-07-09 11:21:24.000000000 +0200
89 @@ -133,14 +133,19 @@ file. */
90
91 /* The functions */
92
93 -PCREPOSIX_EXP_DECL int regcomp(regex_t *, const char *, int);
94 -PCREPOSIX_EXP_DECL int regexec(const regex_t *, const char *, size_t,
95 +PCREPOSIX_EXP_DECL int pcreposix_regcomp(regex_t *, const char *, int);
96 +PCREPOSIX_EXP_DECL int pcreposix_regexec(const regex_t *, const char *, size_t,
97 regmatch_t *, int);
98 -PCREPOSIX_EXP_DECL size_t regerror(int, const regex_t *, char *, size_t);
99 -PCREPOSIX_EXP_DECL void regfree(regex_t *);
100 +PCREPOSIX_EXP_DECL size_t pcreposix_regerror(int, const regex_t *, char *, size_t);
101 +PCREPOSIX_EXP_DECL void pcreposix_regfree(regex_t *);
102
103 #ifdef __cplusplus
104 } /* extern "C" */
105 #endif
106
107 +#define regcomp pcreposix_regcomp
108 +#define regexec pcreposix_regexec
109 +#define regerror pcreposix_regerror
110 +#define regfree pcreposix_regfree
111 +
112 #endif /* End of pcreposix.h */

  ViewVC Help
Powered by ViewVC 1.1.26