When importing symbols from another module, also import any corresponding symver directives.
(I'm new to this part of the code, so please give me pointers on how I can turn this into something that's fit for landing.)
Differential D92335
[ThinLTO] Import symver directives for imported symbols (PR48214) hans on Nov 30 2020, 10:56 AM. Authored by
Details When importing symbols from another module, also import any corresponding symver directives. (I'm new to this part of the code, so please give me pointers on how I can turn this into something that's fit for landing.)
Diff Detail Event TimelineComment Actions Thinking through this some more, I think I was making it too hard. I think we should just be able to collect the symvers out of the inline asm when we do the IR linking. However, not in the place you've modified below, as I note there. Instead, take a look at IRLinker::run(), where it appends the module inline asm strings together if !IsPerformingImport. I think here you could add a case where IsPerformingImport, and just invoke ModuleSymbolTable::CollectAsmSymvers here and directly add any symver you find to the DstM (probably do all this in a helper function). I was thinking that we might need to carry it via module metadata to avoid parsing it during IR linking, but I'm now not sure that's necessary - I don't think it should add significant overhead. Let me know if you run into issues with that approach.
Comment Actions Yes, that seems easier. Thanks!
Comment Actions Pulling in the symver directives in IRLinker::run() instead. (I didn't do a separate function since it's just a few lines, but happy to do that if you think it would be better.) Please take another look. Comment Actions I just realized this makes Linker/ depend on Object/ Comment Actions I think that's fine to have that dependence. Largely lgtm but suggestion for refactor and test below.
Comment Actions Adding test case where the symver doesn't get imported.
Comment Actions Moving the "Append the module inline asm string" code down, and simplifying it in the process. Comment Actions lgtm. Thanks for fixing this, and that's a nice cleanup on the existing handling! One request - could you submit the change to the current handling and associated test changes first, with the symver handling/test as a follow on? |
This function gets called once per global value being linked in, so it would redo the below code multiple times.