Scroll to navigation

AR(1) GNU kehitystyökalut AR(1)

NIMI

ar - luo ja muokkaa arkistoita, palauta arkistoista

YLEISKATSAUS

ar [-X32_64] [-]p[mod] [--plugin name] [--target bfdname] [--output dirname] [relpos] [count] archive [member...]

KUVAUS

GNU GNU ar ohjelma luo ja muokkaa arkistoita ja poistaa jäsentiedostoja arkistoista. Arkisto on tiedosto joka pitää sisällään joukon muita tiedostoja muodossa, joka mahdollistaa tiedostojen (jäsenten) noutamisen alkuperäisessä muodossaan.

The original files' contents, mode (permissions), timestamp, owner, and group are preserved in the archive, and can be restored on extraction.

GNU ar voi ylläpitää arkistoita joiden jäsenten nimet ovat mielivaltaisen pitkiä; kuitenkin, riippuen siitä kuinka ar on konfiguroitu omassa järjestelmässäsi jäsenten nimien pituus voi olla rajoitettu (yhteensopivuuden varmistamiseksi muiden ohjelmien arkistoformaatin kanssa). Mikäli tällainen rajoitus on olemassa, se on tyypillisesti 15 merkkiä (tyypillinen a.out tyyppisissä formaateissa) tai 16 merkkiä (tyypillinen coff tyyppisissä formaateissa).

ar kuuluu binääri-työkaluohjelmien joukkoon, koska arkistoita käytetään useinmiten kirjastoina jotka sisältävät yleisesti tarvittavia aliohjelmia.

ar luo indeksin symboleihin jotka on määritelty uudelleensijoitettavissa objektimoduuleissa kun käytetään komentorivioptiota s. Kun indeksi on kerran luotu, se päivitetään automaattisesti aina kun ar tekee muutoksia arkiston sisältöön (paitsi käytettäessä q komentorivioptiota päivityksen yhteydessä). Indeksoitu arkisto nopeuttaa kirjaston linkittämistä ja mahdollistaa kirjaston rutiinien keskinäiset kutsut riippumatta niiden järjestyksestä arkistossa.

Voit käyttää nm -s tai nm --print-armap indeksitaulun listaamiseen. Jos arkistossa ei ole indeksitaulua, ranlib ohjelmalla se voidaan lisätä jälkeenpäin.

GNU ar can optionally create a thin archive, which contains a symbol index and references to the original copies of the member files of the archive. This is useful for building libraries for use within a local build tree, where the relocatable objects are expected to remain available, and copying the contents of each object would only waste time and space.

An archive can either be thin or it can be normal. It cannot be both at the same time. Once an archive is created its format cannot be changed without first deleting it and then creating a new archive in its place.

Thin archives are also flattened, so that adding one thin archive to another thin archive does not nest it, as would happen with a normal archive. Instead the elements of the first archive are added individually to the second archive.

The paths to the elements of the archive are stored relative to the archive itself.

GNU ar is designed to be compatible with two different facilities. You can control its activity using command-line options, like the different varieties of ar on Unix systems; or, if you specify the single command-line option -M, you can control it with a script supplied via standard input, like the MRI "librarian" program.

VALITSIMET

GNU ar sallii toimintoa kuvaavan kirjaimen p sekä optioita kuvaavien lippujen mod antamisen missä järjestyksessä tahansa kunhan ne ovat ensimmäisen komentoriviargumentin sisällä.

Halutessasi voit aloittaa ensimmäisen komentoriviargumentin viivalla (vähennysmerkki).

p kirjain kuvaa haluttua toimintoa ja se voi olla joku seuraavista:

Poistaa moduuleita arkistosta. Anna poistettavien moduuleiden nimet tiedostoiniminä...; arkistoa ei muuteta jos et anna poistettavia tiedostonimiä.

Jos annat v option, ar listaa kaikki moduulit jotka se poistaa arkistosta.

Siirrä jäseniä arkiston sisällä.

Järjestys jossa jäsenet ovat arkistossa saattaa vaikuttaa ohjelman linkittämiseen kirjaston kanssa jos symboli on määritelty useammassa kuin yhdessä jäsenessä.

Jos "m" toiminnon kanssa ei anneta mitään optioita, kaikki jäsenet joiden nimet on annettu tiedosto argumentteina siirretään arkiston loppuun; voit käyttää a, b tai i optiota jos haluat siirtää jäsenen tarkemmin määriteltyyn paikkaan.

Tulosta annetut arkiston jäsenet. Mikäli v optio on annettu, jäsenen nimi tulostetaan ennen sen sisällön tulostamista.

If you specify no member arguments, all the files in the archive are printed.

Quick append; Historically, add the files member... to the end of archive, without checking for replacement.

Optiot a, b ja i eivät vaikuta tähän toimintoon; uudet jäsenet lisätään aina arkiston loppuun.

Mikäli optio v annetaan, ar listaa kaikki tiedostot jotka se lisää arkistoon.

Since the point of this operation is speed, implementations of ar have the option of not updating the archive's symbol table if one exists. Too many different systems however assume that symbol tables are always up-to-date, so GNU ar will rebuild the table even with a quick append.

Note - GNU ar treats the command qs as a synonym for r - replacing already existing files in the archive and appending new ones at the end.

Lisää tiedostoja... arkistoon (korvaten arkistossa jo olevat samannimiset jäsenet). Tämä toiminto eroaa toiminnosta q siten, että arkistosta poistetaan ensin jäsenet joilla on sama nimi kuin lisättävillä tiedostoilla.

Jos joku tiedostoista jotka on annettu tiedostoniminä... ei ole olemassa, ar tulostaa virheilmoituksen eikä poista arkistosta vastaanannimisiä jäseniä.

Oletusarvoisesti uudet jäsenet lisätään arkiston loppuun; voit kuitenkin käyttää optioita a, b tai i määritelläksesi uuden jäsenen aseman suhteessa johonkin muuhun jäseneen.

Optio v käytettynä tämän toiminnon kanssa aikaansaa jokaisen lisätyn jäsenen nimen tulostuksen, sekä lisäksi kirjaimen a tai r kuvaamaan sitä lisättiinkö (ilman vanhan jäsenen poistamista) vai korvattiinko jäsen.

Add an index to the archive, or update it if it already exists. Note this command is an exception to the rule that there can only be one command letter, as it is possible to use it as either a command or a modifier. In either case it does the same thing.
Display a table listing the contents of archive, or those of the files listed in member... that are present in the archive. Normally only the member name is shown, but if the modifier O is specified, then the corresponding offset of the member is also displayed. Finally, in order to see the modes (permissions), timestamp, owner, group, and size the v modifier should be included.

Jos et anna yhtään tiedostonnimeä, kaikki arkistossa olevat tiedostot tulostetaan.

Jos arkistossa on useampi kuin yksi samanniminen tiedosto (esim. huu arkisossa haa.a, ar t haa.a huu tulostaa vain ensimmäisen löytämänsä tiedoston; kaikkien samannimisten tiedostojen listaaminen vaatii arkiston täydellisen sisällön tulostamista—esim ar t haa.a.

Palauta jäseniä (nimetty tiedostonniminä) arkistosta. Voit käyttää v optiota jos haluat, että ar listaa jokaisen palautettavan tiedoston nimen.

Jos et anna toiminnolle yhtään tiedostoa, kaikki arkistossa olevat tiedostot palautetaan.

Files cannot be extracted from a thin archive, and there are restrictions on extracting from archives created with P: The paths must not be absolute, may not contain "..", and any subdirectories in the paths must exist. If it is desired to avoid these restrictions then used the --output option to specify an output directory.

Joukko optioita (mod) voi seurata välittömästi (ilman välilyötiä) toimintoa kuvaavaa kirjainta p. Optioilla voi vaikuttaa toiminnon käyttäytymiseen:

Lisää uudet tiedostot olemassaolevan jäsenen jälkeen. Jos käytät optiota a, olemassaolevan arkiston jäsenen nimen on oltava annettu option jäsennimenä, ennen arkiston nimen antamista.
Lisää uudet tiedostot ennen olemassaolevaa arkiston jäsentä. Jos käytät optiota b, olemassaolevan arkiston jäsenen nimen on oltava annettu option jäsennimenä, ennen arkiston nimen antamista (sama kuin i).
Luo arkisto. Annettu arkisto luodaan aina jos se ei ole olemassa kun päivitystoiminto on annettu. Tällöin tulostetaan kuitenkin varoitus ellei sitä tätä optiota käyttämällä ole nimenomaan estetty.
Operate in deterministic mode. When adding files and the archive index use zero for UIDs, GIDs, timestamps, and use consistent file modes for all files. When this option is used, if ar is used with identical options and identical input files, multiple runs will create identical output files regardless of the input files' owners, groups, file modes, or modification times.

If binutils was configured with --enable-deterministic-archives, then this mode is on by default. It can be disabled with the U modifier, below.

Lyhennä nimet arkistossa. GNU ar sallii normaalisti mielivaltaisen pitkät tiedostonnimet. Tämä saattaa kuitenkin aiheuttaa sen, että luodut arkistot eivät ole yhteensopivia joidenkin järjestelmien oman ar ohjelman kanssa. Jos tämä aiheuttaa ongelmia, f optiota voidaan käyttää tiedostojen nimien lyhentämiseen niiden arkistoon lisäyksen yhteydessä.
Insert new files before an existing member of the archive. If you use the modifier i, the name of an existing archive member must be present as the relpos argument, before the archive specification. (same as b).
Tämä optio on sallittu yhteensopivuussyistä mutta sillä ei ole mitään vaikutusta.
Uses the count parameter. This is used if there are multiple entries in the archive with the same name. Extract or delete instance count of the given name from the archive.
Säästä alkuperäiset jäsenten aikaleimat palautuksen yhteydessä. Jos tätä optiota ei anneta, arkistosta palautetut tiedostot saavat aikaleimansa palautushetken mukaan.
Display member offsets inside the archive. Use together with the t option.
Use the full path name when matching or storing names in the archive. Archives created with full path names are not POSIX compliant, and thus may not work with tools other than up to date GNU tools. Modifying such archives with GNU ar without using P will remove the full path names unless the archive is a thin archive. Note that P may be useful when adding files to a thin archive since r without P ignores the path when choosing which element to replace. Thus

 ar rcST archive.a subdir/file1 subdir/file2 file1
    

will result in the first "subdir/file1" being replaced with "file1" from the current directory. Adding P will prevent this replacement.

Kirjoita indeksitaulu arkistoon, tai päivitä olemassaoleva taulu vaikka arkistoon ei tehtäisikään muita muutoksia. Tätä optiota voidaan käyttää yksinään, tai se voidaan yhdistää johonkin toimintoon. ar s komennon suorittaminen arkistolle vastaa toiminnoltaan ranlib komentoa.
Do not generate an archive symbol table. This can speed up building a large library in several steps. The resulting archive can not be used with the linker. In order to build a symbol table, you must omit the S modifier on the last execution of ar, or you must run ranlib on the archive.
Make the specified archive a thin archive. If it already exists and is a regular archive, the existing members must be present in the same directory as archive.
Normaalisti ar r... lisää kaikki annetut tiedostot arkistoon. Jos haluat lisätä vain ne tiedostot jotka ovat uudempia kuin arkistossa jo olevat samannimiset jäsenet, käytä tätä optiota. u optio on sallittu vain toiminnon r (korvaa) kanssa. Erityisesti yhdistelmä qu ei ole sallittu, koska aikaleimojen tarkistaminen hävittäisi nopeushyödyn q toiminnosta.
Do not operate in deterministic mode. This is the inverse of the D modifier, above: added files and the archive index will get their actual UID, GID, timestamp, and file mode values.

This is the default unless binutils was configured with --enable-deterministic-archives.

Tämä optio aikaansaa sen, että ar tulostaa toimintoon liittyvää lisäinformaatiota. Esimerkiksi monet toiminnot tulostavat käsiteltävät tiedostonnimet kun niitä käytetään yhdessä option v kanssa.
Tämä optio tulostaa ar ohjelman versionumeron.

The ar program also supports some command-line options which are neither modifiers nor actions, but which do change its behaviour in specific ways:

Displays the list of command-line options supported by ar and then exits.
Displays the version information of ar and then exits.
ar ignores an initial option spelled -X32_64, for compatibility with AIX. The behaviour produced by this option is the default for GNU ar. ar does not support any of the other -X options; in particular, it does not support -X32 which is the default for AIX ar.
The optional command-line switch --plugin name causes ar to load the plugin called name which adds support for more file formats, including object files with link-time optimization information.

This option is only available if the toolchain has been built with plugin support enabled.

If --plugin is not provided, but plugin support has been enabled then ar iterates over the files in ${libdir}/bfd-plugins in alphabetic order and the first plugin that claims the object in question is used.

Please note that this plugin search directory is not the one used by ld's -plugin option. In order to make ar use the linker plugin it must be copied into the ${libdir}/bfd-plugins directory. For GCC based compilations the linker plugin is called liblto_plugin.so.0.0.0. For Clang based compilations it is called LLVMgold.so. The GCC plugin is always backwards compatible with earlier versions, so it is sufficient to just copy the newest one.

The optional command-line switch --target bfdname specifies that the archive members are in an object code format different from your system's default format. See
The --output option can be used to specify a path to a directory into which archive members should be extracted. If this option is not specified then the current directory will be used.

Note - although the presence of this option does imply a x extraction operation that option must still be included on the command line.

@tiedosto
Read command-line options from file. The options read are inserted in place of the original @file option. If file does not exist, or cannot be read, then the option will be treated literally, and not removed.

Options in file are separated by whitespace. A whitespace character may be included in an option by surrounding the entire option in either single or double quotes. Any character (including a backslash) may be included by prefixing the character to be included with a backslash. The file may itself contain additional @file options; any such options will be processed recursively.

KATSO MYÖS

nm(1), ranlib(1), and the Info entries for binutils.

TEKIJÄNOIKEUDET

Copyright (c) 1991-2020 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

KÄÄNNÖS

Tämän käsikirjan suomenkielisen käännöksen tekivät Janne Viitala <janne.viitala@cc.tut.fi>

Tämä käännös on ilmainen dokumentaatio; katso tekijänoikeusehdot GNU General Public License -versiosta 3 tai uudemmasta. Emme ota vastuuta.

20. helmikuuta 2021 binutils-2.35.2