This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Re: ns32k-pc532-netbsd problems


On Sun, 25 Jul 1999 22:52:33  0000 karuottu@freenet.hut.fi said:

> blacky@xanaxis.dyndns.org wrote:
> 
> > I am trying to build an ns32k-pc532-netbsd crosscompiler, I used the
> > sources for binutils egcs from netbsd itself, after solving some
> > problems I was able to build the binutils and crosscompiler.
> > 
> > But when I try to compile anything the compiler comes up with the
> > following :
> > 
> > \\z\ns32k-pc532-netbsd\ns32k-pc532-netbsd\lib\crt0.o(.text 0x44): undefined reference to `_DYNAMIC'
> > \\z\ns32k-pc532-netbsd\ns32k-pc532-netbsd\lib\crt0.o(.text 0x55): undefined reference to `_DYNAMIC'
> > collect2: ld returned 1 exit status
> 
>  Your internal linker script (see it with 'ld -verbose') should have 
> something equivalent as follows:
> 
> ------------- clip ------------------
> D:\usr\local\i486-netbsd\bin>ld -verbose
> GNU ld version 2.9.1 (with BFD 2.9.1)
>   Supported emulations:
>    i386nbsd
> using internal linker script:
> ==================================================
> OUTPUT_FORMAT("a.out-i386-netbsd", "a.out-i386-netbsd",
>               "a.out-i386-netbsd")
> OUTPUT_ARCH(i386)
>  SEARCH_DIR(/usr/local/i486-netbsd/lib);
> __DYNAMIC = 0;
> PROVIDE (__stack = 0);
> SECTIONS
> ------------- clip ------------------
> 
> in the beginning. The linker should take the value of '_DYNAMIC' (or 
> '__DYNAMIC' as here) from it. Anyway the error,
> 
>    crt0.o(.text 0x44): undefined reference to `_DYNAMIC'
> 
> says that your startup file, 'crt0.o' needs it, and your linker and the 
> startup file don't agree with the right name or the linker script lacks the 
> '_DYNAMIC = 0;' line...
> 
>  Please check your 'crt0.o' with 'nm' :
> 
> ------------- clip ------------------
> D:\usr\local\i486-netbsd\lib>..\bin\nm crt0.o
>          U __DYNAMIC
> 000007cc D ___progname
> 000007d0 D ___ps_strings
> 00000054 T ___start
>          U _atexit
> 000006e8 T _dlclose
> 00000730 T _dlctl
> 00000770 T _dlerror
> 000006c4 T _dlopen
> 0000070c T _dlsym
> 00000004 C _environ
> 00000004 C _errno
>          U _exit
>          U _main
>          U _strerror
> 00000000 T start
> ------------- clip ------------------
> 
> to get the right name (should be undefined '_DYNAMIC' there...)
> 
>  Something is wrong with the linker template for NetBSD in the binutils sources 
> you used. I don't remember that I had to fix something to get the '__DYNAMIC' 
> into my linker... The linker templates are in 'ld/emulparams'... Let's look at 
> binutils-2.9.1 sources...
> 
> In 'ld/emulparams' I found:
> 
> ns32knbsd.sh :
> 
>   SCRIPT_NAME=aout
>   TEXT_START_ADDR=0x1020
>   OUTPUT_FORMAT="a.out-ns32k-netbsd"
>   TARGET_PAGE_SIZE=0x1000
>   ARCH=ns32k
> 
> and i386nbsd.sh :
> 
>   SCRIPT_NAME=aout
>   TEXT_START_ADDR=0x1020
>   OUTPUT_FORMAT="a.out-i386-netbsd"
>   TARGET_PAGE_SIZE=0x1000
>   ARCH=i386
>   EXECUTABLE_SYMBOLS='__DYNAMIC = 0;'
> 
>  So it seems that the last line in 'i386nbsd.sh' is missing from 
> 'ns32knbsd.sh'... You can try to add a line:
> 
>   EXECUTABLE_SYMBOLS='_DYNAMIC = 0;'
> 
> into it (if this was the name in your 'crt0.o', rebuild the linker and see what 
> happens...
> 
>  Of course you can use the '-T <script>' to force it to use your own script 
> (e.g. extracted and modified from the internal script), but checking if this 
> is a bug in NetBSD-support in binutils, fixing it and reporting the bug to the 
> address mentioned in binutils docs, or to the 'gnu.utils.bugs' newsgroup could 
> be much better...
> 
>  Cheers, Kai
> 
> _______________________________________________
> New CrossGCC FAQ: http://www.objsw.com/CrossGCC
> _______________________________________________
> To remove yourself from the crossgcc list, send
> mail to crossgcc-request@cygnus.com with the
> text 'unsubscribe' (without the quotes) in the
> body of the message.
> 
> 

Thank you very much. Kai, for your very clear explanation of the
problem. You were completely right, I adjusted the linker-script and
recompiled ld, and it worked like a charm.

Thanx.


Signed, Blacky Stardust



_______________________________________________
New CrossGCC FAQ: http://www.objsw.com/CrossGCC
_______________________________________________
To remove yourself from the crossgcc list, send
mail to crossgcc-request@cygnus.com with the
text 'unsubscribe' (without the quotes) in the
body of the message.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]