Subject: crunchide failure on MIPS with NEW_TOOLCHAIN (Re: build failure making
To: None <,>
From: Izumi Tsutsui <>
List: current-users
Date: 02/02/2002 11:40:18
(moved to port-mips and tech-toolchain)

In article <> on wrote:

> Trying to cross-build for hpcmips hosting on i386, it fails trying to
> link the crunched binary:
> /foo/tools/mipsel--netbsd/bin/ld: sysinst.cro: CALL16 reloc at 0x1c not against global symbol
> sysinst.cro: could not read symbols: Bad value
> collect2: ld returned 1 exit status
> Any suggestions?

I and some other people have the same problem on newsmips and sgimips.

crunchgen(1) generate a makefile which uses objcopy(1) to hide global
symbols rather than (old) crunchide(1) if NEW_TOOLCHAIN is defined.

But as noted in usr.bin/crunch/crunchide/exec_elf32.c:
 * This function 'hides' (some of) ELF executable file's symbols.
 * It hides them by renaming them to "_$$hide$$ <filename> <symbolname>".
 * Symbols in the global keep list, or which are marked as being undefined,
 * are left alone.
 * An old version of this code shuffled various tables around, turning
 * global symbols to be hidden into local symbols.  That lost on the
 * mips, because CALL16 relocs must reference global symbols, and, if
 * those symbols were being hidden, they were no longer global.
it causes problem on MIPS to change global symbols into local ones
to hide them. I guess we have to rename them and keep them global
on some architectures (i.e. mips).

Maybe we have to have BFD'fied crunchide(1), which already exists
in pkgsrc/cross/bfd-crunchide, instead of simple objcopy(1).
Izumi Tsutsui