Commit Graph

34 Commits

Author SHA1 Message Date
Konstantin Belousov
d549ead6a9 Only assign the environ in the startup code when environ is NULL.
Preloaded library could have changed the environment, and
unconditional assingment to the environ undoes the customization.
The binaries needs to be recompiled to get the fix.

Move the common code to set up environ and __progname into the helper.
Note that ia64 possibly not fixed, due to it still using old csu.

Reported and tested by:	John Hein <jhein@symmetricom.com>
Reviewed by:	kan, scf
Approved by:	secteam (simon)
MFC after:	2 weeks
2013-01-07 17:58:27 +00:00
Konstantin Belousov
a22748dbd9 Stop calling _init/_fini methods from crt1 for dynamic binaries. Do
call preinit, init and fini arrays methods from crt1 for static binaries.

Mark new crt1 with FreeBSD-specific ELF note.

Move some common crt1 code into new MI file ignore_init.c, to reduce
duplication.  Also, conservatively adjust nearby sources for style.

Reviewed by:	kan
Tested by:	andrew (arm), flo (sparc64)
MFC after:	3 weeks
2012-03-11 20:04:09 +00:00
Dimitry Andric
cbbcfbf8b7 Let all .c and .S files under lib/csu consistently use the __FBSDID()
macro for identification, instead of several different hand-rolled
variants (plain .ident, .ascii, etc).
2010-12-09 21:31:21 +00:00
Ulrich Spörlein
98b77738b8 Properly declare non-extern functions in crt1
Also move the declarations after __progname consistently to
make the distinction clearer.

Reviewed by:	jmallett
Approved by:	ed (co-mentor)
2010-03-05 13:28:05 +00:00
Konstantin Belousov
c09ba32715 Properly support -fPIE by linking PIE binaries with specially-built
Scrt1.o instead of crt1.o, since the later is built as non-PIC.

Separate i386-elf crt1.c into the pure assembler part and C code,
supplying all data extracted by assembler stub as explicit parameters [1].
Hide and localize _start1 symbol used as an interface between asm and
C code.

In collaboration with:	kan
Inspired by:	PR i386/127387 [1]
Prodded and tested by:	rdivacky [1]
MFC after:	3 weeks
2009-12-02 16:34:20 +00:00
Kip Macy
b84c7a797c Fix TLS on sparc64 for statically and dynamically linked binaries
Approved by: rwatson (mentor)
Reviewed by: jmg and marcel
2006-10-08 02:50:34 +00:00
Doug Rabson
ccd13c49b5 Add support for TLS in statically linked programs. 2004-08-15 16:18:52 +00:00
Mark Murray
7c55188ab2 Very minor EOL whitespace diff-reducer. 2003-01-26 23:34:47 +00:00
Mark Murray
aa4e3f3e5a Missed a bit of cleanup. 2003-01-26 23:29:22 +00:00
Mark Murray
818c8b696b make these more useful for lint(1). Minor diff-reductions while I'm
about it.
2003-01-26 23:14:47 +00:00
Mark Murray
34893fe49b Remove the get_term() function. It pretty much can't work for
FreeBSD, and makes ugly diffs with the other crt1.c's. Leave
behind a comment (words supplied by Thomas Moestl) that explain
the issue.

OK'ed by:	tmm
2003-01-26 23:01:36 +00:00
Mark Murray
7ec538840c Remove a prototype for a function that is no longer called. 2002-09-20 22:23:32 +00:00
Jake Burkholder
aa41a4bc92 Don't need to install the signal trampoline here anymore. 2002-09-03 14:59:41 +00:00
Ruslan Ermilov
d2893b161b Drop support for COPY, -c has been the default mode of install(1)
for a long time now.

Approved by:	bde
2002-07-29 09:40:17 +00:00
Mark Murray
828191256b The main reason for this is to reduce diffs between all the crt1.c's.
Assembler macros are tidied up and made as similar as sanely possible.
The macros are translated into C (__inline static) functions for lint.

Declaration orders are made the same.
Declarations are all ISOfied and tidied up.

Comment contents have gratuitous diffs removed.

The net result is a bunch of crt1.c's that are 90% the same.
It may be possible to now encapsulate the differences in one
MD header, and have only one MI crt1.c file (although the macros
to do this may be ugly).

Helpful comments by:	obrien, bde
Alpha tested by:	des
i386-elf tested by:	markm
2002-07-16 12:28:50 +00:00
Ruslan Ermilov
2020063860 Fixed CLEANFILES after bsd.lib.mk sweep. 2002-05-13 15:28:00 +00:00
Ruslan Ermilov
7893b524b9 SOBJS are not used here for a long time, and were just
pessimising the `install'.
2002-05-13 11:51:11 +00:00
Ruslan Ermilov
2a53f3fb35 Major cleanup of bsd.lib.mk.
Get rid of the INTERNALSTATICLIB knob and just use plain INTERNALLIB.
INTERNALLIB now means to build static library only and don't install
anything.  Added a NOINSTALLLIB knob for libpam/modules.  To not
build any library at all, just do not set LIB.
2002-05-13 10:53:24 +00:00
Ruslan Ermilov
5b8f41af39 Revert the last change. The corresponding bsd.lib.mk changes were
already backed out.
2002-05-12 16:21:23 +00:00
David E. O'Brien
785b36d40f Use the simpler NOMAN rather than NOMAN, NOPIC, NOPROFILE, INTERNALLIB. 2002-05-11 17:45:03 +00:00
David E. O'Brien
471b107936 Use the compiler's crt{begin,end}. 2002-05-10 01:36:29 +00:00
Jake Burkholder
dbba4c62ce Install the libc signal trampoline on startup. 2002-04-29 20:25:29 +00:00
David E. O'Brien
f01730b279 For now we are using our old crt{begin,end}. 2002-04-08 20:31:20 +00:00
Mark Murray
4cd0119367 Do not use __progname directly (except in [gs]etprogname(3)).
Also, make an internal _getprogname() that is used only inside
libc. For libc, getprogname(3) is a weak symbol in case a
function of the same name is defined in userland.
2002-03-29 22:43:43 +00:00
David E. O'Brien
917356f5f6 Revert part of rev 1.3 -- we need the calls to _init and _fini. 2002-03-16 20:38:46 +00:00
David E. O'Brien
8d72757aba Sync with csu/alpha/Makefile: build crt{i,n}.o.
Leave crtbegin* to the compiler vendor.
2002-03-10 23:33:49 +00:00
David E. O'Brien
2e6f61b9bc Minor style(9) nit + utilize ELF features for the FreeBSD ID. 2002-02-28 19:45:34 +00:00
Thomas Moestl
30d514918a Initialize the libc user trap handlers before passing control non-startup
code, so that the userland fp emulator will work.
2002-02-23 21:47:20 +00:00
Jake Burkholder
f2602cd538 Comment out the retrieval of a termination function from %g1. It is
doubtful this will ever be used by anything and rtld uses %g1.
Comment out references to _init and _fini for now too.
2002-01-13 06:17:19 +00:00
Jake Burkholder
be5fa99a1e Fix typo (unclosed comment). 2001-12-28 17:55:15 +00:00
David E. O'Brien
2f67a9b3cd Embelish CFLAGS. 2001-12-15 21:41:11 +00:00
David E. O'Brien
07e70b12fc The instructions on doing something with src/lib/csu/sparc64. 2001-12-15 21:36:30 +00:00
David E. O'Brien
ee425bffeb Sparc64 ELF version of the C runtime support.
It tries to comply with the SCD 2.4.1 (and thus Sparc 64-bit psABI).

This is an amalgamation of the FreeBSD Alpha crt1.c and the BSD/OS Sparc
crt0.c (which the copyright reflects).
2001-12-15 18:54:06 +00:00
David E. O'Brien
db5eede7cc sparc64 verions of the crt initialization and finalization files required
by the ELF ABI.
2001-10-28 00:20:34 +00:00