Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 403827 - dev-util/valgrind: broken when CFLAGS=-Os, works with -O2 on ppc32
Summary: dev-util/valgrind: broken when CFLAGS=-Os, works with -O2 on ppc32
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: PPC Linux
: Normal normal
Assignee: Anthony Basile
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 393461
  Show dependency tree
 
Reported: 2012-02-15 08:02 UTC by hiyuh
Modified: 2012-07-25 13:11 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
/var/tmp/portage/dev-util/valgrind-3.6.1-r2/temp/automake.out (automake.out,874 bytes, text/plain)
2012-02-17 00:58 UTC, hiyuh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hiyuh 2012-02-15 08:02:07 UTC
even if w/ work around like:

 $ cat /etc/portage/env/ggdb+splitdebug
 CFLAGS="${CFLAGS} -ggdb"
 CXXFLAGS="${CXXFLAGS} -ggdb"
 FEATURES="${FEATURES} splitdebug"

 $ cat /etc/portage/package.env
 dev-util/valgrind ggdb+splitdebug
 sys-libs/glibc ggdb+splitdebug

i got:

 * 3.3.1, 3.4.0, 3.4.1, 3.4.1-r1, 3.5.0, 3.5.0-r1, 3.6.0, 3.6.1
   i've not tried these version.
   please let me know if i should try.

 * 3.3.1-r1
   compile fails b/c it wasn't patched for linux-3 and glibc-2.14.

 * 3.6.1-r2
   even fix for automake bug (see Bug 403779),
   it has runtime failure, just seg faults.

   $ valgrind
   Segmentation fault
 
 * 3.7.0-r3
   it has runtime failure like:

    $ cat hello.c
    #include <stdio.h>
    
    int main(int argc, char *argv[]) {
            printf("Hello, world!\n");
            return 0;
    }

    $ gcc -O0 -ggdb -o hello hello.c

    $ ./hello
    Hello, world!

    $ valgrind
    valgrind: no program specified
    valgrind: Use --help for more information.

    $ valgrind ./hello
    ==9282== Memcheck, a memory error detector
    ==9282== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
    ==9282== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
    ==9282== Command: ./hello
    ==9282==

    * hang up w/ 100% CPU usage *

    * press ctrl-c to terminate *

    ^C==9282== Jump to the invalid address stated on the next line
    ==9282==    at 0x814: ???
    ==9282==    by 0xFFBAFDF: memcpy (mc_replace_strmem.c:839)
    ==9282==    by 0x400619F: local_strdup (dl-load.c:167)
    ==9282==    by 0x400975B: _dl_map_object (dl-load.c:2245)
    ==9282==    by 0x400D3A3: openaux (dl-deps.c:65)
    ==9282==    by 0x400F11F: _dl_catch_error (dl-error.c:178)
    ==9282==    by 0x400D5FB: _dl_map_object_deps (dl-deps.c:247)
    ==9282==    by 0x4004073: dl_main (rtld.c:1817)
    ==9282==    by 0x4015473: _dl_sysdep_start (dl-sysdep.c:244)
    ==9282==    by 0x4005973: _dl_start_final (rtld.c:336)
    ==9282==    by 0x4005C8B: _dl_start (rtld.c:564)
    ==9282==    by 0x401777F: _start (in /lib/ld-2.14.1.so)
    ==9282==  Address 0x814 is not stack'd, malloc'd or (recently) free'd
    ==9282==
    ==9282==
    ==9282== Process terminating with default action of signal 11 (SIGSEGV)
    ==9282==  Bad permissions for mapped region at address 0x814
    ==9282==    at 0x814: ???
    ==9282==    by 0xFFBAFDF: memcpy (mc_replace_strmem.c:839)
    ==9282==    by 0x400619F: local_strdup (dl-load.c:167)
    ==9282==    by 0x400975B: _dl_map_object (dl-load.c:2245)
    ==9282==    by 0x400D3A3: openaux (dl-deps.c:65)
    ==9282==    by 0x400F11F: _dl_catch_error (dl-error.c:178)
    ==9282==    by 0x400D5FB: _dl_map_object_deps (dl-deps.c:247)
    ==9282==    by 0x4004073: dl_main (rtld.c:1817)
    ==9282==    by 0x4015473: _dl_sysdep_start (dl-sysdep.c:244)
    ==9282==    by 0x4005973: _dl_start_final (rtld.c:336)
    ==9282==    by 0x4005C8B: _dl_start (rtld.c:564)
    ==9282==    by 0x401777F: _start (in /lib/ld-2.14.1.so)
    ==9282==
    ==9282== HEAP SUMMARY:
    ==9282==     in use at exit: 0 bytes in 0 blocks
    ==9282==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
    ==9282==
    ==9282== All heap blocks were freed -- no leaks are possible
    ==9282==
    ==9282== For counts of detected and suppressed errors, rerun with: -v
    ==9282== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 2)
    Segmentation fault

    $ valgrind --tool=massif ./hello
    ==9298== Massif, a heap profiler
    ==9298== Copyright (C) 2003-2011, and GNU GPL'd, by Nicholas Nethercote
    ==9298== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
    ==9298== Command: ./hello
    ==9298==
    ./hello: symbol lookup error: /usr/lib/valgrind/vgpreload_massif-ppc32-linux.so: undefined symbol: _restgpr_29_x
    ==9298==
    ==9298== Process terminating with default action of signal 11 (SIGSEGV)
    ==9298==  Bad permissions for mapped region at address 0x814
    ==9298==    at 0x814: ???
    ==9298==    by 0x4019553: _Exit (_exit.c:29)
    ==9298==    by 0x400EF67: _dl_signal_error (dl-error.c:122)
    ==9298==    by 0x400F093: _dl_signal_cerror (dl-error.c:152)
    ==9298==    by 0x400B657: _dl_lookup_symbol_x (dl-lookup.c:782)
    ==9298==    by 0x400CBDF: _dl_relocate_object (dl-machine.h:308)
    ==9298==    by 0x4004467: dl_main (rtld.c:2269)
    ==9298==    by 0x4015473: _dl_sysdep_start (dl-sysdep.c:244)
    ==9298==    by 0x4005973: _dl_start_final (rtld.c:336)
    ==9298==    by 0x4005C8B: _dl_start (rtld.c:564)
    ==9298==    by 0x401777F: _start (in /lib/ld-2.14.1.so)
    ==9298==


Reproducible: Always

Steps to Reproduce:
see above Desctiption.
Actual Results:  
no usable dev-util/valgrind on ~ppc

Expected Results:  
usable dev-util/valgrind exists on ~ppc

FYI, my emerge --info is:

Portage 2.1.10.46 (default/linux/powerpc/ppc32/10.0, gcc-4.5.3, glibc-2.14.1-r2, 3.2.5-gentoo ppc)
=================================================================
System uname: Linux-3.2.5-gentoo-ppc-7447A,_altivec_supported-with-gentoo-2.1
Timestamp of tree: Wed, 15 Feb 2012 06:45:01 +0000
ccache version 3.1.7 [enabled]
app-shells/bash:          4.2_p20
dev-lang/python:          2.7.2-r3, 3.2.2
dev-util/ccache:          3.1.7
dev-util/cmake:           2.8.7-r3
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.1
sys-apps/openrc:          0.9.8.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.68
sys-devel/automake:       1.10.3, 1.11.3
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.5.3-r2
sys-devel/gcc-config:     1.5-r2
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 3.2 (virtual/os-headers)
sys-libs/glibc:           2.14.1-r2
Repositories: gentoo x-crossdev hiyuh
ACCEPT_KEYWORDS="ppc ~ppc"
ACCEPT_LICENSE="* -@EULA"
CBUILD="powerpc-unknown-linux-gnu"
CFLAGS="-Os -mcpu=G4 -mtune=G4 -maltivec -mabi=altivec -Wall"
CHOST="powerpc-unknown-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-Os -mcpu=G4 -mtune=G4 -maltivec -mabi=altivec -Wall"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--quiet=n --quiet-build=n"
FEATURES="assume-digests binpkg-logs ccache collision-protect distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
FFLAGS=""
GENTOO_MIRRORS="        http://gentoo.channelx.biz/     http://gentoo.gg3.net/  ftp://gg3.net/pub/linux/gentoo/         ftp://ftp.iij.ad.jp/pub/linux/gentoo/   http://ftp.iij.ad.jp/pub/linux/gentoo/  rsync://ftp.iij.ad.jp/pub/linux/gentoo/         http://ftp.jaist.ac.jp/pub/Linux/Gentoo/        rsync://ftp.jaist.ac.jp/pub/Linux/Gentoo/       ftp://ftp.jaist.ac.jp/pub/Linux/Gentoo/ "
LANG="ja_JP.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en ja"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/overlay/crossdev /usr/local/overlay/hiyuh"
SYNC="rsync://rsync.jp.gentoo.org/gentoo-portage"
USE="X acl altivec bash-completion berkdb bzip2 caps cjk cli cracklib crypt cxx dri fontconfig fortran gdbm gif gpm gtk3 iconv icu jbig jpeg jpeg2k lzma modules mudflap ncurses nls nptl nptlonly opengl openmp png ppc readline session ssl svg sysfs t1lib tcpd threads tiff truetype unicode vim-syntax xcb xft xorg zlib" ALSA_CARDS="aoa aoa-fabric-layout aoa-onyx aoa-soundbus aoa-soundbus-i2s aoa-tas aoa-toonie" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LINGUAS="en ja" RUBY_TARGETS="ruby19" USERLAND="GNU" VIDEO_CARDS="fbdev radeon r200"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 hiyuh 2012-02-15 10:39:36 UTC
*sigh*, replacing -Os to -O2 solves this bug. (see also Bug 403767)
3.7.0-r3 w/ -O2 works fine.
Comment 2 Anthony Basile gentoo-dev 2012-02-15 22:49:22 UTC
How is -Os making its way into the build?  Is it defined in your /etc/make.conf?
Comment 3 hiyuh 2012-02-17 00:58:50 UTC
Created attachment 302225 [details]
/var/tmp/portage/dev-util/valgrind-3.6.1-r2/temp/automake.out
Comment 4 hiyuh 2012-02-17 01:01:44 UTC
(In reply to comment #3)
> Created attachment 302225 [details]
> /var/tmp/portage/dev-util/valgrind-3.6.1-r2/temp/automake.out

oops, i did bombing error.
this should be done for Bug 403779.
Comment 5 hiyuh 2012-02-17 01:13:57 UTC
(In reply to comment #2)
> How is -Os making its way into the build?  Is it defined in your
> /etc/make.conf?

sorry for my bad english skill, you mean "where does -Os come from?"
or "can you show me build.log?"?

for former, i added -Os into CFLAGS of /etc/make.conf.
and you see my emerge --info (see comment #1) has -OS in CFLAGS/CXXFLAGS.

for latter, i've tried many versions.
for global warming abatement, could you mind to specify version,
CFLAGS and etc? :)
Comment 6 Anthony Basile gentoo-dev 2012-07-25 13:11:53 UTC
valgrind + compiler optimization = badness.  While in an ideal world we would like to have all the flags work, I doubt its going to happen.