[PATCH] allow empty string as argument to -Map

Fangrui Song i@maskray.me
Thu May 28 04:23:17 GMT 2020


On Wed, May 27, 2020 at 5:33 PM Rasmus Villemoes <rv@rasmusvillemoes.dk> wrote:
>
> On 27/05/2020 18.50, Nick Clifton wrote:
> > Hi Rasmus,
> >
> >> So, as the next best thing, use a previously bogus value (the empty
> >> string) as a sentinel to indicate "use the output filename + .map".
> >
> > Thanks for suggesting this patch.  I have applied it along with a couple
> > of changes:
> >
> >   * If a filename is supplied, but it references a directory, then
> >     create a file inside that directory, again based upon the output
> >     filename with .map appended.  (I actually did this to make it
> >     easier to test the new feature, but it strikes that it might be
> >     useful in its own right).
>
> That makes a lot of sense, thanks. And one can get "my" behaviour by
> passing "-Map=." or "-Map .", which...
>
> >   * Updated the --help output from the linker to show that the
> >     filename is optional.
>
> ... eliminates the somewhat clumsy need to specify the empty string as
> argument, either via -Map=  or actually have the shell insert an empty
> string, -Map ''. I actually did attempt to modify the help text, but as
> the argument isn't really optional, I couldn't find a way to indicate
> that the empty string was meaningful - I worry a bit that the current
>
>   -Map [FILE]         Write a map file (default: <outputname>.map)
>
> can lead people to think that one can actually omit the argument - and
>
>   -Map --gc-sections
>
> would just put the map in the file --gc-sections, but otherwise work.
>
> So before this gets set in stone, can I retract my suggestion of
> assigning meaning to the empty string (maybe continue to handle it
> internally equivalent to ".", but not advertising it)? For the help
> text, it's hard to explain in one line, but perhaps something like
>
>   -Map FILE/DIR     Write a map file to FILE or DIR/<outputname>.map
>
> (And perhaps change "map file" to "link map" or "linker map")
>
> Rasmus
>

An empty argument value is very uncommon. Does an empty string work in
a response file?


More information about the Binutils mailing list