Page MenuHomePhabricator

[lto] added getCOFFWeakExternalFallback

Authored by inglorion on Jan 31 2017, 7:07 PM.



This allows clients of the LTO API to determine the name of the fallback symbol for COFF weak externals.

Diff Detail


Event Timeline

inglorion created this revision.Jan 31 2017, 7:07 PM
pcc added inline comments.Feb 1 2017, 4:18 PM
149 ↗(On Diff #86559)

I'd make this function specifically for COFF weak externals. No other format requires this feature during symbol resolution, as far as I know.

150 ↗(On Diff #86559)

*refers to

152 ↗(On Diff #86559)

Maybe assert that the symbol is a weak external?

154 ↗(On Diff #86559)

This could be a bitcast or a gep, so I think you need to call stripPointerCasts on the result. You also need to mangle the symbol name, see how we set Name for example.

156 ↗(On Diff #86559)

I don't think we can get here if the symbol is a valid weak external. I'd assert (via cast or otherwise) that this is the case.

inglorion updated this revision to Diff 86867.Feb 2 2017, 12:05 PM
  • renamed to getCOFFWeakExternalFallback to indicate this only works for COFF weak externals
  • asserted that the symbol is a weak external
  • added mangling

(I'll update the title of the revision if you're happy with the new name.)

pcc accepted this revision.Feb 2 2017, 12:15 PM


This revision is now accepted and ready to land.Feb 2 2017, 12:15 PM
inglorion updated this revision to Diff 86903.Feb 2 2017, 3:18 PM
inglorion retitled this revision from [lto] added getAliasName to [lto] added getCOFFWeakExternalFallback.
inglorion edited the summary of this revision. (Show Details)

Updating title and summary.

This revision was automatically updated to reflect the committed changes.