[PATCH] D51961: [objcopy] make objcopy follow program header standards
Jake Ehrlich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 11 16:56:14 PDT 2018
jakehehrlich added a comment.
A couple nits but this LGTM.
================
Comment at: llvm/test/tools/llvm-objcopy/relocatable-phdr.test:5
+# RUN: llvm-objcopy %t %t2
+# RUN: llvm-readelf -file-headers %t2 | FileCheck %s
+
----------------
You'll want to use llvm-readobj instead of llvm-readelf. It produces a more machine readable format.
================
Comment at: llvm/tools/llvm-objcopy/Object.cpp:1053
+ Ehdr.e_phnum = size(Obj.segments());
+ Ehdr.e_phoff = (size(Obj.segments()) != 0) ? Obj.ProgramHdrSegment.Offset : 0;
+ Ehdr.e_phentsize = (size(Obj.segments()) != 0) ? sizeof(Elf_Phdr) : 0;
----------------
I'd use phnum here instead of recalling size.
https://reviews.llvm.org/D51961
More information about the llvm-commits
mailing list