Commit Graph

397 Commits

Author SHA1 Message Date
skrll
5e2026a163 Add code code for .init and .fini section fallthroughs and regression
test.
2004-05-18 19:19:34 +00:00
skrll
c007da99a0 Update for ELF. 2004-05-17 10:44:22 +00:00
skrll
f01797a30f Fix typos so that we define _start and __start.
The linker script gets the right entry point now.
2004-04-30 08:11:37 +00:00
skrll
337520b409 Include bsd.own.mk before testing MKPIC 2004-03-09 20:04:00 +00:00
simonb
216a472c99 Use -fPIC only if MKPIC isn't "no". 2004-02-14 08:41:58 +00:00
simonb
fb8a44d89d Don't build lcrt.o (version of crt0.o that looks in /libexec/ for the
shared linker) if we have MKPIC=no.
2004-02-14 07:48:37 +00:00
matt
69f9c8b092 Add MD_CALL_STATIC_FUNCTION. This allows crt* to compiled with -g. 2003-12-22 21:05:01 +00:00
christos
480316c216 Make sure this still compiles with gcc-2.95. Hello vaxen! 2003-12-03 18:41:35 +00:00
lukem
3921361c6a Use __attribute__((__used__,__noinline__)) (instead of __unused__)
for __do_global_ctors_aux() and __do_global_dtors_aux(),
to fix building with gcc3 -O3.
Discussed with Matt Thomas & Christos Zoulas, and tested on alpha & i386.
2003-12-02 03:01:19 +00:00
fvdl
e367e360a4 The x86_64 assembler seems to get it wrong when assembling
_eprol@GOTPCREL, it resolved it internally as a PC-relative instruction,
getting garbage, since the needed value is in the GOT. Add a CPP hook
to export it explicitly, this makes it work. Only active on amd64. XXX
2003-11-28 23:25:54 +00:00
dsl
8acea4b2c0 Make {g|s|l}crt0.o depend on crt.o and remove the non-standand .afterdepend
translation.
2003-11-11 11:35:03 +00:00
dsl
016359fc65 Make gcrt0.o depend on crt0.o so that it picks up the dependencies from .depend. 2003-11-11 11:32:39 +00:00
agc
b2b49933f4 Move Matt Green's code from a 4-clause to a 3-clause licence by removing
the advertising clause. Diffs provided in PR 22396 by Joel Baker, the changes
were confirmed to the board by Matt Green.
2003-10-13 14:22:20 +00:00
matt
3e272c0b2a Deal with the new toolchain. 2003-10-06 05:28:05 +00:00
fvdl
7e7bcf4bc9 Allow platforms to define __EH_FRAME_CONST. Currently "const" for x86_64,
empty for others. x86_64 (and s390, which we do not have) have .eh_frame
as a read-only section, so __EH_FRAME_BEGIN__ and the register/deregister
functions must take a const foo *.

This also fixes an ICE in gcc 3.3.1 (see gcc PR #9552)
2003-09-07 22:27:54 +00:00
skrll
d900731978 Resolve dlsym(3) and friends directly so that dlsym(RTLD_NEXT,...) works.
Previously dlsym resolved to the version in crt0.o or libc which would
mean that the caller's shared object couldn't be determined correctly
using __builtin_return_address(0).

Mainly from FreeBSD, but adapted by me. Benefits of this solutions are:

	- backward comptibility maintained
	- existing broken binaries are fixed with a new ld.elf_so
	- __mainprog_obj can be removed from crt0.o
	- we do the same thing as FreeBSD

Fixes PR 22067.

OKed by Jason and Christos.
2003-08-12 09:18:38 +00:00
salo
99410184e7 netbsd.org->NetBSD.org 2003-07-26 19:24:24 +00:00
uwe
fa9c69303e Fix previous. s/_start/___start/ in the declaration as well. 2003-07-05 23:50:28 +00:00
marcus
bcd3ee1e02 Provide entry point as both _start and __start, like i386 port does. 2003-07-05 22:51:12 +00:00
thorpej
c2048dc2a3 Don't need sysident.h here anymore; crti provides it. 2003-05-31 19:41:24 +00:00
scw
aa018ec72e Add a work-around for an SH5 binutils bug which results in bogus
GOT offsets in the PIC-compiled crt0 of statically linked binaries.
2003-04-01 10:20:38 +00:00
scw
89380eb358 Add PIC support. 2003-03-24 14:32:57 +00:00
ross
88929ccff1 crt{begin,end}S.o must now depend on the new crt{begin,end}S.c wrappers 2003-03-19 16:54:25 +00:00
ross
520b9c1f59 * remove .ALLSRC, which doesn't work with the new dependency tree
replaced mostly with .IMPSRC, so add .c wrappers for variant .o names

* any machine with a shared crt0.c that also uses common_elf (I didn't see
  any) will now need a reachover wrapper in .CURDIR a la crtbeginS.c

this should fix the build breakage
2003-03-19 04:31:41 +00:00
christos
e04b01c9ff Add appropriate SRCS lines so that we actually create dependencies. I've
been running with a crt0.o from last year!
2003-03-18 19:11:57 +00:00
scw
699eeb228c The temporary asm trampoline code is no longer needed. 2002-12-06 17:06:06 +00:00
scw
098d74e947 Fix the alignment of the MD_SECTION_PROLOGUE. 2002-12-06 17:05:14 +00:00
thorpej
f343e6c086 If EXTERNAL_TOOLCHAIN is defined, don't build crtbegin/crtend. 2002-11-26 19:27:09 +00:00
thorpej
df201a40b9 Correct a comment. 2002-11-23 17:23:51 +00:00
thorpej
5df3ea5331 Oops, the _init() and _fini() entry points need to be in the .init
and .fini sections, respectively (same as the {init,fini}_fallthru
stubs).

This is needed on PowerPC, where otherwise the linker would be unhappy
with the relocation records for the fallthru stubs when building a
shared library.
2002-11-23 17:21:22 +00:00
thorpej
bc4956ce1c Fix the _init and _fini function prologues for ABICALLS. Make sure
the functions are aligned to a 32-bit boundary, otherwise some pretty
colorful lossage can result.
2002-11-23 01:44:13 +00:00
thorpej
6a088e4e31 Fix typo. 2002-11-22 16:47:20 +00:00
thorpej
6dba3a7439 Split crtbegin/crtend into crti/crtbegin/crtend/crtn. NetBSD-specific
things like the .note.netbsd.ident section are provided by crti/crtn.
crti/crtn also provide the _init() and _fini() routines.

crtbegin/crtend now only provide support for ctors/dtors.  This paves
the way to using the "crtstuff" provided with GCC (when we upgrade to
GCC 3.3), which provides, among other things, much better C++/Java
exception handling.
2002-11-22 06:44:56 +00:00
itohy
cbb1f0fb0f MKDYNAMICROOT for a.out 2002-11-12 14:33:48 +00:00
itohy
5b3e8cb3f2 Do not print \0 at the end of error message. 2002-11-12 14:26:10 +00:00
thorpej
303696ca38 Fix signed/unsigned comparison warnings. 2002-11-11 00:44:43 +00:00
grant
291ac7e9c4 don't include machine/asm.h (make this build again). 2002-09-19 01:24:43 +00:00
lukem
ebb6fc9eb8 Use ${NETBSDSRCDIR}/some/path instead of ${.CURDIR}/../../some/path (etc).
(Reduces make output by ~ 20%)
2002-08-19 09:41:27 +00:00
matt
b79865a0af To make things clearer, use register prefixes in asm() code. 2002-07-29 21:54:35 +00:00
scw
c7b95fdc37 Use an assembler trampoline to call the real start entrypoint, at least
until we switch to the native toolchain.
2002-07-10 13:13:47 +00:00
scw
59474a8c82 NetBSD, meet the SH-5 cpu.
SH-5, meet NetBSD.

Let's hope this is the start of a long and fruitful relationship. :-)

This code, funded by Wasabi Systems, adds initial support for the
Hitachi SuperH(tm) SH-5 cpu architecture to NetBSD.

At the present time, NetBSD/evbsh5 only runs on a SH-5 core simulator
which has no simulated devices other than a simple console. However, it
is good enough to get to the "root device: " prompt.

Device driver support for Real SH-5 Hardware is in place, particularly for
supporting the up-coming Cayman evaluation board, and should be quite
easy to get running when the hardware is available.

There is no in-tree toolchain for this port at this time. Gcc-current has
rudimentary SH-5 support but it is known to be buggy. A working toolchain
was obtained from SuperH to facilitate this port. Gcc-current will be
fixed in due course.

The SH-5 architecture is fully 64-bit capable, although NetBSD/evbsh5 has
currently only been tested in 32-bit mode. It is bi-endian, via a boot-
time option and it also has an "SHcompact" mode in which it will execute
SH-[34] user-land instructions.

For more information on the SH-5, see www.superh.com. Suffice to say it
is *not* just another respin of the SH-[34].
2002-07-05 13:31:28 +00:00
fredette
43c563a3dd A new crt0.c for hppa, with support for dynamic linking. 2002-07-01 15:56:41 +00:00
matt
0ec15f80cc Allow this to compile under gcc-current. No multiline strings for asm. 2002-06-09 06:18:34 +00:00
thorpej
8bbbfff0a1 Remove __LEADING_UNDERSCORE case. 2002-06-08 17:27:25 +00:00
fredette
02ac1ae2f0 Added hppa support (some of it incomplete) to lib/csu, lib/libc,
and lib/libkvm.
2002-06-06 20:31:19 +00:00
fvdl
e4b98ed506 Add init/fini handling. 2002-06-06 19:18:22 +00:00
fvdl
e8d64f072a -x is too heavy-handed for removing symbols; newer versions of GNU ld
will completely delete empty local symbols with it. Use -X instead
for crt{begin,end}*.o, to keep init_fallthru hacks.
2002-06-06 19:17:01 +00:00
thorpej
7f350cba6c Don't use multi-line string literals. 2002-06-05 02:51:03 +00:00
wiz
da0b574ae0 Comment out token after #endif. 2002-05-16 19:30:41 +00:00
matt
858f46fb43 Define _SDA(2)_BASE_ as [] which is more correct. 2002-05-09 20:32:59 +00:00