This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Match archive:file in linker script filespecs


On Fri, Jun 06, 2008 at 08:13:19AM -0400, Daniel Jacobowitz wrote:
> On Fri, Jun 06, 2008 at 03:01:34PM +0930, Alan Modra wrote:
> > "archive:file" matches "file" within "archive"
> > "archive:"     matches the whole "archive"
> > ":file"        matches "file" but not one in an archive
> 
> Did you consider the archive(file) syntax?  Since that's what we use
> in error messages, it makes sense to me to use it in linker scripts
> too (and people frequently try to write it that way already).  But I'm
> not sure it's unambiguous.

I did think about using this but rejected the idea for a few reasons.
The main one you mention.  It is ambiguous.  See ldgram.y
input_section_spec_no_keep, which allows a filespec without the
'(' sectionlist ')' part to mean all sections in the file.  So is that
achive(file) or file(section)?  Also, as you say

> For :file we'd still need a colon,

or some other syntax not so obviously connected to the file within
archive syntax.

Lastly, it would need ldlex.l and ldgram.y changes to accept '(' in
filespecs.  (A variant on NAME would work, I think.)  So it was more
work..

Of course, one thing against the syntax I chose is that it breaks any
existing scripts that happen to select for a file containing a colon.
I think (and hope) that this is unlikely, except possibily in the case
of dos filesystem "c:" and suchlike which I already handle.

> Oh and, hey, the manual and NEWS... :-)

OK, OK.  :-)  And as Nick said, testsuite too.  I'm travelling soon,
so it might have to wait until after the gcc summit.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]