This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: ld -lgen -ladm causes assert failure in gnu ld 2.12.1 and 2.13 under Solaris 2.7 or 2.8
Daniel> Preferably the former. Could you try wrapping the linker in a shell
Daniel> script which adds -z nocombreloc (at the end of arguments, I think..)
Daniel> and rebuilding both GCC 3.2 and Python? That way libgcc_s, libstdc++,
Daniel> etc. will be built without combreloc.
I have a simpler suggestion. I changed the test script to specify
zcombreloc explicitly, and as I expected, it crashes under binutils 2.12.1.
So the answer, I think, is to produce a version of binutils that will run
this script correctly before looking for other problems.
Here's the script:
---------------------------------------------
#! /bin/sh
mkdir /tmp/t.$$ || exit 3
cd /tmp/t.$$ || exit 3
cat >main.c <<'EOF'
#include <stdio.h>
#include <dlfcn.h>
int main(void)
{
void *handle, *sym;
char *error;
puts("calling dlopen");
handle = dlopen("./dyn.so", RTLD_NOW);
if (!handle) {
printf("%s\n", dlerror());
return 1;
}
puts("calling dlsym");
sym = dlsym(handle, "sym");
if ((error = dlerror()) != 0) {
printf("%s\n", error);
return 1;
}
puts("calling sym");
((void (*)(void))sym)();
puts("done");
return 0;
}
EOF
cat >dyn.c <<'EOF'
#include <stdio.h>
void sym(void)
{
puts("in sym");
}
EOF
[ -n "$SHFLAGS" ] || SHFLAGS="-fPIC -shared -Wl,-zcombreloc"
[ -n "$CC" ] || CC=gcc
set -x
$CC $CFLAGS $SHFLAGS dyn.c -o dyn.so
$CC $CFLAGS main.c -o main -ldl
./main || exit $?
cd /tmp
rm -rf t.$$