Commit Graph

280 Commits

Author SHA1 Message Date
ru
ed55c31b37 MFi386: revision 1.19. 2003-06-30 12:53:39 +00:00
bde
8ba6f05132 Removed garbage:
- -elf in CFLAGS had no effect except to reduce portability.
- -elf in LDFLAGS had even less effect, since LDFLAGS is not used.
- -Wall in CFLAGS had no effect except to reduce portability and break
  overriding of WARNS, since the setting of WARNS implies -Wall.
2003-06-04 11:21:18 +00:00
obrien
11fe408cd9 This is now Gcc 3.3 WARNS 6 clean. 2003-05-04 18:34:00 +00:00
obrien
3accc3f1ed Set abitag __unused. 2003-05-04 18:33:26 +00:00
peter
665ad725f7 Update for AMD64. repocopied from i386-elf/crt1.c. Deal with regparm
argument passing rather than stack based args.  The kernel passes the
base of the argument/env vector in %rdi (arg1).
2003-04-30 19:27:07 +00:00
markm
0e17357e12 Very minor EOL whitespace diff-reducer. 2003-01-26 23:34:47 +00:00
markm
dffbfb659d Missed a bit of cleanup. 2003-01-26 23:29:22 +00:00
markm
b7034cb57e make these more useful for lint(1). Minor diff-reductions while I'm
about it.
2003-01-26 23:14:47 +00:00
markm
26450b90d3 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
bde
1bae0a9e0c Backed out previous commit (alignment suitable for RELENG_4) as planned
since it has been MFC'ed.  See the log message for the previous commit
for more details.  The alignment bug in gcc-3 has not been fixed, but
it is not very serious and the previous commit just moved it (as intended).

Approved by:	re (murray)
2002-12-01 17:36:18 +00:00
bde
61d4be4f4d Align the stack suitably for the version of gcc in FreeBSD-4 (provided
-fomit-frame-pointer is not used).  This is mostly moot for -current
because gcc-3 does the alignment (slightly incorrectly) in main().

This patch is intended for easy MFC'ing and should be backed out in
-current soon since it causes compiler warnings and better fixes are
possible in -current.  The best fix is to do nothing here and wait for
gcc to do stack alignment right.  gcc-3 aligns the stack in main(), but
does it too late for main()'s local variables and too late for anything
called before main().  A misaligned stack is now more than an efficiency
problem, since some SSE instructions in some or all (hardware)
implementations trap on misaligned operands even if alignment checking
is not enabled.

PR:		41528:
Submitted by:	NIIMI Satoshi <sa2c@sa2c.net> (original version)
MFC after:	3 days
2002-09-29 13:42:27 +00:00
markm
6e7995b000 Remove a prototype for a function that is no longer called. 2002-09-20 22:23:32 +00:00
jake
d602f01d31 Don't need to install the signal trampoline here anymore. 2002-09-03 14:59:41 +00:00
ru
a8adf98c82 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
markm
bedd05ccec 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
markm
38e70a1e48 Whitespace diffs only; this brings this file into the same whitespace
convention as src/lib/csu/*/crt1.c.

This will make the follow up diffs easier to see and extract.
2002-07-03 14:42:39 +00:00
obrien
525ac715e0 WARNS=6'ify.
Style nits.
2002-06-25 18:05:16 +00:00
obrien
67a607d79f Prototype _start.
Submitted by:	markm

Mark some _start formal parameters __unused.
2002-06-25 18:01:12 +00:00
obrien
c6615f0631 Use .rodata section for $FreeBSD$. 2002-05-15 04:19:49 +00:00
ru
661f00368b Fixed CLEANFILES after bsd.lib.mk sweep. 2002-05-13 15:28:00 +00:00
ru
690ae48517 SOBJS are not used here for a long time, and were just
pessimising the `install'.
2002-05-13 11:51:11 +00:00
ru
dc9ee40833 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
ru
77ac6c7e64 Revert the last change. The corresponding bsd.lib.mk changes were
already backed out.
2002-05-12 16:21:23 +00:00
obrien
d2df975828 Use the simpler NOMAN rather than NOMAN, NOPIC, NOPROFILE, INTERNALLIB. 2002-05-11 17:45:03 +00:00
obrien
a90cd41ca2 Use the compiler's crt{begin,end}. 2002-05-10 01:36:29 +00:00
obrien
81b47fd2bc Fix the copyright dates. 2002-05-07 18:07:43 +00:00
jake
2fb2df4097 Install the libc signal trampoline on startup. 2002-04-29 20:25:29 +00:00
bde
0dd30d20d3 Removed "-fkeep-inline-functions" from CFLAGS, since it now has no effect
except to generate spurious warnings about a system header <sys/param.h>
having some inline functions (the bswap family).  This backs out the main
part of rev.1.5 (which was the only part left).  The problem fixed by
rev.1.5 of the Makefile went away in rev.1.5 of ../common/crtbegin.c
when the references to do_ctors() and do_dtors() in the latter were moved
from inline asm to C code.

This leaves the problem that implementation details cause warnings.

Discussed with:	jdp
2002-04-29 13:07:20 +00:00
obrien
36d8f389da Style nit and modernize SCM ID. 2002-04-13 21:54:09 +00:00
obrien
3d5625e8b9 For now we are using our old crt{begin,end}. 2002-04-08 20:31:20 +00:00
markm
76fe441a7b 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
obrien
8cb84dc7fa Style nit. 2002-03-23 18:14:20 +00:00
obrien
133b5a805b Remove prototype, no other crt1.c has or needs it. 2002-03-23 18:14:04 +00:00
obrien
3a56951869 Remove __P() usage. 2002-03-22 09:16:59 +00:00
obrien
6399259994 Remove __P() usage. 2002-03-21 23:43:04 +00:00
obrien
2442cd3075 Revert part of rev 1.3 -- we need the calls to _init and _fini. 2002-03-16 20:38:46 +00:00
obrien
f458f10478 Sync with csu/alpha/Makefile: build crt{i,n}.o.
Leave crtbegin* to the compiler vendor.
2002-03-10 23:33:49 +00:00
obrien
88a86c89ad Minor style(9) nit + utilize ELF features for the FreeBSD ID. 2002-02-28 19:45:34 +00:00
obrien
4aa32f31fc Minor style(9) nit + utilize ELF features for the FreeBSD ID. 2002-02-27 22:13:02 +00:00
obrien
fafeecdcea We do not support the sparc platform. 2002-02-27 21:59:16 +00:00
obrien
498d713c75 Minor WS change to improve readability. 2002-02-27 21:53:27 +00:00
tmm
e7deebe9ff 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
obrien
60e24208f0 GC code that moved to crtbrand.c. 2002-01-28 19:02:34 +00:00
jake
3f719eddda 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
4b91e746b4 Fix typo (unclosed comment). 2001-12-28 17:55:15 +00:00
obrien
4a701250c9 Embelish CFLAGS. 2001-12-15 21:41:11 +00:00
obrien
2fffd47816 The instructions on doing something with src/lib/csu/sparc64. 2001-12-15 21:36:30 +00:00
obrien
994cab589b 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
peter
af02d0d48f Put in an attempt at stack trace/unwind records. 2001-11-03 06:31:27 +00:00
peter
e6400f83f7 Mostly cosmetic. Use indentation that is reasonably close to other
ia64 *.S files in our tree (eg: locore.s).  Put the rest of the args
in the .section lines.

Reviewed by:	dfr
2001-10-29 10:18:58 +00:00
peter
43153baeec Update for the new toolchain. ld doesn't provide _GLOBAL_OFFSET_TABLE_
in 2.11.2, so use a relocatable method of calculating gp.

Reviewed by:	dfr
2001-10-29 10:14:51 +00:00
obrien
eb6a23a09f sparc64 verions of the crt initialization and finalization files required
by the ELF ABI.
2001-10-28 00:20:34 +00:00
peter
c014a2100f Add missing crti.S and crtn.S files. I have tested these with -static
linking only.  They may require some gp relative tweaks for dynamic use.
2001-10-27 10:10:45 +00:00
obrien
e299f0598d Sync with other platforms. 2001-10-27 08:32:07 +00:00
obrien
ab164bcc75 minor style updating 2001-10-27 08:30:36 +00:00
obrien
679fe89052 Update for reality and syncing with other FreeBSD platforms. 2001-10-27 08:29:03 +00:00
obrien
401cae0ddc Feh, it helps to include a file other than yourself... wonder how
GCC cpp liked that.

Properly include the branding info.
2001-10-27 08:25:32 +00:00
obrien
83e21bd3fa Fix nit in copyright. 2001-10-26 06:45:10 +00:00
obrien
481222884e Use the new machine-independent versions of crtbegin and crtend
from the "common" directory.
2001-10-26 06:39:54 +00:00
dfr
f075c7df77 Change to track the new calling convention for execve. This version only
needs one line of assembler to initialise gp.
2001-10-11 12:33:05 +00:00
dfr
d280a62e1c Make sure stack is aligned to 16 bytes. 2001-08-21 16:53:23 +00:00
ru
95ce4d2cdc Removed duplicate VCS ID tags, as per style(9). 2001-08-13 14:06:34 +00:00
mp
eb299211ae Fix compilation errors by adding forward declarations and fix typo. 2001-07-31 16:10:51 +00:00
obrien
543a34690d Add rcsid's. 2001-01-04 10:37:25 +00:00
obrien
2466856dec The instructions on doing something with src/lib/csu/powerpc. 2001-01-04 10:27:04 +00:00
obrien
5520f73249 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
obrien
46c56dd07a PowerPC verions of the crt initialization and finalization files required
by the ELF ABI.
2001-01-04 10:05:42 +00:00
obrien
ffa99e45a6 Alpha verions of the crt initialization and finalization files required
by the ELF ABI.
2000-10-30 05:21:08 +00:00
obrien
82c32a8a3f * 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
dfr
2cd0661ce2 CSU code for ia64. 2000-10-14 16:38:08 +00:00
obrien
87c84875a0 Use the new machine-independent versions of crtbegin and crtend
from the "common" directory.
2000-05-24 02:17:12 +00:00
jdp
d00f222c77 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
jdp
bbdd1c645c Take crtbegin.c and crtend.c from the new machine-independent
"common" sister directory.
2000-05-20 17:47:29 +00:00
jdp
a15d1eb9f1 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
obrien
b86f592229 CSU source for IA-64. Current we use the ../Alpha sources. 2000-04-19 23:46:21 +00:00
obrien
948ba018cd 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
123d7be7a4 CSU source for the Sparc copied over from the FreeBSD/Alpha sources. 2000-04-19 22:53:04 +00:00
obrien
0eac6bbc67 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
76f0c923fe $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
simokawa
1e5433865c Enable gcrt1.o. 1999-07-16 06:59:27 +00:00
jdp
eef63afd3d 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
jdp
6219126570 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
jdp
4f46e3a475 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
jdp
0d2a12bcaf 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
jdp
d790b6b749 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
jdp
a83e407889 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
simokawa
2c9b0d5ff2 Initialize __progname by argv[0] before striping leading path,
otherwise we always get empty name.
1999-01-19 06:58:31 +00:00
jdp
ffcc901f03 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
1e08e3b3da Strip the leading path from __progname.
Ok'd by:	jdp
1999-01-07 20:18:18 +00:00
bde
f67d0f0ce6 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
bde
f13120ec87 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
467e88b19d 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
jdp
5b11e2a2f4 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
jb
bc2aa8b61a Remove the bootstrap hack that prevented the use of the rtld. 1998-08-20 21:37:22 +00:00
bde
317c29f913 Fixed double slashes in pathnames. 1998-05-31 11:32:38 +00:00
sos
bc60c8025e 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
jb
69ae143f47 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
jb
6774bb7ee0 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
jb
ca539b1229 Bring these back from the dead. 1998-03-11 20:48:57 +00:00
jb
b776b60a03 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
jb
ccb7460b92 This commit was generated by cvs2svn to compensate for changes in r34484,
which included commits to RCS files with non-trunk default branches.
1998-03-11 20:36:11 +00:00
jb
c5a6510dda 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
jb
b12189af60 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
jb
8a94357dec 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
jb
8839778db0 This commit was generated by cvs2svn to compensate for changes in r34452,
which included commits to RCS files with non-trunk default branches.
1998-03-10 06:56:16 +00:00
jdp
9ab8e81807 This commit was generated by cvs2svn to compensate for changes in r34198,
which included commits to RCS files with non-trunk default branches.
1998-03-07 20:27:11 +00:00
jdp
d07afba3b3 Import C startup files for ELF support.
Submitted by:	John Polstra <jdp@polstra.com>
1998-03-07 20:27:11 +00:00
jdp
5a744a4713 Import C startup files for ELF support.
Submitted by:	John Polstra <jdp@polstra.com>
1998-03-07 20:27:11 +00:00
jdp
a73c0d4a85 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
jdp
4538098d0b 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
jdp
d5b09c81ec Implement dladdr. 1998-02-06 16:46:46 +00:00
eivind
9d57fd98be ${TARGET} -> ${.TARGET}
Tiny pointed hat goes to:	Our Makefile-meister.
1998-01-12 18:29:02 +00:00
cvs2svn
0506343883 This commit was manufactured by cvs2svn to create branch 'jb'. 1998-01-11 03:30:40 +00:00
jb
003a004c39 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
13d351d261 const correctness for dl*() 1997-11-22 03:34:46 +00:00
asami
3dfcb8cd24 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
wosch
8ee659dd96 Sort cross refereces in section SEE ALSO. 1997-09-29 19:11:55 +00:00
jdp
2ed649b29b Implement dlsym(RTLD_NEXT, symbol). 1997-08-02 04:56:44 +00:00
msmith
025fcb755f Use our copy of dlfcn.h, not the version in /usr/include, which may not
be up-to-date when we are building.
Submitted by:	Terry Lambert <terry@lambert.org>
1997-04-30 03:12:09 +00:00
jdp
72875e2a08 Declare the constructor/destructor linker sets as extern rather than
common.  Add one do-nothing element to each set.  This ensures that
the linker realizes that they are linker sets rather than simple
commons, and makes it possible to link c++rt0.o into every shared
library regardless of whether it is a C++ library or not.  Without
this change, the constructors and destructors in the main program
could be executed multiple times.

This change is going to make it possible to get rid of the
CPLUSPLUSLIB makefile variable once and for all.  It is a piece of
the solution to PR gnu/3505 (gcc -shared).  Finally, it fixes a
heretofore unreported bug:  If CPLUSPLUSLIB was set in a makefile
for a C++ shared library that had no static constructors or
destructors in it, then the main program's constructors and
destructors would be executed multiple times.
1997-04-09 19:14:31 +00:00
jdp
1eeccd0067 Fix an error in the previous revision that caused make world breakage. 1997-04-02 16:49:18 +00:00
bde
0be4160258 Simplified install rule. 1997-04-01 13:53:16 +00:00
peter
6b08958c64 Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
jkh
808a36ef65 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
jdp
9083c9a4a0 Convert to mdoc format.
Add descriptions of RTLD_LAZY and RTLD_NOW.
Correct the synopsis to agree with the actual function prototypes.
Add clarifications of a few things.
Clean up the wording in a few places.
1997-01-12 19:55:49 +00:00
jdp
4a8aa087c2 Add definitions of RTLD_LAZY and RTLD_NOW. 1997-01-12 18:37:46 +00:00
jdp
db2ad2c9ac Set the "crt_ldso" member of the crt-to-ld.so interface structure. This
was apparently overlooked at the time the member was added.  Its absence
causes some error messages from the dynamic linker to begin with
"(null):" instead of with the pathname of the dynamic linker as they
should.

I am also adding a work-around to the dynamic linker, to cope with
legacy binaries that were built with older versions of crt0.
1997-01-11 23:59:34 +00:00
bde
ed911d0bba Use ${COPY} instead of -C for installing non-source files. crt*.o
should be installed using the same flag as libraries, but ${COPY}
is currently used for libraries.
1997-01-01 04:52:55 +00:00
peter
b149fa7d4b When linking with no rtld support, provide stub dl*() functions that
just return errors.  This removes the need for awful hacks like that in
our build of libtcl which would get link errors when linked static.

John Polstra once mentioned that this was on his "todo" list.

Note that one can use:
  cc -Wl,-Bstatic -o foo foo.o
and get an executable that has it's libraries statically linked, but has
a fully functional runtime linker so the executable can call dlopen() and
have it work.  (I've tested this)
1996-12-28 17:10:52 +00:00
scrappy
a7a5567c4d Fixed prototyping of dlopen/dlsym in dlfcn.h, to match how crt0.c defines
it and link.h prototypes it

Error of my ways pointed out by Peter
1996-10-08 01:41:51 +00:00
steve
be4c09c465 Remove garbage initcode reference so that 'gcc -Dlint ...'
will compile without error.
1996-10-06 03:19:26 +00:00
peter
2242c2dae2 Support crt0 <-> ld.so interface version 4. This should be both backwards
and forwards compatable with version 3.  This is needed to enable storing
a run-time library path in the dynamic linking headers.  The crt startup
tries version 4 first, and falls back to version 3, so an executable that
is linked on -current will work with the ld.so on 2.1.x and less.

Reviewed by: nate, jdp
Obtained from: NetBSD
1996-10-01 00:54:48 +00:00
peter
d24d89b928 cmp -s || install -c --> install -C 1996-08-30 01:41:52 +00:00
wosch
9f795376b3 `mv'' -> `mv -f''
``rm'' -> ``rm -f''
so mv/rm may not ask for confirmation if you are not root
1996-05-07 23:19:49 +00:00
jdp
4cf4be8b5a Changed the dimensions of __CTOR_LIST__ and __DTOR_LIST__ from 0
to 2.  This makes them agree with the declarations in libgcc, and
clears the way once again for linking c++rt0.o into all libraries,
and eliminating CPLUSPLUSLIB from <bsd.lib.mk>.  (I have not made
that change yet, because there is still a bootstrapping problem
for "make world".)

Also, removed a check which ensured that the constructor count in
the first word of __CTOR_LIST__ was greater than zero before
traversing the list.  I had added that check earlier, but it is no
longer necessary, now that there is guaranteed to be at least 2
words in __CTOR_LIST__.
1996-02-20 04:07:26 +00:00
nate
33641076c5 Back out the thread_init code in order to allow -current to bootstrap
from -stable, until a better solution is found.

Submitted by:	Consensus of mailing list and the almighty Jordan :)
1996-01-30 05:55:20 +00:00
julian
619b731f5b Reviewed by: julian and (hsu?)
Submitted by:	 John Birrel(L?)

changes for threadsafe operations
1996-01-22 00:02:33 +00:00
jdp
83a650d90c Check the count in the first word of __CTOR_LIST__ before executing
the loop that invokes the static constructors.  That makes it safe
to link c++rt0.o into any shared library, even one that does not
have any static constructors.  Formerly, doing that would cause a
bus error.  If the library has no static constructors, __CTOR_LIST__
comes out as a simple 4-byte COMMON region, and it does not have
the usual NULL word that terminates the list of constructors.  This
caused the old code to "call" a garbage address via the non-existent
entry __CTOR_LIST__[1].

The analogous code that invokes the static destructors was already safe.

This change is fully backward-compatible.

Reviewed by:	dfr@render.com (Doug Rabson)
1996-01-15 17:53:25 +00:00
peter
c3f352d4ad This commit was generated by cvs2svn to compensate for changes in r13122,
which included commits to RCS files with non-trunk default branches.
1995-12-30 19:02:48 +00:00
peter
ab124e78b0 recording cvs-1.6 file death 1995-12-30 19:02:48 +00:00
ache
698e939e43 Remove my locale hack. Sigh. 1995-11-02 12:42:42 +00:00
phk
ec00c35383 Clean up and make code (more) readable. 1995-10-29 09:49:21 +00:00
bde
ef382ef7b6 Fixed dependencies for scrt0.o.
Build a static gcrt0.o (sgcrt0.o) too.  Currently only the dynamic gcrt0.o
is used, although -pg forces -static.
Sorted the .o targets.
1995-10-22 18:36:47 +00:00
phk
a026489209 -fomit-frame-pointer is becomming an increasingly popular optimization,
so before somebody screws up royally, make sure this always works by
adding a -fno-omit-frame-pointer here.
1995-10-20 20:05:15 +00:00
phk
361585330b put the _getenv and _strncmp under #ifdef DEBUG, which is the only time
they are used.  Saves a few bytes here and there, nothing major.
1995-10-18 15:56:55 +00:00
dg
aa55f7313a Create a scrt0.o file that specifically excludes the shared-lib support.
This will be used for -static programs.
1995-10-18 04:19:00 +00:00
nate
f12729acb8 Fixup the "ld.so failed" message for the case when ld.so finds undefined
symbols.

An easy example to see this is to develop an X program which links
against Xt, but doesn't add -lX11 to the link line.  It will link fine,
but cause run-time errors by ld.so because of missing symbols used by Xt
defined in X11.  This patch makes the errors more readable.

Submitted by:	jdp@polstra.com (John Polstra)
1995-09-27 23:13:33 +00:00
bde
1d5c50aac7 Install source files with the -c flag, not with the optional flag ${COPY}. 1995-08-06 12:37:41 +00:00
bde
6579f34131 Change install' to ${INSTALL}' so that default install flags can be
specified in the top level Makefiles.

Previously I missed dozens of Makefiles that skip the install after
using `cmp -s' to decide that the install isn't necessary.
1995-08-06 12:24:38 +00:00
wollman
ceb5359a6a Numerous Makefile fixes:
1) Do dependencies.
2) Install all appropriate links to manual pages.
3) Install header file in `beforeinstall' like all the rest.
4) Install header file only if changed.
5) Install object files only if changed.
1995-06-30 15:30:35 +00:00