0

We have got a number of legacy Gentoo-based machines and are trying to upgrade them. At least three of these hosts fail with a common error emerging the latest glibc:

x86_64-pc-linux-gnu-gcc -m32 -Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--as-needed  -shared -static-libgcc -Wl,-O1  -Wl,-z,defs -Wl,-dynamic-linker=/lib32/ld-linux.so.2  -B/v
ar/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/csu/  -Wl,--version-script=/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-p
c-linux-gnu-nptl/libc.map -Wl,-soname=libc.so.6 -Wl,-z,combreloc -Wl,-z,relro -nostdlib -nostartfiles -e __libc_main -Wl,-z,now -L/var/tmp/portage/sys-libs/glibc-2.20-r
2/work/build-x86-x86_64-pc-linux-gnu-nptl -L/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/math -L/var/tmp/portage/sys-libs/glibc-2.20-
r2/work/build-x86-x86_64-pc-linux-gnu-nptl/elf -L/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/dlfcn -L/var/tmp/portage/sys-libs/glibc
-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/nss -L/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/nis -L/var/tmp/portage/sys-libs/g
libc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/rt -L/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/resolv -L/var/tmp/portage/sys-
libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/crypt -L/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/nptl -Wl,-rpath-link=
/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl:/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/math:/va
r/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/elf:/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/dlfcn:/
var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/nss:/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/nis:/
var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/rt:/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/resolv
:/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/crypt:/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/n
ptl -o /var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc.so -T /var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux
-gnu-nptl/shlib.lds /var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/csu/abi-note.o /var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x8
6-x86_64-pc-linux-gnu-nptl/elf/soinit.os /var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os /var/tmp/portage/sys-libs/glibc-2.2
0-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/elf/sofini.os /var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/elf/interp.os /var/tmp/portag
e/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/elf/ld.so -lgcc
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.5/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.
os: warning: relocation against `_dl_sysinfo' in readonly section `.text.compat'.
/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `__GI_kill':
(.text+0x14af1): undefined reference to `_dl_sysinfo'
/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `__sigaltstack':
(.text+0x150b1): undefined reference to `_dl_sysinfo'
/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `__getcontext':
(.text+0x268b1): undefined reference to `_dl_sysinfo'
/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `setcontext':
(.text+0x268f6): undefined reference to `_dl_sysinfo'
/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `swapcontext':
(.text+0x26a14): undefined reference to `_dl_sysinfo'
/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os:(.text+0x46f91): more undefined references to `_dl_sysinfo' follow
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.5/../../../../x86_64-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in object.
collect2: error: ld returned 1 exit status
../Makerules:601: recipe for target '/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc.so' failed

We tried to find references to _dl_sysinfo on another Gentoo machine, but to no avail:

xxxxxx ~ # find /lib64/ -name "*.so" -exec strings {} \; | grep dl_sysinfo
xxxxxx ~ # find /usr/lib64/ -name "*.so" -exec strings {} \; | grep dl_sysinfo
xxxxxx ~ # 

We also tried to add -fPIC -DPIC to CFLAGS but the error persisted. We are not sure why glibc package has to be updated at all because we already installed the latest one using PORTAGE_BINHOST. The same is for gcc.

The question is: how to fix this?

Update: I just noticed that switching the profile from hardened/linux/amd64 to default/linux/amd64/13.0 prevents glibc from emerging, but this is just a temporary fix. We definitely want to stay on the hardened profile.

Alex
  • 7,939
  • 6
  • 38
  • 52

1 Answers1

0

Emerging glibc with hardened use flag fails if gcc is without it. I had this situation with some servers, as HHVM has problems with hardened gcc. Solution is to specify "-hardened" for sys-libs/glibc also.