This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
shared strings in archive string tables?
- From: Mikael Pettersson <mikpelinux at gmail dot com>
- To: binutils at sourceware dot org
- Date: Mon, 1 Jul 2019 16:30:56 +0200
- Subject: shared strings in archive string tables?
When an 'ar' member references a file name via an index in the
archive's string table, does that index have to be the start of some
string table entry, or may it refer to an internal position of that
entry?
For example:
> touch x0123456789012345 0123456789012345
> ar ruv x.a x0123456789012345 0123456789012345
ar: creating x.a
a - x0123456789012345
a - 0123456789012345
> ar tv x.a
rw-r--r-- 1000/1000 0 Jul 1 16:15 2019 x0123456789012345
rw-r--r-- 1000/1000 0 Jul 1 16:15 2019 0123456789012345
> cat x.a
!<arch>
// 38 `
x0123456789012345/
0123456789012345/
/0 1561990514 1000 1000 100644 0 `
/19 1561990514 1000 1000 100644 0 `
Let's change the second member to use string table offset 1, thus
sharing the tail of the entry starting at offset 0.
> sed -i -e 's,/19,/1 ,g' x.a
> cat x.a
!<arch>
// 38 `
x0123456789012345/
0123456789012345/
/0 1561990514 1000 1000 100644 0 `
/1 1561990514 1000 1000 100644 0 `
> ar tv x.a
rw-r--r-- 1000/1000 0 Jul 1 16:15 2019 x0123456789012345
rw-r--r-- 1000/1000 0 Jul 1 16:15 2019 0123456789012345
So this seems to work with the GNU binutils' 'ar'. My question is if
this is something any 'ar' should handle or not?
/Mikael