<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://sourceware.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="4.4+"
          urlbase="http://sourceware.org/bugzilla/"
          
          maintainer="overseers@sourceware.org"
>

    <bug>
          <bug_id>4822</bug_id>
          
          <creation_ts>2007-07-21 11:21:00 +0000</creation_ts>
          <short_desc>grow_heap: static linking warns about madvise() not implemented</short_desc>
          <delta_ts>2012-02-17 07:57:12 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>glibc</product>
          <component>hurd</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Samuel Thibault">samuel.thibault</reporter>
          <assigned_to name="Roland McGrath">roland</assigned_to>
          <cc>glibc-bugs</cc>
    
    <cc>tschwinge</cc>
          <cf_gcchost></cf_gcchost>
          <cf_gcctarget></cf_gcctarget>
          <cf_gccbuild></cf_gccbuild>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>18141</commentid>
    <comment_count>0</comment_count>
    <who name="Samuel Thibault">samuel.thibault</who>
    <bug_when>2007-07-21 11:21:09 +0000</bug_when>
    <thetext>When statically linking on a system on which madvise() wasn&apos;t ported, the linker complains:

/bin/../lib/gcc/i486-gnu/4.0.4/../../../libcrt.a(malloc.o): In function `grow_heap&apos;:
(.text+0x3t4): warning: warning: madvise is not implemented and will always fail

should there really be such linker warning for madvise() whose failure doesn&apos;t have any semantic consequences, just no boost of performance?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>53157</commentid>
    <comment_count>1</comment_count>
    <who name="Joseph Myers">jsm28</who>
    <bug_when>2012-02-15 21:49:01 +0000</bug_when>
    <thetext>As I understand it this is an issue with glibc for Hurd, not for architectures in ports.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>53163</commentid>
    <comment_count>2</comment_count>
    <who name="Roland McGrath">roland</who>
    <bug_when>2012-02-15 22:16:29 +0000</bug_when>
    <thetext>Should be fixed in trunk, but I didn&apos;t actually try to compile for Hurd.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>53201</commentid>
    <comment_count>3</comment_count>
    <who name="joseph@codesourcery.com">joseph</who>
    <bug_when>2012-02-16 12:57:48 +0000</bug_when>
    <thetext>It appears to be current practice that the person committing a patch 
fixing a (non-ports) bug should also add that bug to the list in the NEWS 
file, so 4822 should be added there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>53231</commentid>
    <comment_count>4</comment_count>
    <who name="Thomas Schwinge">tschwinge</who>
    <bug_when>2012-02-17 07:57:12 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Should be fixed in trunk, but I didn&apos;t actually try to compile for Hurd.

I fixed it up for you in commit 9078ce930afda8bbcba6fe860a13ca62abcf2742.
;-)

Errors and warnings were:

    gcc-4.4 malloc.c [...]
    [...]
    In file included from ../include/sys/mman.h:2,
                     from malloc.c:1754:
    ../misc/sys/mman.h:95: error: expected identifier or &apos;(&apos; before &apos;void&apos;
    ../misc/sys/mman.h:95: error: expected &apos;)&apos; before &apos;(&apos; token
    [...]
    make[3]: *** [/media/erich/home/thomas/tmp/glibc/debian/madvise/eglibc-2.13/build-tree/hurd-i386-libc/malloc/malloc.o] Error 1
    make[3]: Leaving directory `/media/erich/home/thomas/tmp/glibc/debian/madvise/eglibc-2.13/malloc&apos;
    make[2]: *** [malloc/subdir_lib] Error 2

(Poor GCC, seeing that ``prototype&apos;&apos;.)  After fixing that:

    In file included from malloc.c:2567:
    arena.c: In function &apos;shrink_heap&apos;:
    arena.c:823: warning: left-hand operand of comma expression has no effect
    arena.c:823: warning: left-hand operand of comma expression has no effect
    malloc.c: In function &apos;mTRIm&apos;:
    malloc.c:5874: warning: left-hand operand of comma expression has no effect
    malloc.c:5874: warning: left-hand operand of comma expression has no effect

Now the situation is as follows:

    $ echo &apos;int main() { }&apos; | gcc -o /dev/null -x c -
    $ echo &apos;int main() { madvise (); }&apos; | gcc -o /dev/null -x c -
    $ echo &apos;int main() { }&apos; | gcc -o /dev/null -static -x c -
    $ echo &apos;int main() { madvise (); }&apos; | gcc -o /dev/null -static -x c -
    /tmp/cce05X6t.o: In function `main&apos;:
    :(.text+0x7): warning: warning: madvise is not implemented and will always fail

That is, in the -static case, we only get the warning if madvise is
actively being used in the user code, but not due to glibc&apos;s own usage in
malloc.


Joseph already had amended the NEWS file.


Samuel, you can now replace the Debian glibc patch with
d2c736f809690dd69f1cade53a61b99e401bb0e3 and
9078ce930afda8bbcba6fe860a13ca62abcf2742.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>