Package: binutils
Version: 2.16.1cvs20060413-1
Severity: important

The linker's (or GCC's) dependency handling is too stupid.

Suppose we have the files prog.o, mod.a and lib.a, and
only the following dependencies:

        prog.o: mod.a lib.a
        mod.a: lib.a

with the mod.a depending on symbols in lib.a that prog.o doesn't
depend on. Then:

        gcc prog.o lib.a mod.a
                => No, I can't link this because I'm brain-damaged
        gcc prog.o mod.a lib.a
                => No, I can't find shit, because I'm totally blind
        gcc lib.a mod.a prog.o
                => Help me! I'm lost!

But:

        gcc prog.o lib.a mod.a lib.a
                => Hey, thanks for beating me with a cluebat, 
                   now I found the stuf

I haven't actually tried this particular example, but attempting to link 
Ion with PRELOAD_MODULES for static linking creates a situation like this.

The ugly hack

        gcc prog.o -Wl,-whole-archive lib.a mod.a -Wl,-no-whole-archive

also resolves the issue, and this is needed for dynamic loading of modules,
but one _should not_ need this kind of ugly hack for static linking, and
infact this may include unnecessary objects in the resulting binary.
It should be sufficient to for static linking to give a file containing
each necessary symbol only once on the command line, without any ugly
hacks.


-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.14
Locale: LANG=C, LC_CTYPE=fi_FI.UTF-8 (charmap=UTF-8)

Versions of packages binutils depends on:
ii  libc6                         2.3.6-15   GNU C Library: Shared libraries

binutils recommends no packages.

-- debconf information:
  binutils/oformat_warning:
* binutils/kernel_link_warning:


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to