Subject: port-mips/4175: __start vs _start confusion in crt0 entrypoint on NetBSD/mips
To: None <>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: netbsd-bugs
Date: 09/27/1997 23:15:37
>Number:         4175
>Category:       port-mips
>Synopsis:       __start vs _start confusion in crt0 entrypoint on NetBSD/mips
>Confidential:   yes
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 27 23:20:01 1997
>Originator:     Jonathan Stone
>Release:        1997-09-01
System: NetBSD Reno.DSG.Stanford.EDU 1.2G NetBSD 1.2G (GENERIC) #19: Sat Aug 30 01:09:13 PDT 1997 jonathan@Reno.DSG.Stanford.EDU:/reno/compile/GENERIC pmax

	GNU binutils for mips/elf expects _start as the entrypoint
    to crt0.

	The netbsd/mips gcc configuration is set up to use
    __start as the crt0 entrypoint.  The NetBSD/mips crt0.c
    agrees with this.

    The NetBSD/mips gcc driver config tells GCC to invoke ld
    with ``-e __start'' by default.  In  the normal case,
    everything works fine

    However, Programs that specify gcc --nostdlib incur a warning:
    --nostdlib  turns off the explicit -e __start entrypoint, and 
    so GNU ld attempts to link with an entrypoiint of `_start'.

    `_start' is not defined, so the linker sets the entrypoint
    to the start of the text segment.

	This works in almost all cases (since that's where crt0
     usually is) but might fail with, e.g., emacs, or other programs
    that override the default entrypoint.	


	* do a `make build' in /usr/src with a nonnull DESTDIR.
	* build emacs 20.2


	Consider changing /usr/src/gnu/usr.bin/gcc/arch/mips/mips.h
	to _not_ specify an explicit entrypoint, and change crt0.c