This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: A ELF_LINK_NON_GOT_REF patch
- To: ian@zembu.com (Ian Lance Taylor)
- Subject: Re: A ELF_LINK_NON_GOT_REF patch
- From: hjl@lucon.org (H.J. Lu)
- Date: Thu, 9 Sep 1999 20:31:27 -0700 (PDT)
- Cc: binutils@sourceware.cygnus.com
> Your patch isn't correct. You don't consider the various error and
> multiple definition cases.
>
> I also don't see why it is needed. The code which does consider the
> other cases already copies the flag. Do you have Andreas's patch in
> your sources?
>
> 1999-09-06 Andreas Schwab <schwab@suse.de>
>
> * elflink.h (elf_link_add_object_symbols): Copy NON_GOT_REF flag
> to version symbols.
>
> The weakdef flag is copied down in elf_adjust_dynamic_symbol.
>
I have that patch. Here is the test case.
# make
gcc -c x.c -o x.o
gcc -o a.out x.o liba.so
/usr/i686-pc-linux/bin/ld: x.o: warning: unresolvable relocation against symbol `errlist@@GLIBC_2.1' from .text section
> I'll note that comments like ``very tricky'' are fine when you explain
> the trickiness. When you don't, they are a poster child for
> unmaintainable code.
I am sorry. I was in kind of hurry and I don't even know if my patch
is correct.
--
H.J. Lu (hjl@gnu.org)
---
---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1999-09-09 20:28 PDT by <hjl@ocean.lucon.org>.
# Source directory was `/home/hjl/bugs/bfd/got'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 236 -rw-r--r-- Makefile
# 6139 -rw-r--r-- a.c
# 131 -rw-r--r-- a.map
# 66 -rw-r--r-- x.c
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
if test "$gettext_dir" = FAILED && test -f $dir/gettext \
&& ($dir/gettext --version >/dev/null 2>&1)
then
set `$dir/gettext --version 2>&1`
if test "$3" = GNU
then
gettext_dir=$dir
fi
fi
if test "$locale_dir" = FAILED && test -f $dir/shar \
&& ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
then
locale_dir=`$dir/shar --print-text-domain-dir`
fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
echo=echo
else
TEXTDOMAINDIR=$locale_dir
export TEXTDOMAINDIR
TEXTDOMAIN=sharutils
export TEXTDOMAIN
echo="$gettext_dir/gettext -s"
fi
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
shar_touch=touch
else
shar_touch=:
echo
$echo 'WARNING: not restoring timestamps. Consider getting and'
$echo "installing GNU \`touch', distributed in GNU File Utilities..."
echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh27543; then
$echo 'x -' 'creating lock directory'
else
$echo 'failed to create lock directory'
exit 1
fi
# ============= Makefile ==============
if test -f 'Makefile' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'Makefile' '(file already exists)'
else
$echo 'x -' extracting 'Makefile' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
CC=gcc
X
all: a.out
X
liba.so: a.c a.map
X $(CC) $(LDFLAGS) -shared -fPIC -o $@ a.c -Wl,--version-script=a.map
X
a.out: x.o liba.so
X $(CC) -o $@ x.o liba.so
X
clean:
X rm -f a.out libb.so *.o
X
shar:
X shar -c Makefile a.c a.map x.c > shar-out
SHAR_EOF
$shar_touch -am 0909202699 'Makefile' &&
chmod 0644 'Makefile' ||
$echo 'restore of' 'Makefile' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'Makefile:' 'MD5 check failed'
21aceea2b4461714c581ff7839585f55 Makefile
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'Makefile'`"
test 236 -eq "$shar_count" ||
$echo 'Makefile:' 'original size' '236,' 'current size' "$shar_count!"
fi
fi
# ============= a.c ==============
if test -f 'a.c' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'a.c' '(file already exists)'
else
$echo 'x -' extracting 'a.c' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'a.c' &&
const char *const __new_errlist [] =
X {
X [0] = "Success" ,
X [ 1 ] = "Operation not permitted" ,
X [ 2 ] = "No such file or directory" ,
X [ 3 ] = "No such process" ,
X [ 4 ] = "Interrupted system call" ,
X [ 5 ] = "Input/output error" ,
X [ 6 ] = "Device not configured" ,
X [ 7 ] = "Argument list too long" ,
X [ 8 ] = "Exec format error" ,
X [ 9 ] = "Bad file descriptor" ,
X [ 10 ] = "No child processes" ,
X [ 35 ] = "Resource deadlock avoided" ,
X [ 12 ] = "Cannot allocate memory" ,
X [ 13 ] = "Permission denied" ,
X [ 14 ] = "Bad address" ,
X [ 15 ] = "Block device required" ,
X [ 16 ] = "Device or resource busy" ,
X [ 17 ] = "File exists" ,
X [ 18 ] = "Invalid cross-device link" ,
X [ 19 ] = "No such device" ,
X [ 20 ] = "Not a directory" ,
X [ 21 ] = "Is a directory" ,
X [ 22 ] = "Invalid argument" ,
X [ 24 ] = "Too many open files" ,
X [ 23 ] = "Too many open files in system" ,
X [ 25 ] = "Inappropriate ioctl for device" ,
X [ 26 ] = "Text file busy" ,
X [ 27 ] = "File too large" ,
X [ 28 ] = "No space left on device" ,
X [ 29 ] = "Illegal seek" ,
X [ 30 ] = "Read-only file system" ,
X [ 31 ] = "Too many links" ,
X [ 32 ] = "Broken pipe" ,
X [ 33 ] = "Numerical argument out of domain" ,
X [ 34 ] = "Numerical result out of range" ,
X [ 11 ] = "Resource temporarily unavailable" ,
X [ 115 ] = "Operation now in progress" ,
X [ 114 ] = "Operation already in progress" ,
X [ 88 ] = "Socket operation on non-socket" ,
X [ 90 ] = "Message too long" ,
X [ 91 ] = "Protocol wrong type for socket" ,
X [ 92 ] = "Protocol not available" ,
X [ 93 ] = "Protocol not supported" ,
X [ 94 ] = "Socket type not supported" ,
X [ 95 ] = "Operation not supported" ,
X [ 96 ] = "Protocol family not supported" ,
X [ 97 ] = "Address family not supported by protocol" ,
X [ 98 ] = "Address already in use" ,
X [ 99 ] = "Cannot assign requested address" ,
X [ 100 ] = "Network is down" ,
X [ 101 ] = "Network is unreachable" ,
X [ 102 ] = "Network dropped connection on reset" ,
X [ 103 ] = "Software caused connection abort" ,
X [ 104 ] = "Connection reset by peer" ,
X [ 105 ] = "No buffer space available" ,
X [ 106 ] = "Transport endpoint is already connected" ,
X [ 107 ] = "Transport endpoint is not connected" ,
X [ 89 ] = "Destination address required" ,
X [ 108 ] = "Cannot send after transport endpoint shutdown" ,
X [ 109 ] = "Too many references: cannot splice" ,
X [ 110 ] = "Connection timed out" ,
X [ 111 ] = "Connection refused" ,
X [ 40 ] = "Too many levels of symbolic links" ,
X [ 36 ] = "File name too long" ,
X [ 112 ] = "Host is down" ,
X [ 113 ] = "No route to host" ,
X [ 39 ] = "Directory not empty" ,
X [ 87 ] = "Too many users" ,
X [ 122 ] = "Disk quota exceeded" ,
X [ 116 ] = "Stale NFS file handle" ,
X [ 66 ] = "Object is remote" ,
X [ 37 ] = "No locks available" ,
X [ 38 ] = "Function not implemented" ,
X [ 84 ] = "Invalid or incomplete multibyte or wide character" ,
X [ 74 ] = "Bad message" ,
X [ 43 ] = "Identifier removed" ,
X [ 72 ] = "Multihop attempted" ,
X [ 61 ] = "No data available" ,
X [ 67 ] = "Link has been severed" ,
X [ 42 ] = "No message of desired type" ,
X [ 63 ] = "Out of streams resources" ,
X [ 60 ] = "Device not a stream" ,
X [ 75 ] = "Value too large for defined data type" ,
X [ 71 ] = "Protocol error" ,
X [ 62 ] = "Timer expired" ,
X [ 85 ] = "Interrupted system call should be restarted" ,
X [ 44 ] = "Channel number out of range" ,
X [ 45 ] = "Level 2 not synchronized" ,
X [ 46 ] = "Level 3 halted" ,
X [ 47 ] = "Level 3 reset" ,
X [ 48 ] = "Link number out of range" ,
X [ 49 ] = "Protocol driver not attached" ,
X [ 50 ] = "No CSI structure available" ,
X [ 51 ] = "Level 2 halted" ,
X [ 52 ] = "Invalid exchange" ,
X [ 53 ] = "Invalid request descriptor" ,
X [ 54 ] = "Exchange full" ,
X [ 55 ] = "No anode" ,
X [ 56 ] = "Invalid request code" ,
X [ 57 ] = "Invalid slot" ,
X [ 59 ] = "Bad font file format" ,
X [ 64 ] = "Machine is not on the network" ,
X [ 65 ] = "Package not installed" ,
X [ 68 ] = "Advertise error" ,
X [ 69 ] = "Srmount error" ,
X [ 70 ] = "Communication error on send" ,
X [ 73 ] = "RFS specific error" ,
X [ 76 ] = "Name not unique on network" ,
X [ 77 ] = "File descriptor in bad state" ,
X [ 78 ] = "Remote address changed" ,
X [ 79 ] = "Can not access a needed shared library" ,
X [ 80 ] = "Accessing a corrupted shared library" ,
X [ 81 ] = ".lib section in a.out corrupted" ,
X [ 82 ] = "Attempting to link in too many shared libraries" ,
X [ 83 ] = "Cannot exec a shared library directly" ,
X [ 86 ] = "Streams pipe error" ,
X [ 117 ] = "Structure needs cleaning" ,
X [ 118 ] = "Not a XENIX named type file" ,
X [ 119 ] = "No XENIX semaphores available" ,
X [ 120 ] = "Is a named type file" ,
X [ 121 ] = "Remote I/O error" ,
X [ 123 ] = "No medium found" ,
X [ 124 ] = "Wrong medium type" ,
X };
asm (".type __old_errlist,@object;.size __old_errlist,"
X "123" "*" "4" );
extern const char *const *__old_errlist;
extern __typeof ( __old_errlist ) _old_errlist __attribute__ ((weak, alias ("__old_errlist"))); ;
__asm__ (".symver " "__old_errlist" "," "_errlist" "@" "GLIBC_2.0") ;
__asm__ (".symver " "_old_errlist" "," "errlist" "@" "GLIBC_2.0") ;
extern __typeof ( __new_errlist ) _new_errlist __attribute__ ((weak, alias ("__new_errlist")));
__asm__ (".symver " "__new_errlist" "," "_errlist" "@@" "GLIBC_2.1") ;
__asm__ (".symver " "_new_errlist" "," "errlist" "@@" "GLIBC_2.1") ;
SHAR_EOF
$shar_touch -am 0909201999 'a.c' &&
chmod 0644 'a.c' ||
$echo 'restore of' 'a.c' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'a.c:' 'MD5 check failed'
ebaae18287b3e4a96bdac578f6503bfe a.c
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'a.c'`"
test 6139 -eq "$shar_count" ||
$echo 'a.c:' 'original size' '6139,' 'current size' "$shar_count!"
fi
fi
# ============= a.map ==============
if test -f 'a.map' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'a.map' '(file already exists)'
else
$echo 'x -' extracting 'a.map' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'a.map' &&
GLIBC_2.0 {
X global:
X _sys_errlist;
X sys_errlist;
};
X
GLIBC_2.1 {
X global:
X _sys_errlist;
X sys_errlist;
} GLIBC_2.0;
SHAR_EOF
$shar_touch -am 0909202699 'a.map' &&
chmod 0644 'a.map' ||
$echo 'restore of' 'a.map' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'a.map:' 'MD5 check failed'
d22e9b9bd4bee6b3a7718c6005ae7c3c a.map
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'a.map'`"
test 131 -eq "$shar_count" ||
$echo 'a.map:' 'original size' '131,' 'current size' "$shar_count!"
fi
fi
# ============= x.c ==============
if test -f 'x.c' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'x.c' '(file already exists)'
else
$echo 'x -' extracting 'x.c' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'x.c' &&
extern char *errlist[] ;
X
main ()
{
X return errlist[0]== 0;
}
SHAR_EOF
$shar_touch -am 0909202399 'x.c' &&
chmod 0644 'x.c' ||
$echo 'restore of' 'x.c' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'x.c:' 'MD5 check failed'
40623e4a019a9a2e18a9c9ae2ac19470 x.c
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'x.c'`"
test 66 -eq "$shar_count" ||
$echo 'x.c:' 'original size' '66,' 'current size' "$shar_count!"
fi
fi
rm -fr _sh27543
exit 0