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

[ AIE2 ] Driver update for Startup Objects #52

Merged
merged 1 commit into from
May 31, 2024
Merged

[ AIE2 ] Driver update for Startup Objects #52

merged 1 commit into from
May 31, 2024

Conversation

mchokshi091101
Copy link
Collaborator

  • Added changes to driver, to look for startup objects in the Installed Directory (passed through the option -ccc-install-dir).
  • Added test to check if correct builtin library and startup codes are added, as an input to linker, by the driver.

@@ -37,6 +37,15 @@ void aie::Linker::ConstructJob(Compilation &C, const JobAction &JA,
!Args.hasArg(options::OPT_nodefaultlibs)) {
AddRunTimeLibs(ToolChain, ToolChain.getDriver(), CmdArgs, Args);
}
SmallString<128> InstalledDir(ToolChain.getDriver().InstalledDir);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires the startup files to be installed right next to the clang driver, which is not the case.
We should create the following installation dir: test/Driver/Inputs/basic_aie_tree.
In there, create the following structure:

basic_aie_tree/
├── bin
│   └── .keep
└── lib
    └── aie2-none-unknown-elf
        ├── crt0.o
        └── crt1.o

The tests can then point -ccc-install-dir to the bin directory.
The clang driver knows how to navigate this installation directory, hence you can simply call

if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
                   options::OPT_r)) {
  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crt0.o")));
  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crt1.o")));
}

//
//===----------------------------------------------------------------------===//

// RUN: %clang %s -### --target=aie2-none-unknown-elf -D__AIE_ENGINE__ -ccc-install-dir /scratch/llvm-aie/clang/test/Driver/Inputs/aie2 2>&1 \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot hardcode this path, this will fail on any other system.
Replace with

-ccc-install-dir %S/Inputs/basic_aie_tree/bin

//
//===----------------------------------------------------------------------===//

// RUN: %clang %s -### --target=aie2-none-unknown-elf -ccc-install-dir %S/Inputs/basic_aie_tree/bin 2>&1 \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// RUN: %clang %s -### --target=aie2-none-unknown-elf -ccc-install-dir %S/Inputs/basic_aie_tree/bin 2>&1 \
// RUN: %clang %s -### --target=aie2-none-unknown-elf -ccc-install-dir %S/../Inputs/basic_aie_tree/bin 2>&1 \

@SagarMaheshwari99 SagarMaheshwari99 merged commit 70703e8 into Xilinx:aie-public May 31, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants