Commit Graph

508 Commits

Author SHA1 Message Date
uwe
4d9bf144be Implement crtbegin* for sh3. Tested to work on landisk. 2012-01-31 20:30:15 +00:00
uwe
1415c6da05 New ___start() C function takes 3 arguments instead of 6 and fetches
argc, argv and environ from ps_strings instead.  Adjust the trampoline
accordingly.

Fix brain fart in previous: direct jump is jmp @rN, not bsrf rN.
2012-01-31 20:17:57 +00:00
uwe
cd23fa6d26 Use unambiguous .p2align 2 since .align 4 copied from i386 is
incorrect, as .align is .p2align on sh3, not .balign
2012-01-31 20:12:47 +00:00
uwe
5ade3e48ae Move crt0.S in front of crt0-common.c when building crt0.o and gcrt0.o.
Reading disassembly is easier when the asm crt0.S trampoline is at the
start, not hidden behind the C code in crt0-common.c.
2012-01-31 20:08:28 +00:00
uwe
1ecbaba27e Hmm, funny. I wonder why and how did emacs VC managed to add
Warning: Permanently added the RSA host key for IP address '...' to the list of known hosts.

to the committed file. (hi, new cvs!)
2012-01-31 20:03:50 +00:00
uwe
cfdbe19d5f Use -DPIC to compile crtbeginS.o since that's what <machine/asm.h>
headers check.
2012-01-31 19:58:22 +00:00
uwe
ffe3d8992e Since it's in a separate file now, we cannot use direct branch to label. 2012-01-29 23:27:24 +00:00
uwe
2e92e8630a Steal arch/i386/crtend.S 2012-01-28 15:08:47 +00:00
uwe
002cc93ef2 Add a comment that explains what this code does. 2012-01-28 12:44:19 +00:00
uwe
30250d8bed Asm cosmetic. Add a comment that explains what this trampoline does. 2012-01-28 12:21:13 +00:00
he
281cbfe50c After christos@ latest re-structuring of includes and defines in
the various param.h files, STACKALIGNBYTES is now called STACK_ALIGNBYTES,
so adapt accordingly.
2012-01-25 13:29:58 +00:00
mrg
74c1f8ad71 remove -I- from CPPFLAGS. 2011-10-29 10:28:37 +00:00
matt
0ac54b7e3b Don't include <machine/asm.h> 2011-07-30 15:28:58 +00:00
mrg
7c7bb760e6 revert the previous. it didn't help and wasn't the problem anyway. 2011-07-16 23:07:50 +00:00
matt
9decdbdfe4 Add missing */ 2011-07-04 21:55:09 +00:00
mrg
cd21741236 XXX: for now, build sparc64 csu with -O1 if using GCC 4.5. 2011-07-04 21:54:18 +00:00
matt
532130a31c The kernel and ld.elf_so call with a different order for
cleanup, obj, ps_strings so deal with it.
With this change, USE_COMPILERCRTSTUFF=no works.
2011-07-02 20:16:09 +00:00
matt
675a57b0bb Adapt to the new ___start calling convention 2011-07-02 20:14:10 +00:00
matt
fe30c1af31 Make this adhere to the SVR4 ABI. 2011-07-02 07:28:08 +00:00
joerg
c4cda1a2a7 Explicitly declare ___start as hidden. 2011-07-01 02:59:05 +00:00
matt
d8b68e8316 Adapt to new ___start definition.
Use PIC method to load %r13 with address of _SDA_BASE_
2011-06-30 20:10:17 +00:00
wiz
4cbd24b23f dependant -> dependent 2011-06-30 20:09:15 +00:00
matt
0d4e6aae2a Mark ___start as .hidden (for MKPIE=yes executables). 2011-06-30 20:07:35 +00:00
joerg
226567c8f9 Assert that ps_strings is valid. Use it to drop the first three
arguments to ___start to make the assembler callers simpler.
2011-06-30 19:48:43 +00:00
mrg
8f161cd6d3 remove all the code that supported HAVE_GCC=3. mostly from chuq. 2011-06-20 06:52:36 +00:00
matt
01061e574e Don't initialize %r2 for SDA2_BASE anymore. It's needed for TLS. 2011-03-12 07:56:36 +00:00
joerg
5c3ccd6eba Pass down ELF Auxillary Vectors for static NetBSD binaries too.
Rename __libc_init to _libc_init and call it explicitly from CSU code.
This enforces the constructor run order for newly linked programs.
Keep it as constructor with run-once semantic for binary compatibility.
Implement dl_iterate_phdr for statically linked programs.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
2011-03-07 05:09:09 +00:00
matt
2bf60042d7 When loading r13 and r2 with _SDA_BASE_ and _SDA2_BASE, do so in a PIC
manner.  With this change, simple programs can now run with MKPIE=yes
2011-02-26 17:11:23 +00:00
skrll
1548def5e3 Remove old hack for broken binutils. 2011-02-23 10:26:09 +00:00
joerg
9674b81ed9 Introduce __weakref_visible to handle the different required visibility
for weak references. GCC 4.2+ and Clang require static, older GCC wants
extern. Change __weak_reference to include sym. This requires changes
the existing users to not reuse the name of the symbol, but avoids
further differences between GCC 4.1 and GCC 4.2+/clang.
2011-02-22 05:45:05 +00:00
joerg
86df96f692 Allow building with the changed weakref semantic in GCC 4.2 and clang. 2011-02-18 23:37:36 +00:00
matt
af25d173e6 Distinguish between a corrupt obj pointer and a null obj pointer. 2011-02-08 02:03:13 +00:00
matt
8f55cdd3bd First pass at new crtstuff for powerpc. Doesn't quite work yet
(obj parameter to ___start seems to get corrupted sometimes)
2011-02-08 02:02:25 +00:00
drochner
953846fa39 use of .PARSEDIR just doesn't work with .OBJDIR, replace with .CURDIR 2011-01-31 17:54:20 +00:00
matt
b09982f7da Use uintptr_t instead of u_long.
When fetching argc use off the stack, use *(long *) instead of *(int *)
because on mips64 BE system, that int deference will only fetch 0.
2011-01-23 06:25:57 +00:00
joerg
c37869d883 Build assembler sources with assembler compile rules. 2010-12-07 19:51:02 +00:00
joerg
cb0b8d7cc6 Fix stack alignment for non-constructor/destructor calls.
AMD64 stack is 16 Byte aligned at the start of the function,
so always push rbx.
2010-11-30 18:37:59 +00:00
skrll
15fa0783d7 Centralise USE_COMPILERCRTSTUFF.
PCC might need help.
2010-11-28 18:40:54 +00:00
joerg
fcd549e0e4 Retire old crtbegin/crtend implementation. It is not compatible with the
expectations of modern C++
2010-08-07 18:06:59 +00:00
joerg
01bc9d5012 Switch i386 and x86_64 to the new CRT layout. The crt0.c body is shared
between all platforms and a small assembler stub in crt0.S is used for
setting up the proper stack and whatever else MD needs.

Extract crti.S and crtn. from the old dot_init.h files. Prepare other
platforms that use the 6-argument form of __(_)start for this.

Rewrite the crtbegin and crtend modules in assembler to make them
compiler independent. Document the interface in README.
2010-08-07 18:01:32 +00:00
mrg
4f893703d8 delete all the a.out csu code. 2010-07-05 21:27:55 +00:00
matt
1e301281a1 Merge from matt-nb5-mips64 2009-12-14 01:00:46 +00:00
mrg
6b59d31236 move the include for <bsd.own.mk> down a little. 2009-12-13 08:52:38 +00:00
mrg
cba14cb13e look for ${CSU_MACHINE_ARCH}_elf directory first. 2009-12-13 08:03:44 +00:00
skrll
7a915839ac Make lib/csu compile. XXX somewhat bogus. 2009-11-09 14:34:42 +00:00
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