Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 78951 - [glibc/hardened] glibc can't be built with hardened toolchain on ppc/sparc archs
Summary: [glibc/hardened] glibc can't be built with hardened toolchain on ppc/sparc archs
Status: RESOLVED LATER
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: PPC Linux
: High major (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
: 85868 119818 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-01-21 07:44 UTC by Olivier Castan
Modified: 2006-08-20 07:52 UTC (History)
9 users (show)

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


Attachments
Fix incorrect reference to _rtld_global_ro to _dl_hwcap (glibc-2.3.6-r3-PIE-dl_hwcap.patch,752 bytes, patch)
2006-03-03 12:47 UTC, Kevin F. Quinn (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Castan 2005-01-21 07:44:11 UTC
Build die with :
powerpc-unknown-linux-gnu-gcc -nostdlib -nostartfiles -static -o /home/portage/tmp/portage/glibc-2.3.4.20041102/work/build-default-powerpc-unknown-linux-gnu-linuxthreads/elf/sln   /home/portage/tmp/portage/glibc-2.3.4.20041102/work/build-default-powerpc-unknown-linux-gnu-linuxthreads/csu/crt1.o /home/portage/tmp/portage/glibc-2.3.4.20041102/work/build-default-powerpc-unknown-linux-gnu-linuxthreads/csu/crti.o `powerpc-unknown-linux-gnu-gcc --print-file-name=crtbegin.o` /home/portage/tmp/portage/glibc-2.3.4.20041102/work/build-default-powerpc-unknown-linux-gnu-linuxthreads/elf/sln.o  /home/portage/tmp/portage/glibc-2.3.4.20041102/work/build-default-powerpc-unknown-linux-gnu-linuxthreads/libc.a -lgcc -lgcc_eh /home/portage/tmp/portage/glibc-2.3.4.20041102/work/build-default-powerpc-unknown-linux-gnu-linuxthreads/libc.a `powerpc-unknown-linux-gnu-gcc --print-file-name=crtend.o` /home/portage/tmp/portage/glibc-2.3.4.20041102/work/build-default-powerpc-unknown-linux-gnu-linuxthreads/csu/crtn.o
/home/portage/tmp/portage/glibc-2.3.4.20041102/work/build-default-powerpc-unknown-linux-gnu-linuxthreads/libc.a(__longjmp.o)(.text+0xe): In function `__longjmp@@GLIBC_2.3.4':
: undefined reference to `_rtld_global_ro'
/home/portage/tmp/portage/glibc-2.3.4.20041102/work/build-default-powerpc-unknown-linux-gnu-linuxthreads/libc.a(setjmp.o)(.text+0xb2): In function `__sigsetjmp@@GLIBC_2.3.4':
: undefined reference to `_rtld_global_ro'
collect2: ld returned 1 exit status

Looking at libc.a symbols :
nm build-default-powerpc-unknown-linux-gnu-linuxthreads/libc.a | grep _rtld_global_ro
         U _rtld_global_ro
         U _rtld_global_ro

in setjmp.o and __longjmp.o

_rtld_global_ro is a structure defined in glibc-2.3.3/elf/rtld.c which is only included in ld.so

Running "find glibc-2.3.3/sysdeps/ -type f -exec grep -H _rtld_global_ro {} \;", you get :
glibc-2.3.3/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S:      lwz     r5,_rtld_global_ro@got(r5)
glibc-2.3.3/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S:      lwz     r5,_rtld_global_ro@got(r5)
glibc-2.3.3/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S:   lwz     r5,_rtld_global_ro@got(r5)
glibc-2.3.3/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S:   lwz     r5,_rtld_global_ro@got(r5)
glibc-2.3.3/sysdeps/powerpc/powerpc64/setjmp-common.S:  .tc _rtld_global_ro[TC],_rtld_global_ro
glibc-2.3.3/sysdeps/powerpc/powerpc64/__longjmp-common.S:       .tc _rtld_global_ro[TC],_rtld_global_ro
glibc-2.3.3/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S:    lwz r7,_rtld_global_ro@got(r7)
glibc-2.3.3/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S:    lwz r7,_rtld_global_ro@got(r7)
glibc-2.3.3/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S:     lwz r7,_rtld_global_ro@got(r7)
glibc-2.3.3/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S:     lwz r7,_rtld_global_ro@got(r7)
glibc-2.3.3/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S:    .tc _rtld_global_ro[TC],_rtld_global_ro
glibc-2.3.3/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S:     .tc _rtld_global_ro[TC],_rtld_global_ro
glibc-2.3.3/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S:     .tc _rtld_global_ro[TC],_rtld_global_ro
glibc-2.3.3/sysdeps/generic/ldsodefs.h:#  define GLRO(name) _rtld_global_ro._##name
glibc-2.3.3/sysdeps/generic/ldsodefs.h:extern struct rtld_global_ro _rtld_global_ro
glibc-2.3.3/sysdeps/generic/ldsodefs.h:extern const struct rtld_global_ro _rtld_global_ro

POWERPC is the only architecture using this structure to implement longjmp and setjmp library calls (and swapcontext, getcontext moreover).

Looking at one of these files :
cat glibc-2.3.3/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
[...]
#ifndef __NO_VMX__
#ifdef PIC
        mflr    r6
        bl      _GLOBAL_OFFSET_TABLE_@local-4
        mflr    r5
#ifdef SHARED
        lwz     r5,_rtld_global_ro@got(r5)
        mtlr    r6
        lwz     r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r5)
#else
        lwz     r5,_rtld_global_ro@got(r5)
        mtlr    r6
        lwz     r5,0(r5)
#endif
#else
        lis     r5,_dl_hwcap@ha
        lwz     r5,_dl_hwcap@l(r5)
#endif
        andis.  r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16)
[...]

In __longjmp-common.S and setjump-common.S _rtld_global_ro is used when PIC is defined (for swapcontext and getcontext only when SHARED is defined).
Using hardened toolchain I guess the build try to create PIE execs and so include codes referring to _rtld_global_ro in libc.a which makes the build fail (_rtld_global_ro is present in libc.so.6 but the reference is resolved at dynamic link time since it is present in ld.so)

I can imagine 3 solutions :
- Modify assembly code in __longjmp-common.S and setjump-common.S...
- disable PIE for building glibc on powerpc
- trying to build rtld.o and include it in libc.a, but the build process is too complex for my experience and I've have not been successful right now.

Maybe it's a kind of glibc bug and should reported upstream ?

Reproducible: Always
Steps to Reproduce:




gcc -v
Reading specs from /usr/lib/gcc/powerpc-unknown-linux-gnu/3.4.3/specs
Configured with: /home/portage/tmp/portage/gcc-3.4.3-r1/work/gcc-3.4.3/configure
--enable-version-specific-runtime-libs --prefix=/usr
--bindir=/usr/powerpc-unknown-linux-gnu/gcc-bin/3.4.3
--includedir=/usr/lib/gcc/powerpc-unknown-linux-gnu/3.4.3/include
--datadir=/usr/share/gcc-data/powerpc-unknown-linux-gnu/3.4.3
--mandir=/usr/share/gcc-data/powerpc-unknown-linux-gnu/3.4.3/man
--infodir=/usr/share/gcc-data/powerpc-unknown-linux-gnu/3.4.3/info
--with-gxx-include-dir=/usr/lib/gcc/powerpc-unknown-linux-gnu/3.4.3/include/g++-v3
--host=powerpc-unknown-linux-gnu --enable-altivec --enable-nls
--without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu
--with-system-zlib --disable-checking --disable-werror
--disable-libunwind-exceptions --enable-shared --enable-threads=posix
--disable-multilib --disable-libgcj --enable-languages=c,c++,f77
Thread model: posix
gcc version 3.4.3 20041125 (Gentoo Hardened Linux 3.4.3-r1, ssp-3.4.3-0, pie-8.7.7)

emerge info
Portage 2.0.51-r14 (default-linux/ppc/2004.3, gcc-3.4.3,
glibc-2.3.4.20041102-r0, 2.6.9-gentoo-r9 ppc)
=================================================================
System uname: 2.6.9-gentoo-r9 ppc 7455, altivec supported
Gentoo Base System version 1.6.8
Python:              dev-lang/python-2.3.4 [2.3.4 (#1, Jun  5 2004, 03:19:45)]
dev-lang/python:     2.3.4
sys-devel/autoconf:  2.59-r6, 2.13
sys-devel/automake:  1.5, 1.7.9, 1.6.3, 1.9.4, 1.8.5-r2, 1.4_p6
sys-devel/binutils:  2.15.90.0.3-r4
sys-devel/libtool:   1.5.10-r3
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="ppc ~ppc"
AUTOCLEAN="yes"
CFLAGS="-O2 -pipe -mcpu=7400 -maltivec -mabi=altivec"
CHOST="powerpc-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.1/share/config
/usr/kde/3.2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config
/usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb
/usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -pipe -mcpu=7400 -maltivec -mabi=altivec"
DISTDIR="/home/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms"
GENTOO_MIRRORS="http://gentoo.mirror.sdv.fr http://128.213.5.34/gentoo/
http://gentoo.inode.at/ http://ds.thn.htu.se/linux/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/home/portage/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X X509 aac aalib alsa altivec async berkdb bitmap-fonts bonobo cdparanoia
cdr chroot crypt cups dga dillo directfb divx4linux dlloader dts dv dvd dvdr
dvdread edl encode erandom esd exif f77 faac faad fam fb fbcon ffmpeg fla flac
font-server foomaticdb fortran gd gdbm ggi gif gimpprint gnome gphoto2 gpm
graphviz gs gstreamer gtk gtk2 gtkhtml hal hardened imagemagick imlib java
javascript jp2 jpeg lcms libcaca live lzo lzw lzw-tiff mad mailwrapper matroska
md5sum mime mjpeg mng motif mozilla moznocompose moznoirc moznomail mozsvg mp3
mpeg mpeg4 mplayer ncurses network nls nptl ntlm odbc offensive oggvorbis opengl
pam pdflib perl pg-hier physfs png ppc ppds pthreads python quicktime radeon
readline rtc sdl session sftplogging slang smime speex spell ssl stencil-buffer
svg tcltk tcpd tga theora tiff truetype truetype-fonts type1-fonts usb
userlocales v4l v4l2 wmf xanim xface xine xml xml2 xmms xosd xpm xprint xv xvid
xvmc zlib video_cards_radeon"
Unset:  LDFLAGS
Comment 1 Ferris McCormick (RETIRED) gentoo-dev 2005-01-25 04:47:10 UTC
This is also true on sparc, but for glibc-2.3.3.20040420-r2:  Given
(a) sys-devel/gcc-3.3.5-r1 (hardened);
(b) sys-devel/binutils-2.15.92.0.2-r1 (hardened).

Then, 'emerge -Bv glibc' (with USE=hardened) tries to rebuild glibc-2.3.3.20040420-r2

but fails thus:
===============================
gcc   -nostdlib -nostartfiles -shared -o /homes/home1/tmp/portage/glibc-2.3.3.20040420-r2/work/glibc-2.3.2/buildhere/elf/ld.so			\
	  -Wl,-z,combreloc -Wl,-z,relro -Wl,-z,defs 	\
	  /homes/home1/tmp/portage/glibc-2.3.3.20040420-r2/work/glibc-2.3.2/buildhere/elf/librtld.os -Wl,--version-script=/homes/home1/tmp/portage/glibc-2.3.3.20040420-r2/work/glibc-2.3.2/buildhere/ld.map		\
	  -Wl,-soname=ld-linux.so.2 -T /homes/home1/tmp/portage/glibc-2.3.3.20040420-r2/work/glibc-2.3.2/buildhere/elf/ld.so.lds
/usr/lib/gcc-lib/sparc-unknown-linux-gnu/3.3.5/../../../../sparc-unknown-linux-gnu/bin/ld: BFD 2.15.92.0.2 20040927 assertion fail elf32-sparc.c:2485
/usr/lib/gcc-lib/sparc-unknown-linux-gnu/3.3.5/../../../../sparc-unknown-linux-gnu/bin/ld: /homes/home1/tmp/portage/glibc-2.3.3.20040420-r2/work/glibc-2.3.2/buildhere/elf/librtld.os: probably compiled without -fPIC?
/usr/lib/gcc-lib/sparc-unknown-linux-gnu/3.3.5/../../../../sparc-unknown-linux-gnu/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status

============================================
(Sorry for that mess.  It's trying to build ld.so).

Same sort of failure, but at a different spot.
Comment 2 solar (RETIRED) gentoo-dev 2005-03-18 20:48:49 UTC
try removing the -Wl,-z,relro on ppc32
Comment 3 Olivier Castan 2005-03-20 13:52:21 UTC
The -Wl,-z,relro is in sparc comment, not ppc32.
Comment 4 nixnut (RETIRED) gentoo-dev 2005-03-26 12:29:51 UTC
adding -Wl,-z,relro to filter-ldflags did not help. Same error, only in a different place. 

Tried a different order of emerging, glibc after binutils and gcc. Didn't help either. Nor did using the 2.4 kernel-headers (tested in a freshly emerged system in a chroot)


Portage 2.0.51.19 (hardened/ppc, gcc-3.4.3, glibc-2.3.4.20041102-r1, 2.6.11-hardened-r2 ppc)
=================================================================
System uname: 2.6.11-hardnut-1 ppc 7447A, altivec supported
Gentoo Base System version 1.4.16
Python:              dev-lang/python-2.3.4-r1 [2.3.4 (#1, Mar 25 2005, 18:29:53)]
dev-lang/python:     2.3.4-r1
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.5, 1.8.5-r3, 1.7.9-r1, 1.9.4, 1.6.3, 1.4_p6
sys-devel/binutils:  2.15.90.0.3-r3
sys-devel/libtool:   1.5.10-r4
virtual/os-headers:  2.6.8.1
ACCEPT_KEYWORDS="ppc"
AUTOCLEAN="yes"
CFLAGS="-O2 -mtune=G4 -maltivec -mabi=altivec -fno-strict-aliasing -pipe"
CHOST="powerpc-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -mtune=G4 -maltivec -mabi=altivec -fno-strict-aliasing -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox userpriv usersandbox"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage//packages/ppc/"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage/"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X alsa altivec berkdb cdr crypt cups divx4linux dlloader dvd dvdread esd gdbm gif gtk hardened imagemagick imlib java jpeg ldap motif mpeg ncurses network nls oggvorbis opengl pam perl pic pie png ppc python readline real ssl tcpd theora tiff truetype xml2 xmms xv xvid zlib"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS
Comment 5 Daniel Seyffer 2005-04-13 10:02:52 UTC
Same here on my Ultra5 Sparc with hardened - see output below. 
(I can provide more information if you're interested.)

[...]
gcc   -nostdlib -nostartfiles -shared   \
  -Wl,-z,combreloc -Wl,-z,relro -Wl,-z,defs -Wl,--verbose 2>&1 |        \
          LC_ALL=C \
          sed -e '/^=========/,/^=========/!d;/^=========/d'    \
              -e 's/\. = 0 + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \
          > /daten/tmp/portage/glibc-2.3.3.20040420-r2/work/glibc-2.3.2/buildhere/elf/ld.so.lds
gcc   -nostdlib -nostartfiles -shared -o /daten/tmp/portage/glibc-2.3.3.20040420-r2/work/glibc-2.3.2/build
here/elf/ld.so                        \
          -Wl,-z,combreloc -Wl,-z,relro -Wl,-z,defs     \
          /daten/tmp/portage/glibc-2.3.3.20040420-r2/work/glibc-2.3.2/buildhere/elf/librtld.os -Wl,--versi
on-script=/daten/tmp/portage/glibc-2.3.3.20040420-r2/work/glibc-2.3.2/buildhere/ld.map                \
          -Wl,-soname=ld-linux.so.2 -T /daten/tmp/portage/glibc-2.3.3.20040420-r2/work/glibc-2.3.2/buildhe
re/elf/ld.so.lds
/usr/lib/gcc-lib/sparc-unknown-linux-gnu/3.3.5-20050130/../../../../sparc-unknown-linux-gnu/bin/ld: BFD 2.
15.92.0.2 20040927 assertion fail /daten/tmp/portage/binutils-2.15.92.0.2-r8/work/binutils-2.15.92.0.2/bfd
/elf32-sparc.c:2485
/usr/lib/gcc-lib/sparc-unknown-linux-gnu/3.3.5-20050130/../../../../sparc-unknown-linux-gnu/bin/ld: /daten
/tmp/portage/glibc-2.3.3.20040420-r2/work/glibc-2.3.2/buildhere/elf/librtld.os: probably compiled without
-fPIC?
/usr/lib/gcc-lib/sparc-unknown-linux-gnu/3.3.5-20050130/../../../../sparc-unknown-linux-gnu/bin/ld: final
link failed: Bad value
collect2: ld returned 1 exit status
make[2]: *** [/daten/tmp/portage/glibc-2.3.3.20040420-r2/work/glibc-2.3.2/buildhere/elf/ld.so] Error 1
make[2]: Leaving directory `/daten/tmp/portage/glibc-2.3.3.20040420-r2/work/glibc-2.3.2/elf'
make[1]: *** [elf/subdir_lib] Error 2
make[1]: Leaving directory `/daten/tmp/portage/glibc-2.3.3.20040420-r2/work/glibc-2.3.2'
make: *** [all] Error 2

!!! ERROR: sys-libs/glibc-2.3.3.20040420-r2 failed.
!!! Function src_compile, Line 586, Exitcode 2
!!! (no error message)
!!! If you need support, post the topmost build error, NOT this status message.
Comment 6 solar (RETIRED) gentoo-dev 2005-04-20 10:38:42 UTC
You still need to remove the relro.. filter-ldflags is the wrong spot. You need to 
sed the source code where it appears.
I really don't see how read only reloctions could ever work on PPC32/SPARC 
(both of these arches have incorrect headers which leads to your ELF executables 
being marked RWX vs R
Comment 7 nixnut (RETIRED) gentoo-dev 2005-04-21 13:24:30 UTC
I still need to remove the relro...
Where from? 
Removing those flags from Makeconfig didn't work ./Makeconfig:relro-LDFLAGS = -Wl,-z,relro is the only occasion the string -z,relro occurs


In .configure then? Does libc_cv_z_relro always have to be no here?
./configure:echo $ECHO_N "checking for -z relro option... $ECHO_C" >&6
./configure:if test "${libc_cv_z_relro+set}" = set; then
./configure:    libc_cv_z_relro=no
./configure:  if { ac_try='${CC-cc} -v --help 2>&1|grep "z relro" 1>&5'
./configure:      libc_cv_z_relro=yes
Comment 8 Kevin F. Quinn (RETIRED) gentoo-dev 2005-06-12 04:59:38 UTC
I'd guess the problem is highlighted on hardened systems by the automatic -z,now
with the hardened toolchain.  The executables sln and ldconfig may well have
unresolvable symbols in the general case.  Someone with access to a non-hardened
ppc box could do 'LD_BIND_NOW=1 ldconfig -p' and see if it fails to load.


Comment 9 Luca Barbato gentoo-dev 2005-06-12 06:13:46 UTC
tested on glibc-2.3.5 nptlonly. Works with no issues.
Comment 10 Olivier Castan 2005-06-14 02:30:10 UTC
I'm a bit confused, can you tell me what arch are you talking about in comment
#9  and can you tell me your use flags ?
I think that was a mistake to mix ppc and sparc problems since I'm pretty sure
the source of the problem is different. As I wrote in my submission, it looks
related to structures used for setjmp and longjmp which only present in ppc
archs. The structure used in case of relocatable code are stored in ld.so and so
are missing from libc.a and glibc static binaries can't be built.
Comment 11 Kevin F. Quinn (RETIRED) gentoo-dev 2005-06-14 07:20:07 UTC
ok; here's an update.  With the hardened toolchain, '-fPIE' is switched on by
default (in most situations).  The glibc configure detects that the compiler
sets __PIC__ by default (thanks to the auto-PIE in the hardened specs file) and
adds '-DPIC' when it compiles objects for the static library (normally it only
does this for objects for the shared libraries).  This causes the objects
longjmp and setjmp objects to try to find the dl_hwcap data via the
rtld_global_ro structure, which is only present in the shared library.

The following allows the ebuild to complete:

# export EXTRA_ECONF="pic_default=no"
# emerge sys-libs/glibc

successfully building the static sln & ldconfig, while leaving the other
(non-static) binaries as PIEs.  This causes the glibc build to generate objects
for the static library with -fPIE, but doesn't include code conditional on -DPIC.
Comment 12 Olivier Castan 2005-06-17 08:41:11 UTC
Many thanks it almost worked... the compilation is fine but installation fails
with a lot binaries segfaulting like in bug #92794 and bug #85555
I've tried both "nptl -nptlonly" and "nptl nptlonly"...
Comment 13 nixnut (RETIRED) gentoo-dev 2005-07-03 07:32:59 UTC
(In reply to comment #12)
> Many thanks it almost worked... the compilation is fine but installation fails
> with a lot binaries segfaulting like in bug #92794 and bug #85555
> I've tried both "nptl -nptlonly" and "nptl nptlonly"...

I get the same result (segfaulting binaries all over the place), but I don't
have ntpl or ntplonly in my use flags at all.
Comment 14 Darren Kirby 2005-12-07 21:19:48 UTC
Well, I tried this:  
  
# export EXTRA_ECONF="pic_default=no"  
# emerge sys-libs/glibc  
  
without reading the posts past that say a few binaries are segfaulting...  
  
Well on my system _everything_ is segfaulting. Even 'ls' (though only when I  
invoke '-l' flag)! Both the new python 2.4 and the slotted 2.3 are  
segfaulting, which means I can not emerge anything, though I am not certain  
trying to re-emerge glibc will help, as I am almost certain something in the  
toolchain will segfault too (everything else is).  
  
How did you get around this Olivier, and nixnut? 
 
At this point I am pretty much resigned to a reinstall. Not happy about this, 
as I have already invested 8 human hours, and 24 machine hours in getting this 
installed. 
 
Is the glibc problem even resolved? Will using "-hardened" for glibc allow it 
to build? Do I need to get rid of hardened for the entire platform?  
Comment 15 Olivier Castan 2005-12-08 14:13:18 UTC
Replying to comment #14:
- right now I use a partially hardened ppc Gentoo: I switch to vanilla-gcc to
build glibc and for some builds that make gcc segfault (no backtrace gdb seems
broken and latest valgrind needs a non hardened libgcc.a)
- concerning your problem if you haven't done it, it's sad way to learn that you
should build packages for toolchain builds. If you have a package for glibc you
can just use a boot cd or use bb (the busybox, I had to switch to vanilla-gcc to
build it) and untar it like in stage 1 (beware: despite a broken build emerge
still wants to unmerge the previous glibc, and if you were emerging the same
version it will wipe out your freshly untarred glibc)
- mail me if you don't have any glibc package. I have a G4 ~ppc one (eMac) but
you'll have to wait till tomorrow morning (Paris localtime) because it's located
at my work.
Comment 16 Mark Loeser (RETIRED) gentoo-dev 2005-12-15 13:34:00 UTC
Can you post your `emerge info' if you are still  having a problem with this so
we can see what versions of gcc/binutils/glibc people are talking about?
Comment 17 Olivier Castan 2005-12-16 02:46:21 UTC
Portage 2.0.53 (default-linux/ppc/2005.1/ppc/G4, gcc-3.4.4, glibc-2.3.5-r3,
2.6.14-gentoo-r3 ppc)
=================================================================
System uname: 2.6.14-gentoo-r3 ppc 7455, altivec supported
Gentoo Base System version 1.12.0_pre11
dev-lang/python:     2.3.5, 2.4.2
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1-r1
sys-devel/libtool:   1.5.20-r1
virtual/os-headers:  2.6.11-r3
ACCEPT_KEYWORDS="ppc ~ppc"
AUTOCLEAN="yes"
CBUILD="powerpc-unknown-linux-gnu"
CFLAGS="-O2 -pipe -mcpu=7400 -maltivec -mabi=altivec"
CHOST="powerpc-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.1/share/config
/usr/kde/3.2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config
/usr/kde/3.3/shutdown /usr/kde/3.4/env /usr/kde/3.4/share/config
/usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -pipe -mcpu=7400 -maltivec -mabi=altivec"
DISTDIR="/home/portage/distfiles"
FEATURES="autoconfig distlocks nostrip sandbox sfperms strict"
GENTOO_MIRRORS="http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/
http://mir.zyrianes.net/gentoo/
ftp://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/
http://pandemonium.tiscali.de/pub/gentoo/ ftp://pandemonium.tiscali.de/pub/gentoo/"
LANG="fr_FR.UTF-8"
LINGUAS="en fr"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/home/portage/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="ppc X X509 a52 aac aalib alsa altivec async audiofile bash-completion
berkdb bitmap-fonts bonobo browserplugin bzip2 cairo canvas cdda cddb cdio
cdparanoia cdr chroot crypt cups curl dbus dga dillo directfb dlloader dts dv
dvd dvdr dvdread edl eds emboss encode erandom esd ethereal exif expat faac faad
fam fb fbcon ffmpeg firefox fla flac foomaticdb fortran freetype gd gdbm ggi gif
gimpprint glut gnome gphoto2 gpm graphviz gs gstreamer gtk gtk2 gtkhtml gzip hal
hardened hddtemp hpn idn imagemagick imlib java javascript jp2 jpeg lcms libcaca
libwww live lzo lzw lzw-tiff mad mailwrapper matroska md5sum mime mjpeg mng
motif moznocompose moznoirc moznomail mozsvg mp3 mp4live mpeg mpeg2 mpeg4
mplayer ncurses network nls nptl nsplugin ntlm odbc offensive ogg oggvorbis
opengl pam pcre pdflib perl pg-hier physfs pic pie png ppds pthreads python
quicktime radeon readline rtc sdl session sftplogging slang smime speex spell
ssl stencil-buffer svg sysfs tcltk tcpd tga theora tiff truetype truetype-fonts
type1-fonts udev unicode usb userlocales utf8 v4l v4l2 vorbis wmf xanim xface
xine xml xml2 xmms xosd xpm xv xvid zlib video_cards_radeon linguas_en
linguas_fr userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LC_ALL, LDFLAGS, MAKEOPTS

- emerge sys-libs/glibc build breaks looking for _rtld_global_ro
- EXTRA_ECONF="pic_default=no" emerge sys-libs/glibc build succeed, but
everything dynamically linked with glibc segfault
- I use gcc-config to switch to vanilla-gcc to build a working glibc
Comment 18 Kevin F. Quinn (RETIRED) gentoo-dev 2006-02-23 13:02:38 UTC
*** Bug 119818 has been marked as a duplicate of this bug. ***
Comment 19 Kevin F. Quinn (RETIRED) gentoo-dev 2006-02-23 13:04:23 UTC
reopening to re-assign
Comment 20 Kevin F. Quinn (RETIRED) gentoo-dev 2006-02-23 13:36:01 UTC
*** Bug 85868 has been marked as a duplicate of this bug. ***
Comment 21 Kevin F. Quinn (RETIRED) gentoo-dev 2006-03-03 12:46:21 UTC
Guess what - this is fixed upstream (using the method suggested by Olivier here over a year ago).

2.3.6-r3 is almost there, but has a couple of bugs that were fixed upstream middle of last year in the MAIN branch (i.e. not in 2.3.x); notably it references _rtld_global_ro instead of _dl_hwcap in the PIE sections (PIC && !SHARED).

See versions 1.5 MAIN and 1.6 MAIN of __longjmp-common.S and setjmp-common.S respectivly in sysdeps/powerpc/powerpc32/fpu

I'll attach a little patch just for this shortly.
Comment 22 Kevin F. Quinn (RETIRED) gentoo-dev 2006-03-03 12:47:10 UTC
Created attachment 81231 [details, diff]
Fix incorrect reference to _rtld_global_ro to _dl_hwcap
Comment 23 Disenchanted (RETIRED) gentoo-dev 2006-03-03 14:06:22 UTC
it has indeed been in glibc cvs for some time, if you apply them you can build glibc, and with a hardened compiler kill your system if you merge it :)
so make sure you try them only in a chroot, "ok, now it compiles" 
Comment 24 Gustavo Zacarias (RETIRED) gentoo-dev 2006-08-17 14:51:54 UTC
sparc vanishing, we don't plan on supporting this until some dev wishes to.
Comment 25 SpanKY gentoo-dev 2006-08-19 06:31:30 UTC
the ppc issues should be fixed with glibc-2.4+
Comment 26 Joe Jezak (RETIRED) gentoo-dev 2006-08-20 07:52:06 UTC
Alright, removing ppc from CC then.  Feel free to re-add us if it's still not working.