Ағылшыншамен салыстырыңыз: абзацты басыңыз — түпнұсқа терезеде ашылады. Абзац астындағы EN түймесі оны мәтін ішінде көрсетеді.
Мазмұны
Кіріспе
Unix мұрағаттау құралы
Unix archiver utility
Linux Standard Base (LSB) стандартында ar құралы қолданыстан шығарылған және осы стандарттың болашақ нұсқаларында жойылуы күтілуде. Бұл шешімге себеп – "LSB бағдарламалық жасақтаманы әзірлеуге қажетті құралдарды қамтымайды, сондай-ақ o және a файл форматтарын да анықтамайды" деген түсіндірме берілді.
In the Linux Standard Base (LSB), ar has been deprecated and is expected to disappear in a future release of that standard. The rationale provided was that "the LSB does not include software development utilities nor does it specify o and a file formats."
Файл пішімінің егжей-тегжейі
ar форматы ешқашан стандартталмаған; қазіргі заманғы архивтер екі негізгі түрі бар ортақ форматқа негізделген, BSD және System V (алғашқыда COFF деп аталған, және GNU, ELF және Windows жүйелерінде де қолданылады). Тарихи тұрғыдан V6, V7, AIX (кішкентай және үлкен) және Coherent сияқты басқа түрлер де болды, олардың барлығы ортақ форматтан едәуір өзгеше. Debian ".deb" архивтері ортақ форматты пайдаланады. ar файлы жаһандық тақырыппен басталады, одан кейін ar файлында сақталған әрбір файл үшін тақырып және дерек бөлімдері келеді. Әрбір дерек бөлімі 2 байтқа дейін тураланады. Егер ол тақ санмен аяқталса, толтыру үшін жаңа жол ('\n', 0x0A) пайдаланылады.
The ar format has never been standardized; modern archives are based on a common format with two main variants, BSD and System V (initially known as COFF, and used as well by GNU, ELF, and Windows.) Historically there have been other variants including V6, V7, AIX (small and big), and Coherent, which all vary significantly from the common format. Debian ". deb" archives use the common format. An ar file begins with a global header, followed by a header and data section for each file stored within the ar file. Each data section is 2 byte aligned. If it would end on an odd offset, a newline ('\n', 0x0A) is used as filler.
Файлдың қолтаңбасы
Файлдың қолтаңбасы — "!<arch>" сиқырлы ASCII жолынан және бір LF басқару символынан (0x0A) тұратын жалғыз өріс.
The file signature is a single field containing the magic ASCII string "!<arch>" followed by a single LF control character (0x0A).
BSD нұсқасы
BSD ar файл атауларын ASCII бос орындарымен оң жақтан толтырып сақтайды. Бұл файл атауларындағы бос орындарға қатысты мәселелер тудырады. 4.4BSD ar кеңейтілген файл атауларын файл атауы өрісіне "#1/" жолын және файл атауының ұзындығын қосып, дерек бөлімінің алдына нақты файл атауын сақтайды. Ол сондай-ақ SYMDEF деп аталатын архитектураға тән файлды архивтің бірінші мүшесі ретінде қосады. Кейбір туыстас жүйелер реттелген нұсқа екенін көрсету үшін атаудан кейін бос орын мен "СОРТИРЛАНҒАН" деген жазуды қояды. Darwin жүйесінде 64 биттік нұсқасы бар. POSIX ranlib-ті алмастыру ретінде опцияны енгізгенімен, BSD ar-дың жаңа нұсқалары осы мүмкіндікті қолдау үшін қайта жазылды. FreeBSD, әсіресе, SYMDEF кесте форматынан бас тартып, System V стиліндегі кестеге көшті.
BSD ar stores filenames right padded with ASCII spaces. This causes issues with spaces inside filenames. 4.4BSD ar stores extended filenames by placing the string "#1/" followed by the file name length in the file name field, and storing the real filename in front of the data section. which inserts an architecture specific file named SYMDEF as first archive member. Some descendents put a space and "SORTED" after the name to indicate a sorted version. A 64 bit variant called exists on Darwin. Since POSIX added the requirement for the option as an replacement of ranlib, however, newer BSD ar implementations have been rewritten to have this feature. FreeBSD in particular ditched the SYMDEF table format and embraced the System V style table.
V жүйе (немесе GNU) нұсқасы
System V ar жүйесі файл атауының соңындағы "/" таңбасын (0x2F) пайдаланады; бұл кеңейтілген файл атауын қолданбай-ақ кеңістіктерді пайдалануға мүмкіндік береді. Содан кейін ол "//" деген атаумен файлдың дерек бөлімінде бірнеше кеңейтілген файл атауын сақтайды, ал осы жазбаға болашақ тақырыптар сілтеме жасайды. Тақырып кеңейтілген файл атауына "/" таңбасын сақтау арқылы және содан кейін кеңейтілген файл атаулары бөліміндегі файл атауының басына қарай ондық смещение санын қосу арқылы сілтеме жасайды. Бұл "//" файлының форматы – бір немесе бірнеше LF таңбаларымен бөлінген ұзын файл атауларының тізімі ғана. Ондық смещениелер – "//" файлындағы жол немесе жолдар емес, таңбалар саны. Бұл әдетте символдар кестесінен кейін файлдың екінші жазбасы болып табылады, ал символдар кестесі әрқашан бірінші болады. System V ar арнайы файл атауын "/" пайдаланады, бұл келесі деректерде символдарды іздеу кестесі бар екенін көрсетеді, ол ar кітапханаларында қол жеткізу жылдамдығын арттыру үшін қолданылады. Бұл символдар кестесі үш бөліктен тұрады, олар бір-бірімен байланысқан деректер ретінде жазылады. Кестедегі жазбалар санын көрсететін 32 биттік үлкен ендиан бүтін саны. 32 биттік үлкен ендиан бүтін сандарының жиынтығы. Әрбір символ үшін біреу, осы символды қамтитын файлдың бас тақырыбының мұрағаттағы орнын жазады. Нөлмен аяқталатын жолдар жиынтығы. Әрқайсысы символдың атауы және 2-бөлімдегі орналасулар тізімімен бірдей ретпен келеді. Кейбір System V жүйелері символдарды іздеу кестесі үшін жоғарыда сипатталған форматты қолданбайды. Мысалы, HP UX 11.0 операциялық жүйелері үшін бұл ақпарат SOM файл форматына негізделген дерек құрылымында сақталады. "/" арнайы файлы нақты тізбекпен аяқталмайды; соңғы символдың атауы оқылғаннан кейін аяқталды деп есептеледі. 4 Гигабайт файл мөлшері шегінен асып кету үшін Solaris 11.2 және GNU сияқты кейбір операциялық жүйелер өзгертілген іздеу кестесін пайдаланады. Символдарды іздеу кестелерінде 32 биттік бүтін сандардың орнына 64 биттік бүтін сандар қолданылады. Осы кесте үшін идентификатор ретінде "/" орнына "/SYM64/" тізбегі қолданылады.
System V ar uses a '/' character (0x2F) to mark the end of the filename; this allows for the use of spaces without the use of an extended filename. Then it stores multiple extended filenames in the data section of a file with the name "//", this record is referred to by future headers. A header references an extended filename by storing a "/" followed by a decimal offset to the start of the filename in the extended filename data section. The format of this "//" file itself is simply a list of the long filenames, each separated by one or more LF characters. Note that the decimal offsets are number of characters, not line or string number within the "//" file. This is usually the second entry of the file, after the symbol table which always is the first. System V ar uses the special filename "/" to denote that the following data entry contains a symbol lookup table, which is used in ar libraries to speed up access. This symbol table is built in three parts which are recorded together as contiguous data. A 32 bit big endian integer, giving the number of entries in the table. A set of 32 bit big endian integers. One for each symbol, recording the position within the archive of the header for the file containing this symbol. A set of Zero terminated strings. Each is a symbol name, and occurs in the same order as the list of positions in part 2. Some System V systems do not use the format described above for the symbol lookup table. For operating systems such as HP UX 11.0, this information is stored in a data structure based on the SOM file format. The special file "/" is not terminated with a specific sequence; the end is assumed once the last symbol name has been read. To overcome the 4 GiB file size limit some operating system like Solaris 11.2 and GNU use a variant lookup table. Instead of 32 bit integers, 64 bit integers are used in the symbol lookup tables. The string "/SYM64/" instead "/" is used as identifier for this table
Windows нұсқасы
Windows (PE/COFF) нұсқасы SysV/GNU нұсқасына негізделген. Бірінші жазба "/" SysV/GNU символдар кестесімен ұқсас құрылымға ие. Екінші жазба да "/" болып табылады, бұл Microsoft кеңейтімі, ол кеңейтілген символдардың өзара сілтеме кестесін сақтайды. Бұл кесте реттелген және кішкентай эндиан бүтін сандарын қолданады. Үшінші жазба – SysV/GNU-дағыдай, "//" ұзын атау деректерінен тұрады.
The Windows (PE/COFF) variant is based on the SysV/GNU variant. The first entry "/" has the same layout as the SysV/GNU symbol table. The second entry is another "/", a Microsoft extension that stores an extended symbol cross reference table. This one is sorted and uses little endian integers. The third entry is the optional "//" long name data as in SysV/GNU.
Архивтің кішігірім түрі
GNU binutils және Elfutils нұсқаларында сиқырлы саны бар қосымша "жұқа архив" форматы бар. Жұқа архивте тек символдар кестесі және файлға сілтемелер ғана болады. Файл форматы негізінен System V форматындағы архив болып табылады, онда әрбір файл дерек бөлімдерінсіз сақталады. Әрбір файл атауы "ұзын" атау ретінде сақталады және олар символдық сілтемелердей қарастырылады.
The version of in GNU binutils and Elfutils have an additional "thin archive" format with the magic number A thin archive only contains a symbol table and references to the file. The file format is essentially a System V format archive where every file is stored without the data sections. Every filename is stored as a "long" filename and they are to be resolved as if they were symbolic links.