History log of /src/lib/libc/csu/libc_start1.c (Results 1 – 14 of 14)
Revision Date Author Comments
# 64584008 23-Jun-2025 Konstantin Belousov <kib@FreeBSD.org>

csu: C standard requires errno on main() entry

Reported by: Greg Becker <greg.becker@klarasystems.com>
Reviewed by: emaste, kevans, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Also

csu: C standard requires errno on main() entry

Reported by: Greg Becker <greg.becker@klarasystems.com>
Reviewed by: emaste, kevans, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Also see: https://reviews.freebsd.org/D50998
Differential revision: https://reviews.freebsd.org/D50997

show more ...


# 9684658e 18-Oct-2024 Jessica Clarke <jrtc27@FreeBSD.org>

libc/csu: Unify INIT_RELOCS across architectures

Some architectures don't need any arguments, whilst others need auxargs,
which they get by passing in env thanks to INIT_RELOCS referencing the
local

libc/csu: Unify INIT_RELOCS across architectures

Some architectures don't need any arguments, whilst others need auxargs,
which they get by passing in env thanks to INIT_RELOCS referencing the
local variable in __libc_start1(_gcrt) by name. This is unnecessarily
confusing, fragile (one has to look at INIT_IRELOCS's definition to see
that it uses env) and duplicates code between architectures.

Instead, implement it more like rtld-elf. Each architecture provides an
ifunc_init that takes the auxargs directly, and those that don't need it
can just ignore it.

Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D47188

show more ...


# 241a55b4 22-Jul-2023 Dmitry Chagin <dchagin@FreeBSD.org>

libc/csu: Do not compile the finalizer() for PIC build

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D41148


# c383f485 12-Mar-2023 Konstantin Belousov <kib@FreeBSD.org>

lib/csu: do not compile the body of handle_static_init() for PIC build at all

The referenced symbols that provide init array boundaries are weak,
hidden, and undefined. The code that iterates over

lib/csu: do not compile the body of handle_static_init() for PIC build at all

The referenced symbols that provide init array boundaries are weak,
hidden, and undefined. The code that iterates over that arrays is not
used for the case when libc is compiled as dso.

This should fix linking with ld.bfd.

Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks

show more ...


# c5c9d980 11-Mar-2023 Konstantin Belousov <kib@FreeBSD.org>

libc/csu: rename ignore_init.c to libc_start1.c

The current name was a historical curiosity that started when init array
support was added, and then the file appeared a convenient place for the
addi

libc/csu: rename ignore_init.c to libc_start1.c

The current name was a historical curiosity that started when init array
support was added, and then the file appeared a convenient place for the
addition of the MI common code to csu. It is now referenced by name in
single place and the rename is easy, so do it.

Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks

show more ...


# 0c6f0c0d 06-Nov-2022 Konstantin Belousov <kib@FreeBSD.org>

libc: move declaration of 'char **environ' to common private header

Suggested by: imp
Reviewed by: markj
Tested by: markj (aarch64)
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differenti

libc: move declaration of 'char **environ' to common private header

Suggested by: imp
Reviewed by: markj
Tested by: markj (aarch64)
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D37220

show more ...


# 51015e6d 30-Oct-2022 Konstantin Belousov <kib@FreeBSD.org>

csu: move common code to libc

Why? Most trivial point, it shaves around 600 bytes from the dynamic
binaries on amd64. Less trivial, the removed code is no longer part of
the ABI, and we can ship upd

csu: move common code to libc

Why? Most trivial point, it shaves around 600 bytes from the dynamic
binaries on amd64. Less trivial, the removed code is no longer part of
the ABI, and we can ship updates to it with libc updates. Right now most
of the csu is linked into the binaries and require us to do somewhat
tricky ABI compat when it needs to change. For instance, the init_array
change would be much simpler and does not require note tagging if we
have init calling code in libc.

This could be improved more, by splitting dynamic and static
initialization. For instance, &_DYNAMIC tests can be removed then.
Such change, nonetheless, would require building libc three times.
I left this for later, after this change stabilizes, if ever.

Reviewed by: markj
Discussed with: jrtc27 (some objections, see the review), imp
Tested by: markj (aarch64)
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D37220

show more ...


# 99282790 15-Jun-2020 John Baldwin <jhb@FreeBSD.org>

Remove the sed hack for ABI tag notes.

The ELF notes compiled in C were placed in a section with the wrong type
(SHT_PROGBITS instead of SHT_NOTE). Previously, sed was used on the
generated assembl

Remove the sed hack for ABI tag notes.

The ELF notes compiled in C were placed in a section with the wrong type
(SHT_PROGBITS instead of SHT_NOTE). Previously, sed was used on the
generated assembly to rewrite the section type. Instead, write the notes
in assembly which permits setting the correct section type directly.

While here, move inline assembly entry points out of C and into assembly
for aarch64, arm, and riscv.

Reviewed by: kib
Tested on: amd64 (cirrus-ci), riscv64
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25211

show more ...


# b18e62b6 20-Nov-2018 Ed Maste <emaste@FreeBSD.org>

csu: use BSD-1-clause license on csu files

Copyright on these files is held by kib@ and/or the Foundation, and both
agree to this change.

Approved by: kib


# bdafb02f 13-Oct-2018 Konstantin Belousov <kib@FreeBSD.org>

Process irelocs for statically linked binaries from crt1 on x86.

This makes statically linked binaries with ifuncs operational.

Reported and tested by: mjg
Reviewed by: emaste, markj
Sponsored by:

Process irelocs for statically linked binaries from crt1 on x86.

This makes statically linked binaries with ifuncs operational.

Reported and tested by: mjg
Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
Approved by: re (rgrimes)
Differential revision: https://reviews.freebsd.org/D17363

show more ...


# 2284664e 04-Oct-2018 Ed Maste <emaste@FreeBSD.org>

crt: switch to standard note type definitions from elf_common.h

This makes it easier to grep the source tree for these notes, and
ensures that they will remain in sync.

Reviewed by: kib
Approved by

crt: switch to standard note type definitions from elf_common.h

This makes it easier to grep the source tree for these notes, and
ensures that they will remain in sync.

Reviewed by: kib
Approved by: re (gjb)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17408

show more ...


# 5e53a4f9 26-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

lib: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using mis-identified many licenses so this was mostly a manual - error
pr

lib: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using mis-identified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

show more ...


# d549ead6 07-Jan-2013 Konstantin Belousov <kib@FreeBSD.org>

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 binar

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

show more ...


# a22748db 11-Mar-2012 Konstantin Belousov <kib@FreeBSD.org>

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 som

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

show more ...