1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[llvm-readobj] Install llvm-readelf alias

Install an llvm-readelf symlink to llvm-readobj.
When invoked as *readelf*, default to -elf-output-style=GNU.

Patch by Roland McGrath

Differential Revision: https://reviews.llvm.org/D33869

llvm-svn: 308408
This commit is contained in:
Petr Hosek 2017-07-19 02:09:37 +00:00
parent a0ad631f4e
commit 72231eb582
4 changed files with 11 additions and 1 deletions

View File

@ -67,6 +67,7 @@ set(LLVM_TEST_DEPENDS
llvm-profdata
llvm-ranlib
llvm-readobj
llvm-readelf
llvm-rtdyld
llvm-size
llvm-split

View File

@ -8,6 +8,8 @@ RUN: | FileCheck %s -check-prefix ELF64
RUN: llvm-readobj -W --sections \
RUN: %p/Inputs/relocs.obj.elf-x86_64 --elf-output-style=GNU \
RUN: | FileCheck %s -check-prefix ELF64
RUN: llvm-readelf -W -S %p/Inputs/relocs.obj.elf-x86_64 \
RUN: | FileCheck %s -check-prefix ELF64
ELF32: Section Headers:
ELF32-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al

View File

@ -20,3 +20,5 @@ add_llvm_tool(llvm-readobj
WasmDumper.cpp
Win64EHDumper.cpp
)
add_llvm_tool_symlink(llvm-readelf llvm-readobj)

View File

@ -34,6 +34,7 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/Signals.h"
@ -544,7 +545,8 @@ static void dumpInput(StringRef File) {
}
int main(int argc, const char *argv[]) {
sys::PrintStackTraceOnErrorSignal(argv[0]);
StringRef ToolName = argv[0];
sys::PrintStackTraceOnErrorSignal(ToolName);
PrettyStackTraceProgram X(argc, argv);
llvm_shutdown_obj Y;
@ -553,6 +555,9 @@ int main(int argc, const char *argv[]) {
opts::WideOutput.setHiddenFlag(cl::Hidden);
if (sys::path::stem(ToolName).find("readelf") != StringRef::npos)
opts::Output = opts::GNU;
cl::ParseCommandLineOptions(argc, argv, "LLVM Object Reader\n");
// Default to stdin if no filename is specified.