]> git.pld-linux.org Git - packages/valgrind.git/blob - valgrind-3.11.0-wrapmalloc.patch
- rel 2; wrap malloc calls; no rdrand; from FC
[packages/valgrind.git] / valgrind-3.11.0-wrapmalloc.patch
1 commit 13693666bd9fc7be37a907302e5d3d4f4b2c9358
2 Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
3 Date:   Sun Nov 15 16:50:43 2015 +0000
4
5     BZ#355188 valgrind should intercept all malloc related global functions.
6     
7     This implements the interception of all globally public allocation
8     functions by default. It works by adding a flag to the spec to say the
9     interception only applies to global functions. Which is set for the
10     somalloc spec. The librarypath to match is set to "*" unless the user
11     overrides it. Then each DiSym keeps track of whether the symbol is local
12     or global. For a spec which has isGlobal set only isGlobal symbols will
13     match.
14     
15     Note that because of padding to keep the addresses in DiSym aligned the
16     addition of the extra bool isGlobal doesn't actually grow the struct.
17     The comments explain how the struct could be made more compact on 32bit
18     systems, but this isn't as easy on 64bit systems. So I didn't try to do
19     that in this patch.
20     
21     For ELF symbols keeping track of which are global is trivial. For pdb I
22     had to guess and made only the "Public" symbols global. I don't know
23     how/if macho keeps track of global symbols or not. For now I just mark
24     all of them local (which just means things work as previously on platforms
25     that use machos, no non-system symbols are matches by default for somalloc
26     unless the user explicitly tells which library name to match).
27     
28     Included are two testcases for shared libraries (wrapmalloc) and staticly
29     linked (wrapmallocstatic) malloc/free overrides that depend on the new
30     default. One existing testcase (new_override) was adjusted to explicitly
31     not use the new somalloc default because it depends on a user defined
32     new implementation that has side-effects and should explicitly not be
33     intercepted.
34     
35     git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15726 a5019735-40e9-0310-863c-91ae7b9d1cf9
36
37 diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c
38 index 6f11cd2..4dc1129 100644
39 --- a/coregrind/m_debuginfo/debuginfo.c
40 +++ b/coregrind/m_debuginfo/debuginfo.c
41 @@ -4306,7 +4306,8 @@ void VG_(DebugInfo_syms_getidx) ( const DebugInfo *si,
42                                    /*OUT*/const HChar**   pri_name,
43                                    /*OUT*/const HChar***  sec_names,
44                                    /*OUT*/Bool*     isText,
45 -                                  /*OUT*/Bool*     isIFunc )
46 +                                  /*OUT*/Bool*     isIFunc,
47 +                                  /*OUT*/Bool*     isGlobal )
48  {
49     vg_assert(idx >= 0 && idx < si->symtab_used);
50     if (avmas)     *avmas     = si->symtab[idx].avmas;
51 @@ -4315,6 +4316,7 @@ void VG_(DebugInfo_syms_getidx) ( const DebugInfo *si,
52     if (sec_names) *sec_names = si->symtab[idx].sec_names;
53     if (isText)    *isText    = si->symtab[idx].isText;
54     if (isIFunc)   *isIFunc   = si->symtab[idx].isIFunc;
55 +   if (isGlobal)  *isGlobal  = si->symtab[idx].isGlobal;
56  }
57  
58  
59 diff --git a/coregrind/m_debuginfo/priv_storage.h b/coregrind/m_debuginfo/priv_storage.h
60 index aa1d9f9..a43720a 100644
61 --- a/coregrind/m_debuginfo/priv_storage.h
62 +++ b/coregrind/m_debuginfo/priv_storage.h
63 @@ -75,14 +75,18 @@ typedef
64                              the macros defined in pub_core_debuginfo.h */
65        const HChar*  pri_name;  /* primary name, never NULL */
66        const HChar** sec_names; /* NULL, or a NULL term'd array of other names */
67 -      // XXX: this could be shrunk (on 32-bit platforms) by using 30
68 -      // bits for the size and 1 bit each for isText and isIFunc.  If you
69 -      // do this, make sure that all assignments to the latter two use
70 -      // 0 or 1 (or True or False), and that a positive number larger
71 -      // than 1 is never used to represent True.
72 +      // XXX: DiSym could be shrunk (on 32-bit platforms to exactly 16
73 +      // bytes, on 64-bit platforms the first 3 pointers already add
74 +      // up to 24 bytes, so size plus bits will extend to 32 bytes
75 +      // anyway) by using 29 bits for the size and 1 bit each for
76 +      // isText, isIFunc and isGlobal.  If you do this, make sure that
77 +      // all assignments to the latter two use 0 or 1 (or True or
78 +      // False), and that a positive number larger than 1 is never
79 +      // used to represent True.
80        UInt    size;    /* size in bytes */
81        Bool    isText;
82        Bool    isIFunc; /* symbol is an indirect function? */
83 +      Bool    isGlobal; /* Is this symbol globally visible? */
84     }
85     DiSym;
86  
87 diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c
88 index 0861725..3820965 100644
89 --- a/coregrind/m_debuginfo/readelf.c
90 +++ b/coregrind/m_debuginfo/readelf.c
91 @@ -241,7 +241,8 @@ Bool get_elf_symbol_info (
92          Bool*   from_opd_out,   /* ppc64be-linux only: did we deref an
93                                    .opd entry? */
94          Bool*   is_text_out,    /* is this a text symbol? */
95 -        Bool*   is_ifunc        /* is this a  STT_GNU_IFUNC function ?*/
96 +        Bool*   is_ifunc_out,   /* is this a STT_GNU_IFUNC function ?*/
97 +        Bool*   is_global_out   /* is this a global symbol ?*/
98       )
99  {
100     Bool plausible;
101 @@ -259,7 +260,8 @@ Bool get_elf_symbol_info (
102     SET_TOCPTR_AVMA(*sym_avmas_out, 0);   /* default to unknown/inapplicable */
103     SET_LOCAL_EP_AVMA(*sym_avmas_out, 0); /* default to unknown/inapplicable */
104     *from_opd_out      = False;
105 -   *is_ifunc          = False;
106 +   *is_ifunc_out      = False;
107 +   *is_global_out     = False;
108  
109     /* Get the symbol size, but restrict it to fit in a signed 32 bit
110        int.  Also, deal with the stupid case of negative size by making
111 @@ -373,10 +375,14 @@ Bool get_elf_symbol_info (
112     /* Check for indirect functions. */
113     if (*is_text_out
114         && ELFXX_ST_TYPE(sym->st_info) == STT_GNU_IFUNC) {
115 -       *is_ifunc = True;
116 +      *is_ifunc_out = True;
117     }
118  #  endif
119  
120 +   if (ELFXX_ST_BIND(sym->st_info) == STB_GLOBAL) {
121 +      *is_global_out = True;
122 +   }
123 +
124  #  if defined(VGP_ppc64be_linux)
125     /* Allow STT_NOTYPE in the very special case where we're running on
126        ppc64be-linux and the symbol is one which the .opd-chasing hack
127 @@ -777,6 +783,7 @@ void read_elf_symtab__normal(
128        SymAVMAs sym_avmas_really;
129        Int    sym_size = 0;
130        Bool   from_opd = False, is_text = False, is_ifunc = False;
131 +      Bool   is_global = False;
132        DiOffT sym_name_really = DiOffT_INVALID;
133        sym_avmas_really.main = 0;
134        SET_TOCPTR_AVMA(sym_avmas_really, 0);
135 @@ -787,7 +794,7 @@ void read_elf_symtab__normal(
136                                &sym_name_really, 
137                                &sym_avmas_really,
138                                &sym_size,
139 -                              &from_opd, &is_text, &is_ifunc)) {
140 +                              &from_opd, &is_text, &is_ifunc, &is_global)) {
141  
142           DiSym  disym;
143           VG_(memset)(&disym, 0, sizeof(disym));
144 @@ -799,6 +806,7 @@ void read_elf_symtab__normal(
145           disym.size      = sym_size;
146           disym.isText    = is_text;
147           disym.isIFunc   = is_ifunc;
148 +         disym.isGlobal  = is_global;
149           if (cstr) { ML_(dinfo_free)(cstr); cstr = NULL; }
150           vg_assert(disym.pri_name);
151           vg_assert(GET_TOCPTR_AVMA(disym.avmas) == 0);
152 @@ -847,6 +855,7 @@ typedef
153        Bool       from_opd;
154        Bool       is_text;
155        Bool       is_ifunc;
156 +      Bool       is_global;
157     }
158     TempSym;
159  
160 @@ -911,6 +920,7 @@ void read_elf_symtab__ppc64be_linux(
161        SymAVMAs sym_avmas_really;
162        Int    sym_size = 0;
163        Bool   from_opd = False, is_text = False, is_ifunc = False;
164 +      Bool   is_global = False;
165        DiOffT sym_name_really = DiOffT_INVALID;
166        DiSym  disym;
167        VG_(memset)(&disym, 0, sizeof(disym));
168 @@ -923,7 +933,7 @@ void read_elf_symtab__ppc64be_linux(
169                                &sym_name_really, 
170                                &sym_avmas_really,
171                                &sym_size,
172 -                              &from_opd, &is_text, &is_ifunc)) {
173 +                              &from_opd, &is_text, &is_ifunc, &is_global)) {
174  
175           /* Check if we've seen this (name,addr) key before. */
176           key.addr = sym_avmas_really.main;
177 @@ -996,6 +1006,7 @@ void read_elf_symtab__ppc64be_linux(
178              elem->from_opd = from_opd;
179              elem->is_text  = is_text;
180              elem->is_ifunc = is_ifunc;
181 +            elem->is_global = is_global;
182              VG_(OSetGen_Insert)(oset, elem);
183              if (di->trace_symtab) {
184                 HChar* str = ML_(img_strdup)(escn_strtab->img, "di.respl.2",
185 @@ -1034,14 +1045,17 @@ void read_elf_symtab__ppc64be_linux(
186        disym.size      = elem->size;
187        disym.isText    = elem->is_text;
188        disym.isIFunc   = elem->is_ifunc;
189 +      disym.isGlobal  = elem->is_global;
190        if (cstr) { ML_(dinfo_free)(cstr); cstr = NULL; }
191        vg_assert(disym.pri_name != NULL);
192  
193        ML_(addSym) ( di, &disym );
194        if (di->trace_symtab) {
195 -         VG_(printf)("    rec(%c) [%4ld]:          "
196 +         VG_(printf)("    rec(%c%c%c) [%4ld]:          "
197                       "   val %#010lx, toc %#010lx, sz %4d  %s\n",
198                       disym.isText ? 't' : 'd',
199 +                     disym.isIFunc ? 'i' : '-',
200 +                     disym.isGlobal ? 'g' : 'l',
201                       i,
202                       disym.avmas.main,
203                       GET_TOCPTR_AVMA(disym.avmas),
204 diff --git a/coregrind/m_debuginfo/readmacho.c b/coregrind/m_debuginfo/readmacho.c
205 index 98ab048..3d406a4 100644
206 --- a/coregrind/m_debuginfo/readmacho.c
207 +++ b/coregrind/m_debuginfo/readmacho.c
208 @@ -365,6 +365,7 @@ void read_symtab( /*OUT*/XArray* /* DiSym */ syms,
209                           di->text_avma+di->text_size - sym_addr;
210        disym.isText     = True;
211        disym.isIFunc    = False;
212 +      disym.isGlobal   = False;
213        // Lots of user function names get prepended with an underscore.  Eg. the
214        // function 'f' becomes the symbol '_f'.  And the "below main"
215        // function is called "start".  So we skip the leading underscore, and
216 diff --git a/coregrind/m_debuginfo/readpdb.c b/coregrind/m_debuginfo/readpdb.c
217 index 8b63e95..1ebf863 100644
218 --- a/coregrind/m_debuginfo/readpdb.c
219 +++ b/coregrind/m_debuginfo/readpdb.c
220 @@ -1272,6 +1272,7 @@ static ULong DEBUG_SnarfCodeView(
221                               // FIXME: .namelen is sizeof(.data) including .name[]
222              vsym.isText    = (sym->generic.id == S_PUB_V1);
223              vsym.isIFunc   = False;
224 +            vsym.isGlobal  = True;
225              ML_(addSym)( di, &vsym );
226              n_syms_read++;
227           }
228 @@ -1299,6 +1300,7 @@ static ULong DEBUG_SnarfCodeView(
229              vsym.isText    = !!(IMAGE_SCN_CNT_CODE 
230                                  & sectp[sym->data_v2.segment-1].Characteristics);
231              vsym.isIFunc   = False;
232 +            vsym.isGlobal  = True;
233              ML_(addSym)( di, &vsym );
234              n_syms_read++;
235           }
236 @@ -1332,6 +1334,7 @@ static ULong DEBUG_SnarfCodeView(
237              vsym.isText    = !!(IMAGE_SCN_CNT_CODE
238                                  & sectp[sym->data_v2.segment-1].Characteristics);
239              vsym.isIFunc   = False;
240 +            vsym.isGlobal  = True;
241              ML_(addSym)( di, &vsym );
242              n_syms_read++;
243           }
244 @@ -1365,6 +1368,7 @@ static ULong DEBUG_SnarfCodeView(
245           vsym.size      = sym->proc_v1.proc_len;
246           vsym.isText    = True;
247           vsym.isIFunc   = False;
248 +         vsym.isGlobal  = sym->generic.id == S_GPROC_V1;
249           if (debug)
250              VG_(umsg)("  Adding function %s addr=%#lx length=%u\n",
251                        symname, vsym.avmas.main, vsym.size );
252 @@ -1386,6 +1390,7 @@ static ULong DEBUG_SnarfCodeView(
253           vsym.size      = sym->proc_v2.proc_len;
254           vsym.isText    = True;
255           vsym.isIFunc   = False;
256 +         vsym.isGlobal  = sym->generic.id == S_GPROC_V2;
257           if (debug)
258              VG_(umsg)("  Adding function %s addr=%#lx length=%u\n",
259                        symname, vsym.avmas.main, vsym.size );
260 @@ -1408,6 +1413,7 @@ static ULong DEBUG_SnarfCodeView(
261              vsym.size      = sym->proc_v3.proc_len;
262              vsym.isText    = 1;
263              vsym.isIFunc   = False;
264 +            vsym.isGlobal  = sym->generic.id == S_GPROC_V3;
265              ML_(addSym)( di, &vsym );
266              n_syms_read++;
267           }
268 diff --git a/coregrind/m_debuginfo/storage.c b/coregrind/m_debuginfo/storage.c
269 index 45bc135..7b2e26a 100644
270 --- a/coregrind/m_debuginfo/storage.c
271 +++ b/coregrind/m_debuginfo/storage.c
272 @@ -98,10 +98,11 @@ void ML_(ppSym) ( Int idx, const DiSym* sym )
273     vg_assert(sym->pri_name);
274     if (sec_names)
275        vg_assert(sec_names);
276 -   VG_(printf)( "%5d:  %c%c %#8lx .. %#8lx (%u)      %s%s",
277 +   VG_(printf)( "%5d:  %c%c%c %#8lx .. %#8lx (%u)      %s%s",
278                  idx,
279                  sym->isText ? 'T' : '-',
280                  sym->isIFunc ? 'I' : '-',
281 +                sym->isGlobal ? 'G' : '-',
282                  sym->avmas.main, 
283                  sym->avmas.main + sym->size - 1, sym->size,
284                  sym->pri_name, sec_names ? " " : "" );
285 @@ -1646,7 +1647,7 @@ static void canonicaliseSymtab ( struct _DebugInfo* di )
286     Word  i, j, n_truncated;
287     Addr  sta1, sta2, end1, end2, toc1, toc2;
288     const HChar *pri1, *pri2, **sec1, **sec2;
289 -   Bool  ist1, ist2, isf1, isf2;
290 +   Bool  ist1, ist2, isf1, isf2, isg1, isg2;
291  
292  #  define SWAP(ty,aa,bb) \
293        do { ty tt = (aa); (aa) = (bb); (bb) = tt; } while (0)
294 @@ -1693,6 +1694,8 @@ static void canonicaliseSymtab ( struct _DebugInfo* di )
295              }
296              /* mark w as an IFunc if either w or r are */
297              di->symtab[w].isIFunc = di->symtab[w].isIFunc || di->symtab[r].isIFunc;
298 +            /* likewise for global symbols */
299 +            di->symtab[w].isGlobal = di->symtab[w].isGlobal || di->symtab[r].isGlobal;
300              /* and use ::pri_names to indicate this slot is no longer in use */
301              di->symtab[r].pri_name = NULL;
302              if (di->symtab[r].sec_names) {
303 @@ -1796,6 +1799,7 @@ static void canonicaliseSymtab ( struct _DebugInfo* di )
304        sec1 = di->symtab[i].sec_names;
305        ist1 = di->symtab[i].isText;
306        isf1 = di->symtab[i].isIFunc;
307 +      isg1 = di->symtab[i].isGlobal;
308  
309        sta2 = di->symtab[i+1].avmas.main;
310        end2 = sta2 + di->symtab[i+1].size - 1;
311 @@ -1805,6 +1809,7 @@ static void canonicaliseSymtab ( struct _DebugInfo* di )
312        sec2 = di->symtab[i+1].sec_names;
313        ist2 = di->symtab[i+1].isText;
314        isf2 = di->symtab[i+1].isIFunc;
315 +      isg2 = di->symtab[i+1].isGlobal;
316  
317        if (sta1 < sta2) {
318           end1 = sta2 - 1;
319 @@ -1814,7 +1819,7 @@ static void canonicaliseSymtab ( struct _DebugInfo* di )
320              sta1 = end2 + 1;
321              SWAP(Addr,sta1,sta2); SWAP(Addr,end1,end2); SWAP(Addr,toc1,toc2);
322              SWAP(const HChar*,pri1,pri2); SWAP(const HChar**,sec1,sec2);
323 -            SWAP(Bool,ist1,ist2); SWAP(Bool,isf1,isf2);
324 +            SWAP(Bool,ist1,ist2); SWAP(Bool,isf1,isf2); SWAP(Bool, isg1, isg2);
325           } else 
326           if (end1 < end2) {
327              sta2 = end1 + 1;
328 @@ -1831,6 +1836,7 @@ static void canonicaliseSymtab ( struct _DebugInfo* di )
329        di->symtab[i].sec_names = sec1;
330        di->symtab[i].isText    = ist1;
331        di->symtab[i].isIFunc   = isf1;
332 +      di->symtab[i].isGlobal  = isg1;
333  
334        di->symtab[i+1].avmas.main = sta2;
335        di->symtab[i+1].size       = end2 - sta2 + 1;
336 @@ -1840,6 +1846,7 @@ static void canonicaliseSymtab ( struct _DebugInfo* di )
337        di->symtab[i+1].sec_names = sec2;
338        di->symtab[i+1].isText    = ist2;
339        di->symtab[i+1].isIFunc   = isf2;
340 +      di->symtab[i+1].isGlobal  = isg2;
341  
342        vg_assert(sta1 <= sta2);
343        vg_assert(di->symtab[i].size > 0);
344 diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c
345 index 7e4df8d..3d3f70a 100644
346 --- a/coregrind/m_redir.c
347 +++ b/coregrind/m_redir.c
348 @@ -233,6 +233,7 @@ typedef
349        HChar* from_fnpatt;  /* from fnname pattern  */
350        Addr   to_addr;      /* where redirecting to */
351        Bool   isWrap;       /* wrap or replacement? */
352 +      Bool   isGlobal;     /* must the symbol to replace be global? */
353        Int    becTag; /* 0 through 9999.  Behavioural equivalance class tag.
354                          If two wrappers have the same (non-zero) tag, they
355                          are promising that they behave identically. */
356 @@ -388,7 +389,7 @@ static HChar const* advance_to_comma ( HChar const* c ) {
357  
358  void VG_(redir_notify_new_DebugInfo)( const DebugInfo* newdi )
359  {
360 -   Bool         ok, isWrap;
361 +   Bool         ok, isWrap, isGlobal;
362     Int          i, nsyms, becTag, becPrio;
363     Spec*        specList;
364     Spec*        spec;
365 @@ -518,13 +519,14 @@ void VG_(redir_notify_new_DebugInfo)( const DebugInfo* newdi )
366     for (i = 0; i < nsyms; i++) {
367        VG_(DebugInfo_syms_getidx)( newdi, i, &sym_avmas,
368                                    NULL, &sym_name_pri, &sym_names_sec,
369 -                                  &isText, NULL );
370 +                                  &isText, NULL, NULL );
371        /* Set up to conveniently iterate over all names for this symbol. */
372        const HChar*  twoslots[2];
373        const HChar** names_init =
374           alloc_symname_array(sym_name_pri, sym_names_sec, &twoslots[0]);
375        const HChar** names;
376        for (names = names_init; *names; names++) {
377 +         isGlobal = False;
378           ok = VG_(maybe_Z_demangle)( *names,
379                                       &demangled_sopatt,
380                                       &demangled_fnpatt,
381 @@ -579,15 +581,12 @@ void VG_(redir_notify_new_DebugInfo)( const DebugInfo* newdi )
382                 have a matching lib synonym, then replace the sopatt.
383                 Otherwise, just ignore this redirection spec. */
384  
385 -            if (!VG_(clo_soname_synonyms))
386 -               continue; // No synonyms => skip the redir.
387 -
388              /* Search for a matching synonym=newname*/
389              SizeT const sopatt_syn_len 
390                 = VG_(strlen)(demangled_sopatt+VG_SO_SYN_PREFIX_LEN);
391              HChar const* last = VG_(clo_soname_synonyms);
392              
393 -            while (*last) {
394 +            while (last != NULL && *last) {
395                 HChar const* first = last;
396                 last = advance_to_equal(first);
397                 
398 @@ -611,6 +610,17 @@ void VG_(redir_notify_new_DebugInfo)( const DebugInfo* newdi )
399                    last++;
400              }
401              
402 +           // If the user didn't set it then somalloc is special. We
403 +           // want to match public/global symbols that match the
404 +           // fnpatt everywhere.
405 +           if (replaced_sopatt == NULL
406 +               && VG_(strcmp) ( demangled_sopatt, SO_SYN_MALLOC_NAME ) == 0)
407 +             {
408 +               replaced_sopatt = VG_(strdup)("m_redir.rnnD.1", "*");
409 +               demangled_sopatt = replaced_sopatt;
410 +               isGlobal = True;
411 +             }
412 +
413              // If we have not replaced the sopatt, then skip the redir.
414              if (replaced_sopatt == NULL)
415                 continue;
416 @@ -621,6 +631,7 @@ void VG_(redir_notify_new_DebugInfo)( const DebugInfo* newdi )
417           spec->from_fnpatt = dinfo_strdup("redir.rnnD.3", demangled_fnpatt);
418           spec->to_addr = sym_avmas.main;
419           spec->isWrap = isWrap;
420 +         spec->isGlobal = isGlobal;
421           spec->becTag = becTag;
422           spec->becPrio = becPrio;
423           /* check we're not adding manifestly stupid destinations */
424 @@ -653,7 +664,7 @@ void VG_(redir_notify_new_DebugInfo)( const DebugInfo* newdi )
425        for (i = 0; i < nsyms; i++) {
426           VG_(DebugInfo_syms_getidx)( newdi, i, &sym_avmas,
427                                       NULL, &sym_name_pri, &sym_names_sec,
428 -                                     &isText, NULL );
429 +                                     &isText, NULL, NULL );
430           const HChar*  twoslots[2];
431           const HChar** names_init =
432              alloc_symname_array(sym_name_pri, sym_names_sec, &twoslots[0]);
433 @@ -785,7 +796,7 @@ void generate_and_add_actives (
434       )
435  {
436     Spec*   sp;
437 -   Bool    anyMark, isText, isIFunc;
438 +   Bool    anyMark, isText, isIFunc, isGlobal;
439     Active  act;
440     Int     nsyms, i;
441     SymAVMAs  sym_avmas;
442 @@ -813,7 +824,7 @@ void generate_and_add_actives (
443     for (i = 0; i < nsyms; i++) {
444        VG_(DebugInfo_syms_getidx)( di, i, &sym_avmas,
445                                    NULL, &sym_name_pri, &sym_names_sec,
446 -                                  &isText, &isIFunc );
447 +                                  &isText, &isIFunc, &isGlobal );
448        const HChar*  twoslots[2];
449        const HChar** names_init =
450           alloc_symname_array(sym_name_pri, sym_names_sec, &twoslots[0]);
451 @@ -827,7 +838,8 @@ void generate_and_add_actives (
452           for (sp = specs; sp; sp = sp->next) {
453              if (!sp->mark)
454                 continue; /* soname doesn't match */
455 -            if (VG_(string_match)( sp->from_fnpatt, *names )) {
456 +            if (VG_(string_match)( sp->from_fnpatt, *names )
457 +               && (sp->isGlobal == False || isGlobal == True)) {
458                 /* got a new binding.  Add to collection. */
459                 act.from_addr   = sym_avmas.main;
460                 act.to_addr     = sp->to_addr;
461 @@ -1220,6 +1232,7 @@ static void add_hardwired_spec (const  HChar* sopatt, const HChar* fnpatt,
462     spec->from_fnpatt = CONST_CAST(HChar *,fnpatt);
463     spec->to_addr     = to_addr;
464     spec->isWrap      = False;
465 +   spec->isGlobal    = False;
466     spec->mandatory   = mandatory;
467     /* VARIABLE PARTS */
468     spec->mark        = False; /* not significant */
469 @@ -1719,7 +1732,7 @@ static void handle_require_text_symbols ( const DebugInfo* di )
470           const HChar** sym_names_sec = NULL;
471           VG_(DebugInfo_syms_getidx)( di, j, NULL,
472                                       NULL, &sym_name_pri, &sym_names_sec,
473 -                                     &isText, NULL );
474 +                                     &isText, NULL, NULL );
475           const HChar*  twoslots[2];
476           const HChar** names_init =
477              alloc_symname_array(sym_name_pri, sym_names_sec, &twoslots[0]);
478 @@ -1773,10 +1786,11 @@ static void handle_require_text_symbols ( const DebugInfo* di )
479  static void show_spec ( const HChar* left, const Spec* spec )
480  {
481     VG_(message)( Vg_DebugMsg, 
482 -                 "%s%-25s %-30s %s-> (%04d.%d) 0x%08lx\n",
483 +                 "%s%-25s %-30s %s%s-> (%04d.%d) 0x%08lx\n",
484                   left,
485                   spec->from_sopatt, spec->from_fnpatt,
486                   spec->isWrap ? "W" : "R",
487 +                 spec->isGlobal ? "G" : "L",
488                   spec->becTag, spec->becPrio,
489                   spec->to_addr );
490  }
491 diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c
492 index ccac130..3c79c8a 100644
493 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c
494 +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c
495 @@ -291,7 +291,6 @@ static void init(void);
496  // For some lines, we will also define a replacement function
497  // whose only purpose is to be a soname synonym place holder
498  // that can be replaced using --soname-synonyms.
499 -#define SO_SYN_MALLOC VG_SO_SYN(somalloc)
500  
501  // malloc
502  #if defined(VGO_linux)
503 diff --git a/coregrind/pub_core_debuginfo.h b/coregrind/pub_core_debuginfo.h
504 index b698f2c..8f26f25 100644
505 --- a/coregrind/pub_core_debuginfo.h
506 +++ b/coregrind/pub_core_debuginfo.h
507 @@ -216,7 +216,8 @@ void VG_(DebugInfo_syms_getidx)  ( const DebugInfo *di,
508                                     /*OUT*/const HChar**   pri_name,
509                                     /*OUT*/const HChar***  sec_names,
510                                     /*OUT*/Bool*     isText,
511 -                                   /*OUT*/Bool*     isIFunc );
512 +                                   /*OUT*/Bool*     isIFunc,
513 +                                   /*OUT*/Bool*     isGlobal );
514  /* ppc64-linux only: find the TOC pointer (R2 value) that should be in
515     force at the entry point address of the function containing
516     guest_code_addr.  Returns 0 if not known. */
517 diff --git a/docs/xml/manual-core.xml b/docs/xml/manual-core.xml
518 index edda8a1..c80aab0 100644
519 --- a/docs/xml/manual-core.xml
520 +++ b/docs/xml/manual-core.xml
521 @@ -2315,18 +2315,26 @@ need to use them.</para>
522        <option><![CDATA[--soname-synonyms=syn1=pattern1,syn2=pattern2,...]]></option>
523      </term>
524      <listitem>
525 -      <para>When a shared library is loaded, Valgrind checks for 
526 -      functions in the library that must be replaced or wrapped.
527 -      For example, Memcheck replaces all malloc related
528 -      functions (malloc, free, calloc, ...) with its own versions.
529 -      Such replacements are done by default only in shared libraries whose
530 -      soname matches a predefined soname pattern (e.g.
531 -      <varname>libc.so*</varname> on linux).
532 -      By default, no replacement is done for a statically linked
533 -      library or for alternative libraries such as tcmalloc.
534 +      <para>When a shared library is loaded, Valgrind checks for
535 +      functions in the library that must be replaced or wrapped.  For
536 +      example, Memcheck replaces some string and memory functions
537 +      (strchr, strlen, strcpy, memchr, memcpy, memmove, etc.) with its
538 +      own versions.  Such replacements are normally done only in shared
539 +      libraries whose soname matches a predefined soname pattern (e.g.
540 +      <varname>libc.so*</varname> on linux).  By default, no
541 +      replacement is done for a statically linked library or for
542 +      alternative libraries, except for the allocation functions
543 +      (malloc, free, calloc, memalign, realloc, operator new, operator
544 +      delete, etc.) Such allocation functions are intercepted by
545 +      default in any shared library or in the executable if they are
546 +      exported as global symbols. This means that if a replacement
547 +      allocation library such as tcmalloc is found, its functions are
548 +      also intercepted by default.
549 +
550        In some cases, the replacements allow
551        <option>--soname-synonyms</option> to specify one additional
552 -      synonym pattern, giving flexibility in the replacement. </para>
553 +      synonym pattern, giving flexibility in the replacement.  Or to
554 +      prevent interception of all public allocation symbols.</para>
555  
556        <para>Currently, this flexibility is only allowed for the
557        malloc related functions, using the
558 @@ -2339,27 +2347,31 @@ need to use them.</para>
559          <listitem>
560  
561            <para>Alternate malloc library: to replace the malloc
562 -          related functions in an alternate library with
563 -          soname <varname>mymalloclib.so</varname>, give the
564 +          related functions in a specific alternate library with
565 +          soname <varname>mymalloclib.so</varname> (and not in any
566 +          others), give the
567            option <option>--soname-synonyms=somalloc=mymalloclib.so</option>.
568            A pattern can be used to match multiple libraries sonames.
569            For
570            example, <option>--soname-synonyms=somalloc=*tcmalloc*</option>
571 -          will match the soname of all variants of the tcmalloc library
572 -          (native, debug, profiled, ... tcmalloc variants). </para>
573 +          will match the soname of all variants of the tcmalloc
574 +          library (native, debug, profiled, ... tcmalloc
575 +          variants). </para>
576            <para>Note: the soname of a elf shared library can be
577            retrieved using the readelf utility. </para>
578  
579          </listitem>
580  
581          <listitem>
582 -          <para>Replacements in a statically linked library are done by
583 -          using the <varname>NONE</varname> pattern. For example, if
584 -          you link with <varname>libtcmalloc.a</varname>, memcheck 
585 -          will properly work when you give the
586 -          option <option>--soname-synonyms=somalloc=NONE</option>.  Note
587 -          that a NONE pattern will match the main executable and any
588 -          shared library having no soname. </para>
589 +          <para>Replacements in a statically linked library are done
590 +          by using the <varname>NONE</varname> pattern. For example,
591 +          if you link with <varname>libtcmalloc.a</varname>, and only
592 +          want to intercept the malloc related functions in the
593 +          executable (and standard libraries) themselves, but not any
594 +          other shared libraries, you can give the
595 +          option <option>--soname-synonyms=somalloc=NONE</option>.
596 +          Note that a NONE pattern will match the main executable and
597 +          any shared library having no soname. </para>
598          </listitem>
599  
600          <listitem>
601 @@ -2369,6 +2381,17 @@ need to use them.</para>
602            </para>
603          </listitem>
604  
605 +       <listitem>
606 +         <para>To only intercept allocation symbols in the default
607 +         system libraries, but not in any other shared library or the
608 +         executable defining public malloc or operator new related
609 +         functions use a non-existing library name
610 +         like <option>--soname-synonyms=somalloc=nouserintercepts</option>
611 +         (where <varname>nouserintercepts</varname> can be any
612 +         non-existing library name).
613 +         </para>
614 +       </listitem>
615 +
616        </itemizedlist>
617     </listitem>
618    </varlistentry>
619 diff --git a/include/pub_tool_redir.h b/include/pub_tool_redir.h
620 index bac00d7..21d186b 100644
621 --- a/include/pub_tool_redir.h
622 +++ b/include/pub_tool_redir.h
623 @@ -345,6 +345,12 @@
624  #define VG_SO_SYN_PREFIX     "VgSoSyn"
625  #define VG_SO_SYN_PREFIX_LEN 7
626  
627 +// Special soname synonym place holder for the malloc symbols that can
628 +// be replaced using --soname-synonyms.  Otherwise will match all
629 +// public symbols in any shared library/executable.
630 +#define SO_SYN_MALLOC VG_SO_SYN(somalloc)
631 +#define SO_SYN_MALLOC_NAME "VgSoSynsomalloc"
632 +
633  #endif   // __PUB_TOOL_REDIR_H
634  
635  /*--------------------------------------------------------------------*/
636 diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am
637 index 68d9ca1..0f34127 100644
638 --- a/memcheck/tests/Makefile.am
639 +++ b/memcheck/tests/Makefile.am
640 @@ -291,6 +291,9 @@ EXTRA_DIST = \
641         wrap7.vgtest wrap7.stdout.exp wrap7.stderr.exp \
642         wrap8.vgtest wrap8.stdout.exp wrap8.stderr.exp \
643         wrap8.stdout.exp-ppc64 wrap8.stderr.exp-ppc64 \
644 +       wrapmalloc.vgtest wrapmalloc.stdout.exp wrapmalloc.stderr.exp \
645 +       wrapmallocstatic.vgtest wrapmallocstatic.stdout.exp \
646 +       wrapmallocstatic.stderr.exp \
647         writev1.stderr.exp writev1.stderr.exp-solaris writev1.vgtest \
648         xml1.stderr.exp xml1.stdout.exp xml1.vgtest xml1.stderr.exp-s390x-mvc \
649         threadname.vgtest threadname.stderr.exp \
650 @@ -375,6 +378,7 @@ check_PROGRAMS = \
651         wcs \
652         xml1 \
653         wrap1 wrap2 wrap3 wrap4 wrap5 wrap6 wrap7 wrap7so.so wrap8 \
654 +       wrapmalloc wrapmallocso.so wrapmallocstatic \
655         writev1
656  
657  if !SOLARIS_SUN_STUDIO_AS
658 @@ -570,4 +574,26 @@ else
659                                 -Wl,-soname -Wl,wrap7so.so
660  endif
661  
662 +# Build shared object for wrapmalloc
663 +wrapmalloc_SOURCES           = wrapmalloc.c
664 +wrapmalloc_DEPENDENCIES      = wrapmallocso.so
665 +if VGCONF_OS_IS_DARWIN
666 + wrapmalloc_LDADD            = `pwd`/wrapmallocso.so
667 + wrapmalloc_LDFLAGS          = $(AM_FLAG_M3264_PRI)
668 +else
669 + wrapmalloc_LDADD            = wrapmallocso.so
670 + wrapmalloc_LDFLAGS          = $(AM_FLAG_M3264_PRI) \
671 +                               -Wl,-rpath,$(top_builddir)/memcheck/tests
672 +endif
673 +
674 +wrapmallocso_so_SOURCES      = wrapmallocso.c
675 +wrapmallocso_so_CFLAGS       = $(AM_CFLAGS) -fpic
676 +if VGCONF_OS_IS_DARWIN
677 + wrapmallocso_so_LDFLAGS     = -fpic $(AM_FLAG_M3264_PRI) -dynamic \
678 +                               -dynamiclib -all_load
679 +else
680 + wrapmallocso_so_LDFLAGS     = -fpic $(AM_FLAG_M3264_PRI) -shared \
681 +                               -Wl,-soname -Wl,wrapmallocso.so
682 +endif
683 +
684  xml1_CFLAGS             = $(AM_CFLAGS) -D_GNU_SOURCE
685 diff --git a/memcheck/tests/new_override.vgtest b/memcheck/tests/new_override.vgtest
686 index 50e6240..435e330 100644
687 --- a/memcheck/tests/new_override.vgtest
688 +++ b/memcheck/tests/new_override.vgtest
689 @@ -1,2 +1,6 @@
690  prog: new_override
691 +# Don't override the user defined somalloc functions in this test.
692 +# The test depends on some side effects and initializing memory done by
693 +# the user overidden operator new.
694 +vgopts: --soname-synonyms=somalloc=nouseroverride
695  stderr_filter: filter_allocs
696 diff --git a/memcheck/tests/wrapmalloc.c b/memcheck/tests/wrapmalloc.c
697 new file mode 100644
698 index 0000000..2307e77
699 --- /dev/null
700 +++ b/memcheck/tests/wrapmalloc.c
701 @@ -0,0 +1,14 @@
702 +#include <stdio.h>
703 +#include <stdlib.h>
704 +
705 +/* Test that a program that has malloc/free interposed in a shared
706 +   library is also intercepted. */
707 +
708 +int main ( void )
709 +{
710 +   printf ("start\n");
711 +   void *p = malloc (1024);
712 +   free (p);
713 +   printf ("done\n");
714 +   return 0;
715 +}
716 diff --git a/memcheck/tests/wrapmalloc.stderr.exp b/memcheck/tests/wrapmalloc.stderr.exp
717 new file mode 100644
718 index 0000000..d937776
719 --- /dev/null
720 +++ b/memcheck/tests/wrapmalloc.stderr.exp
721 @@ -0,0 +1,10 @@
722 +
723 +
724 +HEAP SUMMARY:
725 +    in use at exit: 0 bytes in 0 blocks
726 +  total heap usage: 1 allocs, 1 frees, 1,024 bytes allocated
727 +
728 +For a detailed leak analysis, rerun with: --leak-check=full
729 +
730 +For counts of detected and suppressed errors, rerun with: -v
731 +ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
732 diff --git a/memcheck/tests/wrapmalloc.stdout.exp b/memcheck/tests/wrapmalloc.stdout.exp
733 new file mode 100644
734 index 0000000..60b5fd2
735 --- /dev/null
736 +++ b/memcheck/tests/wrapmalloc.stdout.exp
737 @@ -0,0 +1,2 @@
738 +start
739 +done
740 diff --git a/memcheck/tests/wrapmalloc.vgtest b/memcheck/tests/wrapmalloc.vgtest
741 new file mode 100644
742 index 0000000..a6dff4e
743 --- /dev/null
744 +++ b/memcheck/tests/wrapmalloc.vgtest
745 @@ -0,0 +1,2 @@
746 +prog: wrapmalloc
747 +
748 diff --git a/memcheck/tests/wrapmallocso.c b/memcheck/tests/wrapmallocso.c
749 new file mode 100644
750 index 0000000..985ce56
751 --- /dev/null
752 +++ b/memcheck/tests/wrapmallocso.c
753 @@ -0,0 +1,17 @@
754 +#include <stdio.h>
755 +#include <stdlib.h>
756 +
757 +/* Fake malloc/free functions that just print something. When run
758 +   under memcheck these functions will be intercepted and not print
759 +   anything. */
760 +
761 +void *malloc ( size_t size )
762 +{
763 +  printf ("malloc\n");
764 +  return NULL;
765 +}
766 +
767 +void free (void *ptr)
768 +{
769 +  printf ("free\n");
770 +}
771 diff --git a/memcheck/tests/wrapmallocstatic.c b/memcheck/tests/wrapmallocstatic.c
772 new file mode 100644
773 index 0000000..be6573b
774 --- /dev/null
775 +++ b/memcheck/tests/wrapmallocstatic.c
776 @@ -0,0 +1,29 @@
777 +#include <stdio.h>
778 +#include <stdlib.h>
779 +
780 +/* Test that a program that has malloc/free interposed in the
781 +   executable is also intercepted. */
782 +
783 +int main ( void )
784 +{
785 +   printf ("start\n");
786 +   void *p = malloc (1024);
787 +   free (p);
788 +   printf ("done\n");
789 +   return 0;
790 +}
791 +
792 +/* Fake malloc/free functions that just print something. When run
793 +   under memcheck these functions will be intercepted and not print
794 +   anything. */
795 +
796 +void *malloc ( size_t size )
797 +{
798 +  printf ("malloc\n");
799 +  return NULL;
800 +}
801 +
802 +void free (void *ptr)
803 +{
804 +  printf ("free\n");
805 +}
806 diff --git a/memcheck/tests/wrapmallocstatic.stderr.exp b/memcheck/tests/wrapmallocstatic.stderr.exp
807 new file mode 100644
808 index 0000000..d937776
809 --- /dev/null
810 +++ b/memcheck/tests/wrapmallocstatic.stderr.exp
811 @@ -0,0 +1,10 @@
812 +
813 +
814 +HEAP SUMMARY:
815 +    in use at exit: 0 bytes in 0 blocks
816 +  total heap usage: 1 allocs, 1 frees, 1,024 bytes allocated
817 +
818 +For a detailed leak analysis, rerun with: --leak-check=full
819 +
820 +For counts of detected and suppressed errors, rerun with: -v
821 +ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
822 diff --git a/memcheck/tests/wrapmallocstatic.stdout.exp b/memcheck/tests/wrapmallocstatic.stdout.exp
823 new file mode 100644
824 index 0000000..60b5fd2
825 --- /dev/null
826 +++ b/memcheck/tests/wrapmallocstatic.stdout.exp
827 @@ -0,0 +1,2 @@
828 +start
829 +done
830 diff --git a/memcheck/tests/wrapmallocstatic.vgtest b/memcheck/tests/wrapmallocstatic.vgtest
831 new file mode 100644
832 index 0000000..7b3c068
833 --- /dev/null
834 +++ b/memcheck/tests/wrapmallocstatic.vgtest
835 @@ -0,0 +1,2 @@
836 +prog: wrapmallocstatic
837 +
838 diff -ur valgrind-3.11.0.orig/memcheck/tests/Makefile.in valgrind-3.11.0/memcheck/tests/Makefile.in
839 --- valgrind-3.11.0.orig/memcheck/tests/Makefile.in     2015-11-15 18:08:05.457930383 +0100
840 +++ valgrind-3.11.0/memcheck/tests/Makefile.in  2015-11-15 18:14:10.828008973 +0100
841 @@ -185,7 +185,8 @@
842         vcpu_fnfns$(EXEEXT) wcs$(EXEEXT) xml1$(EXEEXT) wrap1$(EXEEXT) \
843         wrap2$(EXEEXT) wrap3$(EXEEXT) wrap4$(EXEEXT) wrap5$(EXEEXT) \
844         wrap6$(EXEEXT) wrap7$(EXEEXT) wrap7so.so$(EXEEXT) \
845 -       wrap8$(EXEEXT) writev1$(EXEEXT) $(am__EXEEXT_1) \
846 +       wrap8$(EXEEXT) wrapmalloc$(EXEEXT) wrapmallocso.so$(EXEEXT) \
847 +       wrapmallocstatic$(EXEEXT) writev1$(EXEEXT) $(am__EXEEXT_1) \
848         $(am__EXEEXT_2) $(am__EXEEXT_3) $(am__EXEEXT_4) \
849         $(am__EXEEXT_5)
850  
851 @@ -736,6 +737,18 @@
852  wrap8_SOURCES = wrap8.c
853  wrap8_OBJECTS = wrap8.$(OBJEXT)
854  wrap8_LDADD = $(LDADD)
855 +am_wrapmalloc_OBJECTS = wrapmalloc.$(OBJEXT)
856 +wrapmalloc_OBJECTS = $(am_wrapmalloc_OBJECTS)
857 +wrapmalloc_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(wrapmalloc_LDFLAGS) \
858 +       $(LDFLAGS) -o $@
859 +am_wrapmallocso_so_OBJECTS = wrapmallocso_so-wrapmallocso.$(OBJEXT)
860 +wrapmallocso_so_OBJECTS = $(am_wrapmallocso_so_OBJECTS)
861 +wrapmallocso_so_LDADD = $(LDADD)
862 +wrapmallocso_so_LINK = $(CCLD) $(wrapmallocso_so_CFLAGS) $(CFLAGS) \
863 +       $(wrapmallocso_so_LDFLAGS) $(LDFLAGS) -o $@
864 +wrapmallocstatic_SOURCES = wrapmallocstatic.c
865 +wrapmallocstatic_OBJECTS = wrapmallocstatic.$(OBJEXT)
866 +wrapmallocstatic_LDADD = $(LDADD)
867  writev1_SOURCES = writev1.c
868  writev1_OBJECTS = writev1.$(OBJEXT)
869  writev1_LDADD = $(LDADD)
870 @@ -826,7 +839,8 @@
871         $(varinfo5_SOURCES) $(varinfo5so_so_SOURCES) varinfo6.c \
872         varinforestrict.c vcpu_fbench.c vcpu_fnfns.c wcs.c wrap1.c \
873         wrap2.c wrap3.c wrap4.c wrap5.c wrap6.c $(wrap7_SOURCES) \
874 -       $(wrap7so_so_SOURCES) wrap8.c writev1.c xml1.c
875 +       $(wrap7so_so_SOURCES) wrap8.c $(wrapmalloc_SOURCES) \
876 +       $(wrapmallocso_so_SOURCES) wrapmallocstatic.c writev1.c xml1.c
877  DIST_SOURCES = accounting.c addressable.c atomic_incs.c badaddrvalue.c \
878         badfree.c badjump.c badjump2.c badloop.c badpoll.c badrw.c \
879         big_blocks_freed_list.c brk2.c buflen_check.c bug155125.c \
880 @@ -863,7 +877,8 @@
881         $(varinfo5_SOURCES) $(varinfo5so_so_SOURCES) varinfo6.c \
882         varinforestrict.c vcpu_fbench.c vcpu_fnfns.c wcs.c wrap1.c \
883         wrap2.c wrap3.c wrap4.c wrap5.c wrap6.c $(wrap7_SOURCES) \
884 -       $(wrap7so_so_SOURCES) wrap8.c writev1.c xml1.c
885 +       $(wrap7so_so_SOURCES) wrap8.c $(wrapmalloc_SOURCES) \
886 +       $(wrapmallocso_so_SOURCES) wrapmallocstatic.c writev1.c xml1.c
887  RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
888         ctags-recursive dvi-recursive html-recursive info-recursive \
889         install-data-recursive install-dvi-recursive \
890 @@ -1544,6 +1559,9 @@
891         wrap7.vgtest wrap7.stdout.exp wrap7.stderr.exp \
892         wrap8.vgtest wrap8.stdout.exp wrap8.stderr.exp \
893         wrap8.stdout.exp-ppc64 wrap8.stderr.exp-ppc64 \
894 +       wrapmalloc.vgtest wrapmalloc.stdout.exp wrapmalloc.stderr.exp \
895 +       wrapmallocstatic.vgtest wrapmallocstatic.stdout.exp \
896 +       wrapmallocstatic.stderr.exp \
897         writev1.stderr.exp writev1.stderr.exp-solaris writev1.vgtest \
898         xml1.stderr.exp xml1.stdout.exp xml1.vgtest xml1.stderr.exp-s390x-mvc \
899         threadname.vgtest threadname.stderr.exp \
900 @@ -1662,6 +1680,24 @@
901  @VGCONF_OS_IS_DARWIN_TRUE@wrap7so_so_LDFLAGS = -fpic $(AM_FLAG_M3264_PRI) -dynamic \
902  @VGCONF_OS_IS_DARWIN_TRUE@                             -dynamiclib -all_load
903  
904 +
905 +# Build shared object for wrapmalloc
906 +wrapmalloc_SOURCES = wrapmalloc.c
907 +wrapmalloc_DEPENDENCIES = wrapmallocso.so
908 +@VGCONF_OS_IS_DARWIN_FALSE@wrapmalloc_LDADD = wrapmallocso.so
909 +@VGCONF_OS_IS_DARWIN_TRUE@wrapmalloc_LDADD = `pwd`/wrapmallocso.so
910 +@VGCONF_OS_IS_DARWIN_FALSE@wrapmalloc_LDFLAGS = $(AM_FLAG_M3264_PRI) \
911 +@VGCONF_OS_IS_DARWIN_FALSE@                            -Wl,-rpath,$(top_builddir)/memcheck/tests
912 +
913 +@VGCONF_OS_IS_DARWIN_TRUE@wrapmalloc_LDFLAGS = $(AM_FLAG_M3264_PRI)
914 +wrapmallocso_so_SOURCES = wrapmallocso.c
915 +wrapmallocso_so_CFLAGS = $(AM_CFLAGS) -fpic
916 +@VGCONF_OS_IS_DARWIN_FALSE@wrapmallocso_so_LDFLAGS = -fpic $(AM_FLAG_M3264_PRI) -shared \
917 +@VGCONF_OS_IS_DARWIN_FALSE@                            -Wl,-soname -Wl,wrapmallocso.so
918 +
919 +@VGCONF_OS_IS_DARWIN_TRUE@wrapmallocso_so_LDFLAGS = -fpic $(AM_FLAG_M3264_PRI) -dynamic \
920 +@VGCONF_OS_IS_DARWIN_TRUE@                             -dynamiclib -all_load
921 +
922  xml1_CFLAGS = $(AM_CFLAGS) -D_GNU_SOURCE
923  all: all-recursive
924  
925 @@ -2286,6 +2322,18 @@
926         @rm -f wrap8$(EXEEXT)
927         $(AM_V_CCLD)$(LINK) $(wrap8_OBJECTS) $(wrap8_LDADD) $(LIBS)
928  
929 +wrapmalloc$(EXEEXT): $(wrapmalloc_OBJECTS) $(wrapmalloc_DEPENDENCIES) $(EXTRA_wrapmalloc_DEPENDENCIES) 
930 +       @rm -f wrapmalloc$(EXEEXT)
931 +       $(AM_V_CCLD)$(wrapmalloc_LINK) $(wrapmalloc_OBJECTS) $(wrapmalloc_LDADD) $(LIBS)
932 +
933 +wrapmallocso.so$(EXEEXT): $(wrapmallocso_so_OBJECTS) $(wrapmallocso_so_DEPENDENCIES) $(EXTRA_wrapmallocso_so_DEPENDENCIES) 
934 +       @rm -f wrapmallocso.so$(EXEEXT)
935 +       $(AM_V_CCLD)$(wrapmallocso_so_LINK) $(wrapmallocso_so_OBJECTS) $(wrapmallocso_so_LDADD) $(LIBS)
936 +
937 +wrapmallocstatic$(EXEEXT): $(wrapmallocstatic_OBJECTS) $(wrapmallocstatic_DEPENDENCIES) $(EXTRA_wrapmallocstatic_DEPENDENCIES) 
938 +       @rm -f wrapmallocstatic$(EXEEXT)
939 +       $(AM_V_CCLD)$(LINK) $(wrapmallocstatic_OBJECTS) $(wrapmallocstatic_LDADD) $(LIBS)
940 +
941  writev1$(EXEEXT): $(writev1_OBJECTS) $(writev1_DEPENDENCIES) $(EXTRA_writev1_DEPENDENCIES) 
942         @rm -f writev1$(EXEEXT)
943         $(AM_V_CCLD)$(LINK) $(writev1_OBJECTS) $(writev1_LDADD) $(LIBS)
944 @@ -2446,6 +2494,9 @@
945  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wrap7.Po@am__quote@
946  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wrap7so_so-wrap7so.Po@am__quote@
947  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wrap8.Po@am__quote@
948 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wrapmalloc.Po@am__quote@
949 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wrapmallocso_so-wrapmallocso.Po@am__quote@
950 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wrapmallocstatic.Po@am__quote@
951  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/writev1.Po@am__quote@
952  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xml1-xml1.Po@am__quote@
953  
954 @@ -3011,6 +3062,20 @@
955  @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
956  @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(wrap7so_so_CFLAGS) $(CFLAGS) -c -o wrap7so_so-wrap7so.obj `if test -f 'wrap7so.c'; then $(CYGPATH_W) 'wrap7so.c'; else $(CYGPATH_W) '$(srcdir)/wrap7so.c'; fi`
957  
958 +wrapmallocso_so-wrapmallocso.o: wrapmallocso.c
959 +@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(wrapmallocso_so_CFLAGS) $(CFLAGS) -MT wrapmallocso_so-wrapmallocso.o -MD -MP -MF $(DEPDIR)/wrapmallocso_so-wrapmallocso.Tpo -c -o wrapmallocso_so-wrapmallocso.o `test -f 'wrapmallocso.c' || echo '$(srcdir)/'`wrapmallocso.c
960 +@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/wrapmallocso_so-wrapmallocso.Tpo $(DEPDIR)/wrapmallocso_so-wrapmallocso.Po
961 +@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='wrapmallocso.c' object='wrapmallocso_so-wrapmallocso.o' libtool=no @AMDEPBACKSLASH@
962 +@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
963 +@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(wrapmallocso_so_CFLAGS) $(CFLAGS) -c -o wrapmallocso_so-wrapmallocso.o `test -f 'wrapmallocso.c' || echo '$(srcdir)/'`wrapmallocso.c
964 +
965 +wrapmallocso_so-wrapmallocso.obj: wrapmallocso.c
966 +@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(wrapmallocso_so_CFLAGS) $(CFLAGS) -MT wrapmallocso_so-wrapmallocso.obj -MD -MP -MF $(DEPDIR)/wrapmallocso_so-wrapmallocso.Tpo -c -o wrapmallocso_so-wrapmallocso.obj `if test -f 'wrapmallocso.c'; then $(CYGPATH_W) 'wrapmallocso.c'; else $(CYGPATH_W) '$(srcdir)/wrapmallocso.c'; fi`
967 +@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/wrapmallocso_so-wrapmallocso.Tpo $(DEPDIR)/wrapmallocso_so-wrapmallocso.Po
968 +@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='wrapmallocso.c' object='wrapmallocso_so-wrapmallocso.obj' libtool=no @AMDEPBACKSLASH@
969 +@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
970 +@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(wrapmallocso_so_CFLAGS) $(CFLAGS) -c -o wrapmallocso_so-wrapmallocso.obj `if test -f 'wrapmallocso.c'; then $(CYGPATH_W) 'wrapmallocso.c'; else $(CYGPATH_W) '$(srcdir)/wrapmallocso.c'; fi`
971 +
972  xml1-xml1.o: xml1.c
973  @am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xml1_CFLAGS) $(CFLAGS) -MT xml1-xml1.o -MD -MP -MF $(DEPDIR)/xml1-xml1.Tpo -c -o xml1-xml1.o `test -f 'xml1.c' || echo '$(srcdir)/'`xml1.c
974  @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/xml1-xml1.Tpo $(DEPDIR)/xml1-xml1.Po
This page took 0.315529 seconds and 3 git commands to generate.