From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,10dc57790e0ead82 X-Google-Attributes: gid1164f8,public X-Google-Thread: 102b75,36e5e519b6b43fb X-Google-Attributes: gid102b75,public X-Google-Thread: 110292,10dc57790e0ead82 X-Google-Attributes: gid110292,public From: torek@elf.bsdi.com (Chris Torek) Subject: Re: Intel going to 0.18 micron in Q2/99? Date: 1999/02/28 Message-ID: <7bcv1f$sdm@elf.bsdi.com> X-Deja-AN: 450336331 References: <36BAC1F5.9BFAFA51@strategypartners.com> <918917503.41564@haldjas.folklore.ee> <7a4f1i$gi$1@andros.cygnus.com> X-Complaints-To: abuse@cs.umd.edu X-Trace: cronkite.cs.umd.edu 920256586 13520 205.230.228.129 (1 Mar 1999 02:49:46 GMT) Organization: none of the above NNTP-Posting-Date: 1 Mar 1999 02:49:46 GMT Newsgroups: comp.arch,comp.sys.intel,comp.sys.dec >In article <918917503.41564@haldjas.folklore.ee> Sander Vesik writes: >>No, I mean small petty details like the bitness of certain data types >>like off_t. >>Are these ABI or API? (To which the only possible answer is "yes", "no", or "it depends". :-) ) In article <7a4f1i$gi$1@andros.cygnus.com> TTK Ciar wrote: > The ABI (ELF, aout, coff, etc) defines data type sizes. Usually >just the primitive ones (byte, short, word, dword), and API defines >data types in terms of these primitive types (off_t as word, etc). ... It took me a couple of readings to understand what ttk meant here. ELF and aout do not define data type sizes for anything other than the headers and section sizes and such. In the case of traditional a.out headers, you may not even get names that correspond to types for the various fields -- that is, for an a.out header, you have a "struct exec" with members "a_magic", "a_text", "a_data", "a_bss", "a_syms", "a_entry", "a_trsize", and "a_drsize" fields. There may or may not be some additional fields (such as the "a_dynamic", "a_toolversion", and "a_mid" in SunOS). The types of these members are not well-defined anywhere (sometimes they are "int", sometimes they are "long", some of them may be bitfields, etc.). a.out relocation records are magically different for different machines, and the interpretation (and even the placement) of the "magic number" that identifies something as an a.out image is pretty haphazard. ELF is a lot saner; there is an Elf32_Ehdr for "32-bit ELF" objects (where "objects" approx= files), and an "Elf64_Ehdr" for 64-bit objects. Both of these start with an array of 16 "unsigned char"s that make up an ELF-object identifier. The first four invariably contain 0x7f, 0x45, 0x4c, 0x46 (which spells "\177ELF" in ASCII) and the next few tell you what kind of ELF object you have, and what machine it is for, and so on. (There is room for expansion; about half of these 16 bytes are undefined as yet.) >In ELF's case, it has a "size" attribute in the header for 32-bit >and 64-bit formats, and the sizes of these primitive types depends >on this attribute ... (I assume this refers to the EI_CLASS field: either ELFCLASS32 => the header is an Elf32_Ehdr, or ELFCLASS64 => the header is an Elf64_Ehdr.) In any case, the two header classes use types named, e.g.: Elf32_Addr /* program address (32 bits) */ Elf32_Half /* 16-bit field */ Elf32_Off /* file offset (32 bits) */ Elf64_Addr /* program address (64 bits) */ Elf64_Sxword /* 64-bit signed integer */ Elf64_Xword /* 64-bit field (not signed) */ These types are used throughout the primary ELF header and then again for "section" headers, symbol table entries, and relocation items. These are *not* general ABI types, however. These are merely names for the types that make up the ELF object itself. Indeed, the ABI (if any) is more or less independent of the ELF object. The ABI needs to define how any given bit of code (such as a main program or subroutine) will call any other bit of code (another subroutine or function). This in turn requires not only pinning down the types (and endian-ness) of such calls, but also things like "which register(s) hold which parameters and which return values" and "if the callee is a C varargs/stdarg function, does it get called in the same way as if it is a C fixed-argument function or Pascal function or Fortran function", etc. I have not dealt much with APIs, but assuming this means "how library and OS data are represented in a source language", these are essentially independent of ABIs. They connect at the "output of a compiler" level, and there is no guarantee that using the correct source-code constructs will get you correct binary constructs, nor that using "wrong" source code constructs will get wrong binary interfaces. The degree to which one is tied to the other is up to the compiler: Whether the "st_size" field of a "stat" structure is 32- or 64-bits is sometimes an API question, and sometimes an ABI question. In our system (BSD/OS 4.0), we use ELF "notes" to "brand" object files as being "BSD/OS objects". Objects meant for other systems (such as Linux) can be caught at this point, and have different runtime (dynamic-linker) libraries inserted. (This is how our forthcoming LAP stuff works. For the marketing angle, which is pretty thin on details, see .) > There's no good technical reason I can see for not defining the >more complex types in the ABI ... I assume this refers to examples like "st_size in `struct stat'". The problem that occurs when one defines this in an ABI is that one discovers that the definition came from someone who is still stuck in the 32-bit-file-size world, and suddenly you cannot deal with your existing 12GB data files. Thus, as ttk suggests, this is more a political issue than a technical one. -- In-Real-Life: Chris Torek, Berkeley Software Design Inc El Cerrito, CA Domain: torek@bsdi.com +1 510 234 3167 http://claw.bsdi.com/torek/ (not always up) I report spam to abuse@.