History log of /openbsd-current/libexec/ld.so/alpha/archdep.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.26 18-Nov-2023 deraadt

crt0 uses a helper function in a MD src/libexec/ld.so .h file (rather than
reproducing the relevant defines and code in a different place) to perform
minor relocations. If things go very wrong, it would call _dl_exit() --
a locally defined crt0 function which is syscall exit(2). We don't need
to call exit(2) for this obscure case which doesn't happen and provides no
debugging information. An 'abort' is going to provide better information.
So let's change the function name to _dso_abort() and make it a single
illegal instruction.
ok guenther


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.25 31-Jan-2022 guenther

Nothing depends on archdep.h pulling in other #includes anymore,
so delete the #includes and hide the RELOC_* functions that are
only used by lib/csu behind "#ifdef RCRT0"

matches the others and it's hard to see how it will fail


# 1.24 14-Nov-2021 guenther

Delete all the no-op RELOC_GOT() macros and their uses.
Annotate RELOC_DYN() on non-hppa as only used in lib/csu.
Delete some inconsistent comments, adjust whitespace, and reorder
mips64's archdep.h so that the ld.so/*/archdep.h files look
(almost) the same.

ok visa@ kettenis@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.23 23-Oct-2019 guenther

Prefer the size-independent ELF identifiers over the size-specific ones.
Strip superfluous parens from return statements while here.

Done programatically with two perl invocations

idea ok kettenis@ drahn@
ok visa@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.22 22-Nov-2018 guenther

Make alpha less special: _dl_boot_bind() is written to complete
relocation of ld.so's GOT without using it, so _reloc_alpha_got()
merely made the call to _dl_boot_bind() from asm simpler...while
itself being a call that required special handling.

diff and muild baking by miod@
ok guenther@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.21 27-Oct-2017 mpi

Use <elf.h> instead of <elf_abi.h>

ok jasper@, jca@, deraadt@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.20 24-Jan-2017 guenther

On fatal errors, kill ourselves with thrkill(0,9,NULL) instead of
simply exiting, via helper functions _dl_die(), _dl_diedie(), and
_dl_oom().

prompted by a complaint from jsing@
ok jsing@ deraadt@


# 1.19 20-Jan-2017 guenther

Delete ancient macros and unnecessary #includes

ok deraadt@


# 1.18 09-Jan-2017 kettenis

Remove dependency on __got_{start,end} symbols and look at PT_GNU_RELRO
instead. Result in a few more pages that aren't writable on some platforms
(such as hppa). Based on an initial diff from guenther@.

Thanks to deraadt@ for testing.

ok guenther@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 06-Dec-2015 guenther

Simplify the relocation code for the ld.so bootstrap and static pie: track
just the dynamic tags are needed instead of reusing the generic elf_object_t
structure.

testing and feedback from miod@
ok kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.16 27-Dec-2014 kettenis

Make ld.so process only R_ALPHA_RELATIVE relocations during early GOT
relocation in _reloc_alpha_got(), and teach RELOC_RELA() to skip R_ALPHA_NONE
relocations (which are just nops used to fill out the relocation table).
Handling R_ALPHA_NONE relocations will be necessary for static PIE support
and it is not inconceivable that ld.so will end up with such relocations
at some point.

ok kurt@


# 1.15 03-Nov-2014 guenther

Eliminate RTLD_PROTECT_PLT: ld.so is built with -Bsymbolic so the
PLT is empty/unused. On at least macppc and sparc64, ld.so's attempt
to mprotect its PLT could instead hit its own allocated data and
cause a segfault shortly there after.

While here, take a shot at preventing the same issue with the GOT
by checking for __got_start != __got_end.

reproduction *with ktracing* by afresh1@ provided the key data
ok miod@ deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.14 16-Apr-2014 guenther

It's been a quarter century: we can assume volatile is present with that name.


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.13 02-Jan-2010 kettenis

Fix handling of hppa RELOC_IPLT relocations during 'bootstrap relocation'.

ok miod@, deraadt@, jsing@


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.12 24-May-2004 drahn

Change define used to deal with PLT protection, use postive logic not negative.
ok mickey@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.11 09-Jul-2003 drahn

changes to ld.so to be compatible with newer binutils, requires
slight changes in the startup code on most archs. ok art@ brad@


# 1.10 09-Jun-2003 deraadt

pefo 3/4 licence cleanups


Revision tags: OPENBSD_3_3_BASE
# 1.9 15-Feb-2003 drahn

After relocation is completed, remove write protection from GOT/PLT in ld.so.


# 1.8 25-Oct-2002 pefo

Some small fixes in MI code for mips backport. A new reloc md function,
RELOC_GOT, was added to handle mips got bootstrap reloc.

Also remove workaround used on previous versions of binutils for mips.


Revision tags: OPENBSD_3_2_BASE
# 1.7 12-Aug-2002 drahn

Add support for REL type relocations, all currently supported arch
use only RELA type relocations, but that could change. ok art@


# 1.6 24-May-2002 deraadt

various KNF


Revision tags: OPENBSD_3_1_BASE
# 1.5 21-Feb-2002 drahn

cleanup of MD/MI ld.so (elf), most changes by art@ cleanup by me.
tested on alpha sparc64 powerpc.


# 1.4 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.3 08-Jun-2001 art

Cleanup.
exit when the bootstrap relocation fails.


# 1.2 31-May-2001 art

Correctly implement most linking for alpha.
Remove a lot of code copied from powerpc.


# 1.1 14-May-2001 niklas

Commit initial alpha bits, to facilitate in-tree dev.
This code is not yet working.


# 1.25 31-Jan-2022 guenther

Nothing depends on archdep.h pulling in other #includes anymore,
so delete the #includes and hide the RELOC_* functions that are
only used by lib/csu behind "#ifdef RCRT0"

matches the others and it's hard to see how it will fail


# 1.24 14-Nov-2021 guenther

Delete all the no-op RELOC_GOT() macros and their uses.
Annotate RELOC_DYN() on non-hppa as only used in lib/csu.
Delete some inconsistent comments, adjust whitespace, and reorder
mips64's archdep.h so that the ld.so/*/archdep.h files look
(almost) the same.

ok visa@ kettenis@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.23 23-Oct-2019 guenther

Prefer the size-independent ELF identifiers over the size-specific ones.
Strip superfluous parens from return statements while here.

Done programatically with two perl invocations

idea ok kettenis@ drahn@
ok visa@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.22 22-Nov-2018 guenther

Make alpha less special: _dl_boot_bind() is written to complete
relocation of ld.so's GOT without using it, so _reloc_alpha_got()
merely made the call to _dl_boot_bind() from asm simpler...while
itself being a call that required special handling.

diff and muild baking by miod@
ok guenther@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.21 27-Oct-2017 mpi

Use <elf.h> instead of <elf_abi.h>

ok jasper@, jca@, deraadt@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.20 24-Jan-2017 guenther

On fatal errors, kill ourselves with thrkill(0,9,NULL) instead of
simply exiting, via helper functions _dl_die(), _dl_diedie(), and
_dl_oom().

prompted by a complaint from jsing@
ok jsing@ deraadt@


# 1.19 20-Jan-2017 guenther

Delete ancient macros and unnecessary #includes

ok deraadt@


# 1.18 09-Jan-2017 kettenis

Remove dependency on __got_{start,end} symbols and look at PT_GNU_RELRO
instead. Result in a few more pages that aren't writable on some platforms
(such as hppa). Based on an initial diff from guenther@.

Thanks to deraadt@ for testing.

ok guenther@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 06-Dec-2015 guenther

Simplify the relocation code for the ld.so bootstrap and static pie: track
just the dynamic tags are needed instead of reusing the generic elf_object_t
structure.

testing and feedback from miod@
ok kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.16 27-Dec-2014 kettenis

Make ld.so process only R_ALPHA_RELATIVE relocations during early GOT
relocation in _reloc_alpha_got(), and teach RELOC_RELA() to skip R_ALPHA_NONE
relocations (which are just nops used to fill out the relocation table).
Handling R_ALPHA_NONE relocations will be necessary for static PIE support
and it is not inconceivable that ld.so will end up with such relocations
at some point.

ok kurt@


# 1.15 03-Nov-2014 guenther

Eliminate RTLD_PROTECT_PLT: ld.so is built with -Bsymbolic so the
PLT is empty/unused. On at least macppc and sparc64, ld.so's attempt
to mprotect its PLT could instead hit its own allocated data and
cause a segfault shortly there after.

While here, take a shot at preventing the same issue with the GOT
by checking for __got_start != __got_end.

reproduction *with ktracing* by afresh1@ provided the key data
ok miod@ deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.14 16-Apr-2014 guenther

It's been a quarter century: we can assume volatile is present with that name.


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.13 02-Jan-2010 kettenis

Fix handling of hppa RELOC_IPLT relocations during 'bootstrap relocation'.

ok miod@, deraadt@, jsing@


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.12 24-May-2004 drahn

Change define used to deal with PLT protection, use postive logic not negative.
ok mickey@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.11 09-Jul-2003 drahn

changes to ld.so to be compatible with newer binutils, requires
slight changes in the startup code on most archs. ok art@ brad@


# 1.10 09-Jun-2003 deraadt

pefo 3/4 licence cleanups


Revision tags: OPENBSD_3_3_BASE
# 1.9 15-Feb-2003 drahn

After relocation is completed, remove write protection from GOT/PLT in ld.so.


# 1.8 25-Oct-2002 pefo

Some small fixes in MI code for mips backport. A new reloc md function,
RELOC_GOT, was added to handle mips got bootstrap reloc.

Also remove workaround used on previous versions of binutils for mips.


Revision tags: OPENBSD_3_2_BASE
# 1.7 12-Aug-2002 drahn

Add support for REL type relocations, all currently supported arch
use only RELA type relocations, but that could change. ok art@


# 1.6 24-May-2002 deraadt

various KNF


Revision tags: OPENBSD_3_1_BASE
# 1.5 21-Feb-2002 drahn

cleanup of MD/MI ld.so (elf), most changes by art@ cleanup by me.
tested on alpha sparc64 powerpc.


# 1.4 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.3 08-Jun-2001 art

Cleanup.
exit when the bootstrap relocation fails.


# 1.2 31-May-2001 art

Correctly implement most linking for alpha.
Remove a lot of code copied from powerpc.


# 1.1 14-May-2001 niklas

Commit initial alpha bits, to facilitate in-tree dev.
This code is not yet working.


# 1.24 14-Nov-2021 guenther

Delete all the no-op RELOC_GOT() macros and their uses.
Annotate RELOC_DYN() on non-hppa as only used in lib/csu.
Delete some inconsistent comments, adjust whitespace, and reorder
mips64's archdep.h so that the ld.so/*/archdep.h files look
(almost) the same.

ok visa@ kettenis@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.23 23-Oct-2019 guenther

Prefer the size-independent ELF identifiers over the size-specific ones.
Strip superfluous parens from return statements while here.

Done programatically with two perl invocations

idea ok kettenis@ drahn@
ok visa@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.22 22-Nov-2018 guenther

Make alpha less special: _dl_boot_bind() is written to complete
relocation of ld.so's GOT without using it, so _reloc_alpha_got()
merely made the call to _dl_boot_bind() from asm simpler...while
itself being a call that required special handling.

diff and muild baking by miod@
ok guenther@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.21 27-Oct-2017 mpi

Use <elf.h> instead of <elf_abi.h>

ok jasper@, jca@, deraadt@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.20 24-Jan-2017 guenther

On fatal errors, kill ourselves with thrkill(0,9,NULL) instead of
simply exiting, via helper functions _dl_die(), _dl_diedie(), and
_dl_oom().

prompted by a complaint from jsing@
ok jsing@ deraadt@


# 1.19 20-Jan-2017 guenther

Delete ancient macros and unnecessary #includes

ok deraadt@


# 1.18 09-Jan-2017 kettenis

Remove dependency on __got_{start,end} symbols and look at PT_GNU_RELRO
instead. Result in a few more pages that aren't writable on some platforms
(such as hppa). Based on an initial diff from guenther@.

Thanks to deraadt@ for testing.

ok guenther@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 06-Dec-2015 guenther

Simplify the relocation code for the ld.so bootstrap and static pie: track
just the dynamic tags are needed instead of reusing the generic elf_object_t
structure.

testing and feedback from miod@
ok kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.16 27-Dec-2014 kettenis

Make ld.so process only R_ALPHA_RELATIVE relocations during early GOT
relocation in _reloc_alpha_got(), and teach RELOC_RELA() to skip R_ALPHA_NONE
relocations (which are just nops used to fill out the relocation table).
Handling R_ALPHA_NONE relocations will be necessary for static PIE support
and it is not inconceivable that ld.so will end up with such relocations
at some point.

ok kurt@


# 1.15 03-Nov-2014 guenther

Eliminate RTLD_PROTECT_PLT: ld.so is built with -Bsymbolic so the
PLT is empty/unused. On at least macppc and sparc64, ld.so's attempt
to mprotect its PLT could instead hit its own allocated data and
cause a segfault shortly there after.

While here, take a shot at preventing the same issue with the GOT
by checking for __got_start != __got_end.

reproduction *with ktracing* by afresh1@ provided the key data
ok miod@ deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.14 16-Apr-2014 guenther

It's been a quarter century: we can assume volatile is present with that name.


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.13 02-Jan-2010 kettenis

Fix handling of hppa RELOC_IPLT relocations during 'bootstrap relocation'.

ok miod@, deraadt@, jsing@


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.12 24-May-2004 drahn

Change define used to deal with PLT protection, use postive logic not negative.
ok mickey@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.11 09-Jul-2003 drahn

changes to ld.so to be compatible with newer binutils, requires
slight changes in the startup code on most archs. ok art@ brad@


# 1.10 09-Jun-2003 deraadt

pefo 3/4 licence cleanups


Revision tags: OPENBSD_3_3_BASE
# 1.9 15-Feb-2003 drahn

After relocation is completed, remove write protection from GOT/PLT in ld.so.


# 1.8 25-Oct-2002 pefo

Some small fixes in MI code for mips backport. A new reloc md function,
RELOC_GOT, was added to handle mips got bootstrap reloc.

Also remove workaround used on previous versions of binutils for mips.


Revision tags: OPENBSD_3_2_BASE
# 1.7 12-Aug-2002 drahn

Add support for REL type relocations, all currently supported arch
use only RELA type relocations, but that could change. ok art@


# 1.6 24-May-2002 deraadt

various KNF


Revision tags: OPENBSD_3_1_BASE
# 1.5 21-Feb-2002 drahn

cleanup of MD/MI ld.so (elf), most changes by art@ cleanup by me.
tested on alpha sparc64 powerpc.


# 1.4 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.3 08-Jun-2001 art

Cleanup.
exit when the bootstrap relocation fails.


# 1.2 31-May-2001 art

Correctly implement most linking for alpha.
Remove a lot of code copied from powerpc.


# 1.1 14-May-2001 niklas

Commit initial alpha bits, to facilitate in-tree dev.
This code is not yet working.


# 1.23 23-Oct-2019 guenther

Prefer the size-independent ELF identifiers over the size-specific ones.
Strip superfluous parens from return statements while here.

Done programatically with two perl invocations

idea ok kettenis@ drahn@
ok visa@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.22 22-Nov-2018 guenther

Make alpha less special: _dl_boot_bind() is written to complete
relocation of ld.so's GOT without using it, so _reloc_alpha_got()
merely made the call to _dl_boot_bind() from asm simpler...while
itself being a call that required special handling.

diff and muild baking by miod@
ok guenther@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.21 27-Oct-2017 mpi

Use <elf.h> instead of <elf_abi.h>

ok jasper@, jca@, deraadt@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.20 24-Jan-2017 guenther

On fatal errors, kill ourselves with thrkill(0,9,NULL) instead of
simply exiting, via helper functions _dl_die(), _dl_diedie(), and
_dl_oom().

prompted by a complaint from jsing@
ok jsing@ deraadt@


# 1.19 20-Jan-2017 guenther

Delete ancient macros and unnecessary #includes

ok deraadt@


# 1.18 09-Jan-2017 kettenis

Remove dependency on __got_{start,end} symbols and look at PT_GNU_RELRO
instead. Result in a few more pages that aren't writable on some platforms
(such as hppa). Based on an initial diff from guenther@.

Thanks to deraadt@ for testing.

ok guenther@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 06-Dec-2015 guenther

Simplify the relocation code for the ld.so bootstrap and static pie: track
just the dynamic tags are needed instead of reusing the generic elf_object_t
structure.

testing and feedback from miod@
ok kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.16 27-Dec-2014 kettenis

Make ld.so process only R_ALPHA_RELATIVE relocations during early GOT
relocation in _reloc_alpha_got(), and teach RELOC_RELA() to skip R_ALPHA_NONE
relocations (which are just nops used to fill out the relocation table).
Handling R_ALPHA_NONE relocations will be necessary for static PIE support
and it is not inconceivable that ld.so will end up with such relocations
at some point.

ok kurt@


# 1.15 03-Nov-2014 guenther

Eliminate RTLD_PROTECT_PLT: ld.so is built with -Bsymbolic so the
PLT is empty/unused. On at least macppc and sparc64, ld.so's attempt
to mprotect its PLT could instead hit its own allocated data and
cause a segfault shortly there after.

While here, take a shot at preventing the same issue with the GOT
by checking for __got_start != __got_end.

reproduction *with ktracing* by afresh1@ provided the key data
ok miod@ deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.14 16-Apr-2014 guenther

It's been a quarter century: we can assume volatile is present with that name.


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.13 02-Jan-2010 kettenis

Fix handling of hppa RELOC_IPLT relocations during 'bootstrap relocation'.

ok miod@, deraadt@, jsing@


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.12 24-May-2004 drahn

Change define used to deal with PLT protection, use postive logic not negative.
ok mickey@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.11 09-Jul-2003 drahn

changes to ld.so to be compatible with newer binutils, requires
slight changes in the startup code on most archs. ok art@ brad@


# 1.10 09-Jun-2003 deraadt

pefo 3/4 licence cleanups


Revision tags: OPENBSD_3_3_BASE
# 1.9 15-Feb-2003 drahn

After relocation is completed, remove write protection from GOT/PLT in ld.so.


# 1.8 25-Oct-2002 pefo

Some small fixes in MI code for mips backport. A new reloc md function,
RELOC_GOT, was added to handle mips got bootstrap reloc.

Also remove workaround used on previous versions of binutils for mips.


Revision tags: OPENBSD_3_2_BASE
# 1.7 12-Aug-2002 drahn

Add support for REL type relocations, all currently supported arch
use only RELA type relocations, but that could change. ok art@


# 1.6 24-May-2002 deraadt

various KNF


Revision tags: OPENBSD_3_1_BASE
# 1.5 21-Feb-2002 drahn

cleanup of MD/MI ld.so (elf), most changes by art@ cleanup by me.
tested on alpha sparc64 powerpc.


# 1.4 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.3 08-Jun-2001 art

Cleanup.
exit when the bootstrap relocation fails.


# 1.2 31-May-2001 art

Correctly implement most linking for alpha.
Remove a lot of code copied from powerpc.


# 1.1 14-May-2001 niklas

Commit initial alpha bits, to facilitate in-tree dev.
This code is not yet working.


# 1.22 22-Nov-2018 guenther

Make alpha less special: _dl_boot_bind() is written to complete
relocation of ld.so's GOT without using it, so _reloc_alpha_got()
merely made the call to _dl_boot_bind() from asm simpler...while
itself being a call that required special handling.

diff and muild baking by miod@
ok guenther@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.21 27-Oct-2017 mpi

Use <elf.h> instead of <elf_abi.h>

ok jasper@, jca@, deraadt@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.20 24-Jan-2017 guenther

On fatal errors, kill ourselves with thrkill(0,9,NULL) instead of
simply exiting, via helper functions _dl_die(), _dl_diedie(), and
_dl_oom().

prompted by a complaint from jsing@
ok jsing@ deraadt@


# 1.19 20-Jan-2017 guenther

Delete ancient macros and unnecessary #includes

ok deraadt@


# 1.18 09-Jan-2017 kettenis

Remove dependency on __got_{start,end} symbols and look at PT_GNU_RELRO
instead. Result in a few more pages that aren't writable on some platforms
(such as hppa). Based on an initial diff from guenther@.

Thanks to deraadt@ for testing.

ok guenther@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 06-Dec-2015 guenther

Simplify the relocation code for the ld.so bootstrap and static pie: track
just the dynamic tags are needed instead of reusing the generic elf_object_t
structure.

testing and feedback from miod@
ok kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.16 27-Dec-2014 kettenis

Make ld.so process only R_ALPHA_RELATIVE relocations during early GOT
relocation in _reloc_alpha_got(), and teach RELOC_RELA() to skip R_ALPHA_NONE
relocations (which are just nops used to fill out the relocation table).
Handling R_ALPHA_NONE relocations will be necessary for static PIE support
and it is not inconceivable that ld.so will end up with such relocations
at some point.

ok kurt@


# 1.15 03-Nov-2014 guenther

Eliminate RTLD_PROTECT_PLT: ld.so is built with -Bsymbolic so the
PLT is empty/unused. On at least macppc and sparc64, ld.so's attempt
to mprotect its PLT could instead hit its own allocated data and
cause a segfault shortly there after.

While here, take a shot at preventing the same issue with the GOT
by checking for __got_start != __got_end.

reproduction *with ktracing* by afresh1@ provided the key data
ok miod@ deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.14 16-Apr-2014 guenther

It's been a quarter century: we can assume volatile is present with that name.


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.13 02-Jan-2010 kettenis

Fix handling of hppa RELOC_IPLT relocations during 'bootstrap relocation'.

ok miod@, deraadt@, jsing@


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.12 24-May-2004 drahn

Change define used to deal with PLT protection, use postive logic not negative.
ok mickey@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.11 09-Jul-2003 drahn

changes to ld.so to be compatible with newer binutils, requires
slight changes in the startup code on most archs. ok art@ brad@


# 1.10 09-Jun-2003 deraadt

pefo 3/4 licence cleanups


Revision tags: OPENBSD_3_3_BASE
# 1.9 15-Feb-2003 drahn

After relocation is completed, remove write protection from GOT/PLT in ld.so.


# 1.8 25-Oct-2002 pefo

Some small fixes in MI code for mips backport. A new reloc md function,
RELOC_GOT, was added to handle mips got bootstrap reloc.

Also remove workaround used on previous versions of binutils for mips.


Revision tags: OPENBSD_3_2_BASE
# 1.7 12-Aug-2002 drahn

Add support for REL type relocations, all currently supported arch
use only RELA type relocations, but that could change. ok art@


# 1.6 24-May-2002 deraadt

various KNF


Revision tags: OPENBSD_3_1_BASE
# 1.5 21-Feb-2002 drahn

cleanup of MD/MI ld.so (elf), most changes by art@ cleanup by me.
tested on alpha sparc64 powerpc.


# 1.4 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.3 08-Jun-2001 art

Cleanup.
exit when the bootstrap relocation fails.


# 1.2 31-May-2001 art

Correctly implement most linking for alpha.
Remove a lot of code copied from powerpc.


# 1.1 14-May-2001 niklas

Commit initial alpha bits, to facilitate in-tree dev.
This code is not yet working.


# 1.21 27-Oct-2017 mpi

Use <elf.h> instead of <elf_abi.h>

ok jasper@, jca@, deraadt@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.20 24-Jan-2017 guenther

On fatal errors, kill ourselves with thrkill(0,9,NULL) instead of
simply exiting, via helper functions _dl_die(), _dl_diedie(), and
_dl_oom().

prompted by a complaint from jsing@
ok jsing@ deraadt@


# 1.19 20-Jan-2017 guenther

Delete ancient macros and unnecessary #includes

ok deraadt@


# 1.18 09-Jan-2017 kettenis

Remove dependency on __got_{start,end} symbols and look at PT_GNU_RELRO
instead. Result in a few more pages that aren't writable on some platforms
(such as hppa). Based on an initial diff from guenther@.

Thanks to deraadt@ for testing.

ok guenther@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 06-Dec-2015 guenther

Simplify the relocation code for the ld.so bootstrap and static pie: track
just the dynamic tags are needed instead of reusing the generic elf_object_t
structure.

testing and feedback from miod@
ok kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.16 27-Dec-2014 kettenis

Make ld.so process only R_ALPHA_RELATIVE relocations during early GOT
relocation in _reloc_alpha_got(), and teach RELOC_RELA() to skip R_ALPHA_NONE
relocations (which are just nops used to fill out the relocation table).
Handling R_ALPHA_NONE relocations will be necessary for static PIE support
and it is not inconceivable that ld.so will end up with such relocations
at some point.

ok kurt@


# 1.15 03-Nov-2014 guenther

Eliminate RTLD_PROTECT_PLT: ld.so is built with -Bsymbolic so the
PLT is empty/unused. On at least macppc and sparc64, ld.so's attempt
to mprotect its PLT could instead hit its own allocated data and
cause a segfault shortly there after.

While here, take a shot at preventing the same issue with the GOT
by checking for __got_start != __got_end.

reproduction *with ktracing* by afresh1@ provided the key data
ok miod@ deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.14 16-Apr-2014 guenther

It's been a quarter century: we can assume volatile is present with that name.


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.13 02-Jan-2010 kettenis

Fix handling of hppa RELOC_IPLT relocations during 'bootstrap relocation'.

ok miod@, deraadt@, jsing@


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.12 24-May-2004 drahn

Change define used to deal with PLT protection, use postive logic not negative.
ok mickey@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.11 09-Jul-2003 drahn

changes to ld.so to be compatible with newer binutils, requires
slight changes in the startup code on most archs. ok art@ brad@


# 1.10 09-Jun-2003 deraadt

pefo 3/4 licence cleanups


Revision tags: OPENBSD_3_3_BASE
# 1.9 15-Feb-2003 drahn

After relocation is completed, remove write protection from GOT/PLT in ld.so.


# 1.8 25-Oct-2002 pefo

Some small fixes in MI code for mips backport. A new reloc md function,
RELOC_GOT, was added to handle mips got bootstrap reloc.

Also remove workaround used on previous versions of binutils for mips.


Revision tags: OPENBSD_3_2_BASE
# 1.7 12-Aug-2002 drahn

Add support for REL type relocations, all currently supported arch
use only RELA type relocations, but that could change. ok art@


# 1.6 24-May-2002 deraadt

various KNF


Revision tags: OPENBSD_3_1_BASE
# 1.5 21-Feb-2002 drahn

cleanup of MD/MI ld.so (elf), most changes by art@ cleanup by me.
tested on alpha sparc64 powerpc.


# 1.4 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.3 08-Jun-2001 art

Cleanup.
exit when the bootstrap relocation fails.


# 1.2 31-May-2001 art

Correctly implement most linking for alpha.
Remove a lot of code copied from powerpc.


# 1.1 14-May-2001 niklas

Commit initial alpha bits, to facilitate in-tree dev.
This code is not yet working.