OpenBSD CVS

CVS log for src/lib/csu/crt0.c


[BACK] Up to [local] / src / lib / csu

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.18 / (download) - annotate - [select for diffs], Thu Jul 27 18:17:14 2023 UTC (10 months, 2 weeks ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

Make _eprol (and _etext) hidden.  Fixes "cc -pg" on arm64 where the
current code which has a local _eprol label in the inline asm and a
global _eprol declaration results in an incorrect relocation.  This
also removes an unnecessary relocation on hppa (and possible on
other architectures as well).

ok guenther@

Revision 1.17 / (download) - annotate - [select for diffs], Wed Jan 12 21:41:06 2022 UTC (2 years, 4 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)

Lift the '#ifdef RCRT0' conditional out of boot*.h to crt0.c

Prep for dropping #includes from archdep.h: pull in <machine/reloc.h>
and declare _dl_exit() in boot*.h

ok kettenis@

Revision 1.16 / (download) - annotate - [select for diffs], Sun Nov 14 00:45:38 2021 UTC (2 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)

Split out the hppa and mips64 versions of boot.h similar to how I
split ld.so/boot.c in 2019:
 * delete extraneous #includes
 * delete jmprel handling on non-hppa
 * delete RELOC_GOT() and DT_PROC bits on non-mips64

ok visa@

Revision 1.15 / (download) - annotate - [select for diffs], Wed Oct 14 22:11:18 2020 UTC (3 years, 7 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.14: +4 -1 lines
Diff to previous 1.14 (colored)

use symbolic SYS_exit instead of the value 1
ok kettenis

Revision 1.14 / (download) - annotate - [select for diffs], Fri May 10 13:29:21 2019 UTC (5 years, 1 month ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.13: +5 -1 lines
Diff to previous 1.13 (colored)

ld.so boot cleanup support:
 - put functions and data which are only used before calling the executable's
   start function into their own page-aligned segments for unmapping
   (only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
 - pass .init_array and .preinit_array functions an addition argument which
   is a callback to get a structure which includes a function that frees
   the boot text and data
 - sometimes delay doing RELRO processing: for a shared-object marked
   DF_1_INITFIRST do it after the object's .init_array, for the executable
   do it after the .preinit_array
 - improve test-ld.so to link against libpthread and trigger its initialization
   late
libc changes to use this will come later

ok kettenis@

Revision 1.13 / (download) - annotate - [select for diffs], Wed May 8 20:27:29 2019 UTC (5 years, 1 month ago) by guenther
Branch: MAIN
Changes since 1.12: +3 -3 lines
Diff to previous 1.12 (colored)

Call _csu_finish() before {pre,}init_array functions so that in static
executables the TIB and __progname are set up before they can be used.

problem noted by ori@
ok millert@ kettenis@

Revision 1.12 / (download) - annotate - [select for diffs], Wed Jan 9 16:42:38 2019 UTC (5 years, 5 months ago) by visa
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

Use static consistently with definitions of functions that have been
declared static.

OK guenther@

Revision 1.11 / (download) - annotate - [select for diffs], Fri Dec 21 05:45:42 2018 UTC (5 years, 5 months ago) by guenther
Branch: MAIN
Changes since 1.10: +21 -1 lines
Diff to previous 1.10 (colored)

Add support for {preinit,init,fini}_array sections in static binaries

ok kettenis@

Revision 1.10 / (download) - annotate - [select for diffs], Sat Jan 21 04:14:19 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.9: +2 -1 lines
Diff to previous 1.9 (colored)

Pull in declarations for main() and __init() to make clang happy.
Mark __init() as hidden

ok kettenis@ deraadt@

Revision 1.9 / (download) - annotate - [select for diffs], Thu Jan 19 23:47:04 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.8: +2 -5 lines
Diff to previous 1.8 (colored)

MD_START is now always ___start, so expand and eliminate it

ok phessler@ deraadt@

Revision 1.8 / (download) - annotate - [select for diffs], Mon Sep 26 15:43:26 2016 UTC (7 years, 8 months ago) by kettenis
Branch: MAIN
Changes since 1.7: +1 -5 lines
Diff to previous 1.7 (colored)

Now that vax has been removed, nothing defined MD_NO_CLEANUP anymore.

ok guenther@

Revision 1.7 / (download) - annotate - [select for diffs], Sat May 7 19:30:53 2016 UTC (8 years, 1 month ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.6: +3 -4 lines
Diff to previous 1.6 (colored)

Declare moncontrol(3) APIs in <sys/gmon.h>
Export _gmonparam again.
Make gcrt0.o use an reserved name for _monstartup()

ok millert@

Revision 1.6 / (download) - annotate - [select for diffs], Sun Mar 20 02:32:39 2016 UTC (8 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.5: +8 -47 lines
Diff to previous 1.5 (colored)

Rearrange C runtime bits: now that ld.so exports environ and __progname,
move their definitions and initialization in static links to libc.a
Make crt0 always invoke a new func _csu_finish() in libc to process the auxv
and to either register the ld.so cleanup function (in dynamic links) or
initialize environ and __progname and do MC_DISABLE_KBIND (in static links).
In libc, get pagesize from auxv; cache that between getpagesize() and
sysconf(_SC_PAGESIZE)

ok mpi@ "good time" deraadt@

Revision 1.5 / (download) - annotate - [select for diffs], Tue Sep 1 05:40:06 2015 UTC (8 years, 9 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.4: +6 -3 lines
Diff to previous 1.4 (colored)

In static binaries, invoke kbind() once to disable it.

With much assistance from miod@
ok deraadt@@

Revision 1.4 / (download) - annotate - [select for diffs], Sat Dec 27 16:04:22 2014 UTC (9 years, 5 months ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.3: +3 -1 lines
Diff to previous 1.3 (colored)

Only include "boot.h" if MD_RCRT0_START is defined.  Should fix build on vax.

ok miod@

Revision 1.3 / (download) - annotate - [select for diffs], Mon Dec 22 03:51:08 2014 UTC (9 years, 5 months ago) by kurt
Branch: MAIN
Changes since 1.2: +8 -1 lines
Diff to previous 1.2 (colored)

Introduce new csu0 variant for -static -pie binaries to use called
rcsu0.o where the initial 'r' is for relocatable. rcsu0.o performs
self-relocation on static pie binaries by calling a slightly modified
copy of ld.so's _dl_boot_bind() in boot.h.

The first arch implementatation is also included for amd64 where
__start calls _dl_boot_bind() and then calls ___start(). Includes
parts from kettenis@ to help get R_X86_64_64 relocations working
and proper handling for undefined weak symbols.

This is the first part of several to get static pie self-relocating
binaries working. binutils, gcc and kernel changes are forthcoming
to complete the solution, then per-arch implementations are needed
for MD_RCRT0_START in csu.

okay kettenis@ pascal@ deraadt@

Revision 1.2 / (download) - annotate - [select for diffs], Thu Dec 12 08:12:08 2013 UTC (10 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.1: +6 -1 lines
Diff to previous 1.1 (colored)

Fix static linking of libpthread: have crt0 invoke __init_tcb() if it's
defined and we don't think ld.so has already done the TCB setup.

ok and much discussion miod@

Revision 1.1 / (download) - annotate - [select for diffs], Tue Dec 3 06:21:40 2013 UTC (10 years, 6 months ago) by guenther
Branch: MAIN

Merge the per-arch crt0.c files into common_elf/crt0.c, with MD macros in
the md_init.h files.

Worked out with and ok miod@; ok matthew@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.