Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn LLVM modules into a binary #2721

Open
jonmeow opened this issue Mar 28, 2023 · 0 comments
Open

Turn LLVM modules into a binary #2721

jonmeow opened this issue Mar 28, 2023 · 0 comments
Assignees
Labels
long term Issues expected to take over 90 days to resolve. toolchain

Comments

@jonmeow
Copy link
Contributor

jonmeow commented Mar 28, 2023

Capturing some notes from @chandlerc:

There are two steps here

  1. converting to a .o file
  2. linking together the .o files into an executable
    for (2) I think you'll want to use the Clang driver to run a link subprocess (which will use lld or some other linker on the system)
    for (1), you'll want to do this directly. llc does do this, but I wouldn't use it as a reference. I would use the code in Clang in BackendUtil.cpp
    https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/BackendUtil.cpp
    None of that file's routines are really in usefully public and reliably APIs
    I wouldn't depend on it
    I would look at how it uses the LLVM APIs, and then directly use the LLVM APIs to emit the .o file
    (this file is considered an implementation detail of Clang)
    (but it's usage of the LLVM APIs is likely a better reference that llc's usage of LLVM APIs)

Per some side-discussion, most of the BackendUtil.cpp won't be used, e.g. ThinLTO. We might want that eventually but not right now, and possibly rewritten. Rather, this really is for the most core part of things like using the pass manager and the core LLVM APIs for .o.

(note, not working on this right now, but taking this down to remember the discussion)

@jonmeow jonmeow self-assigned this Mar 28, 2023
@github-actions github-actions bot added the inactive Issues and PRs which have been inactive for at least 90 days. label Jun 27, 2023
@chandlerc chandlerc added long term Issues expected to take over 90 days to resolve. and removed inactive Issues and PRs which have been inactive for at least 90 days. labels Aug 6, 2023
@carbon-language carbon-language deleted a comment from github-actions bot Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
long term Issues expected to take over 90 days to resolve. toolchain
Projects
None yet
Development

No branches or pull requests

2 participants