[llvm] [llvm-objcopy] Add --change-section-address (PR #98664)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 19 02:40:11 PDT 2024
================
@@ -0,0 +1,120 @@
+# RUN: yaml2obj --docnum=1 %s -o %ti
+
+# RUN: llvm-objcopy --adjust-section-vma *+0x20 %ti %to
+# RUN: llvm-readelf --section-headers %to | FileCheck %s --check-prefix=CHECK-ADD-ALL
+
+# RUN: llvm-objcopy --change-section-address *+0x20 %ti %to
+# RUN: llvm-readelf --section-headers %to | FileCheck %s --check-prefix=CHECK-ADD-ALL
+
+# RUN: llvm-objcopy --change-section-address .anotherone-0x30 %ti %to
+# RUN: llvm-readelf --section-headers %to | FileCheck %s --check-prefix=CHECK-SUB-SECTION
+
+# RUN: llvm-objcopy --change-section-address .text*+0x20 %ti %to
+# RUN: llvm-readelf --section-headers %to | FileCheck %s --check-prefix=CHECK-ADD-PATTERN
+
+# RUN: llvm-objcopy --change-section-address .text*=0x10 %ti %to
+# RUN: llvm-readelf --section-headers %to | FileCheck %s --check-prefix=CHECK-SET-PATTERN
+
+# RUN: llvm-objcopy --change-section-address .anotherone-0x30 --change-section-address .anotherone+0x20 %ti %to
+# RUN: llvm-readelf --section-headers %to | FileCheck %s --check-prefix=CHECK-USE-LAST
+
+# RUN: llvm-objcopy --change-section-address .anotherone=0x455 --change-section-address *+0x20 %ti %to
+# RUN: llvm-readelf --section-headers %to | FileCheck %s --check-prefix=CHECK-NOTSUPERSET-SET
+
+# RUN: llvm-objcopy --change-section-address *+0x20 --change-section-address .anotherone=0x455 %ti %to
+# RUN: llvm-readelf --section-headers %to | FileCheck %s --check-prefix=CHECK-SUPERSET-SET
+
+# CHECK-ADD-ALL: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
----------------
jh7370 wrote:
Let's just omit the line from `Off` onwards, since there's no purpose to it.
https://github.com/llvm/llvm-project/pull/98664
More information about the llvm-commits
mailing list