public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Question About 'ar' Output
@ 2022-04-26  3:46 Jon Forrest
  2022-04-26  6:15 ` Jan Beulich
  0 siblings, 1 reply; 5+ messages in thread
From: Jon Forrest @ 2022-04-26  3:46 UTC (permalink / raw)
  To: binutils

(GNU ar version 2.37-10.fc35)

As a learning exercise, I'm trying to duplicate some of what
the 'ar' command does. (There's nothing wrong with 'ar').

I have a .a library that ar shows has the following content:

% ar t libctf.a
libctf_la-ctf-archive.o
libctf_la-ctf-dump.o
libctf_la-ctf-create.o
libctf_la-ctf-decl.o
libctf_la-ctf-error.o
libctf_la-ctf-hash.o
libctf_la-ctf-labels.o
[rest omitted]

When I run my test program I see
/
//
/0
/25
/47
/71
/93
[rest omitted]

When I look at my .a library using 'od' I can see the names starting
with '/' characters. I can also see the names starting with 'libctf'.

I don't understand what the slash names are, nor how they're mapped to
the real names. I tried looking at the 'ar' source code but I didn't
see anything that jumped out at me.

What am I missing?

Cordially,
Jon Forrest




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question About 'ar' Output
  2022-04-26  3:46 Question About 'ar' Output Jon Forrest
@ 2022-04-26  6:15 ` Jan Beulich
  2022-04-26 19:17   ` Jon Forrest
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2022-04-26  6:15 UTC (permalink / raw)
  To: Jon Forrest; +Cc: binutils

On 26.04.2022 05:46, Jon Forrest via Binutils wrote:
> (GNU ar version 2.37-10.fc35)
> 
> As a learning exercise, I'm trying to duplicate some of what
> the 'ar' command does. (There's nothing wrong with 'ar').
> 
> I have a .a library that ar shows has the following content:
> 
> % ar t libctf.a
> libctf_la-ctf-archive.o
> libctf_la-ctf-dump.o
> libctf_la-ctf-create.o
> libctf_la-ctf-decl.o
> libctf_la-ctf-error.o
> libctf_la-ctf-hash.o
> libctf_la-ctf-labels.o
> [rest omitted]
> 
> When I run my test program I see
> /
> //
> /0
> /25
> /47
> /71
> /93
> [rest omitted]
> 
> When I look at my .a library using 'od' I can see the names starting
> with '/' characters. I can also see the names starting with 'libctf'.
> 
> I don't understand what the slash names are, nor how they're mapped to
> the real names. I tried looking at the 'ar' source code but I didn't
> see anything that jumped out at me.

Member names, when they're longer than what fits in the designated
member header field, can use an escape mechanism by indexing into the
special "//" member using the "/<offset>" notation.

Jan


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question About 'ar' Output
  2022-04-26  6:15 ` Jan Beulich
@ 2022-04-26 19:17   ` Jon Forrest
  2022-04-27  5:48     ` Jan Beulich
  2022-04-27  6:28     ` Alan Modra
  0 siblings, 2 replies; 5+ messages in thread
From: Jon Forrest @ 2022-04-26 19:17 UTC (permalink / raw)
  To: Jan Beulich; +Cc: binutils



On 4/25/2022 11:15 PM, Jan Beulich wrote:
>
> Member names, when they're longer than what fits in the designated
> member header field, can use an escape mechanism by indexing into the
> special "//" member using the "/<offset>" notation.

Thanks so much for the quick reply.

Can you point me to where this is documented. I haven't been
able to find it.

Is this what's in a "thin" archive?

When you say "indexing into the special "//" member", do
you mean that something like "/47" means 47 bytes after the beginning
of the "//" member?

Also, are the "/" and "//" members actual members or just some
kind of place holders?

Thanks,
Jon





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question About 'ar' Output
  2022-04-26 19:17   ` Jon Forrest
@ 2022-04-27  5:48     ` Jan Beulich
  2022-04-27  6:28     ` Alan Modra
  1 sibling, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2022-04-27  5:48 UTC (permalink / raw)
  To: Jon Forrest; +Cc: binutils

On 26.04.2022 21:17, Jon Forrest wrote:
> On 4/25/2022 11:15 PM, Jan Beulich wrote:
>> Member names, when they're longer than what fits in the designated
>> member header field, can use an escape mechanism by indexing into the
>> special "//" member using the "/<offset>" notation.
> 
> Thanks so much for the quick reply.
> 
> Can you point me to where this is documented. I haven't been
> able to find it.

No, sorry.

> Is this what's in a "thin" archive?
> 
> When you say "indexing into the special "//" member", do
> you mean that something like "/47" means 47 bytes after the beginning
> of the "//" member?

Something along these lines yes. I don't recall off the top of my head
whether some further constant needs adding.

> Also, are the "/" and "//" members actual members or just some
> kind of place holders?

I'd call them "special members".

Jan


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question About 'ar' Output
  2022-04-26 19:17   ` Jon Forrest
  2022-04-27  5:48     ` Jan Beulich
@ 2022-04-27  6:28     ` Alan Modra
  1 sibling, 0 replies; 5+ messages in thread
From: Alan Modra @ 2022-04-27  6:28 UTC (permalink / raw)
  To: Jon Forrest; +Cc: Jan Beulich, binutils

On Tue, Apr 26, 2022 at 12:17:05PM -0700, Jon Forrest via Binutils wrote:
> Can you point me to where this is documented. I haven't been
> able to find it.

"man 5 ar" or if that doesn't give you anything the good folk of the
freebsd project have documented the format.
https://www.freebsd.org/cgi/man.cgi?query=ar&sektion=5

> Is this what's in a "thin" archive?

No.  A thin archive doesn't store the file contents, instead just
indexing the files on your file system.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-27  6:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26  3:46 Question About 'ar' Output Jon Forrest
2022-04-26  6:15 ` Jan Beulich
2022-04-26 19:17   ` Jon Forrest
2022-04-27  5:48     ` Jan Beulich
2022-04-27  6:28     ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).