Page MenuHomePhabricator

[ifs] Prepare llvm-ifs for elfabi/ifs merging.
Needs ReviewPublic

Authored by haowei on Apr 2 2021, 12:02 PM.



This diff changes llvm-ifs to use unified IFS file format and perform other renaming changes in preparation for the merging between elfabi/ifs.

Diff Detail

Event Timeline

haowei created this revision.Apr 2 2021, 12:02 PM
haowei requested review of this revision.Apr 2 2021, 12:02 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 2 2021, 12:02 PM
haowei updated this revision to Diff 335038.Apr 2 2021, 3:44 PM

Addressed clang tests.

This change is pretty large so I'm wondering if we could possibly split it into two changes, one that does the purely mechanical renaming of ELF and TBE to IFS, and second one that merges the two tools?

26 ↗(On Diff #335038)

Do we know whether the binary output format for the current target is ELF? Shouldn't we check it first?


Since IFS is supposed to be binary format agnostic, it's a bit confusing to use ELF constants here. Could we instead define these values ourselves and convert them to the corresponding ELF values when generating the stub?


The case difference on the left and right side (SoName vs SOName) is confusing, I'd unify them.


No need for curly braces.

haowei updated this revision to Diff 335709.Apr 6 2021, 8:34 PM
haowei marked 5 inline comments as done.
haowei marked 3 inline comments as done.Apr 6 2021, 8:38 PM

I will try to split this change.

26 ↗(On Diff #335038)

I tried following way:

const bool WriteBin = !Args.getLastArg(options::OPT_emit_merged_ifs);
  if (WriteBin) {
    llvm::Triple::OSType OS = C.getDefaultToolChain().getEffectiveTriple().getOS();
    switch(OS) {
    case llvm::Triple::OSType::DragonFly:
    case llvm::Triple::OSType::Fuchsia:
    case llvm::Triple::OSType::KFreeBSD:
    case llvm::Triple::OSType::Linux:
    case llvm::Triple::OSType::Lv2:
    case llvm::Triple::OSType::NetBSD:
    case llvm::Triple::OSType::OpenBSD:
    case llvm::Triple::OSType::Solaris:
    case llvm::Triple::OSType::Haiku:
    case llvm::Triple::OSType::Minix:
    case llvm::Triple::OSType::NaCl:
    case llvm::Triple::OSType::PS4:
    case llvm::Triple::OSType::ELFIAMCU:
    case llvm::Triple::OSType::Contiki:
    case llvm::Triple::OSType::Hurd:
    // default:
    //   // Not adding "--output-format" will cause llvm-ifs to crash.
  } else {

but it does not work. It looks like the Toolchain object is not properly constructed in this stage, which makes it difficult to determine the target of current clang invocation. Do you have any suggestions?


I removed ELF constants and added helper functions.

haowei updated this revision to Diff 336213.Apr 8 2021, 1:50 PM
haowei marked an inline comment as done.
haowei retitled this revision from [ifs][elfabi] Merge llvm-elfabi tool into llvm-ifs to [ifs] Prepare llvm-ifs for elfabi/ifs merging..
haowei edited the summary of this revision. (Show Details)

Split this change into 2.

haowei updated this revision to Diff 343772.Fri, May 7, 3:34 PM

Rebase the code to resolve presubmit errors.