[PATCH] allow empty string as argument to -Map

Rasmus Villemoes rv@rasmusvillemoes.dk
Thu Nov 5 12:23:39 GMT 2020


On 05/11/2020 12.41, Nick Clifton wrote:
> Hi Fangrui, Hi Rasmus,
> 
>   Any comments on the attached patch ?
> 
>   It implements the basename and % character changes as previously
> discussed.

LGTM. I think you can simplify it somewhat: Always overwrite the % with
a nul byte and construct the path using the part of the -Map argument
before the % (which will be empty in the case where % is the first
character).

So instead of the four different asprintf, I think you can just do

  percent[0] = 0;
  res = asprintf(&new_name, "%s%s%s", config.map_filename,
output_filename, percent[1] ? percent + 1 : ".map");

no?

Thanks for working on this.

Rasmus


More information about the Binutils mailing list