Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 376843 - [4.5/bad-code] sys-process/procps is broken w/-Os -frename-registers -fpic
Summary: [4.5/bad-code] sys-process/procps is broken w/-Os -frename-registers -fpic
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: PPC Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-29 04:35 UTC by hiyuh
Modified: 2014-11-01 06:50 UTC (History)
1 user (show)

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


Attachments
reduced test case (test.c,823 bytes, text/plain)
2011-11-14 06:08 UTC, SpanKY
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hiyuh 2011-07-29 04:35:11 UTC
ssia.
3.2.8

Reproducible: Always
Comment 1 hiyuh 2011-07-29 04:39:35 UTC
sorry I failed to enter description.

Symptoms which I experienced.
3.2.8-r2 w/ -Os on ~ppc vomits SEGV on running sysctl.
3.2.8_p10-r1 w/ -Os on ~ppc hang up on running top.
3.2.8_p10-r1 w/ -O2 on ~ppc, no problem for top, sysctl or so.

i'd suggest to add "replace-flags -Os -O2".

FYI, my emerge --info:
Portage 2.1.10.7 (default/linux/powerpc/ppc32/10.0, gcc-4.5.2, glibc-2.13-r4, 3.0.0-gentoo ppc)
=================================================================
System uname: Linux-3.0.0-gentoo-ppc-7447A,_altivec_supported-with-gentoo-2.0.3
Timestamp of tree: Fri, 29 Jul 2011 03:15:01 +0000
ccache version 3.1.5 [enabled]
app-shells/bash:          4.2_p10
dev-lang/python:          2.7.2-r2, 3.2-r2
dev-util/ccache:          3.1.5
dev-util/cmake:           2.8.5-r2
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.8.3-r1
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.68
sys-devel/automake:       1.11.1-r1
sys-devel/binutils:       2.21.1
sys-devel/gcc:            4.5.2
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 2.6.38 (virtual/os-headers)
sys-libs/glibc:           2.13-r4
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"
FEATURES="assume-digests binpkg-logs ccache collision-protect distlocks ebuild-locks fixlafiles fixpackages 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 --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 cli cracklib crypt cxx dri fontconfig fortran gdbm 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 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" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="braindump flow karbon kexi kpresenter krita tables words" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en ja" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 2 Matt Turner gentoo-dev 2011-07-29 18:57:41 UTC
It looks like the most important part of this is *ppc* and not *-Os*. Does -Os work on x86/amd64/other architectures?
Comment 3 Agostino Sarubbo gentoo-dev 2011-07-30 04:24:55 UTC
Hi matt

works for me on amd64 with -Os.
Comment 4 Matt Turner gentoo-dev 2011-07-30 17:33:10 UTC
(In reply to comment #3)
> Hi matt
> 
> works for me on amd64 with -Os.

Thanks Agostino. That tells me that it's definitely related to ppc.
Comment 5 SpanKY gentoo-dev 2011-07-30 18:39:34 UTC
more likely a gcc bug ...
Comment 6 hiyuh 2011-08-11 04:42:46 UTC
(In reply to comment #5)
> more likely a gcc bug ...

FYI, i tried gcc-4.5.3, but no effect.
3.2.8_p10-r1 w/ -Os on ~ppc hang up on running top.
3.2.8_p10-r1 w/ -O2 on ~ppc, no problem for top, sysctl or so.
Comment 7 hiyuh 2011-09-27 06:46:03 UTC
FYI, i tried gcc-4.5.3-r1, but no effect.
3.2.8_p11 w/ -Os on ~ppc hang up on running top.
3.2.8_p11 w/ -O2 on ~ppc, no problem for top.
Comment 8 SpanKY gentoo-dev 2011-11-14 06:02:57 UTC
i can reproduce this on a ppc32 with "-Os".  funny enough, adding "-g" causes it to start working.

the hang happens before main() is even called.  seems to be init_libproc() constructor which calls init_Linux_version() which attempts to return, but fails.  seems like it keeps returning to itself.

removing the sscanf() from the func makes a difference.  but the sscanf call looks fine to me.

i'm no ppc asm pro, so i can't easily single step through this stuff and see where it's going wrong.
Comment 9 SpanKY gentoo-dev 2011-11-14 06:08:24 UTC
Created attachment 292467 [details]
reduced test case

$ gcc -Os -pipe test.c -frename-registers -fpic
$ ./a.out
<hang>
Comment 10 hiyuh 2012-01-27 06:18:46 UTC
FYI, i tried gcc-4.5.3-r2.
3.3.2_p2-r1 w/ -Os on ~ppc, no problem for top or so.
Comment 11 Ryan Hill (RETIRED) gentoo-dev 2012-07-15 05:49:54 UTC
If 4.6 doesn't work, care to send this upstream?
Comment 12 SpanKY gentoo-dev 2014-11-01 06:50:32 UTC
afaict, this is fixed with gcc-4.7+