Add Catecholamine (CA), a tool for breaking code objects out of fat binaries created via LPL. As with LPL, --help provides usage details. Fixed LPL's implementation of path_to_self which was a nasty infinite loop iff for whatever reason readlink would always fail, orthogonally to the string's size. Link against pthread for LPL, which uses call_once and once_flag (this could, under certain circumstances, yield an arcane "Unknown error=-1" exception.

Этот коммит содержится в:
Alex Voicu
2017-12-14 13:32:27 +00:00
родитель 81426ecc0f
Коммит 5a4955617e
10 изменённых файлов: 303 добавлений и 95 удалений
+49
Просмотреть файл
@@ -0,0 +1,49 @@
#include "ca.hpp"
#include <cstdlib>
#include <exception>
#include <iostream>
#include <stdexcept>
#include <string>
#include <vector>
using namespace clara;
using namespace hip_impl;
using namespace std;
int main(int argc, char** argv)
{
try {
bool help = false;
vector<string> inputs;
string targets;
auto cmd = cmdline_parser(help, inputs, targets);
const auto r = cmd.parse(Args{argc, argv});
if (!r) throw runtime_error{r.errorMessage()};
if (help) cout << cmd << endl;
else {
if (inputs.empty()) throw runtime_error{"No inputs specified."};
validate_inputs(inputs);
auto tmp = tokenize_targets(targets);
if (tmp.empty()) {
tmp.assign(amdgpu_targets().cbegin(), amdgpu_targets().cend());
}
else validate_targets(tmp);
extract_code_objects(inputs, tmp);
}
}
catch (const exception& ex) {
cerr << ex.what() << endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}