Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 274269 - sys-libs/glibc 2.10.1 build fails due to missing __call_fallocate symbol
Summary: sys-libs/glibc 2.10.1 build fails due to missing __call_fallocate symbol
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal with 1 vote (vote)
Assignee: Gentoo Toolchain Maintainers
Depends on:
Blocks: glibc-2.10-stable
  Show dependency tree
Reported: 2009-06-15 18:58 UTC by Mikael Magnusson
Modified: 2009-11-10 01:59 UTC (History)
2 users (show)

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

build log (build.log.bz2,88.30 KB, application/octet-stream)
2009-06-23 21:50 UTC, Mikael Magnusson
0077_all_i386-glibc-no-fallocate.patch (0077_all_i386-glibc-no-fallocate.patch,1.48 KB, patch)
2009-11-09 22:36 UTC, SpanKY
Details | Diff
0077_all_i386-glibc-no-fallocate.patch (0077_all_i386-glibc-no-fallocate.patch,1.75 KB, patch)
2009-11-10 00:14 UTC, SpanKY
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikael Magnusson 2009-06-15 18:58:27 UTC
it seems glibc 2.10(.1) doesn't work at all on 32bit (not just x86), see;a=commitdiff;h=1f3615a1
i tried to build with the patch but it failed for some other reason after a while, maybe due to -j2.
Comment 1 Lars Wendler (Polynomial-C) gentoo-dev 2009-06-21 17:45:09 UTC
Let's see what our toolchain ninjas think about this...
Comment 2 SpanKY gentoo-dev 2009-06-22 13:28:50 UTC
ive built 2.10.1 just fine on x86.  i dont think the patch you posted is causing any build errors, nor can we safely include it in 2.10.x since it changes the ABI to reference 2.11 symbols.
Comment 3 Mikael Magnusson 2009-06-22 17:20:59 UTC
Okay, I was probably a bit confused when I reported this bug. What happened was that I got a linking failure involving __fallocate64 or something of the sort. I then saw this commit in glibc git and thought "ah, it's a linking bug that they've fixed for 2.11", obviously I was wrong though and the linking error was for something else, and the commit is just for exporting the interface. Sorry about the noise.
Comment 4 SpanKY gentoo-dev 2009-06-23 12:25:57 UTC
i'm not saying you werent seeing a build error.  if you still are with the latest 2.10.1 ebuild, then post the full build.log as an attachment please.
Comment 5 Mikael Magnusson 2009-06-23 21:50:08 UTC
Created attachment 195610 [details]
build log
Comment 6 Mikael Magnusson 2009-06-23 21:53:06 UTC
You probably want this too:

Portage 2.2_rc33 (default/linux/x86/2008.0/desktop, gcc-4.3.3, glibc-2.7-r1, i686)
System uname: Linux-
Timestamp of tree: Mon, 22 Jun 2009 17:15:02 +0000
app-shells/bash:     4.0_p17
dev-java/java-config: 1.3.7-r1, 2.1.7
dev-lang/python:     2.5.4-r2, 2.6.1-r1
dev-python/pycrypto: 2.0.1-r8
dev-util/cmake:      2.6.3-r1
sys-apps/baselayout: 1.12.12
sys-apps/sandbox:    1.9
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r4, 2.19, 2.19.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
CFLAGS="-march=athlon-xp -O3 -pipe -mfpmath=sse -msse -m3dnow"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config /usr/share/gconf"
CONFIG_PROTECT_MASK="/etc/asciidoc /etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d /usr/share/texmf /var/lib/rpm"
CXXFLAGS="-march=athlon-xp -O3 -pipe -mfpmath=sse -msse -m3dnow -fpermissive -DMIKACHU"
EMERGE_DEFAULT_OPTS="--alphabetical --nospinner"
FEATURES="digests distlocks fixpackages metadata-transfer noinfo preserve-libs protect-owned sandbox sfperms strict userfetch"
LINGUAS="sv ja"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
USE="3dnow X aalib acpi alsa avi branding bzip2 cairo canna cdr cli cracklib crypt cups dri dvd dvdr dvdread emboss encode f77 fam firefox flac fortran gcj gdbm gif gpm gs gtk gtk2 gtkhtml iconv idn isdnlog jpeg jpeg2k kdeenablefinal kpathsea libnotify mad midi mikmod mmx moznocompose moznoirc moznomail mozsvg mp3 mpeg mudflap ncurses nethack no-old-linux nodrm noutempter nptl nptlonly objc ogg opengl openmp oss pam pcre pdf perl pic png ppds pppd python qt3 qt3support qt4 readline reflection sdl session spl sse ssl startup-notification svg sysfs tetex tiff truetype unicode usb vorbis win32codecs wmf x86 xattr xml xorg xprint xulrunner xv zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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 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" ELIBC="glibc" INPUT_DEVICES="evdev keyboard joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="sv ja" USERLAND="GNU" VIDEO_CARDS="nv"
Comment 7 SpanKY gentoo-dev 2009-06-25 05:43:29 UTC
/tmp/portage/sys-libs/glibc-2.10.1/work/build-default-i686-pc-linux-gnu-nptl/libc_pic.os: In function `fallocate':
(.text+0xb2244): undefined reference to `__call_fallocate'
/tmp/portage/sys-libs/glibc-2.10.1/work/build-default-i686-pc-linux-gnu-nptl/libc_pic.os: In function `__fallocate64_l64':
(.text+0xb2255): undefined reference to `__call_fallocate'
/usr/lib/gcc/i686-pc-linux-gnu/4.3.3/../../../../i686-pc-linux-gnu/bin/ld: /tmp/portage/sys-libs/glibc-2.10.1/work/build-default-i686-pc-linux-gnu-nptl/ hidden symbol `__call_fallocate' isn't defined
/usr/lib/gcc/i686-pc-linux-gnu/4.3.3/../../../../i686-pc-linux-gnu/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
make[1]: *** [/tmp/portage/sys-libs/glibc-2.10.1/work/build-default-i686-pc-linux-gnu-nptl/] Error 1
Comment 8 Mikael Magnusson 2009-11-09 18:40:11 UTC
This appears to be due to my 2.6.19 kernel/kernel headers, fallocate was added in 2.6.23. __call_fallocate is called without ifdefs on __NR_fallocate but defined under one, so it can never work. Unless the whole file is compiled conditionally, but it doesn't appear to be, since it does break. (the glibc makefiles are not easy to follow).

glibc-2.11/sysdeps/unix/sysv/linux/i386/call_fallocate.S has the definition
glibc-2.11/sysdeps/unix/sysv/linux/i386/fallocate{,64}.c has the calls

I added a dummy definition to fallocate.c that just returns -ENOTSUP and the compilation finishes now.

Comment 9 SpanKY gentoo-dev 2009-11-09 20:21:49 UTC
ah, good catch.  i'll have to look at the expanded assembly to see what the best course of action is ...
Comment 10 Mikael Magnusson 2009-11-09 20:29:12 UTC
It also seems the oldest linux-headers package currently in portage is 2.6.23, I just never upgraded to it. Is it generally safe to have newer headers than the running kernel?
Comment 11 SpanKY gentoo-dev 2009-11-09 20:50:23 UTC
with glibc, there should be no need whatsoever for the kernel headers to match the running kernel version, or any other version relationship.  the only requirement is that both must be 2.6.9 or newer (controllable by $NPTL_KERN_VER).
Comment 12 SpanKY gentoo-dev 2009-11-09 22:36:53 UTC
Created attachment 209779 [details, diff]

try this patch.  if you update your tree, you should be able to put this patch into /etc/portage/patches/sys-libs/glibc/ to test it.
Comment 13 Mikael Magnusson 2009-11-09 22:43:51 UTC
Before I try that, and it was what I almost tried first too, I'm not sure if it's a good solution. The fallocate(2) manpage documents it as running the syscall directly, and recommends using the posix_fallocate() function for being portable. If I remember correctly, there are some non-ifdeffed extern declarations of __call_fallocate a few lines above your two hunks too, so I don't know if the patch will compile. The error message I got mentioned the hidden attribute, but maybe it won't be an error if the function isn't used anyway. I'll try compiling it in a while.
Comment 14 Mikael Magnusson 2009-11-09 23:41:48 UTC
/tmp/portage/sys-libs/glibc-2.11/work/build-default-i686-pc-linux-gnu-nptl/libc_pic.os: In function `fallocate':
(.text+0xb15f7): undefined reference to `internal_fallocate'
/tmp/portage/sys-libs/glibc-2.11/work/build-default-i686-pc-linux-gnu-nptl/libc_pic.os: In function `fallocate64':
(.text+0xb1645): undefined reference to `internal_fallocate64'

sysdeps/unix/sysv/posix_fallocate.c does this weird dance:
#define posix_fallocate static internal_fallocate
#include <sysdeps/posix/posix_fallocate.c>
#undef posix_fallocate

Presumably we can just call posix_fallocate() instead then.
Comment 15 Mikael Magnusson 2009-11-09 23:45:16 UTC
Now I remember why I didn't do this. The corresponding 64-bit file has
and when I tried to call that I got warnings that it wasn't defined.
It does the same dance:

#define __posix_fallocate64_l64 static internal_fallocate64
#include <sysdeps/posix/posix_fallocate64.c>
#undef __posix_fallocate64_l64


__posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
#ifdef __NR_fallocate
  return internal_fallocate64 (fd, offset, len);

I still think the easiest and most consistent thing is to return -enotsup, since that is what will happen if you compile with newer headers. If an app tries to use fallocate() directly, it probably falls back on posix_fallocate() too.
Comment 16 SpanKY gentoo-dev 2009-11-10 00:14:33 UTC
Created attachment 209781 [details, diff]

the recommended user usage has no bearing here.  fallocate() is part of the C library ABI and cannot be removed.  it also has explicit semantics different from posix_fallocate() which need to be retained.  so you're right we cant use the internal_fallocate stuff like the posix_fallocate file (which i misread).  this patch just uses the same method as the other fallocate files.

extern decls also dont matter at all.  you can declare whatever extern's you want without getting a build error.
Comment 17 Mikael Magnusson 2009-11-10 00:41:19 UTC
This patch compiles and links, so it probably works as intended too.
Comment 18 SpanKY gentoo-dev 2009-11-10 01:59:41 UTC
thanks for testing.  ive added the patch to 2.10.1 and 2.11.