Commit Graph

112 Commits

Author SHA1 Message Date
Doug Rabson
d2cb5f3137 Make sure stack is aligned to 16 bytes. 2001-08-21 16:53:23 +00:00
Ruslan Ermilov
8af1452cf8 Removed duplicate VCS ID tags, as per style(9). 2001-08-13 14:06:34 +00:00
Mark Peek
4f1fda9595 Fix compilation errors by adding forward declarations and fix typo. 2001-07-31 16:10:51 +00:00
David E. O'Brien
7c6e689224 Add rcsid's. 2001-01-04 10:37:25 +00:00
David E. O'Brien
6e88ecec2c The instructions on doing something with src/lib/csu/powerpc. 2001-01-04 10:27:04 +00:00
David E. O'Brien
38b909640e PowerPC version of the C runtime support.
This is an amalgamation of the NetBSD macppc crt0.c (which the copyright
reflects) and the FreeBSD/Alpha crt1.c.
2001-01-04 10:25:59 +00:00
David E. O'Brien
de7c457799 PowerPC verions of the crt initialization and finalization files required
by the ELF ABI.
2001-01-04 10:05:42 +00:00
David E. O'Brien
6f880b49b7 Alpha verions of the crt initialization and finalization files required
by the ELF ABI.
2000-10-30 05:21:08 +00:00
David E. O'Brien
ae7c8a2bb8 * Bring back the guts of crt{i,n}.S. This allows C++ exceptions to work
when using the egcs and gcc-devel ports, along with GCC built from stock
public FSF sources.  With out this change, FreeBSD will be removed from
the list of systems GCC 3.0 must be evaluated on before release.  With
the effort some of us put into getting FreeBSD on this list, we should
not turn this effort into a waste, else we might not be worth fighting
for in the future.  (note that Alpha and IA-64 versions of crt{i,n}.S
are needed)

* Switch from our own crt{begin,in} to those created from GCC's crtstuff.c.
This will allow us to switch to DWARF2 exceptions in the future, along with
staying in sync with any future GCC requirements.

* Break out our ELF branding bits into a seperate file.  Currently this
is now included by our crt1.c files (since this functionality was part of
our native crtbegin.c).  Later crtbrand.o will be merged in the creation
of crti.o.
2000-10-28 21:26:48 +00:00
Doug Rabson
ac5096139b CSU code for ia64. 2000-10-14 16:38:08 +00:00
David E. O'Brien
a62f273fbe Use the new machine-independent versions of crtbegin and crtend
from the "common" directory.
2000-05-24 02:17:12 +00:00
John Polstra
d1db20032f Use the new machine-independent versions of crtbegin and crtend
from the "common" directory.

As a side-effect, this also fixes a bug in the ordering of global
constructors and destructors on the Alpha.  See revision 1.3 of
"../common/crtbegin.c" for details.
2000-05-23 04:53:24 +00:00
John Polstra
bb63c9d3b4 Take crtbegin.c and crtend.c from the new machine-independent
"common" sister directory.
2000-05-20 17:47:29 +00:00
John Polstra
f6d15b87f8 This is step 1 in an effort to unify the start-up files for the
various architectures.  Now all the work is done in crtbegin.c.
It doesn't contain any assembly language code, so it should work
fine on all architectures.  (I have tested it on the i386 and the
alpha.) The old assembly language files crt[in].S are now empty
shells that generate no code or data.  They should not be removed
any time soon, because the various versions of gcc in src and ports
expect them to exist.

Next I will move crtbegin.c into a new common machine-independent
directory, and adjust the i386-elf Makefile to use that version.
After that I will adjust the alpha Makefile to use the common
version too.

Requested by:	obrien
2000-05-19 04:32:17 +00:00
David E. O'Brien
d7ff52ec79 CSU source for IA-64. Current we use the ../Alpha sources. 2000-04-19 23:46:21 +00:00
David E. O'Brien
d497785133 Use ${.ALLSRC} in Makefile so that it is a better candidate for copying.
Also allows the soruce to live somewhere else.
2000-04-19 23:45:43 +00:00
Steve Price
15ee5562d6 CSU source for the Sparc copied over from the FreeBSD/Alpha sources. 2000-04-19 22:53:04 +00:00
David E. O'Brien
c815a20cb2 Change our ELF binary branding to something more acceptable to the Binutils
maintainers.

After we established our branding method of writing upto 8 characters of
the OS name into the ELF header in the padding; the Binutils maintainers
and/or SCO (as USL) decided that instead the ELF header should grow two new
fields -- EI_OSABI and EI_ABIVERSION.  Each of these are an 8-bit unsigned
integer.  SCO has assigned official values for the EI_OSABI field.  In
addition to this, the Binutils maintainers and NetBSD decided that a better
ELF branding method was to include ABI information in a ".note" ELF
section.

With this set of changes, we will now create ELF binaries branded using
both "official" methods.  Due to the complexity of adding a section to a
binary, binaries branded with ``brandelf'' will only brand using the
EI_OSABI method.  Also due to the complexity of pulling a section out of an
ELF file vs. poking around in the ELF header, our image activator only
looks at the EI_OSABI header field.

Note that a new kernel can still properly load old binaries except for
Linux static binaries branded in our old method.

  *
  * For a short period of time, ``ld'' will also brand ELF binaries
  * using our old method.  This is so people can still use kernel.old
  * with a new world.  This support will be removed before 5.0-RELEASE,
  * and may not last anywhere upto the actual release.  My expiration
  * time for this is about 6mo.
  *
2000-04-18 02:39:26 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Hidetoshi Shimokawa
480d03cbdd Enable gcrt1.o. 1999-07-16 06:59:27 +00:00
John Polstra
5ae2733874 Call do_ctors() and do_dtors() using indirect calls through function
pointers.  The calls are in different sections from the functions
being called, and they can potentially be far away.  On a very large
program, the 21-bit displacement field of the BSR instruction
overflowed at link time.
1999-06-06 15:59:08 +00:00
John Polstra
4e54ad63db Remove some left-over stuff from NetBSD that we don't need. This
eliminates the need to include the dynamic linker's private header
file, as well as two other headers from <sys>.
1999-04-24 02:07:17 +00:00
John Polstra
1306c069d2 Ugh. I didn't know this Makefile was reaching over into the dynamic
linker sources for some of its header files.  Add a -I flag to pick
up a new directory over there.
1999-04-09 05:56:23 +00:00
John Polstra
c30965b3bd Add "-fkeep-inline-functions" to CFLAGS so that higher optimization
levels (-O3 and above) won't remove essential code.  Many thanks
to Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru> for pointing out
that it was the optimizer's removal of this code that caused make
world with -O3 to break.  With this change, make buildworld now
completes.
1999-03-15 21:56:54 +00:00
John Polstra
0738f6e0c3 Reverse the order of processing object files within an executable or
shared library when invoking global constructors and destructors.
For constructors, the object files used to be processed from first
to last; now they're done from last to first.  (Destructors are done
in the opposite order, as required by the C++ standard.)  This makes
us consistent with standard gcc and egcs compilers.  It also
eliminates ordering differences between dynamic and static
executables.

Bump the value of __FreeBSD_version to 400002 to reflect this
change.
1999-03-13 01:35:44 +00:00
John Polstra
bb2b869188 Move the code for the ".init" and ".fini" sections outside of a
C function so the compiler won't try to emit line numbers for it
with "-g", breaking the build.  This has the nice side-effect of
making crtbegin.o and crtbeginS.o a little bit smaller.

Remove "-Wno-unused" from the Makefile.  Replace it with "__unused"
on particular function and variable declarations.
1999-03-12 17:33:28 +00:00
Hidetoshi Shimokawa
49837d6cd0 Initialize __progname by argv[0] before striping leading path,
otherwise we always get empty name.
1999-01-19 06:58:31 +00:00
John Polstra
f92bdbd010 Switch to using ".So" as the extension for PIC object files rather
than ".so".  The old extension conflicted with well-established
naming conventions for dynamically loadable modules.

The "clean" targets continue to remove ".so" files too, to deal with
old systems.
1999-01-09 21:51:00 +00:00
Steve Price
0997d762cf Strip the leading path from __progname.
Ok'd by:	jdp
1999-01-07 20:18:18 +00:00
Bruce Evans
3581d64b8d Fixed type mismatches in args to __syscall(). One for mmap() broke on
i386's with 64-bit longs -- the padding between mmap()'s 5th and 6th
is an int, not a long.  The other mismatches were benign.
1998-12-27 15:47:15 +00:00
Bruce Evans
d07b0a6163 Avoid using ld -O (as in bsd.lib.mk).
Fixed `make cleandepend'.  The default is null because SRCS is null.
1998-12-27 15:24:21 +00:00
Steve Price
a124f32704 Strip the leading path from __progname as is done in the a.out case. Also
bring in stddef.h so we can use NULL instead of 0 for pointer comparisons.

Hinted at by:	Bruce Evans
Reviewed by:	John Polstra
1998-12-24 18:19:47 +00:00
John Polstra
5584f22bb3 Make profiling work for ELF. gprof now autodetects the format of
the executable file, so it will work for both a.out and ELF format
files.  I have split the object format specific code into separate
source files.  It's cleaner than it was before, but it's still
pretty crufty.

Don't cheat on your make world for this update.  A lot of things
have to be rebuilt for it to work, including the compiler and all
of the profiled libraries.
1998-09-07 23:32:00 +00:00
John Birrell
34c91739be Remove the bootstrap hack that prevented the use of the rtld. 1998-08-20 21:37:22 +00:00
Bruce Evans
67b780b03b Fixed double slashes in pathnames. 1998-05-31 11:32:38 +00:00
Søren Schmidt
cabb97dcbf ELF preparation step 2:
Move a.out libraries to /usr/lib/aout to make space for ELF libs.
Make rtld usr /usr/lib/aout as default library path.
Make ldconfig reject /usr/lib as an a.out library path.
Fix various Makefiles for LIBDIR!=/usr/lib breakage.

This will after a make world & reboot give a system that no
longer uses /usr/lib/*, infact one could remove all the old
libraries there, they are not used anymore.

We are getting close to an ELF make world, but I'll let this
all settle for a week or two...
1998-05-26 20:12:56 +00:00
John Birrell
ec7fa2a51e Force BOOTSTRAP mode all the time while the headers are broken on alpha
as the result of i386 changes.
1998-05-04 02:06:09 +00:00
John Birrell
8999cfc9b5 Temporary fix for problems that occur if CFLAGS=-g is added to
/etc/make.conf. The tools can't handle generating debug code where
we fiddle with the ELF segments.
1998-04-01 03:24:19 +00:00
John Birrell
f672a042cf Don't share sources with i386-elf. That was too difficult. 8-(
Add a bootstrap mode so that non-rtld versions of these objects can
be built when bootstrapping the system with NetBSD tools, headers
and libraries. Once the FreeBSD tools are built, the FreeBSD headers
are installed and *then* these objects can be recompiled with the
rtld references. Phew.
1998-03-11 20:41:55 +00:00
John Birrell
1901906aa6 Sharing the crt sources with i386-elf wasn't too successful. The crti
asm code didn't link the way it was supposed to and the calling convention
for the entry "function" turned out to be very different. On alpha
it's a true function, but on i386 it's a fudge. Blech.

So jdp suggested keeping separate sets of source and avoiding lots
of #ifdefs. These files are based on his i386-elf code, with crt1.c
borrowing code from NetBSD's crt0. The copyright reflects that.

Complicating matters, the code turned out to be difficult to bootstrap
build using NetBSD tools. To compile against the FreeBSD rtld header
requires FreeBSD specific headers, but these can't be installed until
the tools are built, and they can't be built without the FreeBSD crt
objects. Anal retentive. So I introduced a HAVE_RTLD #define that isn't
set during the build process until all the tools are built and the
headers installed.
1998-03-11 20:36:11 +00:00
John Birrell
b843e53a97 Trash startup sources from NetBSD in favour of jdp's FreeBSD source
now that has been committed.

The makefile is derived from the i386-elf version, modified to pick
up most of the source (except crt1.c) from i386-elf. With minor changes
to i386-elf/crt1.c, this directory can be combined with i386-elf to
be a single csu/elf directory for all seasons.
1998-03-10 07:04:18 +00:00
John Birrell
fbb2bc058d Import a sanitized version of jdp's crt1.c from i386-elf. I have removed
the rtld code pending implementation on the alpha.

The csu/i386-elf should be renamed as csu/elf and this directory
trashed. Consider this a temporary implementation.
1998-03-10 06:56:16 +00:00
John Polstra
966a88d986 Import C startup files for ELF support.
Submitted by:	John Polstra <jdp@polstra.com>
1998-03-07 20:27:11 +00:00
John Polstra
0fbd9e9828 Remove the include of <dlfcn.h> from crt0.c; it is not needed now
that the dl* trampolines have been moved into libc.

Move dlfcn.h from src/lib/csu/i386 into src/include.  Nothing in
src/lib/csu/i386 uses it any more.
1998-02-11 04:57:25 +00:00
John Polstra
645c4be38a Move the trampolines for dlopen and related functions from crt0.o
into libc.  This reduces the size of every dynamically linked
executable by 248 bytes, and it reduces the size of static executables
by a lesser amount.  It also eliminates some global namespace
pollution.

With this change in place, the source for dlfcn.h should probably
be moved to "/usr/src/include".  I'll save that for another day.

Compatibility note:  Programs which use dlopen, if compiled on
systems with this change, will not run on systems with a libc from
prior to this change.  Very few programs use dlopen, so I think
that is OK.
1998-02-09 06:05:25 +00:00
John Polstra
663690b388 Implement dladdr. 1998-02-06 16:46:46 +00:00
Eivind Eklund
920207a8e9 ${TARGET} -> ${.TARGET}
Tiny pointed hat goes to:	Our Makefile-meister.
1998-01-12 18:29:02 +00:00
John Birrell
3c526fbfd3 CSU source for Alpha obtained from NetBSD. The makefile will require
more work when we get a half-way usable libc (which is next).
1998-01-11 03:30:39 +00:00
Brian Somers
9822c98d98 const correctness for dl*() 1997-11-22 03:34:46 +00:00
Satoshi Asami
fc702c5bc8 Make this file p-make clean. (Use "ld -O foo" instead of "ld; mv
a.out foo".)

Reviewed by:	bde (actually more like "Suggested by")
1997-10-11 02:37:42 +00:00