History log of /freebsd-11-stable/lib/csu/i386/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
313538 10-Feb-2017 ngie

MFC r312452-r312512:

r312452-r312512:

- Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones

This simplifies pathing in make/displayed output

- Use .CURDIR:H instead of .CURDIR to simplify pathing in output, etc


/freebsd-11-stable/lib/csu/aarch64/Makefile
/freebsd-11-stable/lib/csu/amd64/Makefile
/freebsd-11-stable/lib/csu/arm/Makefile
Makefile
/freebsd-11-stable/lib/csu/mips/Makefile
/freebsd-11-stable/lib/csu/powerpc/Makefile
/freebsd-11-stable/lib/csu/powerpc64/Makefile
/freebsd-11-stable/lib/csu/riscv/Makefile
/freebsd-11-stable/lib/csu/sparc64/Makefile
/freebsd-11-stable/lib/libalias/libalias/Makefile
/freebsd-11-stable/lib/libalias/modules/Makefile
/freebsd-11-stable/lib/libalias/modules/Makefile.inc
/freebsd-11-stable/lib/libarchive/Makefile
/freebsd-11-stable/lib/libauditd/Makefile
/freebsd-11-stable/lib/libbegemot/Makefile
/freebsd-11-stable/lib/libblocksruntime/Makefile
/freebsd-11-stable/lib/libbluetooth/Makefile
/freebsd-11-stable/lib/libbsm/Makefile
/freebsd-11-stable/lib/libbsnmp/libbsnmp/Makefile
/freebsd-11-stable/lib/libbz2/Makefile
/freebsd-11-stable/lib/libc++/Makefile
/freebsd-11-stable/lib/libc_nonshared/Makefile
/freebsd-11-stable/lib/libcam/Makefile
/freebsd-11-stable/lib/libcom_err/Makefile
/freebsd-11-stable/lib/libcompat/Makefile
/freebsd-11-stable/lib/libcrypt/Makefile
/freebsd-11-stable/lib/libcxxrt/Makefile
/freebsd-11-stable/lib/libdevdctl/tests/Makefile
/freebsd-11-stable/lib/libdwarf/Makefile
/freebsd-11-stable/lib/libelf/Makefile
/freebsd-11-stable/lib/libevent/Makefile
/freebsd-11-stable/lib/libexecinfo/Makefile
/freebsd-11-stable/lib/libexpat/Makefile
/freebsd-11-stable/lib/libgssapi/Makefile
/freebsd-11-stable/lib/libiconv_modules/Makefile.inc
/freebsd-11-stable/lib/libiconv_modules/mapper_parallel/Makefile
/freebsd-11-stable/lib/libkiconv/Makefile
/freebsd-11-stable/lib/libldns/Makefile
/freebsd-11-stable/lib/liblzma/Makefile
/freebsd-11-stable/lib/libmagic/Makefile
/freebsd-11-stable/lib/libmd/Makefile
/freebsd-11-stable/lib/libmilter/Makefile
/freebsd-11-stable/lib/libmp/Makefile
/freebsd-11-stable/lib/libngatm/Makefile
/freebsd-11-stable/lib/libnv/Makefile
/freebsd-11-stable/lib/libopie/Makefile
/freebsd-11-stable/lib/libpam/libpam/Makefile
/freebsd-11-stable/lib/libpam/modules/Makefile.inc
/freebsd-11-stable/lib/libpam/modules/pam_passwdqc/Makefile
/freebsd-11-stable/lib/libpam/modules/pam_ssh/Makefile
/freebsd-11-stable/lib/libpam/static_libpam/Makefile
/freebsd-11-stable/lib/libpcap/Makefile
/freebsd-11-stable/lib/libpe/Makefile
/freebsd-11-stable/lib/libproc/Makefile
/freebsd-11-stable/lib/libprocstat/zfs/Makefile
/freebsd-11-stable/lib/librpcsec_gss/Makefile
/freebsd-11-stable/lib/librpcsvc/Makefile
/freebsd-11-stable/lib/librt/Makefile
/freebsd-11-stable/lib/libsbuf/Makefile
/freebsd-11-stable/lib/libsm/Makefile
/freebsd-11-stable/lib/libsmb/Makefile
/freebsd-11-stable/lib/libsmdb/Makefile
/freebsd-11-stable/lib/libsmutil/Makefile
/freebsd-11-stable/lib/libsqlite3/Makefile
/freebsd-11-stable/lib/libstdthreads/Makefile
/freebsd-11-stable/lib/libsysdecode/Makefile
/freebsd-11-stable/lib/libtelnet/Makefile
/freebsd-11-stable/lib/libthr/Makefile
/freebsd-11-stable/lib/libthr/support/Makefile.inc
/freebsd-11-stable/lib/libthread_db/Makefile
/freebsd-11-stable/lib/libufs/Makefile
/freebsd-11-stable/lib/libulog/Makefile
/freebsd-11-stable/lib/libunbound/Makefile
/freebsd-11-stable/lib/libutil/Makefile
/freebsd-11-stable/lib/libypclnt/Makefile
/freebsd-11-stable/lib/ncurses/config.mk
/freebsd-11-stable/lib/ncurses/form/Makefile
/freebsd-11-stable/lib/ncurses/formw/Makefile
/freebsd-11-stable/lib/ncurses/menu/Makefile
/freebsd-11-stable/lib/ncurses/menuw/Makefile
/freebsd-11-stable/lib/ncurses/ncurses/Makefile
/freebsd-11-stable/lib/ncurses/ncursesw/Makefile
/freebsd-11-stable/lib/ncurses/panel/Makefile
/freebsd-11-stable/lib/ncurses/panelw/Makefile
302408 08-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
292000 08-Dec-2015 emaste

Remove historical GNUC test

The requirement is for a GCC-compatible compiler and not necessarily
GCC itself. However, we currently expect any compiler used for building
the whole of FreeBSD to be GCC-compatible and many things will break if
not; there's no longer a need to have an explicit test for this in csu.

Sponsored by: The FreeBSD Foundation


288226 25-Sep-2015 bdrewery

META_MODE: Remove DEP_RELDIR from Makefile.depend files.

This has not been needed since r284171 in projects/bmake.

Sponsored by: EMC / Isilon Storage Division


288076 21-Sep-2015 bdrewery

Fix installation of 32bit libraries after r288074.

FILES is not used when LIBRARIES_ONLY is set, which is used to build and
install the lib32 sysroot. All of the csu files do quality as "libraries"
for this case so just undefine LIBRARIES_ONLY.

This is still better than the previous realinstall handling as it does
not hook into META_MODE properly.

Sponsored by: EMC / Isilon Storage Division


288074 21-Sep-2015 bdrewery

Replace realinstall: and META_MODE staging hacks with FILES mechanism.

This partially reverts r270170 for lib/csu/i386 while retaining the
change for using bsd.lib.mk.

These FILES groups could go into lib/csu/Makefile.inc but I've kept them
in the Makefiles for clarity.

Sponsored by: EMC / Isilon Storage Division


284345 13-Jun-2015 sjg

Add META_MODE support.

Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision: D2796
Reviewed by: brooks imp


283125 19-May-2015 emaste

All FreeBSD platforms are elf: move i386-elf to i386

This was a leftover from when we had both i386 a.out and ELF.

Reviewed by: kib, imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2591


280980 02-Apr-2015 dim

Ensure the cross assembler, linker and objcopy are used for the build32
stage, just like for the regular world stage.

Reviewed by: rodrigc, imp, bapt, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D2187


270170 19-Aug-2014 bdrewery

Use bsd.lib.mk here as all other csu Makefiles do.

This effectively reverts r124752.

There's no reason this should be different. It resulted in needing NO_PIE in
the original opt-out NO_PIE commit as this was not using the proper framework.

Reported by: peter


270168 19-Aug-2014 bdrewery

Revert r267233 for now. PIE support needs to be reworked.

1. 50+% of NO_PIE use is fixed by adding -fPIC to INTERNALLIB and other
build-only utility libraries.
2. Another 40% is fixed by generating _pic.a variants of various libraries.
3. Some of the NO_PIE use is a bit absurd as it is disabling PIE (and ASLR)
where it never would work anyhow, such as csu or loader. This suggests
there may be better ways of adding support to the tree. Many of these
cases can be fixed such that -fPIE will work but there is really no
reason to have it in those cases.
4. Some of the uses are working around hacks done to some Makefiles that are
really building libraries but have been using bsd.prog.mk because the code
is cleaner. Had they been using bsd.lib.mk then NO_PIE would not have
been needed.

We likely do want to enable PIE by default (opt-out) for non-tree consumers
(such as ports). For in-tree though we probably want to only enable PIE
(opt-in) for common attack targets such as remote service daemons and setuid
utilities. This is also a great performance compromise since ASLR is expected
to reduce performance. As such it does not make sense to enable it in all
utilities such as ls(1) that have little benefit to having it enabled.

Reported by: kib


269114 26-Jul-2014 sjg

Reviewed by: imp

LDFLAGS is supposed to be given to CC not LD.
Define _LDFLAGS as a filtered version of LDFLAGS safe to give to LD


267233 08-Jun-2014 bdrewery

In preparation for ASLR [1] support add WITH_PIE to support building with -fPIE.

This is currently an opt-in build flag. Once ASLR support is ready and stable
it should changed to opt-out and be enabled by default along with ASLR.

Each application Makefile uses opt-out to ensure that ASLR will be enabled by
default in new directories when the system is compiled with PIE/ASLR. [2]

Mark known build failures as NO_PIE for now.

The only known runtime failure was rtld.

[1] http://www.bsdcan.org/2014/schedule/events/452.en.html
Submitted by: Shawn Webb <lattera@gmail.com>
Discussed between: des@ and Shawn Webb [2]


245133 07-Jan-2013 kib

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


234502 20-Apr-2012 dim

After r217375, some startup objects under lib/csu are built in a special
way: first they are compiled to assembly, then some sed'ing is done on
the assembly, and lastly the assembly is compiled to an object file.

This last step is done using ${CC}, and not ${AS}, because when the
compiler is clang, it outputs directives that are too advanced for our
old gas. So we use clang's integrated assembler instead. (When the
compiler is gcc, it just calls gas, and nothing is different, except one
extra fork.)

However, in the .s to .o rules in lib/csu/$ARCH/Makefile, I still passed
CFLAGS to the compiler, instead of ACFLAGS, which are specifically for
compiling .s files.

In case you are using '-g' for debug info anywhere in your CFLAGS, it
causes the .s files to already contain debug information in the assembly
itself. In the next step, the .s files are also compiled using '-g',
and if the compiler is clang, it complains: "error: input can't have
.file dwarf directives when -g is used to generate dwarf debug info for
assembly code".

Fix this by using ${ACFLAGS} for compiling the .s files instead.

Reported by: jasone
MFC after: 1 week


232832 11-Mar-2012 kib

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


217383 13-Jan-2011 kib

The (%esp & 0xf) == 0 should be true before the call instruction is
executed, for the properly aligned stack.

Reported and tested by: rstone
Pointy hat to: kib
MFC after: 3 days


217375 13-Jan-2011 dim

Apply a workaround for a binutils issue with the .note.ABI-tag section
generated from lib/csu/common/crtbrand.c (which ultimately ends up in
executables and shared libraries, via crt1.o, gcrt1.o or Scrt1.o).

For all arches except sparc, gcc emits the section directive for the
abitag struct in crtbrand.c with a PROGBITS type. However, newer
versions of binutils (after 2.16.90) require the section to be of NOTE
type, to guarantee that the .note.ABI-tag section correctly ends up in
the first page of the final executable.

Unfortunately, there is no clean way to tell gcc to use another section
type, so crtbrand.c (or the C files that include it) must be compiled in
multiple steps:

- Compile the .c file to a .s file.
- Edit the .s file to change the 'progbits' type to 'note', for the section
directive that defines the .note.ABI-tag section.
- Compile the .s file to an object file.

These steps are done in the invididual Makefiles for each applicable arch.

Reviewed by: kib


217105 07-Jan-2011 kib

Add section .note.GNU-stack for assembly files used by 386 and amd64.


216338 09-Dec-2010 dim

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).


209295 18-Jun-2010 kib

Add unwind annotations to the asm part of crt1 on i386. Terminate the
process with SIGTRAP if _start1() unexpectedly returns.

Reviewed by: kan
MFC after: 2 weeks


205398 20-Mar-2010 jilles

Do not create *.gmon files for PIE executables on i386.

Scrt1_c.o was accidentally compiled with -DGCRT (profiling), like gcrt1_c.o.
This problem is i386-specific, the other architectures are OK.

If you have problems with PIE executables such as samba and cups leaving
behind gmon files, rebuild them after installing this change.

PR: ports/143924
Reviewed by: kib
MFC after: 3 days


201381 02-Jan-2010 ed

Build lib/ with WARNS=6 by default.

Similar to libexec/, do the same with lib/. Make WARNS=6 the norm and
lower it when needed.

I'm setting WARNS?=0 for secure/. It seems secure/ includes the
Makefile.inc provided by lib/. I'm not going to touch that directory.
Most of the code there is contributed anyway.


200038 02-Dec-2009 kib

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


151072 07-Oct-2005 bde

Fixed profiling of main() for amd64 and i386. This started rotting
in 1993 in rev.1.5 of the i386 a.out version (csu/i386/crt0.c).
Profiling uses a magic label "eprol" to delimit the start of the part
of the text section covered by profiling. This label must be placed
before the call to main() to get main() properly profiled. It was
placed there in rev.1.1 of crt0.c. Rev.1.5 imported the initial
implementation of shared libraries in FreeBSD and misplaced the label.
Fortunately, the misplaced label was misspelled and the old label
wasn't removed, so the new label had no effect. Unfortunately, when
profiling was implemented for the ELF in 1998 in rev.1.2 of
csu/i386-elf/crt1.c, only the incorrectly placed label was copied
(after fixing its name). The bug was then copied to all other arches.
The label seems to be still misplaced in NetBSD for most arches. It
is in common.c for most arches so it is even further from being inside
the function that calls main().

I think "eprol" is short for "end of prologue", but it must be placed
before the end of the prologue so that it covers main(). crt0.c has
it before the calls atexit(_mcleanup) and monstartup(...), but it
cannot affect these calls so I moved it after the call to monstartup().
It now also covers the call to _init() but not the newer call to
_init_tls(). Profiling of _init() seems to be harmless, and the call
to _init_tls() seems to be misplaced.

Reviewed by: jdp (long ago, for a slightly different i386 version)


146371 19-May-2005 dfr

Align the stack to a 16 byte boundary so that we can safely call functions
that use SSE. The compiler does attempt to do this in main() but not very
successfully - it still manages to use unaligned offsets from %ebp in some
cases. Also we need to have an aligned stack in case something uses SSE
via _init().

MFC After: 1 week


146369 19-May-2005 dfr

Keep the stack aligned to a 16 byte boundary when calling init functions
so that we don't cause a bus error if they start storing SSE math stuff
on the stack.

MFC After: 1 week


133754 15-Aug-2004 dfr

Add support for TLS in statically linked programs.


124752 20-Jan-2004 ru

The <bsd.files.mk> API seems the best to use here.


115826 04-Jun-2003 bde

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.


114667 04-May-2003 obrien

This is now Gcc 3.3 WARNS 6 clean.


109905 26-Jan-2003 markm

make these more useful for lint(1). Minor diff-reductions while I'm
about it.


107460 01-Dec-2002 bde

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)


104143 29-Sep-2002 bde

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


100872 29-Jul-2002 ru

Drop support for COPY, -c has been the default mode of install(1)
for a long time now.

Approved by: bde


100167 16-Jul-2002 markm

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


99354 03-Jul-2002 markm

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.


96632 15-May-2002 obrien

Use .rodata section for $FreeBSD$.


96530 13-May-2002 ru

Fixed CLEANFILES after bsd.lib.mk sweep.


96516 13-May-2002 ru

SOBJS are not used here for a long time, and were just
pessimising the `install'.


96512 13-May-2002 ru

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.


96463 12-May-2002 ru

Revert the last change. The corresponding bsd.lib.mk changes were
already backed out.


96411 11-May-2002 obrien

Use the simpler NOMAN rather than NOMAN, NOPIC, NOPROFILE, INTERNALLIB.


95721 29-Apr-2002 bde

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


93399 29-Mar-2002 markm

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.


91430 27-Feb-2002 obrien

Minor style(9) nit + utilize ELF features for the FreeBSD ID.


85594 27-Oct-2001 obrien

minor style updating


67811 28-Oct-2000 obrien

* 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.


60734 20-May-2000 jdp

Take crtbegin.c and crtend.c from the new machine-independent
"common" sister directory.


60698 19-May-2000 jdp

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


59342 18-Apr-2000 obrien

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.
*


50476 28-Aug-1999 peter

$Id$ -> $FreeBSD$


44789 15-Mar-1999 jdp

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.


44699 13-Mar-1999 jdp

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.


44691 12-Mar-1999 jdp

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.


42450 09-Jan-1999 jdp

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.


42049 24-Dec-1998 steve

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


38928 07-Sep-1998 jdp

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.


34199 07-Mar-1998 jdp

This commit was generated by cvs2svn to compensate for changes in r34198,
which included commits to RCS files with non-trunk default branches.