[PATCH] Special case more simple patterns

Alan Modra amodra@gmail.com
Mon Nov 28 02:12:39 GMT 2022


On Fri, Nov 25, 2022 at 04:01:58PM +0000, Michael Matz via Binutils wrote:
> fnmatch is slow, so avoiding it in more cases is good.  This implements
> a more generic version of match_simple_wild which needs some
> pre-processing of patterns.  In particular it supports patterns of the
> form PREFIX*SUFFIX (where all parts are optional), i.e. a super set of
> what's handled now.  Most section matchers of this form and hence don't
> need any calls to fnmatch anymore.
> 
> We retain the implementation of match_simple_wild for the filename
> matchers (they aren't called often enough to matter).
> ---
> This is independendly useful, but will be used in the next-to-be-posted 
> series about section-select.

OK, but please do put the comment for rstrcspn from your later patch
in with this one, and don't commit the following two hunks.

> @@ -645,6 +672,7 @@ walk_wild_section_specs1_wild1 (lang_wild_statement_type *ptr,
>      {
>        const char *sname = bfd_section_name (s);
>        bool skip = !match_simple_wild (wildsec0->spec.name, sname);
> +      //bool skip = !!spec_match (&wildsec0->spec, sname);
>  
>        if (!skip)
>  	walk_wild_consider_section (ptr, file, s, wildsec0, callback, data);
> @@ -682,6 +710,7 @@ walk_wild_section_specs2_wild1 (lang_wild_statement_type *ptr,
>  	{
>  	  const char *sname = bfd_section_name (s);
>  	  bool skip = !match_simple_wild (wildsec1->spec.name, sname);
> +	  //bool skip = !!spec_match (&wildsec1->spec, sname);
>  
>  	  if (!skip)
>  	    walk_wild_consider_section (ptr, file, s, wildsec1, callback,

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list