[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gcc -mbaserel
Thomas Schulze wrote me that he gets a "relocation out of range for
(static symbol) in _strerror.o". This is a design bug in
-mbaserel. The problem is this line in strerror.c:
return(_sock_errlist[errnum - MINSOCKERR]);
It is compiled into (with -m68030):
lea a4@(__sock_errlist-1200:w),a0
movel a0@(d1:l:4),d0
But if __sock_errlist is allocated in the data segment less than 1200
bytes from the beginning, the offset is too big to be represented as a
signed short. Remember, a4 points to 32k bytes from the start of data.
A fix for this is to make _sock_errlist[] a const array, so that it is
allocated in the text segment:
--- orig/strerror.c Wed Nov 3 18:45:02 1993
+++ strerror.c Fri Nov 5 20:35:32 1993
@@ -118,7 +118,7 @@
/* Support for Kay Roemer's socket library */
-char *_sock_errlist[] = {
+char *const _sock_errlist[] = {
"Socket operation on non-socket", /* 300 */
"Destination address required",
"Message too long",