blob: 375bb64590cdc4429d1ceb3bb0df6dcbe90d33c7 [file] [log] [blame]
// Copyright 2018 The Goma Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "elf_parser.h"
#include <cstdlib>
#include <iostream>
#include "glog/logging.h"
#include "goma_init.h"
using devtools_goma::ElfParser;
int main(int argc, char* argv[]) {
if (argc != 2) {
std::cout << "Usage: " << argv[0] << " <filename>" << std::endl;
exit(EXIT_FAILURE);
}
google::InitGoogleLogging(argv[0]);
std::unique_ptr<ElfParser> elf = ElfParser::NewElfParser(argv[1]);
CHECK(elf != nullptr);
CHECK(elf->valid());
std::vector<string> needed, rpath;
if (!elf->ReadDynamicNeededAndRpath(&needed, &rpath)) {
LOG(FATAL) << "ReadDynamicNeededAndRpath";
}
for (const auto& it : needed) {
std::cout << "NEEDED:" << it << std::endl;
}
for (const auto& it : rpath) {
std::cout << "RPATH:" << it << std::endl;
}
exit(0);
}