[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Ping: [PATCH] build: provide option to disambiguate symbol names



On 07.11.2019 12:03, George Dunlap wrote:
> On 11/7/19 7:20 AM, Jan Beulich wrote:
>> On 24.10.2019 15:31, Jan Beulich wrote:
>>> The .file assembler directives generated by the compiler do not include
>>> any path components (gcc) or just the ones specified on the command line
>>> (clang, at least version 5), and hence multiple identically named source
>>> files (in different directories) may produce identically named static
>>> symbols (in their kallsyms representation). The binary diffing algorithm
>>> used by xen-livepatch, however, depends on having unique symbols.
>>>
>>> Provide a Kconfig option to control the (build) behavior, and if enabled
>>> use objcopy to prepend the (relative to the xen/ subdirectory) path to
>>> the compiler invoked STT_FILE symbols.
> 
> This is a good explanation, and I think the changes make sense.  But
> unfortunately...
> 
>>> Conditionalize explicit .file directive insertion in C files where it
>>> exists just to disambiguate names in a less generic manner; note that
>>> at the same time the redundant emission of STT_FILE symbols gets
>>> suppressed for clang. Assembler files as well as multiply compiled C
>>> ones using __OBJECT_FILE__ are left alone for the time being.
> 
> ...I don't follow this at all.  What does the .file directive do in
> those places, and why is it an issue?

As explained at the beginning of the description, for some dir/file.c
passed to the compiler,
- gcc emits ".file file.c",
- clang emits ".file dir/file.c".
It was a long time ago that we had noticed issues with static symbols
because of gcc omitting the directory part. Hence some .file
directives got inserted in source files where we noticed it would
matter.

As to the "why is it an issue part" - these directives get in the way
of the new mechanism (because we ask for "file.c" symbols to be
renamed, not "dir/file.c" ones).

> And why do we always disable it in clang?

Because, as per above, it's redundant with what the compiler inserts.

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.