Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 183725 - binutils: strip --strip-unneeded strips needed parts of fpc object files
Summary: binutils: strip --strip-unneeded strips needed parts of fpc object files
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: http://sourceware.org/bugzilla/show_b...
Whiteboard:
Keywords:
: 186695 (view as bug list)
Depends on:
Blocks: 183604
  Show dependency tree
 
Reported: 2007-06-30 12:00 UTC by Harald van Dijk (RETIRED)
Modified: 2009-03-14 11:38 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Harald van Dijk (RETIRED) gentoo-dev 2007-06-30 12:00:15 UTC
As originally reported in bug #183604, strip --strip-unneeded /usr/lib/fpc/2.0.4/units/*/rtl/syscall.o strips necessary info. I have no idea whose bug this is, but

13:31 < SpanKY> truedfx: file a bug ... if strip is stripping too much, it's a bug in binutils that needs to be fixed

Here you go :)

I don't know if it helps, but:

$ nm syscall.o
0000000000000000 D THREADVARLIST_SYSCALL
$ strip --strip-unneeded syscall.o
$ nm syscall.o
nm: syscall.o: no symbols
$ emerge --info
Portage 2.1.3_rc6 (default-linux/amd64/2006.1/no-multilib, gcc-4.1.2, glibc-2.5-r3, 2.6.21-gentoo-r3 x86_64)
=================================================================
System uname: 2.6.21-gentoo-r3 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 4200+
Gentoo Base System release 2.0.0_alpha3
Timestamp of tree: Fri, 29 Jun 2007 19:00:01 +0000
dev-lang/python:     2.4.4-r4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61
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: 1.4.0
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.21
ACCEPT_KEYWORDS="amd64 ~amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe"
CHOST="x86_64-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/gconf /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-march=athlon64 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y"
FEATURES="assume-digests autopatch collision-protect cvs distlocks metadata-transfer multilib-strict notitles parallel-fetch sandbox sfperms sign strict unmerge-orphans"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="en_GB.UTF-8"
LDFLAGS="-Xlinker --as-needed"
LINGUAS="*"
MAKEOPTS="-j2"
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="/var/cvs/gentoo-x86 /etc/portage/overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 accessibility akode alsa amd64 bidi bindist bitmap-fonts boost bzip2 cjk cli clucene cracklib crypt cvs dbus dri dvd dvdnav dvdread ffmpeg filepicker flac ftp gif gmp gtk iconv immqt inotify ipv6 isdnlog jpeg kde kdeenablefinal kdehiddenvisibility libg++ mbox midi mozdevelop mudflap ncurses nls nocxx nptl nptlonly nsplugin ogg opengl pascal perl png ppds pppd qt3 readline reflection rtc sdl session spl sql ssl tcpd tetex threads truetype truetype-fonts type1-fonts unicode v4l v4l2 vorbis xcomposite xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci 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 mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="*" USERLAND="GNU" VIDEO_CARDS="nv vesa"
Unset:  CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Harald van Dijk (RETIRED) gentoo-dev 2007-06-30 12:05:54 UTC
And binutils 2.16.1-r3 behaves the same way as 2.17.
Comment 2 SpanKY gentoo-dev 2007-06-30 14:26:16 UTC
this can also be seen with yasm/nasm when the ELF objects dont include DWARF debugging information ...
Comment 3 SpanKY gentoo-dev 2007-07-15 06:17:18 UTC
this has been fixed upstream ... i guess i'll put out a 2.17-r1 as who knows when 2.18 will be done
Comment 4 SpanKY gentoo-dev 2007-07-29 04:34:12 UTC
*** Bug 186695 has been marked as a duplicate of this bug. ***
Comment 5 Harald van Dijk (RETIRED) gentoo-dev 2009-03-08 19:48:46 UTC
This was never or only briefly fixed properly. When RESTRICT=strip is removed from fpc/lazarus, bug #183604 happens still.
Comment 6 SpanKY gentoo-dev 2009-03-08 20:38:11 UTC
the original test case works fine for me (look at upstream URL)

so if that passes for you as well, then you'll have to refresh how to reproduce.  it's been way too long for me to remember.

no idea what provides "syscall.o" ...
Comment 7 Harald van Dijk (RETIRED) gentoo-dev 2009-03-08 21:22:26 UTC
Ouch, sorry, it's actually a somewhat different case also triggered in fpc where stripping is also too aggressive. I never noticed the difference before, or I would've let you know about this sooner... Here's the C equivalent:

$ cat test1.c
int i;
$ cat test2.c
extern int i;
int main(void) { return i; }
$ gcc -c test1.c test2.c
$ nm test1.o test2.o

test1.o:
00000004 C i

test2.o:
         U i
00000000 T main
$ strip --strip-unneeded test1.o test2.o
$ nm test1.o test2.o

test1.o:
nm: test1.o: no symbols

test2.o:
         U i
00000000 T main
$ gcc test1.o test2.o -o test
test2.o: In function `main':
(.text+0xf): undefined reference to `i'
collect2: ld returned 1 exit status
Comment 8 SpanKY gentoo-dev 2009-03-08 23:36:48 UTC
the `nm` output is irrelevant ... nm shows debugging symbols, not all symbols.  that's why you'll want to stick with readelf ...

seems like the next bug is that strip will drop COM objects (uninitialized/bss)

$ cat test.c
int i;
int j = 1;
$ gcc -c test.c
$ readelf -s test.o | grep OBJ
     7: 0000000000000000     4 OBJECT  GLOBAL DEFAULT    2 j
     8: 0000000000000004     4 OBJECT  GLOBAL DEFAULT  COM i
$ strip --strip-unneeded test.o
$ readelf -s test.o | grep OBJ
     7: 0000000000000000     4 OBJECT  GLOBAL DEFAULT    2 j
$ ...
Comment 10 SpanKY gentoo-dev 2009-03-10 01:06:08 UTC
upstream has committed a patch for the issue.  i dont suppose you can retest fpc to see if it fixes things ?

you can simply put it into /etc/portage/patches/sys-devel/binutils/ and the ebuild will automatically apply it ...
Comment 11 Harald van Dijk (RETIRED) gentoo-dev 2009-03-10 05:43:19 UTC
The build of lazarus finishes successfully with the patch applied, so it seems there are no other remaining issues.
Comment 12 SpanKY gentoo-dev 2009-03-14 11:38:44 UTC
added strip fix to 2.19.1-r1 ... i'd like to get this stabilized soonish, so that's why i'm not doing another 2.18 -r#

http://sources.gentoo.org/gentoo/src/patchsets/binutils/2.19.1/10_all_binutils-2.18-strip-common.patch?r1=1.1&r2=1.2