📄 link.5
字号:
.\" This source code is a product of Sun Microsystems, Inc. and is provided.\" for unrestricted use provided that this legend is included on all tape.\" media and as a part of the software program in whole or part. Users.\" may copy or modify this source code without charge, but are not authorized.\" to license or distribute it to anyone else except as part of a product or.\" program developed by the user..\".\" THIS PROGRAM CONTAINS SOURCE CODE COPYRIGHTED BY SUN MICROSYSTEMS, INC..\" SUN MICROSYSTEMS, INC., MAKES NO REPRESENTATIONS ABOUT THE SUITABLITY.\" OF SUCH SOURCE CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT.\" EXPRESS OR IMPLIED WARRANTY OF ANY KIND. SUN MICROSYSTEMS, INC. DISCLAIMS.\" ALL WARRANTIES WITH REGARD TO SUCH SOURCE CODE, INCLUDING ALL IMPLIED.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN.\" NO EVENT SHALL SUN MICROSYSTEMS, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT,.\" INCIDENTAL, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING.\" FROM USE OF SUCH SOURCE CODE, REGARDLESS OF THE THEORY OF LIABILITY..\" .\" This source code is provided with no support and without any obligation on.\" the part of Sun Microsystems, Inc. to assist in its use, correction, .\" modification or enhancement..\".\" SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE.\" INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS.\" SOURCE CODE OR ANY PART THEREOF..\".\" Sun Microsystems, Inc..\" 2550 Garcia Avenue.\" Mountain View, California 94043.\".\" Copyright (c) 1991 Sun Microsystems, Inc..\".\" @(#)link.5 1.6 90/01/04 SMI.TH LINK 5 "17 February 1988".SH NAMElink \- link editor interfaces.SH SYNOPSIS.B #include <link.h>.SH DESCRIPTION.IX "link editor" "" "link editor data structures".LPDynamically linked executables created by.BR ld (1)contain data structures used by the dynamic link editorto finish link-editing the program during program execution.These datastructures are described with a .B link_dynamic structure, as defined in the.B link.hfile. .B ldalways identifies the location of this structure in the executable file withthe symbol.BR _\^_DYNAMIC .This symbol is .BR ld -definedand if referenced in an executable that does not require dynamic linking will have the value zero..LPThe program stub linked with ``main'' programs by compiler drivers such as.BR cc (1V)(called .BR crt0 )tests the definition of.B _\^_DYNAMICto determine whether or not the dynamic link editor should be invoked.Programs supplying a substitute for .B crt0must either duplicate this functionality or else require that the programs withwhich they are linked be linked .IR statically .Otherwise, such replacement.BR crt0 'smust open and map in the executable.B /usr/lib/ld.sousing .BR mmap (2).Care should be taken to ensure that the expected mapping relationship betweenthe ``text'' and ``data'' segments of the executable is maintained in thesame manner that the .BR execve (2V)system call does.The first location following the.B a.outheader of this executable is the entry point to a function that begins thedynamic link-editing process. This function must be called and suppliedwith twoarguments. The first argument is an integer representing the revision levelof the argument list, and should have the value ``1''. The second should be apointer to an argument list structure of the form:.LP.RS.nf.ta .75i 1.25i 2.75i.ft Bstruct { int crt_ba; /* base address of ld.so */ int crt_dzfd; /* open fd to /dev/zero */ int crt_ldfd; /* open fd to ld.so */ struct link_dynamic *crt_dp; /* pointer to program's _\^_DYNAMIC */ char **crt_ep; /* environment strings */ caddr_t crt_bp; /* debugger hook */}.ft R.fi.DT.RE.LPThe members of the structure are:.TP 15.B crt_baThe address at which .B /usr/lib/ld.sohas been mapped..TP .B crt_dzfdAn open file descriptor for .BR /dev/zero ..B ld.sowill close this file descriptor before returning..TP .B crt_ldfdThe file descriptor used to map .BR /usr/lib/ld.so ..B ld.sowill close this file descriptor before returning..TP .B crt_dpA pointer to the label.B _\^_DYNAMICin the executable which is calling .BR ld.so ..TP .B crt_epA pointer to the environment strings provided to the program..TP .B crt_bpA location in the executable which contains an instruction that willbe executed after the call to.B ld.soreturns. This location is used as a breakpoint in programs that arebeing executed under the control of a debugger such as.BR adb (1)..SH "SEE ALSO".BR ld (1),.BR mmap (2),.BR a.out (5).SH "BUGS"These interfaces are under development and are subject to rapid change.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -