Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 184609 - portage w/ FEATURES=splitdebug produces Invalid operation on objcopy
Summary: portage w/ FEATURES=splitdebug produces Invalid operation on objcopy
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-08 15:13 UTC by Kent Fredric (IRC: kent\n) (RETIRED)
Modified: 2007-07-13 07:40 UTC (History)
2 users (show)

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


Attachments
log from emerge udev - still tons of errors (udev.log,2.71 KB, text/plain)
2007-07-12 08:03 UTC, Jakub Moc (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2007-07-08 15:13:10 UTC
whilst doing emerge -eND system noticed these messages starting to fleck up in portage in conjunction with the SPLITDEBUG feature.


i686-pc-linux-gnu-objcopy: /tmp/..var/portage/sys-apps/shadow-4.0.18.1-r1/image/usr/lib/debug/sbin/nologin.debug: Invalid operation
   bin/groups
i686-pc-linux-gnu-objcopy: /tmp/..var/portage/sys-apps/shadow-4.0.18.1-r1/image/usr/lib/debug/bin/groups.debug: Invalid operation
   bin/login
i686-pc-linux-gnu-objcopy: /tmp/..var/portage/sys-apps/shadow-4.0.18.1-r1/image/usr/lib/debug/bin/login.debug: Invalid operation
   bin/su
i686-pc-linux-gnu-objcopy: /tmp/..var/portage/sys-apps/shadow-4.0.18.1-r1/image/usr/lib/debug/bin/su.debug: Invalid operation
   bin/passwd
i686-pc-linux-gnu-objcopy: /tmp/..var/portage/sys-apps/shadow-4.0.18.1-r1/image/usr/lib/debug/bin/passwd.debug: Invalid operation

So I did this manual test:

objcopy --strip-unneeded test test_out
objcopy --only-keep-debug test test_debug
objcopy --add-gnu-debuglink=test_debug test_out

which all went fine ( which to me is what it looks like portage was doing )
oddly, running that last objcopy line a second time results in the very same 'Invalid operation' error I see in the emerge logs.

But the worrysome part is what it produces in the debug-link sections.

Where as before it would just store pngcrush with pngcrush.debug in its debug link, its now seeming to put the same data in for everything, which I don't believe is how its supposed to work
 :
extract from elftoc /bin/su
 /* gnu_debuglink */
  {
    'c', 'r', 't', '1', '.', 'o', '.', 'd', 'e', 'b', 'u', 'g', '\0', '\0',
    '\0', '\0', 0x8A, 0x9A, 0xDA, 0x15, 'c', 'r', 't', 'i', '.', 'o', '.',
    'd', 'e', 'b', 'u', 'g', '\0', '\a', '\0', '\0', '_', 0x85, 'X', 'z', 'c',
    'r', 't', 'b', 'e', 'g', 'i', 'n', '.', 'o', '.', 'd', 'e', 'b', 'u', 'g',
    '\0', '1', 0xED, 0xB7, 'Z', '?', '1', 'j', 'c', 'r', 't', 'e', 'n', 'd',
    '.', 'o', '.', 'd', 'e', 'b', 'u', 'g', '\0', 'A', 0xC9, 0xEF, 'J', '6',
    'c', 'r', 't', 'n', '.', 'o', '.', 'd', 'e', 'b', 'u', 'g', '\0', 0x06,
    '\0', '\0', 'U', 0xF9, 0x1C, 'u'
  },

the actual debug file spat out /looks/ perfectly normal, just the link-to-it factility is broken and spits errors. 




Reproducible: Always




Portage 2.1.3_rc6 (default-linux/x86/2007.0, gcc-4.2.0/vanilla, glibc-2.6-r0, 2.6.21-gentookz i686)
=================================================================
System uname: 2.6.21-gentookz i686 AMD Athlon(TM) XP 2000+
Gentoo Base System release 1.12.10
Timestamp of tree: Sun, 08 Jul 2007 01:00:02 +0000
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.4 [disabled]
app-admin/eselect-compiler: 2.0.0_rc2-r1
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python:     2.3.6-r2, 2.4.4-r4, 2.5.1-r2
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r7
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61-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
sys-devel/binutils:  2.17
sys-devel/gcc-config: 2.0.0_rc1
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.21
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=i686 -mtune=athlon-xp -pipe -ggdb3 -gstabs3"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /opt/openjms/config /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/local/kdeextra/share/config /usr/local/kdeextra/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/eselect/compiler /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-O2 -march=i686 -mtune=athlon-xp -pipe -ggdb3 -gstabs3"
DISTDIR="/mnt/fission/distfiles/distfiles"
FEATURES="autoaddcvs cvs distlocks metadata-transfer parallel-fetch sandbox sfperms splitdebug strict unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_AU.UTF-8"
LC_ALL="C"
LDFLAGS="-Wl,-O1,-z,combreloc,--sort-common,--enable-new-dtags"
LINGUAS="en_NZ en_GB en en_US"
MAKEOPTS="-j1"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/mysql-testing /usr/portage/local/layman/mysql-experimental /usr/portage/local/layman/enlightenment /usr/portage/local/layman/armagetron /usr/portage/local/layman/sunrise /usr/portage/local/layman/kde /usr/portage/local/layman/toolchain /usr/portage/local/layman/php-experimental /usr/portage/local/layman/php-testing /usr/local/portage /usr/src/musicbrainz-overlay_svn /usr/src/xgl/xgl-coffee"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
Comment 1 SpanKY gentoo-dev 2007-07-08 20:50:49 UTC
ive already fixed this in portage

run this in the meantime:
objcopy -R .gnu_debuglink /usr/lib*/crt?.o
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2007-07-11 07:49:20 UTC
(In reply to comment #1)
> run this in the meantime:
> objcopy -R .gnu_debuglink /usr/lib*/crt?.o

That produces --help output. Also I don't see any fixed release of portage anywhere.

Comment 3 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2007-07-11 09:44:55 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > run this in the meantime:
> > objcopy -R .gnu_debuglink /usr/lib*/crt?.o
> 
> That produces --help output. Also I don't see any fixed release of portage
> anywhere.
> 

objcopy only works on one file at a time. 
Also , I found the need to do the same on crtbegin.o, crtbeginS.o, ctrend.o, crtendS.o in /usr/lib/gcc/i686-pc-linux-gnu/4.2.0/


find /usr/lib/crt*.o /usr/lib/gcc/i686-pc-linux-gnu/4.2.0/crt*.o | grep -v "\(T.o\|math\)"  | xargs -l1 objcopy -R .gnu_debuglink

Should be a more appropriate solution for now. 
Comment 4 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2007-07-11 09:52:17 UTC
elftoc output for some program with my alterations ( /usr/bin/pango-view  )
Hand transposing those syms seems to work.
But gdb does go nato with warnings about 'section not found in /usr/lib/debug/usr/lib/crti.o.debug'

But at least thats usable.

/* gnu_debuglink */
  {
    0x70, 0x61, 0x6E, 0x67, 0x6F, 0x2D, 0x76, 0x69, 0x65, 0x77, 0x2E, 0x64,
    0x65, 0x62, 0x75, 0x67, 0x00, 0x00, 0x00, 0x00, 0xB1, 0x6F, 0xB2, 0xD4
  },
Comment 5 SpanKY gentoo-dev 2007-07-11 19:46:09 UTC
maybe you should look harder, this has been released already
Comment 6 Jakub Moc (RETIRED) gentoo-dev 2007-07-11 19:52:10 UTC
(In reply to comment #5)
> maybe you should look harder, this has been released already

Dunno what was releases where. 2.1.3_rc7 still has this very same bug (plus of course no changelog entry about this anywhere, because people need to 'look harder' apparently). So, what's exactly the fix here?
Comment 7 SpanKY gentoo-dev 2007-07-11 21:27:44 UTC
incorrect, prepstrip no longer contains the bug
Comment 8 Jakub Moc (RETIRED) gentoo-dev 2007-07-11 21:33:16 UTC
(In reply to comment #7)
> incorrect, prepstrip no longer contains the bug

Great; so the fix is what exactly? Because it still produces the same 'invalid operation' as before.
Comment 9 SpanKY gentoo-dev 2007-07-11 21:39:42 UTC
if you read the comments in the bug and use your head it's pretty easy trivial to deduce the answer yourself

workaround: remove .gnu_debuglink from glibc's crt*.o objects

deduced answer: prepstrip was incorrect adding .gnu_debuglink to .o files and even after prepstrip is fixed, your system will continue to have .gnu_debuglink in all of your .o files until you re-emerge the packages that installed these .o files (like glibc)
Comment 10 Jakub Moc (RETIRED) gentoo-dev 2007-07-11 21:48:59 UTC
(In reply to comment #9)
> if you read the comments in the bug and use your head it's pretty easy trivial
> to deduce the answer yourself
> 
> workaround: remove .gnu_debuglink from glibc's crt*.o objects

Mon Jul  9 08:02:16 2007 >>> sys-apps/portage-2.1.3_rc7
Tue Jul 10 03:16:12 2007 >>> sys-libs/glibc-2.6

Obviously my glibc shouldn't be broken after being emerged by the fixed portage?
Comment 11 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2007-07-12 07:56:27 UTC
An easy fix should be doing the -R mandatorily on binaries prior to adding the debug link. IE: the error occurs because 'zomg something already there!' right? why not just remove it  first, seeing we hard-link the debug-link manually anyway.
Comment 12 Jakub Moc (RETIRED) gentoo-dev 2007-07-12 08:02:02 UTC
Well, I'm sorry but the fix plain doesn't work for me... I still get 'Invalid operation' on prepstrip on every single ELF out there, I'll attach an example output from udev-113-r1.

- I tried an alternative patch from swegener [1] and re-emerged glibc to no avail.
- I re-emerged glibc once again with portage-2.1.3_rc8 to no avail.

$ genlop -s portage glibc binutils --date last week
 * matches found:

     Mon Jul  9 08:02:16 2007 >>> sys-apps/portage-2.1.3_rc7
     Thu Jul 12 07:55:47 2007 >>> sys-apps/portage-2.1.3_rc8
 * matches found:

     Tue Jul 10 03:16:12 2007 >>> sys-libs/glibc-2.6
     Thu Jul 12 02:38:47 2007 >>> sys-libs/glibc-2.6
     Thu Jul 12 09:53:39 2007 >>> sys-libs/glibc-2.6
 * matches found:

     Tue Jul 10 00:23:18 2007 >>> sys-devel/binutils-2.17.50.0.17

[1] http://dev.gentoo.org/~swegener/patches/portage/portage-strip-kernel-objects-for-rc7.patch


Portage 2.1.3_rc8 (default-linux/x86/2007.0/desktop, gcc-4.2.0, glibc-2.6-r0, 2.6.21-gentoo-r3 i686)
=================================================================
System uname: 2.6.21-gentoo-r3 i686 AMD Athlon(tm) XP 1600+
Gentoo Base System release 1.13.0_alpha12
Timestamp of tree: Thu, 12 Jul 2007 05:30:01 +0000
ccache version 2.4 [enabled]
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python:     2.5.1-r2
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r7
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61-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
sys-devel/binutils:  2.17, 2.17.50.0.15, 2.17.50.0.16, 2.17.50.0.17
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.22
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer -fforce-addr"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/revdep-rebuild /etc/splash /etc/terminfo /usr/share/X11/xkb"
CXXFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer -fforce-addr"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--alphabetical --with-bdeps=y"
FEATURES="ccache collision-protect distlocks metadata-transfer parallel-fetch sandbox sfperms splitdebug strict unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="ftp://ftp.fi.muni.cz/pub/linux/gentoo/ http://gentoo.osuosl.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--sort-common"
LINGUAS="cs en"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_EXTRA_OPTS="--progress --prune-empty-dirs"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /usr/local/overlays/beryl /usr/local/overlays/enlightenment"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext 7zip X X509 a52 aac aalib acl acpi alsa amr ao asf audiofile avahi bash-completion berkdb bluetooth branding bzip2 cairo caps cddb cdparanoia cdr chroot cli cpudetection cracklib crypt cscope css cups curl curlwrappers daap dbus dbx dga directfb dri dts dv dvb dvd dvdr dvdread encode exif expat fam fame fbcon ffmpeg fftw firefox flac flash flatfile foomaticdb ftp fuse gd gdbm ggi gif gimp glibc-omitfp glitz glut gmp gphoto2 gpm graphviz gs gstreamer gtk hal ical iconv icq idn imagemagick imap imlib inifile ipv6 irda jack javascript jbig joystick jpeg jpeg2k kdeenablefinal kdehiddenvisibility kipi lame lcms libcaca libg++ libnotify libsamplerate lirc live lm_sensors logrotate lzo mad maildir matroska midi mikmod mime mjpeg mmap mmx mmxext mng modplug moznopango mp3 mp4 mpeg mplayer mudflap multiuser musepack musicbrainz ncurses network network-cron nfs nls nodrm nptl nptlonly nsplugin nvidia offensive ogg openal opengl openmp pam pcre pdf perl png portaudio ppds python qt3 qt3support quicktime rar readline real reflection rle ruby samba sdl sdl-image session skey sms sndfile speex spell spl sqlite sqlite3 sse ssl startup-notification subtitles svg symlink syslog tcpd theora threads threadsafe thumbnail tiff truetype unicode urandom usb v4l v4l2 vcd vim-syntax vim-with-x vorbis wavpack win32codecs wmf x264 x86 xattr xcomposite xine xinerama xinetd xml xmlrpc xorg xosd xpm xv xvid xvmc zeroconf zip zlib" ALSA_CARDS="emu10k1 bt87x" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="joystick keyboard mouse vmmouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="cs en" LIRC_DEVICES="cph06x" USERLAND="GNU" VIDEO_CARDS="fbdev nv nvidia v4l vesa vmware"
Unset:  CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS
Comment 13 Jakub Moc (RETIRED) gentoo-dev 2007-07-12 08:03:41 UTC
Created attachment 124618 [details]
log from emerge udev - still tons of errors
Comment 14 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2007-07-12 10:23:57 UTC
Still Happening in portage-2.1.3_rc8 W/
sys-libs/pam-0.99.8.0-r1


strip: i686-pc-linux-gnu-strip --strip-unneeded -R .comment
   sbin/pam_tally
   sbin/unix_chkpwd
i686-pc-linux-gnu-objcopy: /tmp/..var/portage/sys-libs/pam-0.99.8.0-r1/image/usr/lib/debug/sbin/unix_chkpwd.debug: Invalid operation
   lib/security/pam_filter/upperLOWER
i686-pc-linux-gnu-objcopy: /tmp/..var/portage/sys-libs/pam-0.99.8.0-r1/image/usr/lib/debug/lib/security/pam_filter/upperLOWER.debug: Invalid operation
   lib/security/pam_echo.so
   lib/security/pam_debug.so
   lib/security/pam_rhosts.so
   lib/security/pam_env.so
   lib/security/pam_keyinit.so
   lib/security/pam_unix.so
   lib/security/pam_rootok.so

unix_chkpwd
  /* gnu_debuglink */
  {
    0x53, 0x63, 0x72, 0x74, 0x31, 0x2E, 0x6F, 0x2E, 0x64, 0x65, 0x62, 0x75,
    0x67, 0x00, 0x32, 0x2E, 0x21, 0x8F, 0xFF, 0x80
  },  
                               

upperLOWER
  /* gnu_debuglink */
  {
    0x53, 0x63, 0x72, 0x74, 0x31, 0x2E, 0x6F, 0x2E, 0x64, 0x65, 0x62, 0x75,
    0x67, 0x00, 0x32, 0x2E, 0x21, 0x8F, 0xFF, 0x80
  },
( 0000:0000 Scrt1.o.debug.2.!.ΓΏ.     )         

Offending Library: 
sudo objcopy -R .gnu_debuglink /usr/lib/Scrt1.o
Comment 15 Jakub Moc (RETIRED) gentoo-dev 2007-07-12 10:51:11 UTC
Reopen.
Comment 16 SpanKY gentoo-dev 2007-07-12 18:33:32 UTC
i wasnt kidding when i said "all .o files" ... glibc is not the only package that provides .o files which get linked in

simply use `readelf -x` on the binary to figure out which .o files are still broken on your system
Comment 17 Jakub Moc (RETIRED) gentoo-dev 2007-07-12 18:35:46 UTC
Well, this is really a wonderful "fix". Maybe you could produce a script to fix the broken crap and stick it somewhere to the tree?

Comment 18 Jakub Moc (RETIRED) gentoo-dev 2007-07-12 18:56:43 UTC
(Not to mention that all the udev stuff links to *nothing else* but glibc.) 
Comment 19 SpanKY gentoo-dev 2007-07-12 20:15:15 UTC
that's where you'd be incorrect.  try and compile a simple hello world with -v and you can see .o files coming from more than just glibc.
Comment 20 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2007-07-12 20:42:55 UTC
(In reply to comment #16)
> i wasnt kidding when i said "all .o files" ... glibc is not the only package
> that provides .o files which get linked in
> 
> simply use `readelf -x` on the binary to figure out which .o files are still
> broken on your system
> 

Thats a little unclear. You mean 
WHEN
   /path/to/some/package: InvalidOperation
THEN
   readelf -x .gnu_debuglink /path/to/some/package 
FOREACH *.O in OUTPUT
   objcopy -R .gnu_debuglink $item

Right?
Comment 21 Jakub Moc (RETIRED) gentoo-dev 2007-07-12 21:01:55 UTC
Eh, just need to fix this somehow (nope, `emerge -e world` doesn't count as a solution :P) I'm going to re-emerge gcc as well, that's the last part of toolchain left. If that fails, then I really give up.

On that note, what's wrong w/ the suggestion in Comment #11 (i.e., run ${OBJCOPY} -R .gnu_debuglink {$x} first, before this whole thing makes kaboom)?
Comment 22 Jakub Moc (RETIRED) gentoo-dev 2007-07-13 07:40:21 UTC
Uh; after re-emerging gcc twice, it's finally back to normal (the first run still failed to splitdebug gcc itself properly). Apparently you need to re-emerge complete toolchain to get rid of this borkage, glibc itself is definitely not enough. :/