From: dougbell@berlioz.nsc.COM (Doug Bell)
Newsgroups: comp.windows.x
Subject: Re: jump relocation out-of-range
Date: 21 Aug 92 00:23:03 GMT
Organization: The Internet

*From sun!expo.lcs.mit.edu!xpert-mailer@nsc.nsc.com  Thu Aug 20 10:38:09 1992
*Return-Path: <sun!expo.lcs.mit.edu!xpert-mailer@nsc.nsc.com>
*Received: from nsc.nsc.com by berlioz.nsc.com (4.1/SMI-4.1)
*	id AA03270; Thu, 20 Aug 92 10:38:09 PDT
*Received: from sun by nsc.nsc.com (5.61/1.34) with UUCP
*	id AA11332 for xstuff@berlioz.NSC.COM; Thu, 20 Aug 92 10:38:38 -0700
*Received: from Sun.COM (sun-barr) by sun.Eng.Sun.COM (4.1/SMI-4.1)
*	id AA21768; Thu, 20 Aug 92 07:35:35 PDT
*Received: from expo.lcs.mit.edu by Sun.COM (4.1/SMI-4.1)
*	id AA18018; Wed, 19 Aug 92 22:05:59 PDT
*Received: by expo.lcs.mit.edu; Wed, 19 Aug 92 19:30:43 -0400
*Received: from BLOOM-BEACON.MIT.EDU by expo.lcs.mit.edu; Wed, 19 Aug 92 19:30:34 -0400
*Received:  by bloom-beacon.MIT.EDU (5.61/25-eef)id AA18511; Wed, 19 Aug 92 18:36:04 EDT
*Received: from USENET by bloom-beacon.mit.edu with netnewsfor xpert@expo.lcs.mit.edu (xpert@expo.lcs.mit.edu)(contact usenet@bloom-beacon.mit.edu if you have questions
*Date: 19 Aug 92 17:25:53 GMT
*From: rogerk@Veritas.COM (Roger B.A. Klorese)
*Organization: VERITAS Software
*Subject: Re: jump relocation out-of-range
*Message-Id: <1992Aug19.172553.27742@Veritas.COM>
*Newsgroups: comp.windows.x
*References: <1992Aug19.125703.7774@cid.aes.doe.CA>
*Sender: xpert-request@expo.lcs.mit.edu
*To: xpert@expo.lcs.mit.edu
*Status: R
*
*In article <1992Aug19.125703.7774@cid.aes.doe.CA> afshwrh@cid.aes.doe.CA (Wayne Hodgins) writes:
*>Hi
*>
*>When I attempt to compile & load the following code...
*>
*>#include <Xm/Xm.h>
*>#include <X11/Intrinsic.h>
*>#include <X11/StringDefs.h>
*>#include <X11/Shell.h>
*>.....
*>	Widget toplevel;
*>	XtAppContext app_context;
*>.....
*>        toplevel = XtAppInitialize(&app_context,"XText",NULL,
*>                   0, &argc, argv, NULL, NULL, 0);
*>.....
*>
*>I get this message from ld...
*>
*>/usr/lib/libX11.a(XlibInt.o): jump relocation out-of-range, bad object file prod
*>uced, can't jump from 0x4d51e8 to 0x10048428 (syscall)
*>
*>The code loads fine as a standalone test program; the message occurs when
*>I try to incorporate it into an existing larger program.
*>Any ideas on what the problem may be?
*
*Yes.
*
*Somewhere, a symbol called "syscall" is being defined as a global data
*variable; the loader is therefore attempting to place it at a data
*address (0x10048428).  Somewhere else, such as in libc, a function called
*"syscall" (a standard libc routine) is being called.  The linker can
*resolve the symbol already, because of your data item, so it doesn't load in
*the proper (function) "syscall."  But it can't jump to it, because the
*difference in addresses is greater than that allowed for some jump types in
*the (Mips?) architecture.
*
*Search your code for a variable called "syscall" and rename it.
*
*--
*ROGER B.A. KLORESE                                             VERITAS Software
*4800 Great America Parkway #420   Santa Clara, CA 95054    +1 408-727-1222 x310
*rogerk@veritas.com                               {apple,pyramid}!veritas!rogerk
*"Life turns on a dime." -- Ruth Ann

Hi,
We had a time of it doing some porting, due to external symbols in a code
overriding system interface symbols.  The loader(s) may/may not be
helpful on this issue.  An (admittedly crude) but effective way to check 
your .o files for the possibility of problems follows.  This method was 
done on AIX machines. 
Regards, Doug Bell  dougbell@berlioz.nsc.com  National Semiconductor

--------------------- el snip-o ------------------------------
#!/bin/csh -f
#
# Name:       cheklib
# Author:     Doug Bell, dougbell@berlioz, 408-721-4308
# Purpose:    Compare User code extern symbols with libraries
# Version:    IBM AIX
# Algorithm:  Generate via ar a user extern symbol list. 
#             Generate libraries extern symbol list. Deduce conflict.
# Dependencies:  csh, ar, awk, sed, sort, uniq, comm, join, rm, cat, set
# Comments:   Output is sent directly to standard output
# Revision history (latest first):
# +-----+----------+---------------------------------------------------------+
# | Who |   When   | What                                                    |
# +-----+----------+---------------------------------------------------------+
# |  db |  3/27/92 | Version 1.0  Original.                                  |
# +-----+----------+---------------------------------------------------------+
  #--------------------------------------------------------------------#
  # SET the dir location of the users *.o compiled o/p object files    #
  #--------------------------------------------------------------------#
  set user = *.o
  #--------------------------------------------------------------------#
  # SET the compiler and system libraries used by Makefile             #
  #--------------------------------------------------------------------#
  #-----------------------------------#
  # AIX/370 fvs VS Fortran libraries. Check ld map ...ld -m            #
  #-----------------------------------#
# set libs = ( /usr/lib/libfvs.a \
#                  /lib/libc.a   )
  #-----------------------------------#
  # AIX 3.2 xlf XL Fortran libraries. Check ld map ...ld -bl:load.map  #
  #-----------------------------------#
  set libs = ( /usr/lib/libxlf.a     \
               /usr/lib/libcurses.a  \
               /usr/lib/libtermcap.a \
               /usr/lib/libc.a       \
               /usr/lib/libm.a       )
  #--------------------------------------------------------------------
  #
  # Gen extern symbol list from an .a archive lib of users *.o files
  #
  echo .
  echo Check user compiled output binaries.
  if( -e tempU.a &&! -z tempU.a ) rm tempU.a
  ar -qc tempU.a $user
  ar -w  tempU.a > tempU.x1
  rm     tempU.a
  sed "s/_//g"     tempU.x1  | sort -o tempU.two
  awk '{print $1}' tempU.two | cat   > tempU.one
  #
  # Gen extern symbol list from system libraries
  #
  echo Check system libraries:
  if ( -e tempL.two &&! -z tempL.two ) rm tempL.two
  foreach  dd ($libs)
    echo  $dd
    ar -w $dd >>   tempL.two
  end
  awk '{print $1}' tempL.two | cat   > tempL.z1
  sed "s/_//g"     tempL.z1  | sort -o tempL.z2
  uniq tempL.z2    tempL.one
  #
  # Deduce if there are any user extern symbol conflicts with libraries
  #
  comm -12 tempL.one tempU.one > tempU.out
  join     tempU.two tempU.out > tempU.final
  if ( -e tempU.final &&! -z tempU.final ) then
    echo User external symbol conflict found with system libraries:
    echo extern program-file
    echo ------ ------------
    cat tempU.final
    echo .
  else
    echo No user extern symbol conflict found with system libraries.
  endif

  rm tempL.* tempU.*

# End-Of-This