[llvm] r308408 - [llvm-readobj] Install llvm-readelf alias
Eric Christopher via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 18 23:41:18 PDT 2017
LGTM as a post commit review :)
-eric
On Tue, Jul 18, 2017 at 7:10 PM Petr Hosek via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: phosek
> Date: Tue Jul 18 19:09:37 2017
> New Revision: 308408
>
> URL: http://llvm.org/viewvc/llvm-project?rev=308408&view=rev
> Log:
> [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
>
> Modified:
> llvm/trunk/test/CMakeLists.txt
> llvm/trunk/test/tools/llvm-readobj/gnu-sections.test
> llvm/trunk/tools/llvm-readobj/CMakeLists.txt
> llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp
>
> Modified: llvm/trunk/test/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CMakeLists.txt?rev=308408&r1=308407&r2=308408&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/CMakeLists.txt (original)
> +++ llvm/trunk/test/CMakeLists.txt Tue Jul 18 19:09:37 2017
> @@ -67,6 +67,7 @@ set(LLVM_TEST_DEPENDS
> llvm-profdata
> llvm-ranlib
> llvm-readobj
> + llvm-readelf
> llvm-rtdyld
> llvm-size
> llvm-split
>
> Modified: llvm/trunk/test/tools/llvm-readobj/gnu-sections.test
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/gnu-sections.test?rev=308408&r1=308407&r2=308408&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/tools/llvm-readobj/gnu-sections.test (original)
> +++ llvm/trunk/test/tools/llvm-readobj/gnu-sections.test Tue Jul 18
> 19:09:37 2017
> @@ -8,6 +8,8 @@ RUN: | FileCheck %s -check-prefix ELF6
> 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
>
> Modified: llvm/trunk/tools/llvm-readobj/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/CMakeLists.txt?rev=308408&r1=308407&r2=308408&view=diff
>
> ==============================================================================
> --- llvm/trunk/tools/llvm-readobj/CMakeLists.txt (original)
> +++ llvm/trunk/tools/llvm-readobj/CMakeLists.txt Tue Jul 18 19:09:37 2017
> @@ -20,3 +20,5 @@ add_llvm_tool(llvm-readobj
> WasmDumper.cpp
> Win64EHDumper.cpp
> )
> +
> +add_llvm_tool_symlink(llvm-readelf llvm-readobj)
>
> Modified: llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp?rev=308408&r1=308407&r2=308408&view=diff
>
> ==============================================================================
> --- llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp (original)
> +++ llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp Tue Jul 18 19:09:37 2017
> @@ -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.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170719/eb022356/attachment.html>
More information about the llvm-commits
mailing list