/* NetBSD-specific values for a.out files */ /* XXX This file is mostly copied from the sunos counterpart. Most, but * not all, Sun OS specific things has ben changed, so some comments may * be slightly wrong. */ /* Size of the text section. */ #define N_TXTSIZE(x) \ (N_IS_QMAGIC (x) ? (x).a_text - EXEC_BYTES_SIZE : \ (N_MAGIC(x) != ZMAGIC) ? (x).a_text : \ N_HEADER_IN_TEXT(x) ? \ (x).a_text - EXEC_BYTES_SIZE: \ (x).a_text \ ) /* Offset in an a.out of the start of the text section. */ #define N_TXTOFF(x) \ (N_MAGIC(x) != ZMAGIC ? EXEC_BYTES_SIZE : \ N_HEADER_IN_TEXT(x) ? \ EXEC_BYTES_SIZE : \ ZMAGIC_DISK_BLOCK_SIZE \ ) /* The address of the data segment in virtual memory. */ #define N_TXTADDR(x) \ (N_IS_QMAGIC (x) ? TARGET_PAGE_SIZE + EXEC_BYTES_SIZE : \ N_MAGIC(x) != ZMAGIC ? 0 : \ N_HEADER_IN_TEXT(x) ? \ TEXT_START_ADDR + EXEC_BYTES_SIZE : \ TEXT_START_ADDR \ ) /* When a file is linked against a shared library on NetBSD, the dynamic bit in the exec header is set, and the first symbol in the symbol table is __DYNAMIC. Its value is the address of the following structure. */ struct external_netbsd_dynamic { /* The version number of the structure. NetBSD creates files with version number 8, which is what this structure is based on. */ bfd_byte d_version[4]; /* The virtual address of a 24 byte structure used in debugging. The contents are filled in at run time by ld.so. */ bfd_byte d_debug[4]; /* The virtual address of another structure with information about how to relocate the executable at run time. */ bfd_byte d_un[4]; /* compat - now in crt_ldso */ bfd_byte d_entry[4]; }; /* The size of the debugging structure pointed to by the debugger field of __DYNAMIC. */ #define EXTERNAL_NETBSD_DYNAMIC_DEBUGGER_SIZE (24) /* The structure pointed to by the d_un field of __DYNAMIC. As far as I can tell, most of the addresses in this structure are offsets within the file, but some are actually virtual addresses. */ struct internal_section_dispatch_table { /* Linked list of loaded objects. This is filled in at runtime by ld.so and probably by dlopen. */ unsigned long sdt_loaded; /* The address of the list of names of shared objects which must be included at runtime. Each entry in the list is 16 bytes: the 4 byte address of the string naming the object (e.g., for -lc this is "c"); 4 bytes of flags--the high bit is whether to search for the object using the library path; the 2 byte major version number; the 2 byte minor version number; the 4 byte address of the next entry in the list (zero if this is the last entry). The version numbers seem to only be non-zero when doing library searching. */ unsigned long sdt_sods; /* The address of the path to search for the shared objects which must be included. This points to a string in PATH format which is generated from the -L arguments to the linker. According to the man page, ld.so implicitly adds ${LD_LIBRARY_PATH} to the beginning of this string and /lib:/usr/lib to the end. The string is terminated by a null byte. This field is zero if there is no additional path. */ unsigned long sdt_paths; /* The address of the global offset table. This appears to be a virtual address, not a file offset. The first entry in the global offset table seems to be the virtual address of the _dynamic structure (the same value as the __DYNAMIC symbol). The global offset table is used for PIC code to hold the addresses of variables. A dynamically linked file which does not itself contain PIC code has a four byte global offset table. */ unsigned long sdt_got; /* The address of the procedure linkage table. This appears to be a virtual address, not a file offset. On a SPARC, the table is composed of 12 byte entries, each of which consists of three instructions. The first entry is sethi %hi(0),%g1 jmp %g1 nop These instructions are changed by ld.so into a jump directly into ld.so itself. Each subsequent entry is save %sp, -96, %sp call