Commit Graph

663 Commits

Author SHA1 Message Date
christos ad57574aad strip .ident, if MKSTRIPIDENT. From Adam Ciarci 2009-02-18 15:21:52 +00:00
gmcgarry 3c9a95916d Wrap compiler-specific flags with HAVE_GCC and HAVE_PCC as necessary. Add a few flags for PCC. 2008-08-29 00:02:21 +00:00
lukem ae07e87382 Enable MAKEVERBOSE support. 2008-07-21 15:34:58 +00:00
gmcgarry 38541e9dad Remove old GCC bug work-around which relied on GCC extension. 2008-06-21 00:52:52 +00:00
mrg c2b95373bf remove clause #3 from my license where there are no other
copyright holders involved.
2008-05-29 14:51:25 +00:00
martin 5d1469bd77 Backout previous: the license sweep touched these files in error, so
restore the old license.
2008-05-10 15:31:03 +00:00
martin 3028e483e4 Convert to new 2 clause license 2008-04-29 06:53:00 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
rearnsha 00f0061ae9 ARM/Thumb interworking support 2008-03-15 10:46:24 +00:00
simonb ccab3b34ce Remove support for NetBSD/pc532. 2008-01-10 13:40:36 +00:00
skrll 587600728d Fix things so that crti.o doesn't contain a completely bogus unwind entry
that covers far too much and confuses gdb.

While here remove useless dave/restore of r4.
2007-12-02 13:55:38 +00:00
yamt c2ad33834a CLEANFILES=${OBJS} 2007-12-01 11:06:36 +00:00
yamt 82f3754f04 ___start: remove a stale comment. 2007-12-01 10:16:06 +00:00
skrll 6e57c35ead Remove an include that's not required. 2007-11-13 08:41:50 +00:00
dogcow b8d6c11ba4 <machine/profile.h> needs <sys/types.h>; why crt0.c needs <machine/profile.h>
(and only on amd64) is another question altogether.
2007-09-27 10:51:18 +00:00
skrll 795d937239 All platforms are MD_DO_NOT_NEED_FALLTHRU now so no need to keep it
conditional.
2007-05-15 16:51:37 +00:00
skrll c97173f648 MD_DO_NOT_NEED_FALLTHRU for amd64.
Thanks to Juan Romero Pardines for testing.
2007-05-15 16:48:13 +00:00
scw 5764a76889 Remove support for NetBSD/{,evb}sh5. 2007-04-08 09:35:21 +00:00
skrll bd529f8818 MD_DO_NOT_NEED_FALLTHRU for sh5. Compile tested only. 2007-03-31 21:12:37 +00:00
matt bbd7ce97e9 Didn't fix it completely. Now fixed. 2007-03-16 22:50:22 +00:00
matt 0cc8f96491 Use MD_DO_NOT_NEED_FALLTHRU 2007-03-16 22:20:50 +00:00
martin cc10b3e0c8 MD_DO_NOT_NEED_FALLTHRU - from Nick Hudson. 2007-01-02 14:32:34 +00:00
skrll 7e68cfaa21 powerpc MD_DO_NOT_NEED_FALLTHRU.
OK'ed by Matt Thomas.
2006-10-19 18:59:30 +00:00
skrll e99b876999 Alpha MD_DO_NOT_NEED_FALLTHRU
Ok'd by Matt Thomas.
2006-10-19 16:47:38 +00:00
martin 799bddf8fa MD_DO_NOT_NEED_FALLTHRU for sparc and sparc64, from Nick Hudson. 2006-10-19 08:37:46 +00:00
uwe e7b566fa33 Switch to MD_DO_NOT_NEED_FALLTHRU.
While here: Factor out .section/.previous wrapper into a separate macro.
Provide frame pointer.  Add the comment to MD_CALL_STATIC_FUNCTION to
explain why it needs semicolon and why we actually don't use that macro.
2006-10-17 01:10:26 +00:00
skrll b0b0343b24 ANSIfy 2006-09-15 05:29:44 +00:00
cherry 51b652e0e3 -DELFSIZE=64 for csu build 2006-09-14 23:55:54 +00:00
skrll 296c01bb4f MD_DO_NOT_NEED_FALLTHRU for hppa 2006-09-08 19:18:26 +00:00
skrll 61b77d1855 MD_DO_NOT_NEED_FALLTHRU for ARM. 2006-09-08 07:29:19 +00:00
skrll 44521a9e2e Implement MD_DO_NOT_NEED_FALLTHRU for i386.
Reviewed by christos.
2006-08-25 12:44:19 +00:00
skrll bc3a3e7751 Tidy up for MD_DO_NOT_NEED_FALLTHRU.
Discussed with cherry.
2006-07-18 21:18:23 +00:00
ross 7e22c74b0c Nothing from <machine/asm.h> is even used here, so don't include it.
This was the only place in the system where asm.h contents were seen
by the compiler and hence the only reason why asm.h had to conform
to C syntax. This previously limited asm.h to a cpp constructs and
comments.
2006-07-07 19:57:29 +00:00
ross ce3a138bcc add missing .globl's in new direct fallthru .init .fini 2006-07-06 22:31:55 +00:00
ross d0531274ae Conform to new world order where .init/.fini fallthru code
assembly appears directly inside _init().
2006-07-05 18:03:00 +00:00
cherry b8ee9baf67 First round at ia64 csu 2006-07-02 17:15:22 +00:00
ross 28dc42c889 fix comment 2006-07-01 01:39:17 +00:00
ross bbf630ab7c powerpc64 assembly for .init / .fini 2006-06-30 22:49:50 +00:00
simonb 842e180144 Remove the call to init_fallthru/fini_fallthru and call _init/_fini
directly for MIPS.  Making these global to keep gcc4 happy broke gcc3.
Shaves a few instructions off this path as well.

Other arches to follow with similar changes.

With much help from Nick Hudson.
2006-06-30 09:00:46 +00:00
mrg e487cf62f5 add a .globl to MD_SECTION_PROLOGUE so that the symbol is exported.
this fixes build problems with GCC4 (which will use smaller/faster call
methods for local/static functions) and is the right thing anyway.
2006-06-12 22:05:49 +00:00
mrg db19e89e04 remove support for building (with) GCC 2.95. also:
- always install <stdbool.h>
- don't generate a fake one for vax / gettext.
2006-06-02 22:16:18 +00:00
christos 351fa65664 Instead of using -I- -I${.CURDIR} and #include "dot_init.h", use:
-I${.CURDIR} and #include <dot_init.h>, since -I- is obsoleted in gcc-4,
and it is too confusing anyway.
2006-05-19 19:11:12 +00:00
christos 96473fa808 change __weak_extern to __weak_reference so that gcc4 works. 2006-05-18 17:54:19 +00:00
christos 065d43d6c4 Revert previous changes which are unnecessary now the _DYNAMIC is marked
weak.
2006-05-17 17:08:54 +00:00
christos e08e654f06 Mark _DYNAMIC to have attribute __weakref__, so that gcc-4 does not optimize
&_DYNAMIC == NULL away. From Matt Thomas.
2006-05-17 17:08:07 +00:00
christos f32828209d Back out accidental commit that changed -I- 2006-05-17 17:02:16 +00:00
christos 6f1784f6d3 Fool gcc to compare against a null variable instead of the NULL constant
so that it does not optimize the &_DYNAMIC == NULL away. Idea from Matt.
2006-05-17 17:01:12 +00:00
christos 94b00d6e09 Avoid weak symbol related bug with _DYNAMIC not being referenced in the
code at all for gcc-4. Fixes statically linked binaries, but the fix is
bogus.
2006-05-17 16:39:25 +00:00
mrg 169832563d with GCC4 we *need* to pass -fno-unit-at-a-time otherwise GCC
reorders things breaking _init() and _fini().

for i386, the {init,fini}_fallthru() functions were being output
_before_ the _init()/ _fini(), and instead of falling through to
the rest of the .init/.fini section, it would fall through to
_init()/_fini() again, and again, and again, until the stack was
exhausted.

now i386 works, but i have not checked that this works for
sparc64 as well.
2006-05-13 01:40:34 +00:00
perry 2d65de2479 bare asm -> __asm 2005-12-24 22:45:33 +00:00
perry 0db47b5ca1 bare asm -> __asm 2005-12-24 21:51:51 +00:00
perry 8b7a2f14e9 __asm__ -> __asm 2005-12-24 21:38:40 +00:00
perry 4e11af46bc Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 21:11:15 +00:00
skrll b7ddf5b9cb Copyright Maintenance 2005-05-21 06:46:34 +00:00
thorpej 70638a64cb Error out if we try to build with GCC 3.3 or later; we should be using
the GCC-supplied crtbegin / crtend in the GCC 3.3 or later case.
2004-08-28 00:19:22 +00:00
thorpej 8d13a4aafe Switch to using GCC's supplied crtbegin / crtend files. 2004-08-28 00:18:38 +00:00
thorpej 08456b0802 Use ANSI function decls. 2004-08-26 21:23:06 +00:00
thorpej 5c50ce218e Remove the "allows linking without crtbegin / crtend" hack. 2004-08-26 21:21:33 +00:00
thorpej b979dc154e Use ANSI function decls. 2004-08-26 21:21:05 +00:00
thorpej 54fe33a634 Use ANSI function decls. 2004-08-26 21:09:52 +00:00
thorpej a41fd2dbc8 - Use ANSI function decls.
- Use __used__, not __unused__ attribute for ___start().
2004-08-26 21:07:14 +00:00
thorpej 68e26dcdb6 _strrchr()'s second argument is actually an int. 2004-08-26 21:01:12 +00:00
thorpej 352bb3a6aa Use ANSI function decls. 2004-08-26 20:57:47 +00:00
thorpej 11b5ec27b8 Remove sysident.h-related comment; that stuff is handled by crti.c these
days.
2004-08-26 20:51:27 +00:00
rearnsha 29efdff284 Temporary hack to work around ld problems when linking Thumb
applications where the linker does not correctly insert an
interworking veneer.
2004-08-21 12:12:28 +00:00
chs ddc1ca7bcb map the data segment with PROT_EXEC since the PLT lives there. 2004-08-07 21:33:04 +00:00
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
thorpej 6249662a70 Deal better with platforms that don't yet support shared libraries:
* Only add -fPIC if MKPIC != no.
* Only build crtbeginS and crtendS if MKPIC != no.
2002-05-05 00:45:31 +00:00
thorpej 179139677a All ELF toolchains are of the "new toolchain" variety now, so no need
to conditionalize use of .hidden symbols anymore.
2002-05-05 00:34:00 +00:00
wiz 15d53d85be ${MACHINE_ARCH} != "arm32" is always true now, so remove it from an if. 2002-05-02 16:42:53 +00:00
matt e18dedbd2f switch from addis R,0,... to the simplified mnemonic of lis which is
typically used for this.
2002-04-26 23:28:53 +00:00
kleink 3f1a2352b7 Use __weak_extern() for _SDA_BASE_ and _SDA2_BASE_ declarations. 2002-04-17 17:36:13 +00:00
matt 036d79bb12 Make sure to initialize GPR13/GPR2 appropriately for the Small Data Area
pointer as described in the SVR4 PPC ABI.  Though GPR2 is defined by the
SVR4 PPC ABI as system-reserved, the EABI (Embedded API) changes its use
to be the Small Data Area 2 register (const small data).  Since powerpc
under NetBSD doesn't use R2 in the kernel (yet), support it as well.
2002-04-17 13:32:42 +00:00
skrll 2d0a923dcd Correct some comments. 2002-04-08 22:17:37 +00:00
jmc c03ef26393 Don't make ___start static as gcc can't tell it's referenced and complains. 2002-04-04 08:22:11 +00:00
eeh 41065b740e Don't need `start' in crt0.o any more. ld expects `_start' as the entry
symbol, while gcc likes `__start'.
2002-03-29 18:11:55 +00:00
matt 0ce5ca145f Change to use a register prefix. 2002-02-24 01:06:18 +00:00
matthias 21fb786623 Declare the global register variable kps_strings before including anything
as this needs to be done before any function is defined (and there seems
to be a function definition in one of the include files).
2002-02-22 13:46:30 +00:00
mrg 829b76292e fix multiline string literal. from gcc3 2002-02-11 06:08:23 +00:00
thorpej e4217fbfe4 Pass the rtld object and ps_strings to _start() properly. From Marcus. 2002-02-03 23:57:19 +00:00
thorpej ec206ac99b Multi-line string literals are not in ISO-C. 2002-01-23 03:55:33 +00:00
drochner e757f639d2 don't include <machine/asm.h> to avoid conflicts with definitions
in <sys/cdefs.h>
2002-01-14 12:06:49 +00:00
thorpej fd9112a780 Build and install crtfm.o (sets the Alpha FP_C in a way that GCC's
-ffast-math on Alpha expects).
2002-01-14 01:31:58 +00:00
thorpej 24ca47c4d5 * Use the new ALPHA_SET_FP_C sysarch call.
* Provide an internal sysarch entry point, so that this works
  with statically-linked programs.
2002-01-14 01:31:00 +00:00
thorpej 655925395a Support for the GCC "-ffast-math" option on the Alpha. 2002-01-13 20:05:42 +00:00
thorpej caaec27cfe * Use += to assign OBJS so that machine-dependent Makefiles can
add their own objects to the list.
* Garbage-collect an unneeded CLEANFILES assignment.
2002-01-13 19:59:26 +00:00
thorpej d605da06f0 %progbits, not @progbits (@ is a comment character in ARM assembly). 2002-01-01 01:36:21 +00:00
thorpej 7050ac9aa9 Multi-line string literals are not supported by ANSI C. 2002-01-01 01:31:06 +00:00
thorpej 5ced70565e Set ELFSIZE=64. 2002-01-01 01:14:22 +00:00
thorpej d8abc59932 Add support for invoking GNU C++ local destructors in shared objects
via the __cxa_finalize() mechanism.

XXX Only enabled for new-toolchain platforms, as it requires the assembler
to support the .hidden pseudo-op.
2001-12-31 00:40:11 +00:00
thorpej a50163af65 Build separate crt{begin,end}.o and crt{begin,end}S.o files, rather
than linking them at install time.  Forthcoming changes require different
behavior for static vs. shared object versions of these files.
2001-12-31 00:11:13 +00:00
thorpej c41160abff Add support for registering Java classes emitted by the Java compiler
(e.g. the Java compiler in GCC 3.x) into the ".jcr" section.
2001-12-30 23:45:00 +00:00
thorpej 6027dc5536 Make sure the Dwarf2 EH frame info is 4-byte aligned. 2001-12-30 23:26:20 +00:00
thorpej 5b81869561 Don't use multi-line string literals; they're not supported by ANSI C. 2001-12-30 23:23:38 +00:00
bjh21 7723559395 Quiet GCC warnings. 2001-11-08 22:23:59 +00:00
lukem 65469e54b3 pull in ../../Makefile.inc 2001-11-05 15:11:40 +00:00
skrll 6d6c931c5a This is an a.out thing and doesn't belong here. 2001-10-26 16:05:25 +00:00
scw f768a5c42b Reduce the alignment constraint from 4 to 2. This fixes the problem where
gas(2) pads the text segment with 0x0 instead of NOP. Since m68k instructions
only need 16-bit alignment, .align 2 works just fine.
2001-10-13 09:21:50 +00:00
kristerw 031a62292d Run the entries in __CTOR_LIST__ and __DTOR_LIST__ in the order gcc expect. 2001-10-11 18:02:28 +00:00
matt eef4b63246 Make __start global. 2001-09-08 18:59:20 +00:00
bjh21 751e6fa590 Ensure that the stack is aligned to an 8-byte boundary before calling C code.
(ATPCS B-01)
2001-08-17 00:14:38 +00:00
simonb 9a68629ca6 Enlarge the stack frame to 16 bytes, and store the return address 8
bytes in instead of at the start, to leave room for a .cpload to store
the gp at offset 0 in the frame.  Allow 8 bytes for each (for mips64
one day...).

.cpload overwrite problems noted by Michael Hitch.
2001-08-16 03:44:46 +00:00
matt ee6a16ad18 Add a secondary label called __start (makes gcc 2.95.3 happier) and rename
the internal __start to ___start.   (Since -e is not supplied by default,
this has no effect on a native build.)
2001-08-05 00:01:27 +00:00
thorpej 102df4197d Enable DWARF2 EH support. Confirmed working w/ GCC 2.95.3 on sparc
and i386.
2001-08-03 14:26:13 +00:00
thorpej a6855eea24 Add support for DWARF2 frame unwinding/exception handling. This
should be sufficient for GCC 2.95.3, and probably GCC 3.0 as well.

Not yet enabled by default; further testing required.
2001-08-03 05:54:43 +00:00
wiz e11d04474c issueing -> issuing 2001-07-26 22:55:12 +00:00
tsubai 1278735b51 .init/.fini support. 2001-07-23 20:43:31 +00:00
bjh21 71d647ec7a The common arm_elf code seems to work on arm26, so use that. 2001-07-20 13:01:13 +00:00
simonb 19211890ff Enable dot_init.h on mips, fixing .init & .fini processing. 2001-07-18 04:43:48 +00:00
mrg 6bea810c23 enable dot_init.h on both sparc & sparc64, fixing .init & .fini processing
for both platforms.  they share dot_init.h with a single #ifdef #define
difference...
2001-07-17 18:25:11 +00:00
simonb 1bc139fd41 Add but not enable correct .init/.fini handling. 2001-07-17 15:20:23 +00:00
mrg f4bd34ec5f add but not enable correct .init/.fini handling. 2001-07-17 13:32:35 +00:00
mrg ff68bb147c minor KNF 2001-07-17 13:28:05 +00:00
tsubai 4a0b75d5d2 Add the new .init/.fini support. 2001-07-17 12:16:43 +00:00
matt 119c72fb96 Add new init/fini to VAX ELF. 2001-07-17 06:45:46 +00:00
matt ae9f64ff3b Turn-on new init/fini processing. 2001-07-17 06:39:14 +00:00
thorpej 4abcdae85e Enable the new (working) .init/.fini magic. 2001-07-17 03:56:48 +00:00
matt 126898a2cd Initial CSU for ARM with shared ELF. 2001-07-15 17:29:00 +00:00
fvdl a84b13f43f CSU for x86-64 port. 2001-06-19 00:49:06 +00:00
mrg f59b9e737f set FILESDIR to "${LIBDIR}", not hard coded /usr/lib. 2001-06-07 15:22:49 +00:00
fredette e80c95ddb2 Don't use an EA with a scaled index, it isn't supported on the 68000. 2001-05-17 21:21:07 +00:00
fredette 872a39428c Don't compile with -fPIC when MACHINE_ARCH is m68000. 2001-05-17 21:17:02 +00:00
kleink 7bd28edec7 Add, but do not yet enable, m68k code for .init and .fini section fallthroughs. 2001-05-12 00:17:55 +00:00
ross 2d62241cb9 Reorganization of crtbegin/crtend.
o  Primary mod: alpha and i386 code for .init and .fini section fallthroughs
o  Actual fallthru is not yet enabled, see csu/{alpha,i386_elf}/Makefile
o  When enabled, should fix bin/12865 & should fix at least one WINE bug,
   see http://www.winehq.com/hypermail/wine-devel/2001/05/0021.html
o  Also, removed the function pointer hack put in to prevent gcc from
   incorrectly attempting to do short calls over section boundaries,
   on some architectures, rather, simply simply move ctors() and dtors()
   into .init and .fini.
Other notes.
o  Our crtbegin.c and crtend.c were completely in C, despite
   the fact that .init and .fini section fallthroughs require machine code.
   These modules implement the gnu ctors/dtors mechanism directly, eliminating
   in part the need for the elf .init/.fini section fallthrough. However,
   if we ever want to use the gnu-provided constructor support, we need to
   do the fallthrough, at least one program (WINE) apparently uses the
   feature independently, and other compilers may depend on the mechanism.
o  It is amusing that the previous NetBSD _init() and _fini() were put
   into the .init and .fini sections, because nothing is gained over
   plain .text if they don't fall through. Cargo cult!
o  Other elf ports will need to copy the alpha and i386 example mods.
2001-05-11 22:44:14 +00:00
bjh21 0113cca535 Our ARM ELF ld(1) currently has problems with PIC relocations, so don't
generate them.  I suspect this is safe until we get PIC in general working.
2001-04-28 17:32:33 +00:00
msaitoh 581638d47c check __LEADING_UNDERSCORE 2001-02-25 15:51:24 +00:00
eeh 6a9224a06d Remove old compatibility hack. Should no longer be needed. 2001-02-21 00:47:21 +00:00
simonb 71c90eeec6 ANSIfy and merge some stylistic changes from arm26/crt0.c.
No functional changes.
2001-02-18 23:03:34 +00:00
simonb 5df49e36f3 Fix typo. 2001-02-18 23:01:39 +00:00
bjh21 015575c577 Use _C_LABEL rather than _C_FUNC. 2001-02-03 16:25:26 +00:00
enami 0ebf8f7f72 - Fix typo
- Wrap long line
2001-01-10 13:20:17 +00:00
itojun 99b0df5333 use MACIHNE_CPU to determine architecture-dependent source code directory.
is use of exists(foo) safe enough?
TODO: many other places to fix
2001-01-08 08:29:59 +00:00
itojun 264cf8dcf3 sh3 split 2001-01-04 08:01:49 +00:00
mycroft 94581370f5 The ELF ABI declares that argc must fill an `argument slot'. Make it so.
For __sparc_v9__ only, do a hack to make executables work temporarily before
and after the kernel is switched.
2000-07-26 15:40:07 +00:00
mycroft 209e309de1 Always dereference argc as an int. 2000-07-26 02:11:44 +00:00
mycroft 0ef3f52396 Make this work before and after the kernel is switched to DTRT with argc.
This is temporary, only to make the flag day less painful.
2000-07-25 21:42:55 +00:00
eeh f310f1fd32 Handle dynamic binaries too. 2000-07-18 22:35:45 +00:00
matt d71ca2d66e __syscall takes a quad_t as its first argument, not an int.
_strrchr takes an int (due to promotion) as its third arg.
don't print the null byte at the end of string.
error messages should end with a linefeed.
2000-07-03 23:01:01 +00:00
matt 06f872af34 Use the ___start etc. 2000-07-03 03:56:56 +00:00
christos 3d65200a80 remove initialization of mainprog_obj from here; it is too late for .ini
sections that want to use dlopen(3).
2000-06-16 20:52:49 +00:00
cgd c39575e265 sweep of my licenses for consistency. (no functional changes) These
files have copyright held by people in addition to myself.  (I did the
original work, they copied it, enhanced it, and added their copyright
to the derivative work.)  Their approval has been given re: the license
change.
2000-06-15 16:48:28 +00:00
cgd c85d2eb42b sweep of my licenses for consistency. (no functional changes) These
files have copyright held by people in addition to myself.  (I did the
original work, they copied it, enhanced it, and added their copyright
to the derivative work.)  Their approval has been given re: the license
change.
2000-06-14 22:52:37 +00:00
cgd db755e7c76 sweep of my licenses (userland files w/o only my copyright) for
consistency.  (no functional changes)
2000-06-14 17:24:02 +00:00
thorpej 193ccba813 Normalize copyright notice. 2000-06-14 16:09:54 +00:00
cgd d220ca5ba3 fix up NetBSD RCS Ids to match the standard, and the leading comment as
to match as well.  No functional changes.
2000-06-14 06:48:47 +00:00
bjh21 6c97e2bd78 Initial commit of arm26 port 2000-05-09 21:55:44 +00:00
dmcmahill 7348e432f3 change -fpic to -fPIC. Among other things this will let sparc shared
c++ libraries built with pkglibtool (which uses -fPIC) work.
change approved by mycroft.
2000-04-29 17:42:46 +00:00
minoura 78b105698a Move dl* function definitions to libc on ELF.
Based on the patch supplied by Takuya Shiozaki <tshiozak@astec.co.jp>.
See http://mail-index.netbsd.org/tech-userlevel/2000/02/23/0000.html.
2000-04-02 15:35:47 +00:00
kristerw 33c172d1c1 Const poisoning of dladdr (so that things build after the dlfcn.h change) 2000-02-09 22:41:53 +00:00
scottb 076e309d3e change first argument of dladdr to const. 2000-02-08 16:22:59 +00:00
scottb c0cf420b69 add hooks to support the dladdr function. 2000-02-07 21:40:40 +00:00
mycroft c29a577031 Adjust for .mk file changes. 2000-01-22 19:37:57 +00:00
eeh 818cfe2268 Workaround for gcc 2.96 bugs. 1999-12-30 15:34:47 +00:00
lukem fe5a2bf74b remove the ``static'' from `static void __start()' and `static void ___start()'
because an overly aggressive gcc -O3 "cleverly" optimizes the functions out.
noted in [port-i386/8493], but seen in other ports as well.
1999-11-02 10:07:12 +00:00
lukem fe0968e395 wrap line 1999-11-02 10:03:44 +00:00
msaitoh 2cf9cd31f6 add csu for sh3 1999-10-07 11:56:28 +00:00
mrg 6f967b5c4a add a _start symbol ld(1) can find. 1999-08-24 08:55:27 +00:00
kleink a363a1a034 * __start -> _start, ___start -> __start
* Bump _start() alignment to 4 bytes.
1999-08-23 09:23:06 +00:00
kleink fc5695807b Bump _start() alignment to 4 bytes. 1999-08-23 09:10:23 +00:00
matt 741f18b695 Initial VAX ELF32 support (mostly untested). It's checked primarily for
testing and archival for now.  I don't expect anyone to work with it
since the binutils and gas changes are still pending.  But you got to
crawl before you walk.
1999-08-21 19:26:18 +00:00
kleink b9f86eb3a1 Namespace cleanup: move runtime linker interface into implementation namespace
and provide weak aliases.
1999-08-19 20:52:36 +00:00
fvdl 3cf76a4d16 Add _start (as well as __start). It's the default start symbol expected
by ld for the i386 ELF case.
1999-07-07 22:59:47 +00:00
simonb 6bf3aa19f9 More trailing white space. 1999-07-02 15:46:05 +00:00
thorpej 3787c5c3d8 MAP_COPY -> MAP_PRIVATE 1999-06-17 21:09:47 +00:00
kleink 196becef81 Declare dlerror()'s return value __aconst. 1999-05-19 14:50:49 +00:00
kleink 28d76befd4 When calling dlerror() in a non-dynamically linked executable, return a pointer
to an error string rather than NULL (`no errors occured) to indicate the cause
of failure return values of other dl*() interfaces.
1999-05-19 14:47:12 +00:00
kleink faa2202a49 Use __weak_extern() instead of an asm statement. 1999-05-02 18:26:43 +00:00
simonb 45c86b888b Instead of rolling our own "install" target, use FILES/FILESDIR and
LINKS to that things like "make install UPDATE=" work properly.
1999-04-03 16:39:31 +00:00
simonb 38ca0e64c8 s;/usr/lib;${LIBDIR}; 1999-04-03 16:28:49 +00:00
tsubai 5f1a262044 Fix typo. (COPT --> COPTS) 1999-04-02 12:09:44 +00:00
thorpej cb3c96c11e Pull together common Makefile fragments for ELF crt0 files, and use it
across the board.
1999-03-20 00:32:40 +00:00
thorpej 0d19945594 Collect the top parts of the ELF crt0.c files into a common header, and
use it across the board.

crt0.c now contains stuff that REALLY IS machine-dependent, or stuff that
is completely intermingled in machdep code (and thus can't be separated
easily).
1999-03-20 00:13:51 +00:00
thorpej 0571914c5b Garbage-collect ECOFF_COMPAT. 1999-03-19 23:55:17 +00:00
thorpej 3f196ccbc8 Put a good chunk of code common to all ELF crt0.c files into a common
location, and use it.
1999-03-19 23:34:49 +00:00
thorpej 4216363b47 Move crtbegin.c and crtend.c from alpha subdir to common_elf subdir via
repository copy, remove all redundant copies of these files, and make all
ELF platforms use the common versions.
1999-03-19 23:16:15 +00:00
thorpej d002bd5dc3 Not used. 1999-03-19 23:11:53 +00:00
thorpej 84065de42a Not used. 1999-03-19 23:00:16 +00:00
thorpej 216dc58aac Oops, revert previous; thinko. 1999-03-19 22:58:04 +00:00
thorpej 3a25f9286e Moved via repository copy to common_aout/ 1999-03-19 22:56:01 +00:00
thorpej d72bf587c9 Ajust for new location of a.out crt0 Makefile fragment. 1999-03-19 22:54:40 +00:00
thorpej e9c1df5e9e Fix -I path. 1999-03-19 22:50:20 +00:00
thorpej faaf65e09f Go ahead and built c++rt0.o on all non-ELF platforms (i.e. including arm32;
the hacks to make this work have been committed).
1999-03-19 22:42:16 +00:00
nisimura 00ab30d02b - Make this compilable. 1999-03-19 01:17:41 +00:00
thorpej 63d06af169 Don't build c++rt.o if ELF. 1999-03-16 23:02:13 +00:00
eeh 3c92d3e233 Make things link correctly again. 1999-03-13 03:42:33 +00:00
kleink f049fe75cc Snapshot. 1999-03-08 11:03:43 +00:00
kleink 198e9a2784 s/rtld_setup/_rtld_setup/ to move it out of the user's name space. 1999-03-08 10:49:08 +00:00
tv 907d550100 This needs to use C///, not S///. 1999-02-27 21:13:50 +00:00
tv 803ae8725f Add c++rt0 for arm32 with the "special" hacks. Put c++rt0.c in arm32's
own directory until it is "fixed".
1999-02-27 03:28:30 +00:00
tv 97df55d7ae Remove -fpic condition for powerpc - we don't build c++rt0 for powerpc,
and powerpc has PIC now.
1999-02-27 03:27:54 +00:00
tv a75b29d92f Clean up mipse[bl]->mips substitution. 1999-02-27 03:27:01 +00:00
drochner 3654576f9f make this build again after the mips->mipse? transition 1999-02-24 15:10:16 +00:00
christos 9c7fb208f8 If object_fmt == elf and we have machine_elf, build that one. 1999-02-03 10:55:12 +00:00
christos b75634107c Call 1-800-IAMIDIOT... We are not using the local registers... 1999-02-01 12:19:36 +00:00
christos 2dd07da4a9 Elf startup for sparc. 1999-01-31 21:15:31 +00:00
fvdl b94126e9f9 Change ld_entry handling a bit to make dl*() from init sections work. 1999-01-28 23:59:49 +00:00
mycroft 26c8a9b676 Clean this up a little, and fix the compilation error caused by Manuel's
byte-swapping changes.
1999-01-22 11:45:16 +00:00
mycroft d15c9ceb61 Remove items defined in common.h. 1999-01-22 11:29:16 +00:00
mycroft 1da636920d Do not build on arm32 by default.
This is temporary.
1999-01-21 09:45:28 +00:00
christos 5042017dd3 Remove debugging code and unused variable. 1999-01-11 09:34:17 +00:00
christos e748cbf6b0 Don't use %eax 1999-01-10 18:20:13 +00:00