summaryrefslogtreecommitdiff
path: root/open_issues/glibc_madvise_vs_static_linking.mdwn
blob: bfda0f748e151cf537f0fc8ac2381b2ed2ac10cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
[[!meta copyright="Copyright © 2010, 2011, 2012 Free Software Foundation,
Inc."]]

[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
id="license" text="Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no Invariant
Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of the license
is included in the section entitled [[GNU Free Documentation
License|/fdl]]."]]"""]]

[[!tag open_issue_glibc]]

    $ echo 'int main() {}' | gcc -o /dev/null -static -x c -
    /usr/lib/gcc/i486-gnu/4.4.5/../../../libcrt.a(malloc.o): In function `_int_free':
    (.text+0xdc3): warning: warning: madvise is not implemented and will always fail

This is correct, but it does confuse GNU Autoconf, for example, which then
thinks that static linking is not supported and sets a flag accordingly, which
luckly no / not many packages use.

*This call does not influence the semantics of the application (except in the
case of MADV_DONTNEED), but may influence its performance.  The kernel is free
to ignore the advice.* (`man madvise`), so we may simply want to turn it into a
no-op in glibc, avoiding the link-time warning.

2011-07: This is what Samuel has done for Debian glibc.

GCC c5db973fdab3db3e13db575e5650c0bcfd3630f4 (2011-10-17) makes use of this.
As we now export the symbol (and `MADV_DONTNEED`, too), GCC will no longer
`munmap` pages, but will keep them mapped for later re-use.  This may increase
memory usage.