Fix intelmic-mkoffload.c if the temp path contains a '-'

Ilya Verbin iverbin@gmail.com
Sat Sep 5 01:52:00 GMT 2015


2015-09-05 1:50 GMT+03:00 Mike Stump <mikestump@comcast.net>:
>
> On Sep 4, 2015, at 2:45 PM, Ilya Verbin <iverbin@gmail.com> wrote:
>
>> 2015-09-04 22:27 GMT+03:00 Mike Stump <mikestump@comcast.net>:
>>> On Sep 4, 2015, at 4:10 AM, Hahnfeld, Jonas <Hahnfeld@itc.rwth-aachen.de> wrote:
>>>>>>>   * intelmic-mkoffload.c (prepare_target_image): Fix if the temp path
>>>>>>>   contains a '-‘.
>>>
>>> So, out of curiosity, did you test all characters other than null?  If - doesn’t work, there is a good chance that no such test has been done, and there is a small hoard of bugs, all the same in there.
>>
>> Good point.  Objcopy in bfd/binary.c creates symbol names this way:
>>
>>  for (p = buf; *p; p++)
>>    if (! ISALNUM (*p))
>>      *p = '_’;
>
> So, this code can’t be the code in question, as - is ! ALNUM, and then should have been a _, meaning ‘-‘ would not have to be handled.  Since the code is handling ‘-‘, this can’t be the code in question?

When we run "objcopy <args> /tmp-1/liba.so", this code in bfd/binary.c
creates a symbol called "_binary__tmp_1_liba_so_start".  Then
intelmic-mkoffload.c wants to rename it to
"__offload_image_intelmic_start".  To do this, it prepares a string
"--redefine-sym
_binary__tmp_1_liba_so_start=__offload_image_intelmic_start",
therefore it should replace all ! ISALNUM chars in the name, as
objcopy does.

  -- Ilya



More information about the Gcc-patches mailing list