History log of /src/sys/arch/mips/include/elf_machdep.h |
Revision | | Date | Author | Comments |
1.21 |
| 16-Apr-2025 |
riastradh | ld.elf_so: Teach this to handle MIPS PIE rtld debug data.
Adapt t_rtld_r_debug to handle the two MIPS cases too.
XXX t_rtld_r_debug should be tested both as PIE and non-PIE to exercise both cases.
Context:
The value of a DT_DEBUG .dynamic entry is initialized at load-time, by ld.elf_so, to a pointer to a data structure set up by ld.elf_so describing the shared objects loaded by the executable, so debuggers can find them from, e.g., core dumps. None of this is really documented anywhere that I can find. Best reference is this post on the gdb mailing list from a quarter century ago saying there's no real documentation:
https://web.archive.org/web/20250414021320/https://sourceware.org/pipermail/gdb/2000-April/004509.html
However, on MIPS, the .dynamic section is mapped read-only, so ld.elf_so can't properly modify it (I imagine technically it could with some mprotect shenanigans but that's not how it's done on MIPS). Instead, the linker reserves a location in read/write memory and uses a DT_MIPS_RLD_MAP entry with a pointer to that location.
However, in position-independent executables, the .dynamic entry can't have an absolute pointer to that location because it's not known up front. Instead, the the linker uses a DT_MIPS_RLD_MAP_REL entry with the relative offset to that location from the Elf_Dyn entry itself.
I would add a reference for this but it's basically a matter of UTSL plus some oblique mentions on the web and mailing list discussions:
https://web.archive.org/web/20250414024823/https://cygwin.com/legacy-ml/binutils/2016-04/msg00244.html https://web.archive.org/web/20250403151803/https://maskray.me/blog/2023-09-04-toolchain-notes-on-mips https://web.archive.org/web/20211024050833/https://reviews.llvm.org/D12794?id=34533 https://web.archive.org/web/20250407052145/https://wiki.debian.org/MIPSPort https://web.archive.org/web/20250414024924/https://reviews.freebsd.org/D17867?id=50122
PR port-mips/59296: t_rtld_r_debug test is failing
|
1.20 |
| 06-Nov-2017 |
christos | branches: 1.20.40; Handle 64 bit kernels.
|
1.19 |
| 06-Nov-2017 |
christos | Cleanup and clarify the ELFSIZE mess:
We now have 2 variables automatically set in elf_machdep.h:
ARCH_ELFSIZE: the size for userland binaries KERN_ELFSIZE: the size for the kernel binaries
DB_ELFSIZE has been deleted and KERN_ELFSIZE should have always the same values DB_ELFSIZE used to have.
In sys/exec_elf.h, if ELFSIZE is not set, it is set to KERN_ELFSIZE for the kernel and ARCH_ELFSIZE for userland. These defaults should eliminate the need for most manual ELFSIZE setting.
|
1.18 |
| 23-May-2013 |
christos | add generic copyrights so FreeBSD can use them.
|
1.17 |
| 30-Jan-2013 |
christos | whitespace police
|
1.16 |
| 30-Jan-2013 |
matt | Add two missing relocs and DT_MIPS_PLTGOT and DT_MIPS_RWPLT
|
1.15 |
| 15-Mar-2011 |
matt | branches: 1.15.4; 1.15.14; Add separate support for MIPS32R2 and MIPS64R2. Use EHB/SSNOP and jr.hb ra as appropriate (COP0_SYNC now uses them). Add support for COP_0_HWRENA and COP_0_USERLOCAL (use by rdhwr $3,$29 instruction for TLS support). Add mips3+ reserved instruction handler to emulate rdhwr is many fewer instructions.
|
1.14 |
| 20-Feb-2011 |
matt | Major merge forward from matt-nb5-mips64. New fixup code. New common SPL code. New common interrupt code. Move related variables into structures. Cleanup locore (move MD variable into it). Kill StudlyCaps Use PCU for FPU
|
1.13 |
| 14-Dec-2009 |
mrg | branches: 1.13.4; 1.13.6; 1.13.8; forward declare struct exec_package
|
1.12 |
| 14-Dec-2009 |
matt | Merge from matt-nb5-mips64 Merge mips-specific arch files.
|
1.11 |
| 30-May-2009 |
skrll | Add TLS relocation definitions.
|
1.10 |
| 11-Dec-2005 |
christos | branches: 1.10.42; 1.10.78; 1.10.96; merge ktrace-lwp.
|
1.9 |
| 31-Oct-2003 |
drochner | don't need ELF_INTER_NON_RELOCATABLE anymore if no COMPAT_16, from simonb
|
1.8 |
| 09-Dec-2001 |
thorpej | branches: 1.8.16; Add support for dumping ELF-cormat core files.
|
1.7 |
| 02-Apr-2000 |
minoura | branches: 1.7.8; 1.7.12; Move dl* function definitions to libc on ELF. Based on the patch supplied by Takuya Shiozaki <tshiozak@astec.co.jp>. See http://mail-index.netbsd.org/tech-userlevel/2000/02/23/0000.html.
|
1.6 |
| 25-Oct-1999 |
kleink | Update to match new SVR4-style definition names in <sys/exec_elf.h>.
|
1.5 |
| 24-Apr-1999 |
simonb | branches: 1.5.2; 1.5.4; 1.5.6; Nuke register and remove trailling white space.
|
1.4 |
| 25-Mar-1998 |
mhitch | branches: 1.4.12; Define ELF dynamic types for MIPS (some will be used by ld.elf_so).
|
1.3 |
| 03-Mar-1997 |
jonathan | branches: 1.3.8; Add architecture-specific ELf relocs for mips chips.
|
1.2 |
| 11-Nov-1996 |
jonathan | branches: 1.2.6; Elf32 fixes for mips shared libraries:
* handle interpreters with nonzero virtual address of entry-point: subtract p_vaddr from computed entrypoint, as the mips elf exec did.
* Add #ifdef ELF_INTERP_NON_RELOCATABLE/#endif around the code that tries to choose a `good' address at which to load an interpreter, if none was set by the emul probe function. (the address chosen could be improved to avoid fragmenting the process virtual address space).
* define ELF_INTERP_NON_RELOCATABLE in machine/elf_machdep.h for mips CPUs, which currently use a GNU-derived ld.so.
ELF_INTERP_NON_RELOCATABLE is not necessary for native NetBSD/alpha ELF binaries. It may be required for GNU-derived ELF dynamic loaders (Linux/i386?)
|
1.1 |
| 26-Sep-1996 |
cgd | add and use a machine-dependent header, which currently defines some macros to use to remove #ifdefs from the machine ID case check. Eventually, these headers will contain other information, e.g. machine-dependent relocation information, etc.
|
1.2.6.1 |
| 12-Mar-1997 |
is | Merge in changes from Trunk
|
1.3.8.1 |
| 10-May-1998 |
mycroft | Pull up 1.4, per request of mhitch.
|
1.4.12.1 |
| 21-Jun-1999 |
thorpej | Sync w/ -current.
|
1.5.6.1 |
| 27-Dec-1999 |
wrstuden | Pull up to last week's -current.
|
1.5.4.1 |
| 15-Nov-1999 |
fvdl | Sync with -current
|
1.5.2.1 |
| 20-Nov-2000 |
bouyer | Update thorpej_scsipi to -current as of a month ago A i386 GENERIC kernel compiles without the siop, ahc and bha drivers (will be updated later). i386 IDE/ATAPI and ncr work, as well as sparc/esp_sbus. alpha should work as well (untested yet). siop, ahc and bha will be updated once I've updated the branch to current -current, as well as machine-dependant code.
|
1.7.12.1 |
| 08-Jan-2002 |
nathanw | Catch up to -current.
|
1.7.8.1 |
| 10-Jan-2002 |
thorpej | Sync kqueue branch with -current.
|
1.8.16.3 |
| 21-Sep-2004 |
skrll | Fix the sync with head I botched.
|
1.8.16.2 |
| 18-Sep-2004 |
skrll | Sync with HEAD.
|
1.8.16.1 |
| 03-Aug-2004 |
skrll | Sync with HEAD
|
1.10.96.9 |
| 29-Apr-2011 |
matt | Major merge to/from current. Adds MIPS32/MIPS64 R2 support (24k, 74k, etc.) including COP0_USERLOCAL Adds support for emulation of rdhwr $3,$29 instruction. Major cleanup of SMP code. (stable on multi-core / single thread per core) llsc locking code only used in MP capable kernels.
|
1.10.96.8 |
| 26-Jan-2010 |
matt | If ELFSIZE == 64, define ELF64_MACHDEP_ID_CASES regardless of _LP64
|
1.10.96.7 |
| 12-Sep-2009 |
matt | Fix for COMPAT_NETBSD32.
|
1.10.96.6 |
| 05-Sep-2009 |
matt | Fix EF_ARCH_*. (should be in high nibble)
|
1.10.96.5 |
| 23-Aug-2009 |
matt | Make sure we only don't run other sized ELFs.
|
1.10.96.4 |
| 22-Aug-2009 |
matt | Move ELF{32,64}_MACHDEP_ENDIANNESS to <mips/elf_machdep.h>
|
1.10.96.3 |
| 21-Aug-2009 |
matt | Add prototypes for mips_netbsd_elfXX_probe to verify the current kernel and cpu support the ABI and architecture specified in the elf header. Add prototypes for moredump_elfXX_setup which will set the core dump elf flags to the current abi and what the architecture of the current cpu.
|
1.10.96.2 |
| 20-Aug-2009 |
matt | On _LP64 default to ELFSIZE=64 Add a ELF64 default case for EM_MIPS
|
1.10.96.1 |
| 16-Aug-2009 |
matt | Kill use of _MIPS_BSD_ABI - switch to __mips_<abi> Use device_t where appropriate. Remove magic numbers.
|
1.10.78.2 |
| 11-Mar-2010 |
yamt | sync with head
|
1.10.78.1 |
| 20-Jun-2009 |
yamt | sync with head
|
1.10.42.1 |
| 18-Jul-2007 |
matt | Add MIPS EF_*. Add ELF64 stuff. Add hooks to check for ABI type.
|
1.13.8.1 |
| 05-Mar-2011 |
bouyer | Sync with HEAD
|
1.13.6.1 |
| 06-Jun-2011 |
jruoho | Sync with HEAD.
|
1.13.4.2 |
| 21-Apr-2011 |
rmind | sync with head
|
1.13.4.1 |
| 05-Mar-2011 |
rmind | sync with head
|
1.15.14.3 |
| 03-Dec-2017 |
jdolecek | update from HEAD
|
1.15.14.2 |
| 23-Jun-2013 |
tls | resync from head
|
1.15.14.1 |
| 25-Feb-2013 |
tls | resync with head
|
1.15.4.1 |
| 22-May-2014 |
yamt | sync with head.
for a reference, the tree before this commit was tagged as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments")
|
1.20.40.1 |
| 02-Aug-2025 |
perseant | Sync with HEAD
|