From 1c98619801a5705c688e683be3ef9d70169a0686 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 23 Jul 2016 20:48:50 +0000 Subject: Vendor import of lld release_39 branch r276489: https://llvm.org/svn/llvm-project/lld/branches/release_39@276489 --- test/CMakeLists.txt | 4 +- test/COFF/Inputs/armnt-executable.obj.yaml | 2 +- test/COFF/Inputs/export.yaml | 4 +- test/COFF/Inputs/export2.yaml | 2 +- test/COFF/Inputs/hello32.yaml | 2 +- test/COFF/Inputs/import.yaml | 2 +- test/COFF/Inputs/include1a.yaml | 4 +- test/COFF/Inputs/include1b.yaml | 4 +- test/COFF/Inputs/include1c.yaml | 2 +- test/COFF/Inputs/machine-x64.yaml | 2 +- test/COFF/Inputs/machine-x86.yaml | 2 +- test/COFF/Inputs/manifestinput.test | 13 + test/COFF/Inputs/ret42.yaml | 2 +- test/COFF/alternatename.test | 4 +- test/COFF/ar-comdat.test | 2 +- test/COFF/armnt-blx23t.test | 2 +- test/COFF/armnt-branch24t.test | 2 +- test/COFF/armnt-imports.test | 2 +- test/COFF/armnt-mov32t-exec.test | 2 +- test/COFF/armnt-movt32t.test | 2 +- test/COFF/base.test | 2 +- test/COFF/baserel.test | 2 +- test/COFF/common.test | 2 +- test/COFF/conflict.test | 2 +- test/COFF/debug.test | 2 +- test/COFF/dllorder.test | 65 --- test/COFF/entry-inference.test | 2 +- test/COFF/entry-inference2.test | 4 +- test/COFF/entry-inference32.test | 2 +- test/COFF/entry-mangled.test | 2 +- test/COFF/export32.test | 4 +- test/COFF/force.test | 2 +- test/COFF/icf-circular.test | 2 +- test/COFF/icf-circular2.test | 2 +- test/COFF/icf-different-align.test | 2 +- test/COFF/icf-local.test | 2 +- test/COFF/icf-simple.test | 2 +- test/COFF/imports-mangle.test | 2 +- test/COFF/include.test | 4 +- test/COFF/internal.test | 2 +- test/COFF/invalid-obj.test | 2 +- test/COFF/loadcfg.ll | 2 +- test/COFF/loadcfg.test | 22 +- test/COFF/loadcfg32.test | 20 +- test/COFF/locally-imported.test | 2 +- test/COFF/locally-imported32.test | 2 +- test/COFF/long-section-name.test | 2 +- test/COFF/manifestinput.test | 10 + test/COFF/merge.test | 2 +- test/COFF/opt.test | 2 +- test/COFF/out.test | 6 +- test/COFF/reloc-arm.test | 2 +- test/COFF/reloc-x64.test | 2 +- test/COFF/reloc-x86.test | 2 +- test/COFF/safeseh.test | 2 +- test/COFF/section.test | 62 ++ test/COFF/seh.test | 2 +- test/COFF/sort-debug.test | 2 +- test/COFF/subsystem-inference.test | 2 +- test/COFF/symtab.test | 2 +- test/COFF/tls.test | 2 +- test/COFF/tls32.test | 4 +- test/COFF/unwind.test | 2 +- test/COFF/weak-external.test | 2 +- test/COFF/weak-external2.test | 2 +- test/COFF/weak-external3.test | 2 +- test/Driver/def-lib-search.test | 8 - test/Driver/flavor-option.test | 8 - test/Driver/lib-search.test | 24 - test/Driver/so-whole-archive.test | 63 --- test/Driver/trivial-driver.test | 5 - test/Driver/undef-basic.objtxt | 22 - test/ELF/Inputs/aarch64-copy2.s | 5 + test/ELF/Inputs/aarch64-tls-gdie.s | 4 + test/ELF/Inputs/abs-hidden.s | 3 + test/ELF/Inputs/allow-shlib-undefined.s | 2 +- test/ELF/Inputs/archive.s | 4 +- test/ELF/Inputs/arm-plt-reloc.s | 14 + test/ELF/Inputs/arm-thumb-blx-targets.s | 36 ++ test/ELF/Inputs/arm-thumb-narrow-branch.s | 18 + test/ELF/Inputs/conflict.s | 7 + test/ELF/Inputs/copy-in-shared.s | 4 + test/ELF/Inputs/copy-rel-corrupted.s | 4 + test/ELF/Inputs/copy-rel-pie.s | 9 + test/ELF/Inputs/ctors_dtors_priority1.s | 5 + test/ELF/Inputs/ctors_dtors_priority2.s | 5 + test/ELF/Inputs/ctors_dtors_priority3.s | 5 + test/ELF/Inputs/duplicated-plt-entry.s | 3 + test/ELF/Inputs/dynamic-reloc-weak.s | 11 + test/ELF/Inputs/ehframe-relocation.s | 2 + test/ELF/Inputs/empty-ver.ver | 2 + test/ELF/Inputs/far-arm-abs.s | 13 + test/ELF/Inputs/far-arm-thumb-abs.s | 24 + test/ELF/Inputs/gc-sections-weak.s | 8 + test/ELF/Inputs/gnu-ifunc-gotpcrel.s | 4 + test/ELF/Inputs/gotpc-relax-und-dso.s | 4 + test/ELF/Inputs/icf2.s | 5 + test/ELF/Inputs/invalid-cie-version2.elf | Bin 0 -> 1128 bytes test/ELF/Inputs/libsearch-dyn.s | 2 +- test/ELF/Inputs/libsearch-st.s | 2 +- test/ELF/Inputs/mips-align-err.s | 2 + test/ELF/Inputs/mips-dynamic.s | 24 + test/ELF/Inputs/mips-gp-disp.so | Bin 131832 -> 131828 bytes test/ELF/Inputs/mips-nonalloc.s | 2 + test/ELF/Inputs/mips-pic.s | 19 + test/ELF/Inputs/mips-tls.s | 5 + test/ELF/Inputs/plt-aarch64.s | 5 + test/ELF/Inputs/ppc64-addr16-error.s | 3 + test/ELF/Inputs/protected-shared.s | 10 + test/ELF/Inputs/relocatable-ehframe.s | 14 + test/ELF/Inputs/relocatable.s | 22 + test/ELF/Inputs/relocatable2.s | 22 + test/ELF/Inputs/relocation-copy-alias.s | 25 + test/ELF/Inputs/relocation-copy-arm.s | 22 + test/ELF/Inputs/resolution-shared.s | 2 + test/ELF/Inputs/shared.s | 4 + test/ELF/Inputs/start-lib-comdat.s | 5 + test/ELF/Inputs/start-lib1.s | 3 + test/ELF/Inputs/start-lib2.s | 2 + test/ELF/Inputs/symbol-override.s | 16 + test/ELF/Inputs/tls-got-entry.s | 13 + test/ELF/Inputs/tls-in-archive.s | 3 + test/ELF/Inputs/trace-ar1.s | 2 + test/ELF/Inputs/trace-ar2.s | 2 + test/ELF/Inputs/trace-symbols-foo-strong.s | 14 + test/ELF/Inputs/trace-symbols-foo-weak.s | 12 + test/ELF/Inputs/undef-with-plt-addr.s | 7 + test/ELF/Inputs/undef.s | 3 + test/ELF/Inputs/unresolved-symbols.s | 3 + test/ELF/Inputs/verdef-defaultver.s | 22 + test/ELF/Inputs/verdef.s | 6 + test/ELF/Inputs/verneed.so.sh | 58 ++ test/ELF/Inputs/version-script-err.script | 4 + test/ELF/Inputs/version-use.script | 6 + test/ELF/Inputs/visibility.s | 1 + test/ELF/Inputs/warn-common.s | 2 + test/ELF/Inputs/warn-common2.s | 8 + test/ELF/Inputs/whole-archive.s | 2 +- test/ELF/Inputs/x86-64-relax-offset.s | 7 + test/ELF/Inputs/x86-64-reloc-error.s | 7 + test/ELF/Inputs/x86-64-tls-gd-got.s | 6 + test/ELF/aarch64-abs64-dyn.s | 27 + test/ELF/aarch64-copy.s | 38 +- test/ELF/aarch64-copy2.s | 27 + test/ELF/aarch64-fpic-abs16.s | 2 +- test/ELF/aarch64-fpic-add_abs_lo12_nc.s | 2 +- test/ELF/aarch64-fpic-adr_prel_lo21.s | 2 +- test/ELF/aarch64-fpic-adr_prel_pg_hi21.s | 2 +- test/ELF/aarch64-fpic-got.s | 18 + test/ELF/aarch64-fpic-ldst32_abs_lo12_nc.s | 2 +- test/ELF/aarch64-fpic-ldst64_abs_lo12_nc.s | 2 +- test/ELF/aarch64-fpic-ldst8_abs_lo12_nc.s | 2 +- test/ELF/aarch64-fpic-prel16.s | 2 +- test/ELF/aarch64-fpic-prel32.s | 2 +- test/ELF/aarch64-fpic-prel64.s | 2 +- test/ELF/aarch64-gnu-ifunc-nosym.s | 6 +- test/ELF/aarch64-gnu-ifunc.s | 16 +- test/ELF/aarch64-got-relocations.s | 21 + test/ELF/aarch64-got.s | 18 + test/ELF/aarch64-relative.s | 26 + test/ELF/aarch64-relocs.s | 30 + test/ELF/aarch64-tls-gdie.s | 34 ++ test/ELF/aarch64-tls-gdle.s | 26 + test/ELF/aarch64-tls-ie.s | 3 +- test/ELF/aarch64-tls-iele.s | 33 ++ test/ELF/aarch64-tls-le.s | 31 + test/ELF/aarch64-tls-pie.s | 28 + test/ELF/aarch64-tls-static.s | 37 ++ test/ELF/aarch64-tlsdesc.s | 24 + test/ELF/abs-hidden.s | 46 ++ test/ELF/allow-shlib-undefined.s | 2 +- test/ELF/amdgpu-entry.s | 2 +- test/ELF/amdgpu-globals.s | 20 +- test/ELF/amdgpu-kernels.s | 10 +- test/ELF/amdgpu-relocs.s | 33 ++ test/ELF/archive.s | 4 + test/ELF/arm-abs32-dyn.s | 32 ++ test/ELF/arm-attributes-remove.s | 45 ++ test/ELF/arm-blx.s | 113 ++++ test/ELF/arm-branch-error.s | 19 + test/ELF/arm-branch.s | 59 ++ test/ELF/arm-copy.s | 81 +++ test/ELF/arm-data-prel.s | 63 +++ test/ELF/arm-data-relocs.s | 20 + test/ELF/arm-fpic-got.s | 63 +++ test/ELF/arm-gnu-ifunc-nosym.s | 27 + test/ELF/arm-gnu-ifunc.s | 131 +++++ test/ELF/arm-got-relative.s | 53 ++ test/ELF/arm-gotoff.s | 74 +++ test/ELF/arm-mov-relocs.s | 94 ++++ test/ELF/arm-plt-reloc.s | 90 +++ test/ELF/arm-thumb-blx.s | 85 +++ test/ELF/arm-thumb-branch-error.s | 19 + test/ELF/arm-thumb-branch.s | 59 ++ test/ELF/arm-thumb-interwork-thunk.s | 375 +++++++++++++ test/ELF/arm-thumb-narrow-branch-check.s | 72 +++ test/ELF/arm-thumb-plt-reloc.s | 101 ++++ test/ELF/as-needed-no-reloc.s | 23 + test/ELF/as-needed.s | 5 +- test/ELF/avoid-empty-program-headers.s | 78 +++ test/ELF/basic-aarch64.s | 2 +- test/ELF/basic-mips.s | 99 ++-- test/ELF/basic-ppc.s | 13 +- test/ELF/basic.s | 22 +- test/ELF/basic32.s | 4 +- test/ELF/basic64be.s | 76 ++- test/ELF/bsymbolic-undef.s | 26 + test/ELF/bsymbolic.s | 34 ++ test/ELF/build-id.s | 38 ++ test/ELF/combrelocs.s | 92 +++ test/ELF/comdat.s | 11 + test/ELF/common.s | 3 + test/ELF/compressed-debug-input.s | 61 ++ test/ELF/conflict.s | 26 + test/ELF/copy-errors.s | 15 + test/ELF/copy-in-shared.s | 10 + test/ELF/copy-rel-corrupted.s | 10 + test/ELF/copy-rel-pie-error.s | 12 + test/ELF/copy-rel-pie.s | 44 ++ test/ELF/ctors_dtors_priority.s | 41 ++ test/ELF/default-output.s | 2 +- test/ELF/discard-merge-locals.s | 11 + test/ELF/discard-merge-unnamed.s | 11 + test/ELF/discard-none.s | 2 +- test/ELF/dont-export-hidden.s | 39 ++ test/ELF/driver.test | 49 ++ test/ELF/duplicate-internal.s | 2 +- test/ELF/duplicated-plt-entry.s | 17 + test/ELF/dynamic-list.s | 110 ++++ test/ELF/dynamic-reloc-in-ro.s | 8 + test/ELF/dynamic-reloc-weak.s | 14 +- test/ELF/dynamic-reloc.s | 2 +- test/ELF/dynamic.s | 44 ++ test/ELF/dynsym-pie.s | 36 ++ test/ELF/edata-etext.s | 117 ++++ test/ELF/eh-frame-dyn-rel.s | 10 + test/ELF/eh-frame-gc.s | 20 + test/ELF/eh-frame-hdr-abs-fde.s | 33 ++ test/ELF/eh-frame-hdr-augmentation.s | 38 ++ test/ELF/eh-frame-hdr-icf.s | 27 + test/ELF/eh-frame-hdr-no-out.s | 6 + test/ELF/eh-frame-hdr-no-out2.s | 19 + test/ELF/eh-frame-hdr.s | 127 +++++ test/ELF/eh-frame-marker.s | 6 + test/ELF/eh-frame-merge.s | 2 +- test/ELF/eh-frame-multilpe-cie.s | 12 + test/ELF/eh-frame-type.test | 5 +- test/ELF/ehframe-relocation.s | 8 +- test/ELF/empty-ver.s | 25 + test/ELF/emulation.s | 118 +++- test/ELF/end.s | 8 +- test/ELF/entry.s | 4 +- test/ELF/fatal-warnings.s | 16 + test/ELF/file-sym.s | 12 + test/ELF/gc-merge-local-sym.s | 34 ++ test/ELF/gc-sections-eh.s | 13 + test/ELF/gc-sections-local-sym.s | 57 ++ test/ELF/gc-sections-lsda.s | 21 + test/ELF/gc-sections-merge-addend.s | 39 ++ test/ELF/gc-sections-merge-implicit-addend.s | 39 ++ test/ELF/gc-sections-merge.s | 61 ++ test/ELF/gc-sections-protected.s | 18 + test/ELF/gc-sections-shared.s | 34 ++ test/ELF/gc-sections-weak.s | 24 + test/ELF/global_offset_table_shared.s | 9 + test/ELF/gnu-ifunc-gotpcrel.s | 14 + test/ELF/gnu-ifunc-i386.s | 16 +- test/ELF/gnu-ifunc-nosym-i386.s | 6 +- test/ELF/gnu-ifunc-nosym.s | 6 +- test/ELF/gnu-ifunc-relative.s | 23 + test/ELF/gnu-ifunc.s | 18 +- test/ELF/gnu-unique.s | 33 +- test/ELF/got-plt-header.s | 30 + test/ELF/gotpc-relax-nopic.s | 81 +++ test/ELF/gotpc-relax-und-dso.s | 72 +++ test/ELF/gotpc-relax.s | 98 ++++ test/ELF/gotpcrelx.s | 30 + test/ELF/i386-got-and-copy.s | 25 + test/ELF/i386-gotpc.s | 20 + test/ELF/i386-merge.s | 50 ++ test/ELF/i386-relative.s | 14 + test/ELF/i386-relax-reloc.s | 12 + test/ELF/i386-tls-ie-shared.s | 110 ++++ test/ELF/icf1.s | 23 + test/ELF/icf2.s | 17 + test/ELF/icf3.s | 19 + test/ELF/icf4.s | 19 + test/ELF/icf5.s | 19 + test/ELF/icf6.s | 23 + test/ELF/icf7.s | 29 + test/ELF/image-base.s | 60 ++ test/ELF/incompatible.s | 1 + test/ELF/init-fini.s | 2 +- test/ELF/init_fini_priority.s | 37 ++ test/ELF/invalid-cie-length.s | 2 +- test/ELF/invalid-cie-length3.s | 2 +- test/ELF/invalid-cie-length4.s | 2 +- test/ELF/invalid-cie-length5.s | 2 +- test/ELF/invalid-cie-reference.s | 2 +- test/ELF/invalid-dynamic-list.test | 37 ++ test/ELF/invalid-elf.test | 13 +- test/ELF/invalid-linkerscript.test | 54 ++ test/ELF/invalid-relocations.test | 5 +- test/ELF/libsearch.s | 12 +- test/ELF/linkerscript-align.s | 41 ++ test/ELF/linkerscript-diagnostic.s | 66 +++ test/ELF/linkerscript-locationcounter.s | 340 +++++++++++ test/ELF/linkerscript-orphans.s | 31 + test/ELF/linkerscript-phdr-check.s | 15 + test/ELF/linkerscript-repsection-va.s | 24 + test/ELF/linkerscript-sections-keep.s | 80 +++ test/ELF/linkerscript-sections-padding.s | 44 ++ test/ELF/linkerscript-sections.s | 10 +- test/ELF/linkerscript-symbol-conflict.s | 11 + test/ELF/linkerscript-symbols.s | 11 + test/ELF/linkerscript-va.s | 24 + test/ELF/linkerscript.s | 38 +- test/ELF/linkerscript2.s | 8 +- test/ELF/lit.local.cfg | 2 +- test/ELF/llvm33-rela-outside-group.s | 11 + test/ELF/local-dynamic.s | 11 + test/ELF/local-got-pie.s | 36 ++ test/ELF/local-undefined-symbol.s | 13 + test/ELF/lto/Inputs/archive-2.ll | 6 + test/ELF/lto/Inputs/archive-3.ll | 5 + test/ELF/lto/Inputs/archive.ll | 6 + test/ELF/lto/Inputs/available-externally.ll | 6 + test/ELF/lto/Inputs/comdat.s | 5 + test/ELF/lto/Inputs/common.s | 1 + test/ELF/lto/Inputs/drop-debug-info.bc | Bin 0 -> 1152 bytes test/ELF/lto/Inputs/drop-linkage.ll | 12 + test/ELF/lto/Inputs/dynsym.s | 3 + test/ELF/lto/Inputs/internalize-exportdyn.ll | 6 + test/ELF/lto/Inputs/internalize-undef.ll | 6 + test/ELF/lto/Inputs/irmover-error.ll | 6 + test/ELF/lto/Inputs/linkonce-odr.ll | 6 + test/ELF/lto/Inputs/linkonce.ll | 6 + test/ELF/lto/Inputs/resolution.s | 4 + test/ELF/lto/Inputs/save-temps.ll | 6 + test/ELF/lto/Inputs/shared.s | 7 + test/ELF/lto/Inputs/start-lib1.ll | 8 + test/ELF/lto/Inputs/start-lib2.ll | 6 + test/ELF/lto/Inputs/tls-mixed.s | 4 + test/ELF/lto/Inputs/type-merge.ll | 8 + test/ELF/lto/Inputs/type-merge2.ll | 8 + test/ELF/lto/Inputs/undef-mixed.s | 3 + test/ELF/lto/Inputs/unnamed-addr-lib.s | 6 + test/ELF/lto/Inputs/visibility.s | 8 + test/ELF/lto/archive-2.ll | 28 + test/ELF/lto/archive-3.ll | 19 + test/ELF/lto/archive.ll | 37 ++ test/ELF/lto/asmundef.ll | 25 + test/ELF/lto/available-externally.ll | 22 + test/ELF/lto/combined-lto-object-name.ll | 14 + test/ELF/lto/comdat.ll | 21 + test/ELF/lto/comdat2.ll | 40 ++ test/ELF/lto/common.ll | 31 + test/ELF/lto/common2.ll | 24 + test/ELF/lto/ctors.ll | 18 + test/ELF/lto/discard-value-names.ll | 23 + test/ELF/lto/drop-debug-info.ll | 9 + test/ELF/lto/drop-linkage.ll | 14 + test/ELF/lto/duplicated.ll | 10 + test/ELF/lto/dynamic-list.ll | 25 + test/ELF/lto/dynsym.ll | 25 + test/ELF/lto/inline-asm.ll | 11 + test/ELF/lto/internalize-basic.ll | 21 + test/ELF/lto/internalize-exportdyn.ll | 47 ++ test/ELF/lto/internalize-llvmused.ll | 20 + test/ELF/lto/internalize-undef.ll | 16 + test/ELF/lto/internalize-version-script.ll | 22 + test/ELF/lto/invalid-bitcode.ll | 12 + test/ELF/lto/irmover-error.ll | 12 + test/ELF/lto/linkage.ll | 20 + test/ELF/lto/linkonce-odr.ll | 17 + test/ELF/lto/linkonce.ll | 17 + test/ELF/lto/lto-start.ll | 23 + test/ELF/lto/ltopasses-basic.ll | 18 + test/ELF/lto/ltopasses-custom.ll | 30 + test/ELF/lto/metadata.ll | 13 + test/ELF/lto/mix-platforms.ll | 10 + test/ELF/lto/module-asm.ll | 19 + test/ELF/lto/opt-level.ll | 29 + test/ELF/lto/parallel-internalize.ll | 57 ++ test/ELF/lto/parallel.ll | 24 + test/ELF/lto/pic.ll | 20 + test/ELF/lto/relax-relocs.ll | 15 + test/ELF/lto/resolution.ll | 27 + test/ELF/lto/save-temps.ll | 20 + test/ELF/lto/shlib-undefined.ll | 27 + test/ELF/lto/start-lib.ll | 27 + test/ELF/lto/tls-mixed.ll | 10 + test/ELF/lto/tls-preserve.ll | 25 + test/ELF/lto/type-merge.ll | 26 + test/ELF/lto/type-merge2.ll | 27 + test/ELF/lto/undef-mixed.ll | 22 + test/ELF/lto/undef-weak.ll | 29 + test/ELF/lto/undef.ll | 20 + test/ELF/lto/undefined-puts.ll | 28 + test/ELF/lto/unnamed-addr-comdat.ll | 11 + test/ELF/lto/unnamed-addr-lib.ll | 21 + test/ELF/lto/unnamed-addr.ll | 14 + test/ELF/lto/verify-invalid.ll | 17 + test/ELF/lto/version-script.ll | 50 ++ test/ELF/lto/visibility.ll | 35 ++ test/ELF/lto/weak.ll | 16 + test/ELF/merge-shared-str.s | 28 + test/ELF/merge-shared.s | 2 +- test/ELF/merge-string-align.s | 25 +- test/ELF/merge-string-error.s | 4 +- test/ELF/merge-string-no-null.s | 2 +- test/ELF/merge-string.s | 26 +- test/ELF/merge.s | 6 +- test/ELF/mips-26.s | 95 ++++ test/ELF/mips-32.s | 78 +++ test/ELF/mips-64-disp.s | 89 +++ test/ELF/mips-64-got.s | 87 +++ test/ELF/mips-64-gprel-so.s | 23 + test/ELF/mips-64-rels.s | 46 ++ test/ELF/mips-64.s | 63 +++ test/ELF/mips-align-err.s | 12 + test/ELF/mips-dynamic.s | 19 +- test/ELF/mips-gnu-hash.s | 2 +- test/ELF/mips-got-and-copy.s | 57 ++ test/ELF/mips-got-extsym.s | 59 ++ test/ELF/mips-got-redundant.s | 58 ++ test/ELF/mips-got-relocs.s | 5 +- test/ELF/mips-got-weak.s | 172 ++++++ test/ELF/mips-got16.s | 120 ++++ test/ELF/mips-gp-disp.s | 9 +- test/ELF/mips-gp-local.s | 20 + test/ELF/mips-gprel32-relocs-gp0.test | 31 + test/ELF/mips-gprel32-relocs.s | 2 +- test/ELF/mips-hilo-gp-disp.s | 21 +- test/ELF/mips-hilo-hi-only.s | 2 +- test/ELF/mips-hilo.s | 10 +- test/ELF/mips-jalr.test | 7 +- test/ELF/mips-lo16-not-relative.s | 23 + test/ELF/mips-nonalloc.s | 21 + test/ELF/mips-npic-call-pic.s | 144 +++++ test/ELF/mips-options-r.test | 19 + test/ELF/mips-options.s | 28 + test/ELF/mips-pc-relocs.s | 15 +- test/ELF/mips-plt-copy.s | 85 +++ test/ELF/mips-relocs.s | 42 -- test/ELF/mips-sto-plt.s | 66 +++ test/ELF/mips-tls-64.s | 86 +++ test/ELF/mips-tls-hilo.s | 52 ++ test/ELF/mips-tls.s | 77 +++ test/ELF/no-augmentation.s | 19 + test/ELF/no-inhibit-exec.s | 4 +- test/ELF/no-plt-shared.s | 17 + test/ELF/no-undefined.s | 2 +- test/ELF/noplt-pie.s | 21 + test/ELF/note.s | 18 + test/ELF/phdr-align.s | 82 +++ test/ELF/pie-weak.s | 16 + test/ELF/pie.s | 102 ++++ test/ELF/plt-aarch64.s | 2 +- test/ELF/plt-i686.s | 20 +- test/ELF/plt.s | 2 +- test/ELF/ppc64-addr16-error.s | 5 +- test/ELF/ppc64-relocs.s | 4 +- test/ELF/ppc64-toc-restore.s | 4 +- test/ELF/pre_init_fini_array.s | 24 +- test/ELF/progname.s | 21 +- test/ELF/protected-shared.s | 52 ++ test/ELF/rel-offset.s | 15 + test/ELF/relative-dynamic-reloc-pie.s | 26 + test/ELF/relative-dynamic-reloc-ppc64.s | 7 +- test/ELF/relative-dynamic-reloc.s | 7 +- test/ELF/relocatable-bss.s | 40 ++ test/ELF/relocatable-ehframe.s | 51 ++ test/ELF/relocatable-reloc.s | 14 + test/ELF/relocatable-symbols.s | 183 ++++++ test/ELF/relocatable.s | 121 +++- test/ELF/relocation-copy-alias.s | 67 +++ test/ELF/relocation-copy-flags.s | 73 +++ test/ELF/relocation-copy-i686.s | 2 +- test/ELF/relocation-copy.s | 2 +- test/ELF/relocation-i686.s | 24 +- test/ELF/relocation-in-merge.s | 2 +- test/ELF/relocation-non-alloc.s | 60 ++ test/ELF/relocation-past-merge-end.s | 3 +- test/ELF/relocation-relative-absolute.s | 12 + test/ELF/relocation-relative-synthetic.s | 11 + test/ELF/relocation-relative-weak.s | 14 + test/ELF/relocation-shared.s | 35 ++ test/ELF/relocation-size-shared.s | 76 +-- test/ELF/relocation-size.s | 138 ++--- test/ELF/relocation.s | 21 +- test/ELF/relro-tls.s | 23 + test/ELF/relro.s | 2 +- test/ELF/reproduce-error.s | 15 + test/ELF/reproduce-linkerscript.s | 17 + test/ELF/reproduce-thin-archive.s | 15 + test/ELF/reproduce-windows.s | 12 + test/ELF/reproduce.s | 67 +++ test/ELF/resolution-shared.s | 15 + test/ELF/resolution.s | 2 +- test/ELF/section-align-0.test | 3 +- test/ELF/section-name.s | 6 + test/ELF/section-symbol.s | 13 +- test/ELF/shared-be.s | 7 +- test/ELF/shared.s | 19 +- test/ELF/soname.s | 2 +- test/ELF/splitstacks.s | 11 + test/ELF/start-lib-comdat.s | 23 + test/ELF/start-lib.s | 25 + test/ELF/startstop-gccollect.s | 32 ++ test/ELF/startstop-shared.s | 20 +- test/ELF/startstop.s | 16 +- test/ELF/string-gc.s | 73 +++ test/ELF/string-table.s | 5 +- test/ELF/strip-all.s | 6 +- test/ELF/strip-debug.s | 25 + test/ELF/symbol-override.s | 46 ++ test/ELF/symbols.s | 14 +- test/ELF/sysroot.s | 4 +- test/ELF/tail-merge-string-align.s | 35 ++ test/ELF/tls-archive.s | 10 + test/ELF/tls-dynamic-i686.s | 24 +- test/ELF/tls-dynamic.s | 10 +- test/ELF/tls-got-entry.s | 25 + test/ELF/tls-got.s | 2 +- test/ELF/tls-i686.s | 54 +- test/ELF/tls-in-archive.s | 11 + test/ELF/tls-initial-exec-local.s | 36 ++ test/ELF/tls-offset.s | 56 ++ test/ELF/tls-opt-gdie.s | 27 +- test/ELF/tls-opt-iele-i686-nopic.s | 59 -- test/ELF/tls-opt-no-plt.s | 34 ++ test/ELF/tls-opt.s | 74 +-- test/ELF/tls-two-relocs.s | 30 + test/ELF/trace-ar.s | 21 + test/ELF/trace-symbols.s | 78 +++ test/ELF/trace.s | 9 + test/ELF/undef-shared.s | 14 + test/ELF/undef-version-script.s | 40 ++ test/ELF/undef-with-plt-addr-i686.s | 23 + test/ELF/undef-with-plt-addr.s | 45 ++ test/ELF/undef.s | 15 +- test/ELF/undefined-opt.s | 13 +- test/ELF/unresolved-symbols.s | 63 +++ test/ELF/user_def_init_array_start.s | 10 + test/ELF/valid-cie-length-dw64.s | 13 - test/ELF/verdef-defaultver.s | 205 +++++++ test/ELF/verdef-dependency.s | 44 ++ test/ELF/verdef.s | 117 ++++ test/ELF/verneed-as-needed-weak.s | 14 + test/ELF/verneed-local.s | 8 + test/ELF/verneed.s | 173 ++++++ test/ELF/version-script-err.s | 10 + test/ELF/version-script-extern.s | 97 ++++ test/ELF/version-script-noundef.s | 22 + test/ELF/version-script.s | 274 +++++++++ test/ELF/version-undef-sym.s | 42 ++ test/ELF/version-use.s | 9 + test/ELF/version-wildcard.test | 114 ++++ test/ELF/visibility.s | 31 +- test/ELF/warn-common.s | 25 + test/ELF/weak-undef-hidden.s | 29 + test/ELF/weak-undef-shared.s | 19 + test/ELF/weak-undef.s | 21 + test/ELF/whole-archive.s | 8 +- test/ELF/wildcards.s | 80 +++ test/ELF/writable-merge.s | 4 +- test/ELF/x86-64-dyn-rel-error.s | 12 + test/ELF/x86-64-dyn-rel-error2.s | 12 + test/ELF/x86-64-rela.s | 11 + test/ELF/x86-64-relax-offset.s | 13 + test/ELF/x86-64-reloc-32-error.s | 8 - test/ELF/x86-64-reloc-32-fpic.s | 7 + test/ELF/x86-64-reloc-32S-error.s | 7 - test/ELF/x86-64-reloc-error.s | 10 + test/ELF/x86-64-reloc-pc32-fpic.s | 7 + test/ELF/x86-64-reloc-range.s | 13 + test/ELF/x86-64-tls-gd-got.s | 19 + test/ELF/x86-64-tls-gd-local.s | 52 ++ test/ELF/x86-64-tls-pie.s | 26 + test/ELF/zdefs.s | 7 + test/LinkerScript/expr-precedence.test | 34 -- test/LinkerScript/extern-bad-symbol.test | 22 - test/LinkerScript/extern-empty.test | 19 - test/LinkerScript/extern-valid.test | 29 - test/LinkerScript/incomplete-ternary.test | 25 - test/LinkerScript/libname-err-1.test | 11 - test/LinkerScript/libname-err-2.test | 11 - test/LinkerScript/linker-script-outputformat.test | 12 - test/LinkerScript/linker-script.test | 46 -- test/LinkerScript/memory-empty.test | 17 - test/LinkerScript/memory-missing-attrs.test | 32 -- test/LinkerScript/memory-missing-length.test | 29 - test/LinkerScript/memory-missing-name.test | 31 - test/LinkerScript/memory-missing-origin.test | 30 - test/LinkerScript/memory-valid.test | 56 -- test/LinkerScript/missing-entry-symbol.test | 21 - test/LinkerScript/missing-input-file-name.test | 25 - test/LinkerScript/missing-input-sections.test | 27 - test/LinkerScript/missing-operand.test | 24 - test/LinkerScript/missing-output-section-name.test | 25 - test/LinkerScript/missing-symbol.test | 24 - test/LinkerScript/phdrs-sections.test | 29 - test/LinkerScript/sections.test | 624 --------------------- test/Unit/lit.site.cfg.in | 4 +- test/core/Inputs/archive-basic.objtxt | 21 - test/core/Inputs/archive-chain.objtxt | 24 - test/core/Inputs/archive-chain2.objtxt | 21 - test/core/Inputs/archive-tentdef-search.objtxt | 11 - test/core/Inputs/associates.objtxt | 8 - test/core/Inputs/auto-hide-coalesce.objtxt | 20 - test/core/Inputs/code-model-attributes.objtxt | 4 - test/core/Inputs/code-model-attributes2.objtxt | 4 - test/core/Inputs/code-model-attributes3.objtxt | 4 - test/core/Inputs/code-model-attributes4.objtxt | 4 - test/core/Inputs/code-model-attributes5.objtxt | 4 - test/core/Inputs/constants-coalesce.objtxt | 9 - test/core/Inputs/constants-coalesce2.objtxt | 10 - test/core/Inputs/cstring-coalesce.objtxt | 6 - test/core/Inputs/cstring-coalesce2.objtxt | 6 - test/core/Inputs/custom-section-coalesce.objtxt | 15 - test/core/Inputs/custom-section-coalesce2.objtxt | 13 - test/core/Inputs/dead-strip-attributes.objtxt | 4 - test/core/Inputs/dead-strip-attributes2.objtxt | 4 - test/core/Inputs/dead-strip-basic.objtxt | 9 - test/core/Inputs/dead-strip-basic2.objtxt | 8 - test/core/Inputs/dead-strip-globals.objtxt | 9 - test/core/Inputs/dead-strip-globals2.objtxt | 8 - test/core/Inputs/error-duplicate-absolutes.objtxt | 5 - .../Inputs/gnulinkonce-rearrange-resolve.objtxt | 26 - .../core/Inputs/gnulinkonce-remaining-undef.objtxt | 34 -- .../Inputs/gnulinkonce-remaining-undef2.objtxt | 4 - test/core/Inputs/gnulinkonce-resolve.objtxt | 25 - test/core/Inputs/gnulinkonce-simple.objtxt | 4 - test/core/Inputs/inline-coalesce.objtxt | 6 - test/core/Inputs/inline-coalesce2.objtxt | 6 - test/core/Inputs/multiple-def-error.objtxt | 5 - test/core/Inputs/sectiongroup-deadstrip.objtxt | 3 - .../Inputs/sectiongroup-gnulinkonce-error.objtxt | 26 - .../Inputs/sectiongroup-rearrange-resolve.objtxt | 25 - .../Inputs/sectiongroup-remaining-undef.objtxt | 34 -- .../Inputs/sectiongroup-remaining-undef2.objtxt | 4 - test/core/Inputs/sectiongroup-resolve.objtxt | 26 - test/core/Inputs/sectiongroup-simple.objtxt | 4 - test/core/Inputs/shared-library-coalesce.objtxt | 28 - test/core/Inputs/tent-merge.objtxt | 6 - test/core/Inputs/undef-coalesce-error.objtxt | 8 - test/core/Inputs/undef-coalesce-error2.objtxt | 8 - test/core/Inputs/undef-coalesce.objtxt | 8 - test/core/Inputs/undef-coalesce2.objtxt | 8 - test/core/Inputs/undef-fallback.objtxt | 7 - test/core/Inputs/undef-weak-coalesce.objtxt | 20 - test/core/Inputs/weak-coalesce.objtxt | 5 - test/core/Inputs/weak-coalesce2.objtxt | 6 - test/core/absolute-basic.objtxt | 23 - test/core/absolute-local.objtxt | 25 - test/core/archive-basic.objtxt | 23 - test/core/archive-chain.objtxt | 23 - test/core/archive-tentdef-search.objtxt | 30 - test/core/associates.objtxt | 21 - test/core/auto-hide-coalesce.objtxt | 39 -- test/core/code-model-attributes.objtxt | 33 -- test/core/constants-coalesce.objtxt | 42 -- test/core/cstring-coalesce.objtxt | 29 - test/core/custom-section-coalesce.objtxt | 50 -- test/core/custom-section.objtxt | 34 -- test/core/dead-strip-attributes.objtxt | 22 - test/core/dead-strip-basic.objtxt | 45 -- test/core/dead-strip-globals.objtxt | 43 -- test/core/dead-strip-reverse.objtxt | 25 - test/core/error-atom-attribute.objtxt | 19 - test/core/error-atom-content-byte-value.objtxt | 18 - test/core/error-atom-content-bytes.objtxt | 19 - test/core/error-atom-type.objtxt | 19 - .../error-atom-undefined-wrong-attribue.objtxt | 17 - test/core/error-duplicate-absolutes.objtxt | 19 - test/core/error-file-attribute.objtxt | 17 - test/core/error-fixup-attribute.objtxt | 21 - test/core/error-fixup-target.objtxt | 26 - test/core/fixups-addend.objtxt | 50 -- test/core/fixups-dup-named.objtxt | 31 - test/core/fixups-named.objtxt | 36 -- test/core/fixups-unnamed.objtxt | 40 -- test/core/gnulinkonce-rearrange-resolve.objtxt | 53 -- test/core/gnulinkonce-remaining-undef.objtxt | 43 -- test/core/gnulinkonce-resolve.objtxt | 63 --- test/core/gnulinkonce-simple.objtxt | 76 --- test/core/inline-coalesce.objtxt | 19 - test/core/multiple-def-error.objtxt | 14 - test/core/permissions.objtxt | 57 -- test/core/sectiongroup-deadstrip.objtxt | 84 --- test/core/sectiongroup-gnulinkonce-error.objtxt | 38 -- test/core/sectiongroup-rearrange-resolve.objtxt | 53 -- test/core/sectiongroup-remaining-undef.objtxt | 42 -- test/core/sectiongroup-resolve.objtxt | 64 --- test/core/sectiongroup-simple.objtxt | 76 --- test/core/shared-library-basic.objtxt | 40 -- test/core/shared-library-coalesce.objtxt | 55 -- test/core/tent-merge.objtxt | 19 - test/core/undef-coalesce-error.objtxt | 31 - test/core/undef-coalesce.objtxt | 26 - test/core/undef-fallback.objtxt | 29 - test/core/undef-weak-coalesce.objtxt | 52 -- test/core/weak-coalesce.objtxt | 16 - test/darwin/cmdline-objc_gc.objtxt | 15 + test/darwin/cmdline-objc_gc_compaction.objtxt | 15 + test/darwin/cmdline-objc_gc_only.objtxt | 15 + test/lit.cfg | 13 +- test/lit.site.cfg.in | 5 +- .../Inputs/no-version-min-load-command-object.yaml | 22 + test/mach-o/Inputs/swift-version-1.yaml | 18 + test/mach-o/arm-interworking-movw.yaml | 6 +- .../mach-o/arm64-relocs-errors-delta64-offset.yaml | 2 +- test/mach-o/data-in-code-load-command.yaml | 35 ++ test/mach-o/dead-strip-globals.yaml | 27 + test/mach-o/dependency_info.yaml | 13 +- test/mach-o/do-not-emit-unwind-fde-arm64.yaml | 8 +- test/mach-o/dso_handle.yaml | 2 +- test/mach-o/eh-frame-relocs-arm64.yaml | 318 +++++++++++ test/mach-o/error-simulator-vs-macosx.yaml | 30 + test/mach-o/function-starts-load-command.yaml | 32 ++ test/mach-o/hello-world-x86_64.yaml | 5 +- test/mach-o/interposing-section.yaml | 2 +- test/mach-o/lazy-bind-x86_64.yaml | 11 + test/mach-o/mach_header-cpusubtype.yaml | 34 ++ test/mach-o/mh_bundle_header.yaml | 9 +- test/mach-o/mh_dylib_header.yaml | 2 +- test/mach-o/objc-category-list-atom.yaml | 70 +++ test/mach-o/objc-image-info-host-vs-simulator.yaml | 23 + test/mach-o/objc-image-info-invalid-size.yaml | 20 + test/mach-o/objc-image-info-invalid-version.yaml | 20 + .../objc-image-info-mismatched-swift-version.yaml | 20 + test/mach-o/objc-image-info-pass-output.yaml | 30 + test/mach-o/objc-image-info-simulator-vs-host.yaml | 23 + test/mach-o/objc-image-info-unsupported-gc.yaml | 20 + test/mach-o/objc_export_list.yaml | 2 +- test/mach-o/parse-cfstring32.yaml | 2 +- test/mach-o/parse-compact-unwind64.yaml | 2 +- test/mach-o/parse-data-relocs-x86_64.yaml | 126 +++-- test/mach-o/parse-data.yaml | 4 +- test/mach-o/parse-eh-frame.yaml | 2 +- test/mach-o/sdk-version-error.yaml | 22 + test/mach-o/sectattrs.yaml | 30 + test/mach-o/seg-protection-arm64.yaml | 78 +++ test/mach-o/seg-protection-x86_64.yaml | 78 +++ test/mach-o/source-version.yaml | 28 + test/mach-o/subsections-via-symbols-default.yaml | 28 + test/mach-o/unwind-info-simple-arm64.yaml | 2 +- test/mach-o/unwind-info-simple-x86_64.yaml | 4 - test/mach-o/version-min-load-command-object.yaml | 35 ++ test/mach-o/version-min-load-command.yaml | 43 ++ test/old-elf/AArch64/Inputs/fn.c | 4 - test/old-elf/AArch64/Inputs/fn.o | Bin 899 -> 0 bytes test/old-elf/AArch64/Inputs/general-dyn-tls-0.yaml | 64 --- test/old-elf/AArch64/Inputs/initfini-option.c | 12 - test/old-elf/AArch64/Inputs/initfini-option.o | Bin 1552 -> 0 bytes test/old-elf/AArch64/Inputs/initfini.c | 13 - test/old-elf/AArch64/Inputs/initfini.o | Bin 2056 -> 0 bytes .../old-elf/AArch64/Inputs/initial-exec-tls-1.yaml | 77 --- test/old-elf/AArch64/Inputs/main.c | 4 - test/old-elf/AArch64/Inputs/main.o | Bin 1064 -> 0 bytes test/old-elf/AArch64/Inputs/no-interp-section.c | 1 - test/old-elf/AArch64/Inputs/no-interp-section.o | Bin 903 -> 0 bytes test/old-elf/AArch64/Inputs/zerosizedsection.o | Bin 816 -> 0 bytes test/old-elf/AArch64/Inputs/zerosizedsection.s | 3 - test/old-elf/AArch64/defsym.test | 22 - .../AArch64/dontignorezerosize-sections.test | 9 - test/old-elf/AArch64/dynamicvars.test | 113 ---- test/old-elf/AArch64/dynlib-nointerp-section.test | 5 - test/old-elf/AArch64/general-dyn-tls-0.test | 103 ---- test/old-elf/AArch64/initfini.test | 23 - test/old-elf/AArch64/initial-exec-tls-0.test | 146 ----- test/old-elf/AArch64/local-tls.test | 184 ------ test/old-elf/AArch64/rel-abs16-overflow.test | 44 -- test/old-elf/AArch64/rel-abs16.test | 53 -- test/old-elf/AArch64/rel-abs32-overflow.test | 53 -- test/old-elf/AArch64/rel-abs32.test | 59 -- test/old-elf/AArch64/rel-abs64.test | 59 -- .../AArch64/rel-adr_prel_lo21-overflow.test | 45 -- test/old-elf/AArch64/rel-adr_prel_lo21.test | 51 -- .../AArch64/rel-adr_prel_pg_hi21-overflow.test | 45 -- test/old-elf/AArch64/rel-adr_prel_pg_hi21.test | 52 -- test/old-elf/AArch64/rel-bad.test | 44 -- test/old-elf/AArch64/rel-prel16-overflow.test | 53 -- test/old-elf/AArch64/rel-prel16.test | 59 -- test/old-elf/AArch64/rel-prel32-overflow.test | 53 -- test/old-elf/AArch64/rel-prel32.test | 59 -- test/old-elf/AArch64/rel-prel64.test | 59 -- test/old-elf/ARM/Inputs/fn.c | 1 - test/old-elf/ARM/Inputs/libfn.so | Bin 4972 -> 0 bytes test/old-elf/ARM/Inputs/libobj.so | Bin 5067 -> 0 bytes test/old-elf/ARM/Inputs/obj.c | 4 - test/old-elf/ARM/arm-symbols.test | 51 -- test/old-elf/ARM/defsym.test | 50 -- test/old-elf/ARM/dynamic-symbols.test | 83 --- test/old-elf/ARM/entry-point.test | 113 ---- test/old-elf/ARM/exidx.test | 254 --------- test/old-elf/ARM/header-flags.test | 57 -- test/old-elf/ARM/mapping-code-model.test | 160 ------ test/old-elf/ARM/mapping-symbols.test | 122 ---- test/old-elf/ARM/missing-symbol.test | 38 -- test/old-elf/ARM/plt-dynamic.test | 200 ------- test/old-elf/ARM/plt-ifunc-interwork.test | 396 ------------- test/old-elf/ARM/plt-ifunc-mapping.test | 109 ---- test/old-elf/ARM/rel-abs32.test | 58 -- test/old-elf/ARM/rel-arm-call.test | 112 ---- test/old-elf/ARM/rel-arm-jump24-veneer-b.test | 122 ---- test/old-elf/ARM/rel-arm-jump24-veneer-bl.test | 120 ---- test/old-elf/ARM/rel-arm-jump24.test | 108 ---- test/old-elf/ARM/rel-arm-mov.test | 64 --- test/old-elf/ARM/rel-arm-prel31.test | 90 --- test/old-elf/ARM/rel-arm-target1.test | 114 ---- test/old-elf/ARM/rel-arm-thm-interwork.test | 121 ---- test/old-elf/ARM/rel-base-prel.test | 61 -- test/old-elf/ARM/rel-copy.test | 60 -- test/old-elf/ARM/rel-glob-dat.test | 57 -- test/old-elf/ARM/rel-got-brel.test | 63 --- test/old-elf/ARM/rel-group-relocs.test | 71 --- test/old-elf/ARM/rel-ifunc.test | 101 ---- test/old-elf/ARM/rel-jump-slot.test | 50 -- test/old-elf/ARM/rel-rel32.test | 56 -- test/old-elf/ARM/rel-thm-call.test | 114 ---- test/old-elf/ARM/rel-thm-jump11.test | 209 ------- test/old-elf/ARM/rel-thm-jump24-veneer.test | 120 ---- test/old-elf/ARM/rel-thm-jump24.test | 110 ---- test/old-elf/ARM/rel-thm-mov.test | 70 --- test/old-elf/ARM/rel-tls-ie32.test | 125 ----- test/old-elf/ARM/rel-tls-le32.test | 73 --- test/old-elf/ARM/rel-v4bx.test | 72 --- test/old-elf/ARM/thm-symbols.test | 51 -- test/old-elf/ARM/two-got-for-symbol.test | 62 -- test/old-elf/ARM/undef-lazy-symbol.test | 133 ----- test/old-elf/ARM/veneer-mapping.test | 92 --- test/old-elf/ARM/weak-branch.test | 221 -------- test/old-elf/Hexagon/Inputs/dynobj-data.c | 3 - test/old-elf/Hexagon/Inputs/dynobj-data.o | Bin 916 -> 0 bytes test/old-elf/Hexagon/Inputs/dynobj.c | 26 - test/old-elf/Hexagon/Inputs/dynobj.o | Bin 1288 -> 0 bytes test/old-elf/Hexagon/Inputs/got-plt-order.c | 6 - test/old-elf/Hexagon/Inputs/got-plt-order.o | Bin 964 -> 0 bytes test/old-elf/Hexagon/Inputs/libMaxAlignment.a | Bin 1010 -> 0 bytes test/old-elf/Hexagon/Inputs/sda-base.o | Bin 1469 -> 0 bytes test/old-elf/Hexagon/Inputs/sdata1.c | 3 - test/old-elf/Hexagon/Inputs/sdata1.o | Bin 684 -> 0 bytes test/old-elf/Hexagon/Inputs/sdata2.c | 6 - test/old-elf/Hexagon/Inputs/sdata2.o | Bin 829 -> 0 bytes test/old-elf/Hexagon/Inputs/use-shared.hexagon | Bin 872 -> 0 bytes test/old-elf/Hexagon/dynlib-data.test | 9 - test/old-elf/Hexagon/dynlib-gotoff.test | 128 ----- test/old-elf/Hexagon/dynlib-hash.test | 9 - test/old-elf/Hexagon/dynlib-rela.test | 9 - test/old-elf/Hexagon/dynlib-syms.test | 7 - test/old-elf/Hexagon/dynlib.test | 36 -- test/old-elf/Hexagon/hexagon-got-plt-order.test | 5 - test/old-elf/Hexagon/hexagon-plt-setup.test | 12 - test/old-elf/Hexagon/maxalignment.test | 8 - test/old-elf/Hexagon/rela-order.test | 9 - test/old-elf/Hexagon/sda-base.test | 4 - test/old-elf/Hexagon/zerofillquick-sdata.test | 18 - test/old-elf/Inputs/abs-test.i386 | Bin 504 -> 0 bytes test/old-elf/Inputs/allowduplicates.objtxt | 12 - test/old-elf/Inputs/bar.o.x86-64 | Bin 1240 -> 0 bytes test/old-elf/Inputs/branch-test.hexagon | Bin 700 -> 0 bytes test/old-elf/Inputs/branch-test.ppc | Bin 852 -> 0 bytes test/old-elf/Inputs/consecutive-weak-defs.o.yaml | 65 --- test/old-elf/Inputs/constants-merge.x86-64 | Bin 1232 -> 0 bytes test/old-elf/Inputs/constdata.x86-64 | Bin 1688 -> 0 bytes test/old-elf/Inputs/foo.o.x86-64 | Bin 1240 -> 0 bytes test/old-elf/Inputs/globalconst.c | 2 - test/old-elf/Inputs/globalconst.o.x86-64 | Bin 1072 -> 0 bytes test/old-elf/Inputs/gotpcrel.S | 11 - test/old-elf/Inputs/gotpcrel.x86-64 | Bin 904 -> 0 bytes test/old-elf/Inputs/group-cmd-search-1.ls | 1 - test/old-elf/Inputs/group-cmd-search-2.ls | 1 - test/old-elf/Inputs/group-cmd-search-3.ls | 1 - test/old-elf/Inputs/ifunc.S | 21 - test/old-elf/Inputs/ifunc.cpp | 3 - test/old-elf/Inputs/ifunc.cpp.x86-64 | Bin 1224 -> 0 bytes test/old-elf/Inputs/ifunc.x86-64 | Bin 912 -> 0 bytes test/old-elf/Inputs/libfnarchive.a | Bin 2656 -> 0 bytes test/old-elf/Inputs/libifunc.x86-64.so | Bin 2512 -> 0 bytes test/old-elf/Inputs/libundef.so | Bin 11128 -> 0 bytes test/old-elf/Inputs/libweaksym.so | Bin 2160 -> 0 bytes test/old-elf/Inputs/main-with-global-def.o.yaml | 55 -- test/old-elf/Inputs/mainobj.x86_64 | Bin 1360 -> 0 bytes test/old-elf/Inputs/no-unique-section-names.x86-64 | Bin 2128 -> 0 bytes test/old-elf/Inputs/object-test.elf-hexagon | Bin 1532 -> 0 bytes test/old-elf/Inputs/object-test.elf-i386 | Bin 1784 -> 0 bytes test/old-elf/Inputs/phdr.i386 | Bin 17536 -> 0 bytes .../Inputs/quickdata-sort-test.o.elf-hexagon | Bin 1385 -> 0 bytes .../Inputs/quickdata-sortcommon-test.o.elf-hexagon | Bin 1469 -> 0 bytes test/old-elf/Inputs/quickdata-test.elf-hexagon | Bin 891 -> 0 bytes test/old-elf/Inputs/reloc-test.elf-i386 | Bin 1076 -> 0 bytes test/old-elf/Inputs/reloc-xb.x86 | Bin 568 -> 0 bytes test/old-elf/Inputs/reloc-xt.x86 | Bin 548 -> 0 bytes test/old-elf/Inputs/relocs-dynamic.x86-64 | Bin 864 -> 0 bytes test/old-elf/Inputs/relocs.x86-64 | Bin 1536 -> 0 bytes test/old-elf/Inputs/responsefile | 1 - test/old-elf/Inputs/rodata-test.hexagon | Bin 669 -> 0 bytes test/old-elf/Inputs/rodata-test.i386 | Bin 537 -> 0 bytes test/old-elf/Inputs/rodata.c | 4 - test/old-elf/Inputs/rodata.o | Bin 1568 -> 0 bytes test/old-elf/Inputs/section-test.i386 | Bin 717 -> 0 bytes test/old-elf/Inputs/shared.c | 16 - test/old-elf/Inputs/shared.so-x86-64 | Bin 7536 -> 0 bytes test/old-elf/Inputs/shndx.o-x86_64 | Bin 624 -> 0 bytes test/old-elf/Inputs/stripped-empty.x86_64 | Bin 416 -> 0 bytes test/old-elf/Inputs/target-test.hexagon | Bin 676 -> 0 bytes test/old-elf/Inputs/target-test.ppc | Bin 552 -> 0 bytes test/old-elf/Inputs/tls-tbss-size.yaml | 59 -- test/old-elf/Inputs/tls.S | 50 -- test/old-elf/Inputs/tls.c | 11 - test/old-elf/Inputs/tls.x86-64 | Bin 1424 -> 0 bytes test/old-elf/Inputs/tlsAddr.x86-64 | Bin 1752 -> 0 bytes test/old-elf/Inputs/tlsaddr.c | 8 - test/old-elf/Inputs/undef-from-main-so.c | 1 - test/old-elf/Inputs/undef-from-main.c | 5 - test/old-elf/Inputs/undef-pc32.o | Bin 1248 -> 0 bytes test/old-elf/Inputs/undef.o | Bin 1264 -> 0 bytes test/old-elf/Inputs/undef2-so.o.yaml | 49 -- test/old-elf/Inputs/use-shared-32s.c | 8 - test/old-elf/Inputs/use-shared-32s.x86-64 | Bin 1336 -> 0 bytes test/old-elf/Inputs/use-shared.c | 7 - test/old-elf/Inputs/use-shared.x86-64 | Bin 1376 -> 0 bytes test/old-elf/Inputs/weaksym.o | Bin 840 -> 0 bytes test/old-elf/Inputs/writersyms.o | Bin 868 -> 0 bytes test/old-elf/Inputs/x86-64-relocs.S | 12 - test/old-elf/Mips/abi-flags-01.test | 35 -- test/old-elf/Mips/abi-flags-02.test | 92 --- test/old-elf/Mips/abi-flags-03.test | 149 ----- test/old-elf/Mips/abi-flags-04.test | 125 ----- test/old-elf/Mips/abi-flags-05.test | 186 ------ test/old-elf/Mips/abi-flags-06.test | 79 --- test/old-elf/Mips/abi-flags-07.test | 60 -- test/old-elf/Mips/abi-flags-08.test | 71 --- test/old-elf/Mips/abi-flags-09.test | 67 --- test/old-elf/Mips/abi-flags-10.test | 60 -- test/old-elf/Mips/abi-flags-11.test | 59 -- test/old-elf/Mips/base-address-64.test | 80 --- test/old-elf/Mips/base-address.test | 95 ---- test/old-elf/Mips/ctors-order.test | 164 ------ test/old-elf/Mips/driver-hash-style.test | 15 - test/old-elf/Mips/dt-textrel-64.test | 74 --- test/old-elf/Mips/dt-textrel.test | 74 --- test/old-elf/Mips/dynamic-linking.test | 22 - test/old-elf/Mips/dynamic-sym.test | 41 -- test/old-elf/Mips/dynlib-dynamic.test | 110 ---- test/old-elf/Mips/dynlib-dynsym-micro.test | 208 ------- test/old-elf/Mips/dynlib-dynsym.test | 202 ------- test/old-elf/Mips/dynlib-fileheader-64.test | 72 --- test/old-elf/Mips/dynlib-fileheader-micro-64.test | 75 --- test/old-elf/Mips/dynlib-fileheader-micro.test | 79 --- test/old-elf/Mips/dynlib-fileheader.test | 76 --- test/old-elf/Mips/dynsym-table-1.test | 127 ----- test/old-elf/Mips/dynsym-table-2.test | 105 ---- test/old-elf/Mips/e-flags-merge-1-64.test | 30 - test/old-elf/Mips/e-flags-merge-1.test | 56 -- test/old-elf/Mips/e-flags-merge-10.test | 43 -- test/old-elf/Mips/e-flags-merge-11.test | 43 -- test/old-elf/Mips/e-flags-merge-12.test | 44 -- test/old-elf/Mips/e-flags-merge-2-64.test | 33 -- test/old-elf/Mips/e-flags-merge-2.test | 35 -- test/old-elf/Mips/e-flags-merge-3-64.test | 130 ----- test/old-elf/Mips/e-flags-merge-3.test | 134 ----- test/old-elf/Mips/e-flags-merge-4-64.test | 64 --- test/old-elf/Mips/e-flags-merge-4.test | 65 --- test/old-elf/Mips/e-flags-merge-5-64.test | 42 -- test/old-elf/Mips/e-flags-merge-5.test | 42 -- test/old-elf/Mips/e-flags-merge-6-64.test | 79 --- test/old-elf/Mips/e-flags-merge-6.test | 80 --- test/old-elf/Mips/e-flags-merge-7-64.test | 42 -- test/old-elf/Mips/e-flags-merge-7.test | 42 -- test/old-elf/Mips/e-flags-merge-8.test | 65 --- test/old-elf/Mips/e-flags-merge-9.test | 43 -- test/old-elf/Mips/entry-name.test | 26 - test/old-elf/Mips/exe-dynamic.test | 110 ---- test/old-elf/Mips/exe-dynsym-micro.test | 94 ---- test/old-elf/Mips/exe-dynsym.test | 91 --- test/old-elf/Mips/exe-fileheader-02.test | 62 -- test/old-elf/Mips/exe-fileheader-03.test | 72 --- test/old-elf/Mips/exe-fileheader-64.test | 66 --- test/old-elf/Mips/exe-fileheader-be-64.test | 60 -- test/old-elf/Mips/exe-fileheader-be.test | 60 -- test/old-elf/Mips/exe-fileheader-micro-64.test | 68 --- test/old-elf/Mips/exe-fileheader-micro.test | 69 --- test/old-elf/Mips/exe-fileheader-n32.test | 65 --- test/old-elf/Mips/exe-fileheader.test | 105 ---- test/old-elf/Mips/exe-got-micro.test | 115 ---- test/old-elf/Mips/exe-got.test | 116 ---- test/old-elf/Mips/got-page-32-micro.test | 251 --------- test/old-elf/Mips/got-page-32.test | 244 -------- test/old-elf/Mips/got-page-64-micro.test | 210 ------- test/old-elf/Mips/got-page-64.test | 203 ------- test/old-elf/Mips/got16-2.test | 73 --- test/old-elf/Mips/got16-micro.test | 165 ------ test/old-elf/Mips/got16.test | 196 ------- test/old-elf/Mips/gotsym.test | 43 -- test/old-elf/Mips/gp-sym-1-micro.test | 88 --- test/old-elf/Mips/gp-sym-1.test | 86 --- test/old-elf/Mips/gp-sym-2.test | 103 ---- test/old-elf/Mips/hilo16-1.test | 40 -- test/old-elf/Mips/hilo16-2.test | 70 --- test/old-elf/Mips/hilo16-3-overflow.test | 44 -- test/old-elf/Mips/hilo16-3.test | 74 --- test/old-elf/Mips/hilo16-4.test | 93 --- test/old-elf/Mips/hilo16-5.test | 103 ---- test/old-elf/Mips/hilo16-8-micro.test | 81 --- test/old-elf/Mips/hilo16-9-micro.test | 142 ----- test/old-elf/Mips/initfini-micro.test | 45 -- test/old-elf/Mips/interpreter-64.test | 26 - test/old-elf/Mips/interpreter-n32.test | 27 - test/old-elf/Mips/interpreter.test | 26 - test/old-elf/Mips/invalid-reginfo.test | 28 - test/old-elf/Mips/jalx-align-err.test | 46 -- test/old-elf/Mips/jalx-jalr.test | 47 -- test/old-elf/Mips/jalx.test | 71 --- test/old-elf/Mips/jump-fix-err.test | 45 -- test/old-elf/Mips/la25-stub-be.test | 113 ---- test/old-elf/Mips/la25-stub-micro-be.test | 121 ---- test/old-elf/Mips/la25-stub-micro.test | 136 ----- test/old-elf/Mips/la25-stub-npic-01.test | 153 ----- test/old-elf/Mips/la25-stub-npic-02.test | 123 ---- test/old-elf/Mips/la25-stub-npic-shared.test | 152 ----- test/old-elf/Mips/la25-stub-pic.test | 144 ----- test/old-elf/Mips/la25-stub.test | 133 ----- test/old-elf/Mips/mips-options-01.test | 34 -- test/old-elf/Mips/mips-options-02.test | 104 ---- test/old-elf/Mips/mips-options-03.test | 41 -- test/old-elf/Mips/mips-options-04.test | 77 --- test/old-elf/Mips/mips-options-05.test | 119 ---- test/old-elf/Mips/mips-options-gp0.test | 77 --- test/old-elf/Mips/n32-rela-chain.test | 68 --- test/old-elf/Mips/n64-rel-chain.test | 204 ------- test/old-elf/Mips/n64-rel-shift.test | 48 -- test/old-elf/Mips/opt-emulation.test | 43 -- test/old-elf/Mips/pc23-range.test | 54 -- test/old-elf/Mips/plt-entry-mixed-1.test | 114 ---- test/old-elf/Mips/plt-entry-mixed-2.test | 93 --- test/old-elf/Mips/plt-entry-mixed-3.test | 98 ---- test/old-elf/Mips/plt-entry-mixed-4.test | 85 --- test/old-elf/Mips/plt-entry-r6-be.test | 109 ---- test/old-elf/Mips/plt-entry-r6.test | 109 ---- test/old-elf/Mips/plt-header-be.test | 104 ---- test/old-elf/Mips/plt-header-micro-be.test | 105 ---- test/old-elf/Mips/plt-header-micro.test | 108 ---- test/old-elf/Mips/plt-header-mixed.test | 105 ---- test/old-elf/Mips/plt-header.test | 99 ---- test/old-elf/Mips/r26-1-micro.test | 131 ----- test/old-elf/Mips/r26-1.test | 132 ----- test/old-elf/Mips/r26-2-micro.test | 31 - test/old-elf/Mips/r26-2.test | 31 - test/old-elf/Mips/reginfo-01.test | 30 - test/old-elf/Mips/reginfo-02.test | 107 ---- test/old-elf/Mips/reginfo-03.test | 45 -- test/old-elf/Mips/reginfo-04.test | 81 --- test/old-elf/Mips/reginfo-05.test | 123 ---- test/old-elf/Mips/rel-16-overflow.test | 45 -- test/old-elf/Mips/rel-16.test | 51 -- test/old-elf/Mips/rel-32-be.test | 60 -- test/old-elf/Mips/rel-32.test | 59 -- test/old-elf/Mips/rel-64.test | 61 -- test/old-elf/Mips/rel-call-hilo-01.test | 109 ---- test/old-elf/Mips/rel-call-hilo-micro.test | 154 ----- test/old-elf/Mips/rel-copy-micro.test | 159 ------ test/old-elf/Mips/rel-copy-pc.test | 113 ---- test/old-elf/Mips/rel-copy.test | 177 ------ test/old-elf/Mips/rel-dynamic-01-micro.test | 201 ------- test/old-elf/Mips/rel-dynamic-01.test | 261 --------- test/old-elf/Mips/rel-dynamic-02.test | 101 ---- test/old-elf/Mips/rel-dynamic-03-micro.test | 133 ----- test/old-elf/Mips/rel-dynamic-03.test | 129 ----- test/old-elf/Mips/rel-dynamic-04-micro.test | 226 -------- test/old-elf/Mips/rel-dynamic-04.test | 221 -------- test/old-elf/Mips/rel-dynamic-05-micro.test | 192 ------- test/old-elf/Mips/rel-dynamic-05.test | 188 ------- test/old-elf/Mips/rel-dynamic-06-64.test | 114 ---- test/old-elf/Mips/rel-dynamic-06.test | 115 ---- test/old-elf/Mips/rel-dynamic-07-64.test | 348 ------------ test/old-elf/Mips/rel-dynamic-07.test | 363 ------------ test/old-elf/Mips/rel-dynamic-08-64.test | 275 --------- test/old-elf/Mips/rel-dynamic-08-micro.test | 278 --------- test/old-elf/Mips/rel-dynamic-08.test | 275 --------- test/old-elf/Mips/rel-dynamic-09-micro.test | 109 ---- test/old-elf/Mips/rel-dynamic-09.test | 107 ---- test/old-elf/Mips/rel-dynamic-10-micro.test | 166 ------ test/old-elf/Mips/rel-dynamic-10.test | 160 ------ test/old-elf/Mips/rel-dynamic-11.test | 110 ---- test/old-elf/Mips/rel-dynamic-12.test | 237 -------- test/old-elf/Mips/rel-dynamic-13.test | 94 ---- test/old-elf/Mips/rel-dynamic-14.test | 94 ---- test/old-elf/Mips/rel-dynamic-15.test | 81 --- test/old-elf/Mips/rel-eh-01.test | 186 ------ test/old-elf/Mips/rel-eh-02.test | 130 ----- test/old-elf/Mips/rel-eh-03.test | 128 ----- test/old-elf/Mips/rel-got-hilo-01.test | 109 ---- test/old-elf/Mips/rel-got-hilo-micro.test | 154 ----- test/old-elf/Mips/rel-gprel16-micro-overflow.test | 57 -- test/old-elf/Mips/rel-gprel16-micro.test | 78 --- test/old-elf/Mips/rel-gprel16-overflow.test | 48 -- test/old-elf/Mips/rel-gprel16.test | 104 ---- test/old-elf/Mips/rel-gprel32-64.test | 84 --- test/old-elf/Mips/rel-gprel32.test | 84 --- test/old-elf/Mips/rel-gprel7-micro-overflow.test | 48 -- test/old-elf/Mips/rel-gprel7-micro.test | 65 --- test/old-elf/Mips/rel-hi0-lo16-micro.test | 58 -- test/old-elf/Mips/rel-high-01.test | 25 - test/old-elf/Mips/rel-high-02.test | 25 - test/old-elf/Mips/rel-jalr-01.test | 101 ---- test/old-elf/Mips/rel-jalr-02.test | 68 --- test/old-elf/Mips/rel-lit-micro.test | 59 -- test/old-elf/Mips/rel-lit.test | 57 -- test/old-elf/Mips/rel-pc-hilo.test | 70 --- test/old-elf/Mips/rel-pc16-align.test | 43 -- test/old-elf/Mips/rel-pc16-overflow.test | 45 -- test/old-elf/Mips/rel-pc16.test | 53 -- test/old-elf/Mips/rel-pc18-s3-align.test | 44 -- test/old-elf/Mips/rel-pc18-s3-micro.test | 56 -- test/old-elf/Mips/rel-pc18-s3.test | 54 -- test/old-elf/Mips/rel-pc19-s2-align.test | 44 -- test/old-elf/Mips/rel-pc19-s2-micro.test | 56 -- test/old-elf/Mips/rel-pc19-s2.test | 54 -- test/old-elf/Mips/rel-pc21-s2-align.test | 44 -- test/old-elf/Mips/rel-pc21-s2-micro.test | 56 -- test/old-elf/Mips/rel-pc21-s2-overflow.test | 45 -- test/old-elf/Mips/rel-pc21-s2.test | 54 -- test/old-elf/Mips/rel-pc26-s2-align.test | 44 -- test/old-elf/Mips/rel-pc26-s2-micro.test | 56 -- test/old-elf/Mips/rel-pc26-s2.test | 54 -- test/old-elf/Mips/rel-pc32.test | 59 -- test/old-elf/Mips/rel-pc7-10-16-23.test | 86 --- test/old-elf/Mips/rel-sub-micro.test | 62 -- test/old-elf/Mips/rel-sub.test | 61 -- test/old-elf/Mips/rld_map.test | 42 -- test/old-elf/Mips/sign-rela.test | 54 -- test/old-elf/Mips/st-other.test | 90 --- test/old-elf/Mips/static-01.test | 119 ---- test/old-elf/Mips/tls-1-micro.test | 65 --- test/old-elf/Mips/tls-1.test | 63 --- test/old-elf/Mips/tls-2-64-static.test | 71 --- test/old-elf/Mips/tls-2-64.test | 69 --- test/old-elf/Mips/tls-2-micro.test | 70 --- test/old-elf/Mips/tls-2-static.test | 125 ----- test/old-elf/Mips/tls-2.test | 69 --- test/old-elf/Mips/tls-3-64-static.test | 70 --- test/old-elf/Mips/tls-3-micro.test | 183 ------ test/old-elf/Mips/tls-3-static.test | 67 --- test/old-elf/Mips/tls-3.test | 180 ------ test/old-elf/Mips/tls-4-64-static.test | 71 --- test/old-elf/Mips/tls-4-micro.test | 126 ----- test/old-elf/Mips/tls-4-static.test | 68 --- test/old-elf/Mips/tls-4.test | 123 ---- test/old-elf/Mips/tls-5-64.test | 71 --- test/old-elf/Mips/tls-5-micro.test | 70 --- test/old-elf/Mips/tls-5.test | 69 --- test/old-elf/Mips/validate-rel-01.test | 82 --- test/old-elf/Mips/validate-rel-03.test | 56 -- test/old-elf/X86_64/ExampleTarget/triple.test | 32 -- test/old-elf/X86_64/Inputs/constint.c | 1 - test/old-elf/X86_64/Inputs/constint.o | Bin 1062 -> 0 bytes test/old-elf/X86_64/Inputs/debug0.c | 5 - test/old-elf/X86_64/Inputs/debug0.x86-64 | Bin 2704 -> 0 bytes test/old-elf/X86_64/Inputs/debug1.c | 3 - test/old-elf/X86_64/Inputs/debug1.x86-64 | Bin 2584 -> 0 bytes test/old-elf/X86_64/Inputs/externtls.c | 6 - test/old-elf/X86_64/Inputs/externtls.x86-64 | Bin 1424 -> 0 bytes test/old-elf/X86_64/Inputs/fn.c | 4 - test/old-elf/X86_64/Inputs/fn.o | Bin 1072 -> 0 bytes test/old-elf/X86_64/Inputs/generaltls-so.o.yaml | 67 --- test/old-elf/X86_64/Inputs/group/1.c | 8 - test/old-elf/X86_64/Inputs/group/1.o | Bin 1456 -> 0 bytes test/old-elf/X86_64/Inputs/group/fn.c | 4 - test/old-elf/X86_64/Inputs/group/fn.o | Bin 1360 -> 0 bytes test/old-elf/X86_64/Inputs/group/fn1.c | 3 - test/old-elf/X86_64/Inputs/group/fn1.o | Bin 1352 -> 0 bytes test/old-elf/X86_64/Inputs/group/fn2.c | 3 - test/old-elf/X86_64/Inputs/group/fn2.o | Bin 1224 -> 0 bytes test/old-elf/X86_64/Inputs/group/group.sh | 38 -- test/old-elf/X86_64/Inputs/group/libfn.a | Bin 2792 -> 0 bytes test/old-elf/X86_64/Inputs/group/libfn.so | Bin 2516 -> 0 bytes test/old-elf/X86_64/Inputs/group/libfn1.a | Bin 1492 -> 0 bytes test/old-elf/X86_64/Inputs/group/libfn2.so | Bin 9624 -> 0 bytes test/old-elf/X86_64/Inputs/initfini-option.c | 13 - test/old-elf/X86_64/Inputs/initfini-option.o | Bin 1824 -> 0 bytes test/old-elf/X86_64/Inputs/initfini.c | 14 - test/old-elf/X86_64/Inputs/initfini.o | Bin 2256 -> 0 bytes test/old-elf/X86_64/Inputs/largebss.c | 3 - test/old-elf/X86_64/Inputs/largebss.o | Bin 1131 -> 0 bytes test/old-elf/X86_64/Inputs/layoutpass/1.c | 8 - test/old-elf/X86_64/Inputs/layoutpass/1.o | Bin 1448 -> 0 bytes test/old-elf/X86_64/Inputs/layoutpass/2.c | 7 - test/old-elf/X86_64/Inputs/layoutpass/2.o | Bin 1320 -> 0 bytes test/old-elf/X86_64/Inputs/layoutpass/3.c | 3 - test/old-elf/X86_64/Inputs/layoutpass/3.o | Bin 1216 -> 0 bytes test/old-elf/X86_64/Inputs/layoutpass/lib2.a | Bin 1464 -> 0 bytes test/old-elf/X86_64/Inputs/libfn.a | Bin 1364 -> 0 bytes test/old-elf/X86_64/Inputs/libfn.so | Bin 2008 -> 0 bytes test/old-elf/X86_64/Inputs/main.c | 4 - test/old-elf/X86_64/Inputs/main.o | Bin 1360 -> 0 bytes test/old-elf/X86_64/Inputs/multi-ovrd.c | 10 - test/old-elf/X86_64/Inputs/multi-ovrd.o | Bin 1648 -> 0 bytes test/old-elf/X86_64/Inputs/multi-weak.c | 20 - test/old-elf/X86_64/Inputs/multi-weak.o | Bin 1856 -> 0 bytes test/old-elf/X86_64/Inputs/multiweaksyms.o | Bin 928 -> 0 bytes test/old-elf/X86_64/Inputs/nmagic.c | 8 - test/old-elf/X86_64/Inputs/nmagic.o | Bin 1528 -> 0 bytes test/old-elf/X86_64/Inputs/no-interp-section.c | 1 - test/old-elf/X86_64/Inputs/no-interp-section.o | Bin 975 -> 0 bytes test/old-elf/X86_64/Inputs/note.o | Bin 785 -> 0 bytes test/old-elf/X86_64/Inputs/note.s | 11 - test/old-elf/X86_64/Inputs/note_ro_rw.o | Bin 905 -> 0 bytes test/old-elf/X86_64/Inputs/note_ro_rw.s | 21 - test/old-elf/X86_64/Inputs/ovrd.c | 6 - test/old-elf/X86_64/Inputs/ovrd.o | Bin 1488 -> 0 bytes test/old-elf/X86_64/Inputs/rodata.c | 3 - test/old-elf/X86_64/Inputs/rodata.o | Bin 1584 -> 0 bytes test/old-elf/X86_64/Inputs/rodata.s | 24 - test/old-elf/X86_64/Inputs/rwint.c | 1 - test/old-elf/X86_64/Inputs/rwint.o | Bin 963 -> 0 bytes test/old-elf/X86_64/Inputs/sectionmap.c | 4 - test/old-elf/X86_64/Inputs/sectionmap.o | Bin 1478 -> 0 bytes test/old-elf/X86_64/Inputs/undefcpp.c | 1 - test/old-elf/X86_64/Inputs/undefcpp.o | Bin 1344 -> 0 bytes test/old-elf/X86_64/Inputs/weak-zero-sized.o | Bin 688 -> 0 bytes test/old-elf/X86_64/Inputs/weak.c | 14 - test/old-elf/X86_64/Inputs/weak.o | Bin 1712 -> 0 bytes test/old-elf/X86_64/Inputs/weak.s | 21 - test/old-elf/X86_64/Inputs/zerosizedsection.o | Bin 760 -> 0 bytes test/old-elf/X86_64/Inputs/zerosizedsection.s | 3 - test/old-elf/X86_64/alignoffset.test | 118 ---- test/old-elf/X86_64/debug.test | 57 -- test/old-elf/X86_64/defsym.test | 22 - test/old-elf/X86_64/demangle.test | 12 - .../X86_64/dontignorezerosize-sections.test | 9 - test/old-elf/X86_64/dynamicvars.test | 123 ---- test/old-elf/X86_64/dynlib-nointerp-section.test | 4 - test/old-elf/X86_64/dynlib-search.test | 6 - test/old-elf/X86_64/dynsym-weak.test | 118 ---- test/old-elf/X86_64/extern-tls.test | 16 - test/old-elf/X86_64/general-dynamic-tls.test | 128 ----- test/old-elf/X86_64/imagebase.test | 94 ---- test/old-elf/X86_64/initfini-order.test | 10 - test/old-elf/X86_64/initfini.test | 23 - test/old-elf/X86_64/largebss.test | 20 - test/old-elf/X86_64/layoutpass-order.test | 14 - test/old-elf/X86_64/maxpagesize.test | 113 ---- test/old-elf/X86_64/mergesimilarstrings.test | 47 -- test/old-elf/X86_64/multi-weak-layout.test | 52 -- test/old-elf/X86_64/multi-weak-override.test | 16 - test/old-elf/X86_64/multi-weak-syms-order.test | 13 - test/old-elf/X86_64/nmagic.test | 91 --- test/old-elf/X86_64/noalignsegments.test | 95 ---- test/old-elf/X86_64/note-sections-ro_plus_rw.test | 42 -- test/old-elf/X86_64/note-sections.test | 23 - test/old-elf/X86_64/omagic.test | 237 -------- test/old-elf/X86_64/outputsegments.test | 188 ------- test/old-elf/X86_64/reloc_r_x86_64_16.test | 59 -- test/old-elf/X86_64/reloc_r_x86_64_pc16.test | 60 -- test/old-elf/X86_64/reloc_r_x86_64_pc64.test | 60 -- test/old-elf/X86_64/rodata.test | 9 - test/old-elf/X86_64/sectionchoice.test | 7 - test/old-elf/X86_64/sectionmap.test | 22 - test/old-elf/X86_64/startGroupEndGroup.test | 48 -- .../X86_64/startGroupEndGroupWithDynlib.test | 10 - test/old-elf/X86_64/staticlib-search.test | 6 - test/old-elf/X86_64/undef.test | 18 - test/old-elf/X86_64/underscore-end.test | 81 --- test/old-elf/X86_64/weak-override.test | 45 -- test/old-elf/X86_64/weak-zero-sized.test | 26 - test/old-elf/X86_64/weaksym.test | 77 --- test/old-elf/X86_64/yamlinput.test | 166 ------ test/old-elf/abs-dup.objtxt | 19 - test/old-elf/abs.test | 19 - test/old-elf/allowduplicates.objtxt | 41 -- test/old-elf/archive-elf-forceload.test | 43 -- test/old-elf/archive-elf.test | 38 -- test/old-elf/as-needed.test | 15 - test/old-elf/branch.test | 34 -- test/old-elf/check.test | 39 -- test/old-elf/checkrodata.test | 9 - test/old-elf/common.test | 10 - test/old-elf/consecutive-weak-sym-defs.test | 81 --- test/old-elf/defsym.objtxt | 31 - test/old-elf/discard-all.test | 88 --- test/old-elf/discard-locals.test | 65 --- test/old-elf/dynamic-segorder.test | 17 - test/old-elf/dynamic-undef.test | 38 -- test/old-elf/dynamic.test | 80 --- test/old-elf/eh_frame_hdr.test | 30 - test/old-elf/entry.objtxt | 58 -- test/old-elf/export-dynamic.test | 98 ---- test/old-elf/filenotfound.test | 3 - .../gnulinkonce-report-discarded-reference.test | 145 ----- .../gnulinkonce/gnulinkonce-report-undef.test | 127 ----- test/old-elf/gnulinkonce/gnulinkonce.test | 149 ----- test/old-elf/gotpcrel.test | 21 - test/old-elf/gottpoff.test | 119 ---- test/old-elf/group-cmd-search.test | 134 ----- test/old-elf/hexagon-quickdata-sort.test | 12 - test/old-elf/hexagon-quickdata-sortcommon.test | 16 - test/old-elf/ifunc.test | 69 --- test/old-elf/ignore-unknownoption.test | 5 - test/old-elf/init_array-order.test | 67 --- test/old-elf/init_array.test | 127 ----- test/old-elf/initfini-options.test-1.test | 33 -- test/old-elf/initfini-options.test-2.test | 47 -- test/old-elf/initfini-options.test-3.test | 53 -- test/old-elf/librarynotfound.test | 5 - test/old-elf/linker-as-ld.test | 16 - test/old-elf/linkerscript/Inputs/externs.ls | 3 - test/old-elf/linkerscript/Inputs/invalid.ls | 1 - test/old-elf/linkerscript/Inputs/prog1.o.yaml | 87 --- test/old-elf/linkerscript/Inputs/prog2.o.yaml | 88 --- test/old-elf/linkerscript/Inputs/prog3.o.yaml | 51 -- test/old-elf/linkerscript/Inputs/simple-pic.o.yaml | 32 -- test/old-elf/linkerscript/Inputs/simple.o.yaml | 51 -- test/old-elf/linkerscript/Inputs/valid.ls | 6 - test/old-elf/linkerscript/externs.objtxt | 21 - .../linkerscript/filename-with-wildcards.test | 49 -- .../old-elf/linkerscript/invalid-script-cli-1.test | 10 - .../old-elf/linkerscript/invalid-script-cli-2.test | 6 - test/old-elf/linkerscript/invalid.test | 5 - test/old-elf/linkerscript/phdrs-all-none.test | 26 - test/old-elf/linkerscript/phdrs-custom-none.test | 36 -- test/old-elf/linkerscript/phdrs-default.test | 82 --- test/old-elf/linkerscript/phdrs-different.test | 45 -- test/old-elf/linkerscript/phdrs-extra-program.test | 27 - test/old-elf/linkerscript/phdrs-flags.test | 46 -- test/old-elf/linkerscript/phdrs-has-program.test | 33 -- test/old-elf/linkerscript/phdrs-invalid.test | 63 --- .../linkerscript/phdrs-misplaced-program.test | 26 - test/old-elf/linkerscript/phdrs-no-program.test | 25 - test/old-elf/linkerscript/phdrs-one-none.test | 36 -- test/old-elf/linkerscript/phdrs-program-flags.test | 33 -- .../linkerscript/phdrs-program-good-phdrs.test | 34 -- .../linkerscript/phdrs-program-no-phdrs.test | 26 - .../linkerscript/phdrs-program-wrong-phdrs.test | 26 - test/old-elf/linkerscript/phdrs-same-flags.test | 35 -- test/old-elf/linkerscript/phdrs-same.test | 36 -- .../linkerscript/phdrs/sections-empty-phdrs.script | 11 - .../linkerscript/phdrs/sections-no-phdrs.script | 7 - .../linkerscript/phdrs/sections-none-phdrs.script | 11 - .../linkerscript/phdrs/undef-empty-phdrs.script | 11 - .../linkerscript/phdrs/undef-id-phdrs.script | 12 - .../linkerscript/phdrs/undef-no-phdrs.script | 7 - test/old-elf/linkerscript/sections-order.test | 113 ---- .../linkerscript/sections-with-wildcards.test | 88 --- .../old-elf/linkerscript/symbol-definition-so.test | 32 -- test/old-elf/linkerscript/symbol-definition.test | 54 -- test/old-elf/linkerscript/valid-script-cli.objtxt | 23 - test/old-elf/loginputfiles.test | 28 - test/old-elf/mergeatoms.test | 6 - test/old-elf/mergeconstants.test | 20 - test/old-elf/mergeglobalatoms.test | 11 - test/old-elf/no-unique-section-names.test | 19 - test/old-elf/note.test | 50 -- test/old-elf/options/dynamic-linker.test | 17 - test/old-elf/options/target-specific-args.test | 5 - test/old-elf/phdr.test | 99 ---- test/old-elf/quickdata.test | 15 - test/old-elf/reloc.test | 38 -- test/old-elf/responsefile.test | 6 - test/old-elf/rodata.test | 5 - test/old-elf/rosegment.test | 26 - .../sectionGroups/sectiongroup-new-members.test | 151 ----- .../old-elf/sectionGroups/sectiongroup-simple.test | 144 ----- .../sectiongroup-undef-member-other.test | 156 ------ .../sectionGroups/sectiongroup-undef-member.test | 142 ----- .../sectiongroup-with-globalsymbols.test | 250 --------- ...sectiongroup-with-undef-external-reference.test | 236 -------- .../sectiongroup-with-undef-signature.test | 219 -------- test/old-elf/sections.test | 142 ----- test/old-elf/sh_addralign.test | 37 -- test/old-elf/shndx.test | 18 - test/old-elf/soname.test | 6 - test/old-elf/start-stop-sym.test | 108 ---- test/old-elf/strip-all.test | 108 ---- test/old-elf/stripped-empty.test | 4 - test/old-elf/symbols.test | 33 -- test/old-elf/tls-tbss-size.test | 176 ------ test/old-elf/tls.test | 43 -- test/old-elf/tlsAddr.test | 7 - test/old-elf/undef-from-dso-to-main.test | 52 -- test/old-elf/undef-from-main-dso.test | 43 -- test/old-elf/weaksym.test | 7 - test/old-elf/wrap.test | 276 --------- test/old-elf/x86-64-dynamic-relocs.test | 26 - test/old-elf/x86-64-dynamic.test | 79 --- test/old-elf/x86.test | 38 -- test/old-elf/x86_64-kinds.test | 23 - test/old-elf/zoption_dtflags.test | 89 --- 1390 files changed, 15158 insertions(+), 42307 deletions(-) create mode 100644 test/COFF/Inputs/manifestinput.test delete mode 100644 test/COFF/dllorder.test create mode 100644 test/COFF/manifestinput.test create mode 100644 test/COFF/section.test delete mode 100644 test/Driver/def-lib-search.test delete mode 100644 test/Driver/flavor-option.test delete mode 100644 test/Driver/lib-search.test delete mode 100644 test/Driver/so-whole-archive.test delete mode 100644 test/Driver/trivial-driver.test delete mode 100644 test/Driver/undef-basic.objtxt create mode 100644 test/ELF/Inputs/aarch64-copy2.s create mode 100644 test/ELF/Inputs/aarch64-tls-gdie.s create mode 100644 test/ELF/Inputs/abs-hidden.s create mode 100644 test/ELF/Inputs/arm-plt-reloc.s create mode 100644 test/ELF/Inputs/arm-thumb-blx-targets.s create mode 100644 test/ELF/Inputs/arm-thumb-narrow-branch.s create mode 100644 test/ELF/Inputs/conflict.s create mode 100644 test/ELF/Inputs/copy-in-shared.s create mode 100644 test/ELF/Inputs/copy-rel-corrupted.s create mode 100644 test/ELF/Inputs/copy-rel-pie.s create mode 100644 test/ELF/Inputs/ctors_dtors_priority1.s create mode 100644 test/ELF/Inputs/ctors_dtors_priority2.s create mode 100644 test/ELF/Inputs/ctors_dtors_priority3.s create mode 100644 test/ELF/Inputs/duplicated-plt-entry.s create mode 100644 test/ELF/Inputs/dynamic-reloc-weak.s create mode 100644 test/ELF/Inputs/ehframe-relocation.s create mode 100644 test/ELF/Inputs/empty-ver.ver create mode 100644 test/ELF/Inputs/far-arm-abs.s create mode 100644 test/ELF/Inputs/far-arm-thumb-abs.s create mode 100644 test/ELF/Inputs/gc-sections-weak.s create mode 100644 test/ELF/Inputs/gnu-ifunc-gotpcrel.s create mode 100644 test/ELF/Inputs/gotpc-relax-und-dso.s create mode 100644 test/ELF/Inputs/icf2.s create mode 100644 test/ELF/Inputs/invalid-cie-version2.elf create mode 100644 test/ELF/Inputs/mips-align-err.s create mode 100644 test/ELF/Inputs/mips-nonalloc.s create mode 100644 test/ELF/Inputs/mips-pic.s create mode 100644 test/ELF/Inputs/mips-tls.s create mode 100644 test/ELF/Inputs/plt-aarch64.s create mode 100644 test/ELF/Inputs/ppc64-addr16-error.s create mode 100644 test/ELF/Inputs/protected-shared.s create mode 100644 test/ELF/Inputs/relocatable-ehframe.s create mode 100644 test/ELF/Inputs/relocatable.s create mode 100644 test/ELF/Inputs/relocatable2.s create mode 100644 test/ELF/Inputs/relocation-copy-alias.s create mode 100644 test/ELF/Inputs/relocation-copy-arm.s create mode 100644 test/ELF/Inputs/resolution-shared.s create mode 100644 test/ELF/Inputs/start-lib-comdat.s create mode 100644 test/ELF/Inputs/start-lib1.s create mode 100644 test/ELF/Inputs/start-lib2.s create mode 100644 test/ELF/Inputs/symbol-override.s create mode 100644 test/ELF/Inputs/tls-got-entry.s create mode 100644 test/ELF/Inputs/tls-in-archive.s create mode 100644 test/ELF/Inputs/trace-ar1.s create mode 100644 test/ELF/Inputs/trace-ar2.s create mode 100644 test/ELF/Inputs/trace-symbols-foo-strong.s create mode 100644 test/ELF/Inputs/trace-symbols-foo-weak.s create mode 100644 test/ELF/Inputs/undef-with-plt-addr.s create mode 100644 test/ELF/Inputs/undef.s create mode 100644 test/ELF/Inputs/unresolved-symbols.s create mode 100644 test/ELF/Inputs/verdef-defaultver.s create mode 100644 test/ELF/Inputs/verdef.s create mode 100755 test/ELF/Inputs/verneed.so.sh create mode 100644 test/ELF/Inputs/version-script-err.script create mode 100644 test/ELF/Inputs/version-use.script create mode 100644 test/ELF/Inputs/warn-common.s create mode 100644 test/ELF/Inputs/warn-common2.s create mode 100644 test/ELF/Inputs/x86-64-relax-offset.s create mode 100644 test/ELF/Inputs/x86-64-reloc-error.s create mode 100644 test/ELF/Inputs/x86-64-tls-gd-got.s create mode 100644 test/ELF/aarch64-abs64-dyn.s create mode 100644 test/ELF/aarch64-copy2.s create mode 100644 test/ELF/aarch64-fpic-got.s create mode 100644 test/ELF/aarch64-got-relocations.s create mode 100644 test/ELF/aarch64-got.s create mode 100644 test/ELF/aarch64-relative.s create mode 100644 test/ELF/aarch64-tls-gdie.s create mode 100644 test/ELF/aarch64-tls-gdle.s create mode 100644 test/ELF/aarch64-tls-iele.s create mode 100644 test/ELF/aarch64-tls-le.s create mode 100644 test/ELF/aarch64-tls-pie.s create mode 100644 test/ELF/aarch64-tls-static.s create mode 100644 test/ELF/aarch64-tlsdesc.s create mode 100644 test/ELF/abs-hidden.s create mode 100644 test/ELF/amdgpu-relocs.s create mode 100644 test/ELF/arm-abs32-dyn.s create mode 100644 test/ELF/arm-attributes-remove.s create mode 100644 test/ELF/arm-blx.s create mode 100644 test/ELF/arm-branch-error.s create mode 100644 test/ELF/arm-branch.s create mode 100644 test/ELF/arm-copy.s create mode 100644 test/ELF/arm-data-prel.s create mode 100644 test/ELF/arm-data-relocs.s create mode 100644 test/ELF/arm-fpic-got.s create mode 100644 test/ELF/arm-gnu-ifunc-nosym.s create mode 100644 test/ELF/arm-gnu-ifunc.s create mode 100644 test/ELF/arm-got-relative.s create mode 100644 test/ELF/arm-gotoff.s create mode 100644 test/ELF/arm-mov-relocs.s create mode 100644 test/ELF/arm-plt-reloc.s create mode 100644 test/ELF/arm-thumb-blx.s create mode 100644 test/ELF/arm-thumb-branch-error.s create mode 100644 test/ELF/arm-thumb-branch.s create mode 100644 test/ELF/arm-thumb-interwork-thunk.s create mode 100644 test/ELF/arm-thumb-narrow-branch-check.s create mode 100644 test/ELF/arm-thumb-plt-reloc.s create mode 100644 test/ELF/as-needed-no-reloc.s create mode 100644 test/ELF/avoid-empty-program-headers.s create mode 100644 test/ELF/bsymbolic-undef.s create mode 100644 test/ELF/bsymbolic.s create mode 100644 test/ELF/build-id.s create mode 100644 test/ELF/combrelocs.s create mode 100644 test/ELF/compressed-debug-input.s create mode 100644 test/ELF/conflict.s create mode 100644 test/ELF/copy-errors.s create mode 100644 test/ELF/copy-in-shared.s create mode 100644 test/ELF/copy-rel-corrupted.s create mode 100644 test/ELF/copy-rel-pie-error.s create mode 100644 test/ELF/copy-rel-pie.s create mode 100644 test/ELF/ctors_dtors_priority.s create mode 100644 test/ELF/dont-export-hidden.s create mode 100644 test/ELF/driver.test create mode 100644 test/ELF/duplicated-plt-entry.s create mode 100644 test/ELF/dynamic-list.s create mode 100644 test/ELF/dynamic-reloc-in-ro.s create mode 100644 test/ELF/dynamic.s create mode 100644 test/ELF/dynsym-pie.s create mode 100644 test/ELF/edata-etext.s create mode 100644 test/ELF/eh-frame-dyn-rel.s create mode 100644 test/ELF/eh-frame-gc.s create mode 100644 test/ELF/eh-frame-hdr-abs-fde.s create mode 100644 test/ELF/eh-frame-hdr-augmentation.s create mode 100644 test/ELF/eh-frame-hdr-icf.s create mode 100644 test/ELF/eh-frame-hdr-no-out.s create mode 100644 test/ELF/eh-frame-hdr-no-out2.s create mode 100644 test/ELF/eh-frame-hdr.s create mode 100644 test/ELF/eh-frame-marker.s create mode 100644 test/ELF/eh-frame-multilpe-cie.s create mode 100644 test/ELF/empty-ver.s create mode 100644 test/ELF/fatal-warnings.s create mode 100644 test/ELF/file-sym.s create mode 100644 test/ELF/gc-merge-local-sym.s create mode 100644 test/ELF/gc-sections-local-sym.s create mode 100644 test/ELF/gc-sections-lsda.s create mode 100644 test/ELF/gc-sections-merge-addend.s create mode 100644 test/ELF/gc-sections-merge-implicit-addend.s create mode 100644 test/ELF/gc-sections-merge.s create mode 100644 test/ELF/gc-sections-protected.s create mode 100644 test/ELF/gc-sections-shared.s create mode 100644 test/ELF/gc-sections-weak.s create mode 100644 test/ELF/global_offset_table_shared.s create mode 100644 test/ELF/gnu-ifunc-gotpcrel.s create mode 100644 test/ELF/gnu-ifunc-relative.s create mode 100644 test/ELF/got-plt-header.s create mode 100644 test/ELF/gotpc-relax-nopic.s create mode 100644 test/ELF/gotpc-relax-und-dso.s create mode 100644 test/ELF/gotpc-relax.s create mode 100644 test/ELF/gotpcrelx.s create mode 100644 test/ELF/i386-got-and-copy.s create mode 100644 test/ELF/i386-gotpc.s create mode 100644 test/ELF/i386-merge.s create mode 100644 test/ELF/i386-relative.s create mode 100644 test/ELF/i386-relax-reloc.s create mode 100644 test/ELF/i386-tls-ie-shared.s create mode 100644 test/ELF/icf1.s create mode 100644 test/ELF/icf2.s create mode 100644 test/ELF/icf3.s create mode 100644 test/ELF/icf4.s create mode 100644 test/ELF/icf5.s create mode 100644 test/ELF/icf6.s create mode 100644 test/ELF/icf7.s create mode 100644 test/ELF/image-base.s create mode 100644 test/ELF/init_fini_priority.s create mode 100644 test/ELF/invalid-dynamic-list.test create mode 100644 test/ELF/invalid-linkerscript.test create mode 100644 test/ELF/linkerscript-align.s create mode 100644 test/ELF/linkerscript-diagnostic.s create mode 100644 test/ELF/linkerscript-locationcounter.s create mode 100644 test/ELF/linkerscript-orphans.s create mode 100644 test/ELF/linkerscript-phdr-check.s create mode 100644 test/ELF/linkerscript-repsection-va.s create mode 100644 test/ELF/linkerscript-sections-keep.s create mode 100644 test/ELF/linkerscript-sections-padding.s create mode 100644 test/ELF/linkerscript-symbol-conflict.s create mode 100644 test/ELF/linkerscript-symbols.s create mode 100644 test/ELF/linkerscript-va.s create mode 100644 test/ELF/llvm33-rela-outside-group.s create mode 100644 test/ELF/local-got-pie.s create mode 100644 test/ELF/local-undefined-symbol.s create mode 100644 test/ELF/lto/Inputs/archive-2.ll create mode 100644 test/ELF/lto/Inputs/archive-3.ll create mode 100644 test/ELF/lto/Inputs/archive.ll create mode 100644 test/ELF/lto/Inputs/available-externally.ll create mode 100644 test/ELF/lto/Inputs/comdat.s create mode 100644 test/ELF/lto/Inputs/common.s create mode 100644 test/ELF/lto/Inputs/drop-debug-info.bc create mode 100644 test/ELF/lto/Inputs/drop-linkage.ll create mode 100644 test/ELF/lto/Inputs/dynsym.s create mode 100644 test/ELF/lto/Inputs/internalize-exportdyn.ll create mode 100644 test/ELF/lto/Inputs/internalize-undef.ll create mode 100644 test/ELF/lto/Inputs/irmover-error.ll create mode 100644 test/ELF/lto/Inputs/linkonce-odr.ll create mode 100644 test/ELF/lto/Inputs/linkonce.ll create mode 100644 test/ELF/lto/Inputs/resolution.s create mode 100644 test/ELF/lto/Inputs/save-temps.ll create mode 100644 test/ELF/lto/Inputs/shared.s create mode 100644 test/ELF/lto/Inputs/start-lib1.ll create mode 100644 test/ELF/lto/Inputs/start-lib2.ll create mode 100644 test/ELF/lto/Inputs/tls-mixed.s create mode 100644 test/ELF/lto/Inputs/type-merge.ll create mode 100644 test/ELF/lto/Inputs/type-merge2.ll create mode 100644 test/ELF/lto/Inputs/undef-mixed.s create mode 100644 test/ELF/lto/Inputs/unnamed-addr-lib.s create mode 100644 test/ELF/lto/Inputs/visibility.s create mode 100644 test/ELF/lto/archive-2.ll create mode 100644 test/ELF/lto/archive-3.ll create mode 100644 test/ELF/lto/archive.ll create mode 100644 test/ELF/lto/asmundef.ll create mode 100644 test/ELF/lto/available-externally.ll create mode 100644 test/ELF/lto/combined-lto-object-name.ll create mode 100644 test/ELF/lto/comdat.ll create mode 100644 test/ELF/lto/comdat2.ll create mode 100644 test/ELF/lto/common.ll create mode 100644 test/ELF/lto/common2.ll create mode 100644 test/ELF/lto/ctors.ll create mode 100644 test/ELF/lto/discard-value-names.ll create mode 100644 test/ELF/lto/drop-debug-info.ll create mode 100644 test/ELF/lto/drop-linkage.ll create mode 100644 test/ELF/lto/duplicated.ll create mode 100644 test/ELF/lto/dynamic-list.ll create mode 100644 test/ELF/lto/dynsym.ll create mode 100644 test/ELF/lto/inline-asm.ll create mode 100644 test/ELF/lto/internalize-basic.ll create mode 100644 test/ELF/lto/internalize-exportdyn.ll create mode 100644 test/ELF/lto/internalize-llvmused.ll create mode 100644 test/ELF/lto/internalize-undef.ll create mode 100644 test/ELF/lto/internalize-version-script.ll create mode 100644 test/ELF/lto/invalid-bitcode.ll create mode 100644 test/ELF/lto/irmover-error.ll create mode 100644 test/ELF/lto/linkage.ll create mode 100644 test/ELF/lto/linkonce-odr.ll create mode 100644 test/ELF/lto/linkonce.ll create mode 100644 test/ELF/lto/lto-start.ll create mode 100644 test/ELF/lto/ltopasses-basic.ll create mode 100644 test/ELF/lto/ltopasses-custom.ll create mode 100644 test/ELF/lto/metadata.ll create mode 100644 test/ELF/lto/mix-platforms.ll create mode 100644 test/ELF/lto/module-asm.ll create mode 100644 test/ELF/lto/opt-level.ll create mode 100644 test/ELF/lto/parallel-internalize.ll create mode 100644 test/ELF/lto/parallel.ll create mode 100644 test/ELF/lto/pic.ll create mode 100644 test/ELF/lto/relax-relocs.ll create mode 100644 test/ELF/lto/resolution.ll create mode 100644 test/ELF/lto/save-temps.ll create mode 100644 test/ELF/lto/shlib-undefined.ll create mode 100644 test/ELF/lto/start-lib.ll create mode 100644 test/ELF/lto/tls-mixed.ll create mode 100644 test/ELF/lto/tls-preserve.ll create mode 100644 test/ELF/lto/type-merge.ll create mode 100644 test/ELF/lto/type-merge2.ll create mode 100644 test/ELF/lto/undef-mixed.ll create mode 100644 test/ELF/lto/undef-weak.ll create mode 100644 test/ELF/lto/undef.ll create mode 100644 test/ELF/lto/undefined-puts.ll create mode 100644 test/ELF/lto/unnamed-addr-comdat.ll create mode 100644 test/ELF/lto/unnamed-addr-lib.ll create mode 100644 test/ELF/lto/unnamed-addr.ll create mode 100644 test/ELF/lto/verify-invalid.ll create mode 100644 test/ELF/lto/version-script.ll create mode 100644 test/ELF/lto/visibility.ll create mode 100644 test/ELF/lto/weak.ll create mode 100644 test/ELF/merge-shared-str.s create mode 100644 test/ELF/mips-26.s create mode 100644 test/ELF/mips-32.s create mode 100644 test/ELF/mips-64-disp.s create mode 100644 test/ELF/mips-64-got.s create mode 100644 test/ELF/mips-64-gprel-so.s create mode 100644 test/ELF/mips-64-rels.s create mode 100644 test/ELF/mips-64.s create mode 100644 test/ELF/mips-align-err.s create mode 100644 test/ELF/mips-got-and-copy.s create mode 100644 test/ELF/mips-got-extsym.s create mode 100644 test/ELF/mips-got-redundant.s create mode 100644 test/ELF/mips-got-weak.s create mode 100644 test/ELF/mips-got16.s create mode 100644 test/ELF/mips-gp-local.s create mode 100644 test/ELF/mips-gprel32-relocs-gp0.test create mode 100644 test/ELF/mips-lo16-not-relative.s create mode 100644 test/ELF/mips-nonalloc.s create mode 100644 test/ELF/mips-npic-call-pic.s create mode 100644 test/ELF/mips-options-r.test create mode 100644 test/ELF/mips-options.s create mode 100644 test/ELF/mips-plt-copy.s delete mode 100644 test/ELF/mips-relocs.s create mode 100644 test/ELF/mips-sto-plt.s create mode 100644 test/ELF/mips-tls-64.s create mode 100644 test/ELF/mips-tls-hilo.s create mode 100644 test/ELF/mips-tls.s create mode 100644 test/ELF/no-augmentation.s create mode 100644 test/ELF/no-plt-shared.s create mode 100644 test/ELF/noplt-pie.s create mode 100644 test/ELF/note.s create mode 100644 test/ELF/phdr-align.s create mode 100644 test/ELF/pie-weak.s create mode 100644 test/ELF/pie.s create mode 100644 test/ELF/protected-shared.s create mode 100644 test/ELF/rel-offset.s create mode 100644 test/ELF/relative-dynamic-reloc-pie.s create mode 100644 test/ELF/relocatable-bss.s create mode 100644 test/ELF/relocatable-ehframe.s create mode 100644 test/ELF/relocatable-reloc.s create mode 100644 test/ELF/relocatable-symbols.s create mode 100644 test/ELF/relocation-copy-alias.s create mode 100644 test/ELF/relocation-copy-flags.s create mode 100644 test/ELF/relocation-non-alloc.s create mode 100644 test/ELF/relocation-relative-absolute.s create mode 100644 test/ELF/relocation-relative-synthetic.s create mode 100644 test/ELF/relocation-relative-weak.s create mode 100644 test/ELF/relocation-shared.s create mode 100644 test/ELF/relro-tls.s create mode 100644 test/ELF/reproduce-error.s create mode 100644 test/ELF/reproduce-linkerscript.s create mode 100644 test/ELF/reproduce-thin-archive.s create mode 100644 test/ELF/reproduce-windows.s create mode 100644 test/ELF/reproduce.s create mode 100644 test/ELF/resolution-shared.s create mode 100644 test/ELF/splitstacks.s create mode 100644 test/ELF/start-lib-comdat.s create mode 100644 test/ELF/start-lib.s create mode 100644 test/ELF/startstop-gccollect.s create mode 100644 test/ELF/string-gc.s create mode 100644 test/ELF/strip-debug.s create mode 100644 test/ELF/symbol-override.s create mode 100644 test/ELF/tail-merge-string-align.s create mode 100644 test/ELF/tls-archive.s create mode 100644 test/ELF/tls-got-entry.s create mode 100644 test/ELF/tls-in-archive.s create mode 100644 test/ELF/tls-initial-exec-local.s create mode 100644 test/ELF/tls-offset.s create mode 100644 test/ELF/tls-opt-no-plt.s create mode 100644 test/ELF/tls-two-relocs.s create mode 100644 test/ELF/trace-ar.s create mode 100644 test/ELF/trace-symbols.s create mode 100644 test/ELF/trace.s create mode 100644 test/ELF/undef-shared.s create mode 100644 test/ELF/undef-version-script.s create mode 100644 test/ELF/undef-with-plt-addr-i686.s create mode 100644 test/ELF/undef-with-plt-addr.s create mode 100644 test/ELF/unresolved-symbols.s create mode 100644 test/ELF/user_def_init_array_start.s delete mode 100644 test/ELF/valid-cie-length-dw64.s create mode 100644 test/ELF/verdef-defaultver.s create mode 100644 test/ELF/verdef-dependency.s create mode 100644 test/ELF/verdef.s create mode 100644 test/ELF/verneed-as-needed-weak.s create mode 100644 test/ELF/verneed-local.s create mode 100644 test/ELF/verneed.s create mode 100644 test/ELF/version-script-err.s create mode 100644 test/ELF/version-script-extern.s create mode 100644 test/ELF/version-script-noundef.s create mode 100644 test/ELF/version-script.s create mode 100644 test/ELF/version-undef-sym.s create mode 100644 test/ELF/version-use.s create mode 100644 test/ELF/version-wildcard.test create mode 100644 test/ELF/warn-common.s create mode 100644 test/ELF/weak-undef-hidden.s create mode 100644 test/ELF/weak-undef-shared.s create mode 100644 test/ELF/weak-undef.s create mode 100644 test/ELF/wildcards.s create mode 100644 test/ELF/x86-64-dyn-rel-error.s create mode 100644 test/ELF/x86-64-dyn-rel-error2.s create mode 100644 test/ELF/x86-64-rela.s create mode 100644 test/ELF/x86-64-relax-offset.s delete mode 100644 test/ELF/x86-64-reloc-32-error.s create mode 100644 test/ELF/x86-64-reloc-32-fpic.s delete mode 100644 test/ELF/x86-64-reloc-32S-error.s create mode 100644 test/ELF/x86-64-reloc-error.s create mode 100644 test/ELF/x86-64-reloc-pc32-fpic.s create mode 100644 test/ELF/x86-64-reloc-range.s create mode 100644 test/ELF/x86-64-tls-gd-got.s create mode 100644 test/ELF/x86-64-tls-gd-local.s create mode 100644 test/ELF/x86-64-tls-pie.s create mode 100644 test/ELF/zdefs.s delete mode 100644 test/LinkerScript/expr-precedence.test delete mode 100644 test/LinkerScript/extern-bad-symbol.test delete mode 100644 test/LinkerScript/extern-empty.test delete mode 100644 test/LinkerScript/extern-valid.test delete mode 100644 test/LinkerScript/incomplete-ternary.test delete mode 100644 test/LinkerScript/libname-err-1.test delete mode 100644 test/LinkerScript/libname-err-2.test delete mode 100644 test/LinkerScript/linker-script-outputformat.test delete mode 100644 test/LinkerScript/linker-script.test delete mode 100644 test/LinkerScript/memory-empty.test delete mode 100644 test/LinkerScript/memory-missing-attrs.test delete mode 100644 test/LinkerScript/memory-missing-length.test delete mode 100644 test/LinkerScript/memory-missing-name.test delete mode 100644 test/LinkerScript/memory-missing-origin.test delete mode 100644 test/LinkerScript/memory-valid.test delete mode 100644 test/LinkerScript/missing-entry-symbol.test delete mode 100644 test/LinkerScript/missing-input-file-name.test delete mode 100644 test/LinkerScript/missing-input-sections.test delete mode 100644 test/LinkerScript/missing-operand.test delete mode 100644 test/LinkerScript/missing-output-section-name.test delete mode 100644 test/LinkerScript/missing-symbol.test delete mode 100644 test/LinkerScript/phdrs-sections.test delete mode 100644 test/LinkerScript/sections.test delete mode 100644 test/core/Inputs/archive-basic.objtxt delete mode 100644 test/core/Inputs/archive-chain.objtxt delete mode 100644 test/core/Inputs/archive-chain2.objtxt delete mode 100644 test/core/Inputs/archive-tentdef-search.objtxt delete mode 100644 test/core/Inputs/associates.objtxt delete mode 100644 test/core/Inputs/auto-hide-coalesce.objtxt delete mode 100644 test/core/Inputs/code-model-attributes.objtxt delete mode 100644 test/core/Inputs/code-model-attributes2.objtxt delete mode 100644 test/core/Inputs/code-model-attributes3.objtxt delete mode 100644 test/core/Inputs/code-model-attributes4.objtxt delete mode 100644 test/core/Inputs/code-model-attributes5.objtxt delete mode 100644 test/core/Inputs/constants-coalesce.objtxt delete mode 100644 test/core/Inputs/constants-coalesce2.objtxt delete mode 100644 test/core/Inputs/cstring-coalesce.objtxt delete mode 100644 test/core/Inputs/cstring-coalesce2.objtxt delete mode 100644 test/core/Inputs/custom-section-coalesce.objtxt delete mode 100644 test/core/Inputs/custom-section-coalesce2.objtxt delete mode 100644 test/core/Inputs/dead-strip-attributes.objtxt delete mode 100644 test/core/Inputs/dead-strip-attributes2.objtxt delete mode 100644 test/core/Inputs/dead-strip-basic.objtxt delete mode 100644 test/core/Inputs/dead-strip-basic2.objtxt delete mode 100644 test/core/Inputs/dead-strip-globals.objtxt delete mode 100644 test/core/Inputs/dead-strip-globals2.objtxt delete mode 100644 test/core/Inputs/error-duplicate-absolutes.objtxt delete mode 100644 test/core/Inputs/gnulinkonce-rearrange-resolve.objtxt delete mode 100644 test/core/Inputs/gnulinkonce-remaining-undef.objtxt delete mode 100644 test/core/Inputs/gnulinkonce-remaining-undef2.objtxt delete mode 100644 test/core/Inputs/gnulinkonce-resolve.objtxt delete mode 100644 test/core/Inputs/gnulinkonce-simple.objtxt delete mode 100644 test/core/Inputs/inline-coalesce.objtxt delete mode 100644 test/core/Inputs/inline-coalesce2.objtxt delete mode 100644 test/core/Inputs/multiple-def-error.objtxt delete mode 100644 test/core/Inputs/sectiongroup-deadstrip.objtxt delete mode 100644 test/core/Inputs/sectiongroup-gnulinkonce-error.objtxt delete mode 100644 test/core/Inputs/sectiongroup-rearrange-resolve.objtxt delete mode 100644 test/core/Inputs/sectiongroup-remaining-undef.objtxt delete mode 100644 test/core/Inputs/sectiongroup-remaining-undef2.objtxt delete mode 100644 test/core/Inputs/sectiongroup-resolve.objtxt delete mode 100644 test/core/Inputs/sectiongroup-simple.objtxt delete mode 100644 test/core/Inputs/shared-library-coalesce.objtxt delete mode 100644 test/core/Inputs/tent-merge.objtxt delete mode 100644 test/core/Inputs/undef-coalesce-error.objtxt delete mode 100644 test/core/Inputs/undef-coalesce-error2.objtxt delete mode 100644 test/core/Inputs/undef-coalesce.objtxt delete mode 100644 test/core/Inputs/undef-coalesce2.objtxt delete mode 100644 test/core/Inputs/undef-fallback.objtxt delete mode 100644 test/core/Inputs/undef-weak-coalesce.objtxt delete mode 100644 test/core/Inputs/weak-coalesce.objtxt delete mode 100644 test/core/Inputs/weak-coalesce2.objtxt delete mode 100644 test/core/absolute-basic.objtxt delete mode 100644 test/core/absolute-local.objtxt delete mode 100644 test/core/archive-basic.objtxt delete mode 100644 test/core/archive-chain.objtxt delete mode 100644 test/core/archive-tentdef-search.objtxt delete mode 100644 test/core/associates.objtxt delete mode 100644 test/core/auto-hide-coalesce.objtxt delete mode 100644 test/core/code-model-attributes.objtxt delete mode 100644 test/core/constants-coalesce.objtxt delete mode 100644 test/core/cstring-coalesce.objtxt delete mode 100644 test/core/custom-section-coalesce.objtxt delete mode 100644 test/core/custom-section.objtxt delete mode 100644 test/core/dead-strip-attributes.objtxt delete mode 100644 test/core/dead-strip-basic.objtxt delete mode 100644 test/core/dead-strip-globals.objtxt delete mode 100644 test/core/dead-strip-reverse.objtxt delete mode 100644 test/core/error-atom-attribute.objtxt delete mode 100644 test/core/error-atom-content-byte-value.objtxt delete mode 100644 test/core/error-atom-content-bytes.objtxt delete mode 100644 test/core/error-atom-type.objtxt delete mode 100644 test/core/error-atom-undefined-wrong-attribue.objtxt delete mode 100644 test/core/error-duplicate-absolutes.objtxt delete mode 100644 test/core/error-file-attribute.objtxt delete mode 100644 test/core/error-fixup-attribute.objtxt delete mode 100644 test/core/error-fixup-target.objtxt delete mode 100644 test/core/fixups-addend.objtxt delete mode 100644 test/core/fixups-dup-named.objtxt delete mode 100644 test/core/fixups-named.objtxt delete mode 100644 test/core/fixups-unnamed.objtxt delete mode 100644 test/core/gnulinkonce-rearrange-resolve.objtxt delete mode 100644 test/core/gnulinkonce-remaining-undef.objtxt delete mode 100644 test/core/gnulinkonce-resolve.objtxt delete mode 100644 test/core/gnulinkonce-simple.objtxt delete mode 100644 test/core/inline-coalesce.objtxt delete mode 100644 test/core/multiple-def-error.objtxt delete mode 100644 test/core/permissions.objtxt delete mode 100644 test/core/sectiongroup-deadstrip.objtxt delete mode 100644 test/core/sectiongroup-gnulinkonce-error.objtxt delete mode 100644 test/core/sectiongroup-rearrange-resolve.objtxt delete mode 100644 test/core/sectiongroup-remaining-undef.objtxt delete mode 100644 test/core/sectiongroup-resolve.objtxt delete mode 100644 test/core/sectiongroup-simple.objtxt delete mode 100644 test/core/shared-library-basic.objtxt delete mode 100644 test/core/shared-library-coalesce.objtxt delete mode 100644 test/core/tent-merge.objtxt delete mode 100644 test/core/undef-coalesce-error.objtxt delete mode 100644 test/core/undef-coalesce.objtxt delete mode 100644 test/core/undef-fallback.objtxt delete mode 100644 test/core/undef-weak-coalesce.objtxt delete mode 100644 test/core/weak-coalesce.objtxt create mode 100644 test/darwin/cmdline-objc_gc.objtxt create mode 100644 test/darwin/cmdline-objc_gc_compaction.objtxt create mode 100644 test/darwin/cmdline-objc_gc_only.objtxt create mode 100644 test/mach-o/Inputs/no-version-min-load-command-object.yaml create mode 100644 test/mach-o/Inputs/swift-version-1.yaml create mode 100644 test/mach-o/data-in-code-load-command.yaml create mode 100644 test/mach-o/dead-strip-globals.yaml create mode 100644 test/mach-o/eh-frame-relocs-arm64.yaml create mode 100644 test/mach-o/error-simulator-vs-macosx.yaml create mode 100644 test/mach-o/function-starts-load-command.yaml create mode 100644 test/mach-o/mach_header-cpusubtype.yaml create mode 100644 test/mach-o/objc-category-list-atom.yaml create mode 100644 test/mach-o/objc-image-info-host-vs-simulator.yaml create mode 100644 test/mach-o/objc-image-info-invalid-size.yaml create mode 100644 test/mach-o/objc-image-info-invalid-version.yaml create mode 100644 test/mach-o/objc-image-info-mismatched-swift-version.yaml create mode 100644 test/mach-o/objc-image-info-pass-output.yaml create mode 100644 test/mach-o/objc-image-info-simulator-vs-host.yaml create mode 100644 test/mach-o/objc-image-info-unsupported-gc.yaml create mode 100644 test/mach-o/sdk-version-error.yaml create mode 100644 test/mach-o/sectattrs.yaml create mode 100644 test/mach-o/seg-protection-arm64.yaml create mode 100644 test/mach-o/seg-protection-x86_64.yaml create mode 100644 test/mach-o/source-version.yaml create mode 100644 test/mach-o/subsections-via-symbols-default.yaml create mode 100644 test/mach-o/version-min-load-command-object.yaml create mode 100644 test/mach-o/version-min-load-command.yaml delete mode 100644 test/old-elf/AArch64/Inputs/fn.c delete mode 100644 test/old-elf/AArch64/Inputs/fn.o delete mode 100644 test/old-elf/AArch64/Inputs/general-dyn-tls-0.yaml delete mode 100644 test/old-elf/AArch64/Inputs/initfini-option.c delete mode 100644 test/old-elf/AArch64/Inputs/initfini-option.o delete mode 100644 test/old-elf/AArch64/Inputs/initfini.c delete mode 100644 test/old-elf/AArch64/Inputs/initfini.o delete mode 100644 test/old-elf/AArch64/Inputs/initial-exec-tls-1.yaml delete mode 100644 test/old-elf/AArch64/Inputs/main.c delete mode 100644 test/old-elf/AArch64/Inputs/main.o delete mode 100644 test/old-elf/AArch64/Inputs/no-interp-section.c delete mode 100644 test/old-elf/AArch64/Inputs/no-interp-section.o delete mode 100644 test/old-elf/AArch64/Inputs/zerosizedsection.o delete mode 100644 test/old-elf/AArch64/Inputs/zerosizedsection.s delete mode 100644 test/old-elf/AArch64/defsym.test delete mode 100644 test/old-elf/AArch64/dontignorezerosize-sections.test delete mode 100644 test/old-elf/AArch64/dynamicvars.test delete mode 100644 test/old-elf/AArch64/dynlib-nointerp-section.test delete mode 100644 test/old-elf/AArch64/general-dyn-tls-0.test delete mode 100644 test/old-elf/AArch64/initfini.test delete mode 100644 test/old-elf/AArch64/initial-exec-tls-0.test delete mode 100644 test/old-elf/AArch64/local-tls.test delete mode 100644 test/old-elf/AArch64/rel-abs16-overflow.test delete mode 100644 test/old-elf/AArch64/rel-abs16.test delete mode 100644 test/old-elf/AArch64/rel-abs32-overflow.test delete mode 100644 test/old-elf/AArch64/rel-abs32.test delete mode 100644 test/old-elf/AArch64/rel-abs64.test delete mode 100644 test/old-elf/AArch64/rel-adr_prel_lo21-overflow.test delete mode 100644 test/old-elf/AArch64/rel-adr_prel_lo21.test delete mode 100644 test/old-elf/AArch64/rel-adr_prel_pg_hi21-overflow.test delete mode 100644 test/old-elf/AArch64/rel-adr_prel_pg_hi21.test delete mode 100644 test/old-elf/AArch64/rel-bad.test delete mode 100644 test/old-elf/AArch64/rel-prel16-overflow.test delete mode 100644 test/old-elf/AArch64/rel-prel16.test delete mode 100644 test/old-elf/AArch64/rel-prel32-overflow.test delete mode 100644 test/old-elf/AArch64/rel-prel32.test delete mode 100644 test/old-elf/AArch64/rel-prel64.test delete mode 100644 test/old-elf/ARM/Inputs/fn.c delete mode 100755 test/old-elf/ARM/Inputs/libfn.so delete mode 100755 test/old-elf/ARM/Inputs/libobj.so delete mode 100644 test/old-elf/ARM/Inputs/obj.c delete mode 100644 test/old-elf/ARM/arm-symbols.test delete mode 100644 test/old-elf/ARM/defsym.test delete mode 100644 test/old-elf/ARM/dynamic-symbols.test delete mode 100644 test/old-elf/ARM/entry-point.test delete mode 100644 test/old-elf/ARM/exidx.test delete mode 100644 test/old-elf/ARM/header-flags.test delete mode 100644 test/old-elf/ARM/mapping-code-model.test delete mode 100644 test/old-elf/ARM/mapping-symbols.test delete mode 100644 test/old-elf/ARM/missing-symbol.test delete mode 100644 test/old-elf/ARM/plt-dynamic.test delete mode 100644 test/old-elf/ARM/plt-ifunc-interwork.test delete mode 100644 test/old-elf/ARM/plt-ifunc-mapping.test delete mode 100644 test/old-elf/ARM/rel-abs32.test delete mode 100644 test/old-elf/ARM/rel-arm-call.test delete mode 100644 test/old-elf/ARM/rel-arm-jump24-veneer-b.test delete mode 100644 test/old-elf/ARM/rel-arm-jump24-veneer-bl.test delete mode 100644 test/old-elf/ARM/rel-arm-jump24.test delete mode 100644 test/old-elf/ARM/rel-arm-mov.test delete mode 100644 test/old-elf/ARM/rel-arm-prel31.test delete mode 100644 test/old-elf/ARM/rel-arm-target1.test delete mode 100644 test/old-elf/ARM/rel-arm-thm-interwork.test delete mode 100644 test/old-elf/ARM/rel-base-prel.test delete mode 100644 test/old-elf/ARM/rel-copy.test delete mode 100644 test/old-elf/ARM/rel-glob-dat.test delete mode 100644 test/old-elf/ARM/rel-got-brel.test delete mode 100644 test/old-elf/ARM/rel-group-relocs.test delete mode 100644 test/old-elf/ARM/rel-ifunc.test delete mode 100644 test/old-elf/ARM/rel-jump-slot.test delete mode 100644 test/old-elf/ARM/rel-rel32.test delete mode 100644 test/old-elf/ARM/rel-thm-call.test delete mode 100644 test/old-elf/ARM/rel-thm-jump11.test delete mode 100644 test/old-elf/ARM/rel-thm-jump24-veneer.test delete mode 100644 test/old-elf/ARM/rel-thm-jump24.test delete mode 100644 test/old-elf/ARM/rel-thm-mov.test delete mode 100644 test/old-elf/ARM/rel-tls-ie32.test delete mode 100644 test/old-elf/ARM/rel-tls-le32.test delete mode 100644 test/old-elf/ARM/rel-v4bx.test delete mode 100644 test/old-elf/ARM/thm-symbols.test delete mode 100644 test/old-elf/ARM/two-got-for-symbol.test delete mode 100644 test/old-elf/ARM/undef-lazy-symbol.test delete mode 100644 test/old-elf/ARM/veneer-mapping.test delete mode 100644 test/old-elf/ARM/weak-branch.test delete mode 100644 test/old-elf/Hexagon/Inputs/dynobj-data.c delete mode 100644 test/old-elf/Hexagon/Inputs/dynobj-data.o delete mode 100644 test/old-elf/Hexagon/Inputs/dynobj.c delete mode 100644 test/old-elf/Hexagon/Inputs/dynobj.o delete mode 100644 test/old-elf/Hexagon/Inputs/got-plt-order.c delete mode 100644 test/old-elf/Hexagon/Inputs/got-plt-order.o delete mode 100644 test/old-elf/Hexagon/Inputs/libMaxAlignment.a delete mode 100644 test/old-elf/Hexagon/Inputs/sda-base.o delete mode 100644 test/old-elf/Hexagon/Inputs/sdata1.c delete mode 100644 test/old-elf/Hexagon/Inputs/sdata1.o delete mode 100644 test/old-elf/Hexagon/Inputs/sdata2.c delete mode 100644 test/old-elf/Hexagon/Inputs/sdata2.o delete mode 100644 test/old-elf/Hexagon/Inputs/use-shared.hexagon delete mode 100644 test/old-elf/Hexagon/dynlib-data.test delete mode 100644 test/old-elf/Hexagon/dynlib-gotoff.test delete mode 100644 test/old-elf/Hexagon/dynlib-hash.test delete mode 100644 test/old-elf/Hexagon/dynlib-rela.test delete mode 100644 test/old-elf/Hexagon/dynlib-syms.test delete mode 100644 test/old-elf/Hexagon/dynlib.test delete mode 100644 test/old-elf/Hexagon/hexagon-got-plt-order.test delete mode 100644 test/old-elf/Hexagon/hexagon-plt-setup.test delete mode 100644 test/old-elf/Hexagon/maxalignment.test delete mode 100644 test/old-elf/Hexagon/rela-order.test delete mode 100644 test/old-elf/Hexagon/sda-base.test delete mode 100644 test/old-elf/Hexagon/zerofillquick-sdata.test delete mode 100644 test/old-elf/Inputs/abs-test.i386 delete mode 100644 test/old-elf/Inputs/allowduplicates.objtxt delete mode 100644 test/old-elf/Inputs/bar.o.x86-64 delete mode 100644 test/old-elf/Inputs/branch-test.hexagon delete mode 100644 test/old-elf/Inputs/branch-test.ppc delete mode 100644 test/old-elf/Inputs/consecutive-weak-defs.o.yaml delete mode 100644 test/old-elf/Inputs/constants-merge.x86-64 delete mode 100644 test/old-elf/Inputs/constdata.x86-64 delete mode 100644 test/old-elf/Inputs/foo.o.x86-64 delete mode 100644 test/old-elf/Inputs/globalconst.c delete mode 100644 test/old-elf/Inputs/globalconst.o.x86-64 delete mode 100644 test/old-elf/Inputs/gotpcrel.S delete mode 100644 test/old-elf/Inputs/gotpcrel.x86-64 delete mode 100644 test/old-elf/Inputs/group-cmd-search-1.ls delete mode 100644 test/old-elf/Inputs/group-cmd-search-2.ls delete mode 100644 test/old-elf/Inputs/group-cmd-search-3.ls delete mode 100644 test/old-elf/Inputs/ifunc.S delete mode 100644 test/old-elf/Inputs/ifunc.cpp delete mode 100644 test/old-elf/Inputs/ifunc.cpp.x86-64 delete mode 100644 test/old-elf/Inputs/ifunc.x86-64 delete mode 100644 test/old-elf/Inputs/libfnarchive.a delete mode 100644 test/old-elf/Inputs/libifunc.x86-64.so delete mode 100644 test/old-elf/Inputs/libundef.so delete mode 100755 test/old-elf/Inputs/libweaksym.so delete mode 100644 test/old-elf/Inputs/main-with-global-def.o.yaml delete mode 100644 test/old-elf/Inputs/mainobj.x86_64 delete mode 100644 test/old-elf/Inputs/no-unique-section-names.x86-64 delete mode 100644 test/old-elf/Inputs/object-test.elf-hexagon delete mode 100644 test/old-elf/Inputs/object-test.elf-i386 delete mode 100644 test/old-elf/Inputs/phdr.i386 delete mode 100644 test/old-elf/Inputs/quickdata-sort-test.o.elf-hexagon delete mode 100644 test/old-elf/Inputs/quickdata-sortcommon-test.o.elf-hexagon delete mode 100644 test/old-elf/Inputs/quickdata-test.elf-hexagon delete mode 100644 test/old-elf/Inputs/reloc-test.elf-i386 delete mode 100644 test/old-elf/Inputs/reloc-xb.x86 delete mode 100644 test/old-elf/Inputs/reloc-xt.x86 delete mode 100644 test/old-elf/Inputs/relocs-dynamic.x86-64 delete mode 100644 test/old-elf/Inputs/relocs.x86-64 delete mode 100644 test/old-elf/Inputs/responsefile delete mode 100644 test/old-elf/Inputs/rodata-test.hexagon delete mode 100644 test/old-elf/Inputs/rodata-test.i386 delete mode 100644 test/old-elf/Inputs/rodata.c delete mode 100644 test/old-elf/Inputs/rodata.o delete mode 100644 test/old-elf/Inputs/section-test.i386 delete mode 100644 test/old-elf/Inputs/shared.c delete mode 100644 test/old-elf/Inputs/shared.so-x86-64 delete mode 100644 test/old-elf/Inputs/shndx.o-x86_64 delete mode 100644 test/old-elf/Inputs/stripped-empty.x86_64 delete mode 100644 test/old-elf/Inputs/target-test.hexagon delete mode 100644 test/old-elf/Inputs/target-test.ppc delete mode 100644 test/old-elf/Inputs/tls-tbss-size.yaml delete mode 100644 test/old-elf/Inputs/tls.S delete mode 100644 test/old-elf/Inputs/tls.c delete mode 100644 test/old-elf/Inputs/tls.x86-64 delete mode 100644 test/old-elf/Inputs/tlsAddr.x86-64 delete mode 100644 test/old-elf/Inputs/tlsaddr.c delete mode 100644 test/old-elf/Inputs/undef-from-main-so.c delete mode 100644 test/old-elf/Inputs/undef-from-main.c delete mode 100644 test/old-elf/Inputs/undef-pc32.o delete mode 100644 test/old-elf/Inputs/undef.o delete mode 100644 test/old-elf/Inputs/undef2-so.o.yaml delete mode 100644 test/old-elf/Inputs/use-shared-32s.c delete mode 100644 test/old-elf/Inputs/use-shared-32s.x86-64 delete mode 100644 test/old-elf/Inputs/use-shared.c delete mode 100644 test/old-elf/Inputs/use-shared.x86-64 delete mode 100644 test/old-elf/Inputs/weaksym.o delete mode 100644 test/old-elf/Inputs/writersyms.o delete mode 100644 test/old-elf/Inputs/x86-64-relocs.S delete mode 100644 test/old-elf/Mips/abi-flags-01.test delete mode 100644 test/old-elf/Mips/abi-flags-02.test delete mode 100644 test/old-elf/Mips/abi-flags-03.test delete mode 100644 test/old-elf/Mips/abi-flags-04.test delete mode 100644 test/old-elf/Mips/abi-flags-05.test delete mode 100644 test/old-elf/Mips/abi-flags-06.test delete mode 100644 test/old-elf/Mips/abi-flags-07.test delete mode 100644 test/old-elf/Mips/abi-flags-08.test delete mode 100644 test/old-elf/Mips/abi-flags-09.test delete mode 100644 test/old-elf/Mips/abi-flags-10.test delete mode 100644 test/old-elf/Mips/abi-flags-11.test delete mode 100644 test/old-elf/Mips/base-address-64.test delete mode 100644 test/old-elf/Mips/base-address.test delete mode 100644 test/old-elf/Mips/ctors-order.test delete mode 100644 test/old-elf/Mips/driver-hash-style.test delete mode 100644 test/old-elf/Mips/dt-textrel-64.test delete mode 100644 test/old-elf/Mips/dt-textrel.test delete mode 100644 test/old-elf/Mips/dynamic-linking.test delete mode 100644 test/old-elf/Mips/dynamic-sym.test delete mode 100644 test/old-elf/Mips/dynlib-dynamic.test delete mode 100644 test/old-elf/Mips/dynlib-dynsym-micro.test delete mode 100644 test/old-elf/Mips/dynlib-dynsym.test delete mode 100644 test/old-elf/Mips/dynlib-fileheader-64.test delete mode 100644 test/old-elf/Mips/dynlib-fileheader-micro-64.test delete mode 100644 test/old-elf/Mips/dynlib-fileheader-micro.test delete mode 100644 test/old-elf/Mips/dynlib-fileheader.test delete mode 100644 test/old-elf/Mips/dynsym-table-1.test delete mode 100644 test/old-elf/Mips/dynsym-table-2.test delete mode 100644 test/old-elf/Mips/e-flags-merge-1-64.test delete mode 100644 test/old-elf/Mips/e-flags-merge-1.test delete mode 100644 test/old-elf/Mips/e-flags-merge-10.test delete mode 100644 test/old-elf/Mips/e-flags-merge-11.test delete mode 100644 test/old-elf/Mips/e-flags-merge-12.test delete mode 100644 test/old-elf/Mips/e-flags-merge-2-64.test delete mode 100644 test/old-elf/Mips/e-flags-merge-2.test delete mode 100644 test/old-elf/Mips/e-flags-merge-3-64.test delete mode 100644 test/old-elf/Mips/e-flags-merge-3.test delete mode 100644 test/old-elf/Mips/e-flags-merge-4-64.test delete mode 100644 test/old-elf/Mips/e-flags-merge-4.test delete mode 100644 test/old-elf/Mips/e-flags-merge-5-64.test delete mode 100644 test/old-elf/Mips/e-flags-merge-5.test delete mode 100644 test/old-elf/Mips/e-flags-merge-6-64.test delete mode 100644 test/old-elf/Mips/e-flags-merge-6.test delete mode 100644 test/old-elf/Mips/e-flags-merge-7-64.test delete mode 100644 test/old-elf/Mips/e-flags-merge-7.test delete mode 100644 test/old-elf/Mips/e-flags-merge-8.test delete mode 100644 test/old-elf/Mips/e-flags-merge-9.test delete mode 100644 test/old-elf/Mips/entry-name.test delete mode 100644 test/old-elf/Mips/exe-dynamic.test delete mode 100644 test/old-elf/Mips/exe-dynsym-micro.test delete mode 100644 test/old-elf/Mips/exe-dynsym.test delete mode 100644 test/old-elf/Mips/exe-fileheader-02.test delete mode 100644 test/old-elf/Mips/exe-fileheader-03.test delete mode 100644 test/old-elf/Mips/exe-fileheader-64.test delete mode 100644 test/old-elf/Mips/exe-fileheader-be-64.test delete mode 100644 test/old-elf/Mips/exe-fileheader-be.test delete mode 100644 test/old-elf/Mips/exe-fileheader-micro-64.test delete mode 100644 test/old-elf/Mips/exe-fileheader-micro.test delete mode 100644 test/old-elf/Mips/exe-fileheader-n32.test delete mode 100644 test/old-elf/Mips/exe-fileheader.test delete mode 100644 test/old-elf/Mips/exe-got-micro.test delete mode 100644 test/old-elf/Mips/exe-got.test delete mode 100644 test/old-elf/Mips/got-page-32-micro.test delete mode 100644 test/old-elf/Mips/got-page-32.test delete mode 100644 test/old-elf/Mips/got-page-64-micro.test delete mode 100644 test/old-elf/Mips/got-page-64.test delete mode 100644 test/old-elf/Mips/got16-2.test delete mode 100644 test/old-elf/Mips/got16-micro.test delete mode 100644 test/old-elf/Mips/got16.test delete mode 100644 test/old-elf/Mips/gotsym.test delete mode 100644 test/old-elf/Mips/gp-sym-1-micro.test delete mode 100644 test/old-elf/Mips/gp-sym-1.test delete mode 100644 test/old-elf/Mips/gp-sym-2.test delete mode 100644 test/old-elf/Mips/hilo16-1.test delete mode 100644 test/old-elf/Mips/hilo16-2.test delete mode 100644 test/old-elf/Mips/hilo16-3-overflow.test delete mode 100644 test/old-elf/Mips/hilo16-3.test delete mode 100644 test/old-elf/Mips/hilo16-4.test delete mode 100644 test/old-elf/Mips/hilo16-5.test delete mode 100644 test/old-elf/Mips/hilo16-8-micro.test delete mode 100644 test/old-elf/Mips/hilo16-9-micro.test delete mode 100644 test/old-elf/Mips/initfini-micro.test delete mode 100644 test/old-elf/Mips/interpreter-64.test delete mode 100644 test/old-elf/Mips/interpreter-n32.test delete mode 100644 test/old-elf/Mips/interpreter.test delete mode 100644 test/old-elf/Mips/invalid-reginfo.test delete mode 100644 test/old-elf/Mips/jalx-align-err.test delete mode 100644 test/old-elf/Mips/jalx-jalr.test delete mode 100644 test/old-elf/Mips/jalx.test delete mode 100644 test/old-elf/Mips/jump-fix-err.test delete mode 100644 test/old-elf/Mips/la25-stub-be.test delete mode 100644 test/old-elf/Mips/la25-stub-micro-be.test delete mode 100644 test/old-elf/Mips/la25-stub-micro.test delete mode 100644 test/old-elf/Mips/la25-stub-npic-01.test delete mode 100644 test/old-elf/Mips/la25-stub-npic-02.test delete mode 100644 test/old-elf/Mips/la25-stub-npic-shared.test delete mode 100644 test/old-elf/Mips/la25-stub-pic.test delete mode 100644 test/old-elf/Mips/la25-stub.test delete mode 100644 test/old-elf/Mips/mips-options-01.test delete mode 100644 test/old-elf/Mips/mips-options-02.test delete mode 100644 test/old-elf/Mips/mips-options-03.test delete mode 100644 test/old-elf/Mips/mips-options-04.test delete mode 100644 test/old-elf/Mips/mips-options-05.test delete mode 100644 test/old-elf/Mips/mips-options-gp0.test delete mode 100644 test/old-elf/Mips/n32-rela-chain.test delete mode 100644 test/old-elf/Mips/n64-rel-chain.test delete mode 100644 test/old-elf/Mips/n64-rel-shift.test delete mode 100644 test/old-elf/Mips/opt-emulation.test delete mode 100644 test/old-elf/Mips/pc23-range.test delete mode 100644 test/old-elf/Mips/plt-entry-mixed-1.test delete mode 100644 test/old-elf/Mips/plt-entry-mixed-2.test delete mode 100644 test/old-elf/Mips/plt-entry-mixed-3.test delete mode 100644 test/old-elf/Mips/plt-entry-mixed-4.test delete mode 100644 test/old-elf/Mips/plt-entry-r6-be.test delete mode 100644 test/old-elf/Mips/plt-entry-r6.test delete mode 100644 test/old-elf/Mips/plt-header-be.test delete mode 100644 test/old-elf/Mips/plt-header-micro-be.test delete mode 100644 test/old-elf/Mips/plt-header-micro.test delete mode 100644 test/old-elf/Mips/plt-header-mixed.test delete mode 100644 test/old-elf/Mips/plt-header.test delete mode 100644 test/old-elf/Mips/r26-1-micro.test delete mode 100644 test/old-elf/Mips/r26-1.test delete mode 100644 test/old-elf/Mips/r26-2-micro.test delete mode 100644 test/old-elf/Mips/r26-2.test delete mode 100644 test/old-elf/Mips/reginfo-01.test delete mode 100644 test/old-elf/Mips/reginfo-02.test delete mode 100644 test/old-elf/Mips/reginfo-03.test delete mode 100644 test/old-elf/Mips/reginfo-04.test delete mode 100644 test/old-elf/Mips/reginfo-05.test delete mode 100644 test/old-elf/Mips/rel-16-overflow.test delete mode 100644 test/old-elf/Mips/rel-16.test delete mode 100644 test/old-elf/Mips/rel-32-be.test delete mode 100644 test/old-elf/Mips/rel-32.test delete mode 100644 test/old-elf/Mips/rel-64.test delete mode 100644 test/old-elf/Mips/rel-call-hilo-01.test delete mode 100644 test/old-elf/Mips/rel-call-hilo-micro.test delete mode 100644 test/old-elf/Mips/rel-copy-micro.test delete mode 100644 test/old-elf/Mips/rel-copy-pc.test delete mode 100644 test/old-elf/Mips/rel-copy.test delete mode 100644 test/old-elf/Mips/rel-dynamic-01-micro.test delete mode 100644 test/old-elf/Mips/rel-dynamic-01.test delete mode 100644 test/old-elf/Mips/rel-dynamic-02.test delete mode 100644 test/old-elf/Mips/rel-dynamic-03-micro.test delete mode 100644 test/old-elf/Mips/rel-dynamic-03.test delete mode 100644 test/old-elf/Mips/rel-dynamic-04-micro.test delete mode 100644 test/old-elf/Mips/rel-dynamic-04.test delete mode 100644 test/old-elf/Mips/rel-dynamic-05-micro.test delete mode 100644 test/old-elf/Mips/rel-dynamic-05.test delete mode 100644 test/old-elf/Mips/rel-dynamic-06-64.test delete mode 100644 test/old-elf/Mips/rel-dynamic-06.test delete mode 100644 test/old-elf/Mips/rel-dynamic-07-64.test delete mode 100644 test/old-elf/Mips/rel-dynamic-07.test delete mode 100644 test/old-elf/Mips/rel-dynamic-08-64.test delete mode 100644 test/old-elf/Mips/rel-dynamic-08-micro.test delete mode 100644 test/old-elf/Mips/rel-dynamic-08.test delete mode 100644 test/old-elf/Mips/rel-dynamic-09-micro.test delete mode 100644 test/old-elf/Mips/rel-dynamic-09.test delete mode 100644 test/old-elf/Mips/rel-dynamic-10-micro.test delete mode 100644 test/old-elf/Mips/rel-dynamic-10.test delete mode 100644 test/old-elf/Mips/rel-dynamic-11.test delete mode 100644 test/old-elf/Mips/rel-dynamic-12.test delete mode 100644 test/old-elf/Mips/rel-dynamic-13.test delete mode 100644 test/old-elf/Mips/rel-dynamic-14.test delete mode 100644 test/old-elf/Mips/rel-dynamic-15.test delete mode 100644 test/old-elf/Mips/rel-eh-01.test delete mode 100644 test/old-elf/Mips/rel-eh-02.test delete mode 100644 test/old-elf/Mips/rel-eh-03.test delete mode 100644 test/old-elf/Mips/rel-got-hilo-01.test delete mode 100644 test/old-elf/Mips/rel-got-hilo-micro.test delete mode 100644 test/old-elf/Mips/rel-gprel16-micro-overflow.test delete mode 100644 test/old-elf/Mips/rel-gprel16-micro.test delete mode 100644 test/old-elf/Mips/rel-gprel16-overflow.test delete mode 100644 test/old-elf/Mips/rel-gprel16.test delete mode 100644 test/old-elf/Mips/rel-gprel32-64.test delete mode 100644 test/old-elf/Mips/rel-gprel32.test delete mode 100644 test/old-elf/Mips/rel-gprel7-micro-overflow.test delete mode 100644 test/old-elf/Mips/rel-gprel7-micro.test delete mode 100644 test/old-elf/Mips/rel-hi0-lo16-micro.test delete mode 100644 test/old-elf/Mips/rel-high-01.test delete mode 100644 test/old-elf/Mips/rel-high-02.test delete mode 100644 test/old-elf/Mips/rel-jalr-01.test delete mode 100644 test/old-elf/Mips/rel-jalr-02.test delete mode 100644 test/old-elf/Mips/rel-lit-micro.test delete mode 100644 test/old-elf/Mips/rel-lit.test delete mode 100644 test/old-elf/Mips/rel-pc-hilo.test delete mode 100644 test/old-elf/Mips/rel-pc16-align.test delete mode 100644 test/old-elf/Mips/rel-pc16-overflow.test delete mode 100644 test/old-elf/Mips/rel-pc16.test delete mode 100644 test/old-elf/Mips/rel-pc18-s3-align.test delete mode 100644 test/old-elf/Mips/rel-pc18-s3-micro.test delete mode 100644 test/old-elf/Mips/rel-pc18-s3.test delete mode 100644 test/old-elf/Mips/rel-pc19-s2-align.test delete mode 100644 test/old-elf/Mips/rel-pc19-s2-micro.test delete mode 100644 test/old-elf/Mips/rel-pc19-s2.test delete mode 100644 test/old-elf/Mips/rel-pc21-s2-align.test delete mode 100644 test/old-elf/Mips/rel-pc21-s2-micro.test delete mode 100644 test/old-elf/Mips/rel-pc21-s2-overflow.test delete mode 100644 test/old-elf/Mips/rel-pc21-s2.test delete mode 100644 test/old-elf/Mips/rel-pc26-s2-align.test delete mode 100644 test/old-elf/Mips/rel-pc26-s2-micro.test delete mode 100644 test/old-elf/Mips/rel-pc26-s2.test delete mode 100644 test/old-elf/Mips/rel-pc32.test delete mode 100644 test/old-elf/Mips/rel-pc7-10-16-23.test delete mode 100644 test/old-elf/Mips/rel-sub-micro.test delete mode 100644 test/old-elf/Mips/rel-sub.test delete mode 100644 test/old-elf/Mips/rld_map.test delete mode 100644 test/old-elf/Mips/sign-rela.test delete mode 100644 test/old-elf/Mips/st-other.test delete mode 100644 test/old-elf/Mips/static-01.test delete mode 100644 test/old-elf/Mips/tls-1-micro.test delete mode 100644 test/old-elf/Mips/tls-1.test delete mode 100644 test/old-elf/Mips/tls-2-64-static.test delete mode 100644 test/old-elf/Mips/tls-2-64.test delete mode 100644 test/old-elf/Mips/tls-2-micro.test delete mode 100644 test/old-elf/Mips/tls-2-static.test delete mode 100644 test/old-elf/Mips/tls-2.test delete mode 100644 test/old-elf/Mips/tls-3-64-static.test delete mode 100644 test/old-elf/Mips/tls-3-micro.test delete mode 100644 test/old-elf/Mips/tls-3-static.test delete mode 100644 test/old-elf/Mips/tls-3.test delete mode 100644 test/old-elf/Mips/tls-4-64-static.test delete mode 100644 test/old-elf/Mips/tls-4-micro.test delete mode 100644 test/old-elf/Mips/tls-4-static.test delete mode 100644 test/old-elf/Mips/tls-4.test delete mode 100644 test/old-elf/Mips/tls-5-64.test delete mode 100644 test/old-elf/Mips/tls-5-micro.test delete mode 100644 test/old-elf/Mips/tls-5.test delete mode 100644 test/old-elf/Mips/validate-rel-01.test delete mode 100644 test/old-elf/Mips/validate-rel-03.test delete mode 100644 test/old-elf/X86_64/ExampleTarget/triple.test delete mode 100644 test/old-elf/X86_64/Inputs/constint.c delete mode 100644 test/old-elf/X86_64/Inputs/constint.o delete mode 100644 test/old-elf/X86_64/Inputs/debug0.c delete mode 100644 test/old-elf/X86_64/Inputs/debug0.x86-64 delete mode 100644 test/old-elf/X86_64/Inputs/debug1.c delete mode 100644 test/old-elf/X86_64/Inputs/debug1.x86-64 delete mode 100644 test/old-elf/X86_64/Inputs/externtls.c delete mode 100644 test/old-elf/X86_64/Inputs/externtls.x86-64 delete mode 100644 test/old-elf/X86_64/Inputs/fn.c delete mode 100644 test/old-elf/X86_64/Inputs/fn.o delete mode 100644 test/old-elf/X86_64/Inputs/generaltls-so.o.yaml delete mode 100644 test/old-elf/X86_64/Inputs/group/1.c delete mode 100644 test/old-elf/X86_64/Inputs/group/1.o delete mode 100644 test/old-elf/X86_64/Inputs/group/fn.c delete mode 100644 test/old-elf/X86_64/Inputs/group/fn.o delete mode 100644 test/old-elf/X86_64/Inputs/group/fn1.c delete mode 100644 test/old-elf/X86_64/Inputs/group/fn1.o delete mode 100644 test/old-elf/X86_64/Inputs/group/fn2.c delete mode 100644 test/old-elf/X86_64/Inputs/group/fn2.o delete mode 100755 test/old-elf/X86_64/Inputs/group/group.sh delete mode 100644 test/old-elf/X86_64/Inputs/group/libfn.a delete mode 100755 test/old-elf/X86_64/Inputs/group/libfn.so delete mode 100644 test/old-elf/X86_64/Inputs/group/libfn1.a delete mode 100755 test/old-elf/X86_64/Inputs/group/libfn2.so delete mode 100644 test/old-elf/X86_64/Inputs/initfini-option.c delete mode 100644 test/old-elf/X86_64/Inputs/initfini-option.o delete mode 100644 test/old-elf/X86_64/Inputs/initfini.c delete mode 100644 test/old-elf/X86_64/Inputs/initfini.o delete mode 100644 test/old-elf/X86_64/Inputs/largebss.c delete mode 100644 test/old-elf/X86_64/Inputs/largebss.o delete mode 100644 test/old-elf/X86_64/Inputs/layoutpass/1.c delete mode 100644 test/old-elf/X86_64/Inputs/layoutpass/1.o delete mode 100644 test/old-elf/X86_64/Inputs/layoutpass/2.c delete mode 100644 test/old-elf/X86_64/Inputs/layoutpass/2.o delete mode 100644 test/old-elf/X86_64/Inputs/layoutpass/3.c delete mode 100644 test/old-elf/X86_64/Inputs/layoutpass/3.o delete mode 100644 test/old-elf/X86_64/Inputs/layoutpass/lib2.a delete mode 100644 test/old-elf/X86_64/Inputs/libfn.a delete mode 100755 test/old-elf/X86_64/Inputs/libfn.so delete mode 100644 test/old-elf/X86_64/Inputs/main.c delete mode 100644 test/old-elf/X86_64/Inputs/main.o delete mode 100644 test/old-elf/X86_64/Inputs/multi-ovrd.c delete mode 100644 test/old-elf/X86_64/Inputs/multi-ovrd.o delete mode 100644 test/old-elf/X86_64/Inputs/multi-weak.c delete mode 100644 test/old-elf/X86_64/Inputs/multi-weak.o delete mode 100644 test/old-elf/X86_64/Inputs/multiweaksyms.o delete mode 100644 test/old-elf/X86_64/Inputs/nmagic.c delete mode 100644 test/old-elf/X86_64/Inputs/nmagic.o delete mode 100644 test/old-elf/X86_64/Inputs/no-interp-section.c delete mode 100644 test/old-elf/X86_64/Inputs/no-interp-section.o delete mode 100644 test/old-elf/X86_64/Inputs/note.o delete mode 100644 test/old-elf/X86_64/Inputs/note.s delete mode 100644 test/old-elf/X86_64/Inputs/note_ro_rw.o delete mode 100644 test/old-elf/X86_64/Inputs/note_ro_rw.s delete mode 100644 test/old-elf/X86_64/Inputs/ovrd.c delete mode 100644 test/old-elf/X86_64/Inputs/ovrd.o delete mode 100644 test/old-elf/X86_64/Inputs/rodata.c delete mode 100644 test/old-elf/X86_64/Inputs/rodata.o delete mode 100644 test/old-elf/X86_64/Inputs/rodata.s delete mode 100644 test/old-elf/X86_64/Inputs/rwint.c delete mode 100644 test/old-elf/X86_64/Inputs/rwint.o delete mode 100644 test/old-elf/X86_64/Inputs/sectionmap.c delete mode 100644 test/old-elf/X86_64/Inputs/sectionmap.o delete mode 100644 test/old-elf/X86_64/Inputs/undefcpp.c delete mode 100644 test/old-elf/X86_64/Inputs/undefcpp.o delete mode 100644 test/old-elf/X86_64/Inputs/weak-zero-sized.o delete mode 100644 test/old-elf/X86_64/Inputs/weak.c delete mode 100644 test/old-elf/X86_64/Inputs/weak.o delete mode 100644 test/old-elf/X86_64/Inputs/weak.s delete mode 100644 test/old-elf/X86_64/Inputs/zerosizedsection.o delete mode 100644 test/old-elf/X86_64/Inputs/zerosizedsection.s delete mode 100644 test/old-elf/X86_64/alignoffset.test delete mode 100644 test/old-elf/X86_64/debug.test delete mode 100644 test/old-elf/X86_64/defsym.test delete mode 100644 test/old-elf/X86_64/demangle.test delete mode 100644 test/old-elf/X86_64/dontignorezerosize-sections.test delete mode 100644 test/old-elf/X86_64/dynamicvars.test delete mode 100644 test/old-elf/X86_64/dynlib-nointerp-section.test delete mode 100644 test/old-elf/X86_64/dynlib-search.test delete mode 100644 test/old-elf/X86_64/dynsym-weak.test delete mode 100644 test/old-elf/X86_64/extern-tls.test delete mode 100644 test/old-elf/X86_64/general-dynamic-tls.test delete mode 100644 test/old-elf/X86_64/imagebase.test delete mode 100644 test/old-elf/X86_64/initfini-order.test delete mode 100644 test/old-elf/X86_64/initfini.test delete mode 100644 test/old-elf/X86_64/largebss.test delete mode 100644 test/old-elf/X86_64/layoutpass-order.test delete mode 100644 test/old-elf/X86_64/maxpagesize.test delete mode 100644 test/old-elf/X86_64/mergesimilarstrings.test delete mode 100644 test/old-elf/X86_64/multi-weak-layout.test delete mode 100644 test/old-elf/X86_64/multi-weak-override.test delete mode 100644 test/old-elf/X86_64/multi-weak-syms-order.test delete mode 100644 test/old-elf/X86_64/nmagic.test delete mode 100644 test/old-elf/X86_64/noalignsegments.test delete mode 100644 test/old-elf/X86_64/note-sections-ro_plus_rw.test delete mode 100644 test/old-elf/X86_64/note-sections.test delete mode 100644 test/old-elf/X86_64/omagic.test delete mode 100644 test/old-elf/X86_64/outputsegments.test delete mode 100644 test/old-elf/X86_64/reloc_r_x86_64_16.test delete mode 100644 test/old-elf/X86_64/reloc_r_x86_64_pc16.test delete mode 100644 test/old-elf/X86_64/reloc_r_x86_64_pc64.test delete mode 100644 test/old-elf/X86_64/rodata.test delete mode 100644 test/old-elf/X86_64/sectionchoice.test delete mode 100644 test/old-elf/X86_64/sectionmap.test delete mode 100644 test/old-elf/X86_64/startGroupEndGroup.test delete mode 100644 test/old-elf/X86_64/startGroupEndGroupWithDynlib.test delete mode 100644 test/old-elf/X86_64/staticlib-search.test delete mode 100644 test/old-elf/X86_64/undef.test delete mode 100644 test/old-elf/X86_64/underscore-end.test delete mode 100644 test/old-elf/X86_64/weak-override.test delete mode 100644 test/old-elf/X86_64/weak-zero-sized.test delete mode 100644 test/old-elf/X86_64/weaksym.test delete mode 100644 test/old-elf/X86_64/yamlinput.test delete mode 100644 test/old-elf/abs-dup.objtxt delete mode 100644 test/old-elf/abs.test delete mode 100644 test/old-elf/allowduplicates.objtxt delete mode 100644 test/old-elf/archive-elf-forceload.test delete mode 100644 test/old-elf/archive-elf.test delete mode 100644 test/old-elf/as-needed.test delete mode 100644 test/old-elf/branch.test delete mode 100644 test/old-elf/check.test delete mode 100644 test/old-elf/checkrodata.test delete mode 100644 test/old-elf/common.test delete mode 100644 test/old-elf/consecutive-weak-sym-defs.test delete mode 100644 test/old-elf/defsym.objtxt delete mode 100644 test/old-elf/discard-all.test delete mode 100644 test/old-elf/discard-locals.test delete mode 100644 test/old-elf/dynamic-segorder.test delete mode 100644 test/old-elf/dynamic-undef.test delete mode 100644 test/old-elf/dynamic.test delete mode 100644 test/old-elf/eh_frame_hdr.test delete mode 100644 test/old-elf/entry.objtxt delete mode 100644 test/old-elf/export-dynamic.test delete mode 100644 test/old-elf/filenotfound.test delete mode 100644 test/old-elf/gnulinkonce/gnulinkonce-report-discarded-reference.test delete mode 100644 test/old-elf/gnulinkonce/gnulinkonce-report-undef.test delete mode 100644 test/old-elf/gnulinkonce/gnulinkonce.test delete mode 100644 test/old-elf/gotpcrel.test delete mode 100644 test/old-elf/gottpoff.test delete mode 100644 test/old-elf/group-cmd-search.test delete mode 100644 test/old-elf/hexagon-quickdata-sort.test delete mode 100644 test/old-elf/hexagon-quickdata-sortcommon.test delete mode 100644 test/old-elf/ifunc.test delete mode 100644 test/old-elf/ignore-unknownoption.test delete mode 100644 test/old-elf/init_array-order.test delete mode 100644 test/old-elf/init_array.test delete mode 100644 test/old-elf/initfini-options.test-1.test delete mode 100644 test/old-elf/initfini-options.test-2.test delete mode 100644 test/old-elf/initfini-options.test-3.test delete mode 100644 test/old-elf/librarynotfound.test delete mode 100644 test/old-elf/linker-as-ld.test delete mode 100644 test/old-elf/linkerscript/Inputs/externs.ls delete mode 100644 test/old-elf/linkerscript/Inputs/invalid.ls delete mode 100644 test/old-elf/linkerscript/Inputs/prog1.o.yaml delete mode 100644 test/old-elf/linkerscript/Inputs/prog2.o.yaml delete mode 100644 test/old-elf/linkerscript/Inputs/prog3.o.yaml delete mode 100644 test/old-elf/linkerscript/Inputs/simple-pic.o.yaml delete mode 100644 test/old-elf/linkerscript/Inputs/simple.o.yaml delete mode 100644 test/old-elf/linkerscript/Inputs/valid.ls delete mode 100644 test/old-elf/linkerscript/externs.objtxt delete mode 100644 test/old-elf/linkerscript/filename-with-wildcards.test delete mode 100644 test/old-elf/linkerscript/invalid-script-cli-1.test delete mode 100644 test/old-elf/linkerscript/invalid-script-cli-2.test delete mode 100644 test/old-elf/linkerscript/invalid.test delete mode 100644 test/old-elf/linkerscript/phdrs-all-none.test delete mode 100644 test/old-elf/linkerscript/phdrs-custom-none.test delete mode 100644 test/old-elf/linkerscript/phdrs-default.test delete mode 100644 test/old-elf/linkerscript/phdrs-different.test delete mode 100644 test/old-elf/linkerscript/phdrs-extra-program.test delete mode 100644 test/old-elf/linkerscript/phdrs-flags.test delete mode 100644 test/old-elf/linkerscript/phdrs-has-program.test delete mode 100644 test/old-elf/linkerscript/phdrs-invalid.test delete mode 100644 test/old-elf/linkerscript/phdrs-misplaced-program.test delete mode 100644 test/old-elf/linkerscript/phdrs-no-program.test delete mode 100644 test/old-elf/linkerscript/phdrs-one-none.test delete mode 100644 test/old-elf/linkerscript/phdrs-program-flags.test delete mode 100644 test/old-elf/linkerscript/phdrs-program-good-phdrs.test delete mode 100644 test/old-elf/linkerscript/phdrs-program-no-phdrs.test delete mode 100644 test/old-elf/linkerscript/phdrs-program-wrong-phdrs.test delete mode 100644 test/old-elf/linkerscript/phdrs-same-flags.test delete mode 100644 test/old-elf/linkerscript/phdrs-same.test delete mode 100644 test/old-elf/linkerscript/phdrs/sections-empty-phdrs.script delete mode 100644 test/old-elf/linkerscript/phdrs/sections-no-phdrs.script delete mode 100644 test/old-elf/linkerscript/phdrs/sections-none-phdrs.script delete mode 100644 test/old-elf/linkerscript/phdrs/undef-empty-phdrs.script delete mode 100644 test/old-elf/linkerscript/phdrs/undef-id-phdrs.script delete mode 100644 test/old-elf/linkerscript/phdrs/undef-no-phdrs.script delete mode 100644 test/old-elf/linkerscript/sections-order.test delete mode 100644 test/old-elf/linkerscript/sections-with-wildcards.test delete mode 100644 test/old-elf/linkerscript/symbol-definition-so.test delete mode 100644 test/old-elf/linkerscript/symbol-definition.test delete mode 100644 test/old-elf/linkerscript/valid-script-cli.objtxt delete mode 100644 test/old-elf/loginputfiles.test delete mode 100644 test/old-elf/mergeatoms.test delete mode 100644 test/old-elf/mergeconstants.test delete mode 100644 test/old-elf/mergeglobalatoms.test delete mode 100644 test/old-elf/no-unique-section-names.test delete mode 100644 test/old-elf/note.test delete mode 100644 test/old-elf/options/dynamic-linker.test delete mode 100644 test/old-elf/options/target-specific-args.test delete mode 100644 test/old-elf/phdr.test delete mode 100644 test/old-elf/quickdata.test delete mode 100644 test/old-elf/reloc.test delete mode 100644 test/old-elf/responsefile.test delete mode 100644 test/old-elf/rodata.test delete mode 100644 test/old-elf/rosegment.test delete mode 100644 test/old-elf/sectionGroups/sectiongroup-new-members.test delete mode 100644 test/old-elf/sectionGroups/sectiongroup-simple.test delete mode 100644 test/old-elf/sectionGroups/sectiongroup-undef-member-other.test delete mode 100644 test/old-elf/sectionGroups/sectiongroup-undef-member.test delete mode 100644 test/old-elf/sectionGroups/sectiongroup-with-globalsymbols.test delete mode 100644 test/old-elf/sectionGroups/sectiongroup-with-undef-external-reference.test delete mode 100644 test/old-elf/sectionGroups/sectiongroup-with-undef-signature.test delete mode 100644 test/old-elf/sections.test delete mode 100644 test/old-elf/sh_addralign.test delete mode 100644 test/old-elf/shndx.test delete mode 100644 test/old-elf/soname.test delete mode 100644 test/old-elf/start-stop-sym.test delete mode 100644 test/old-elf/strip-all.test delete mode 100644 test/old-elf/stripped-empty.test delete mode 100644 test/old-elf/symbols.test delete mode 100644 test/old-elf/tls-tbss-size.test delete mode 100644 test/old-elf/tls.test delete mode 100644 test/old-elf/tlsAddr.test delete mode 100644 test/old-elf/undef-from-dso-to-main.test delete mode 100644 test/old-elf/undef-from-main-dso.test delete mode 100644 test/old-elf/weaksym.test delete mode 100644 test/old-elf/wrap.test delete mode 100644 test/old-elf/x86-64-dynamic-relocs.test delete mode 100644 test/old-elf/x86-64-dynamic.test delete mode 100644 test/old-elf/x86.test delete mode 100644 test/old-elf/x86_64-kinds.test delete mode 100644 test/old-elf/zoption_dtflags.test (limited to 'test') diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b92489e2cc8d..88cd128fc4c7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -20,9 +20,9 @@ configure_lit_site_cfg( ) set(LLD_TEST_DEPS - FileCheck not llvm-ar llvm-as llvm-nm llc + FileCheck not llvm-ar llvm-as llvm-dis llvm-nm llc lld llvm-config llvm-objdump llvm-readobj yaml2obj obj2yaml - linker-script-test llvm-mc llvm-nm llvm-lib + llvm-mc llvm-nm llvm-lib ) if (LLVM_INCLUDE_TESTS) set(LLD_TEST_DEPS ${LLD_TEST_DEPS} LLDUnitTests) diff --git a/test/COFF/Inputs/armnt-executable.obj.yaml b/test/COFF/Inputs/armnt-executable.obj.yaml index 33b2c886b860..5c42b9009dab 100644 --- a/test/COFF/Inputs/armnt-executable.obj.yaml +++ b/test/COFF/Inputs/armnt-executable.obj.yaml @@ -1,4 +1,4 @@ ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_ARMNT Characteristics: [] diff --git a/test/COFF/Inputs/export.yaml b/test/COFF/Inputs/export.yaml index 25b57288a1bf..1ccf0909a953 100644 --- a/test/COFF/Inputs/export.yaml +++ b/test/COFF/Inputs/export.yaml @@ -1,4 +1,4 @@ ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] @@ -9,7 +9,7 @@ sections: SectionData: B800000000506800000000680000000050E80000000050E800000000 - Name: .drectve Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ] - Alignment: 2147483648 + Alignment: 1 SectionData: 2f6578706f72743a6578706f7274666e3300 # /export:exportfn3 symbols: - Name: .text diff --git a/test/COFF/Inputs/export2.yaml b/test/COFF/Inputs/export2.yaml index 592b76526ffa..37fa4c751b90 100644 --- a/test/COFF/Inputs/export2.yaml +++ b/test/COFF/Inputs/export2.yaml @@ -1,4 +1,4 @@ ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/Inputs/hello32.yaml b/test/COFF/Inputs/hello32.yaml index ea5a5c84c4f1..09e76f144532 100644 --- a/test/COFF/Inputs/hello32.yaml +++ b/test/COFF/Inputs/hello32.yaml @@ -1,4 +1,4 @@ ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_I386 Characteristics: [] diff --git a/test/COFF/Inputs/import.yaml b/test/COFF/Inputs/import.yaml index 2c5fdc545b48..493400143d6c 100644 --- a/test/COFF/Inputs/import.yaml +++ b/test/COFF/Inputs/import.yaml @@ -1,4 +1,4 @@ ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/Inputs/include1a.yaml b/test/COFF/Inputs/include1a.yaml index 7fca9833cb7b..f61e0e0877ec 100644 --- a/test/COFF/Inputs/include1a.yaml +++ b/test/COFF/Inputs/include1a.yaml @@ -1,4 +1,4 @@ ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] @@ -9,7 +9,7 @@ sections: SectionData: B800000000506800000000680000000050E80000000050E800000000 - Name: .drectve Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ] - Alignment: 2147483648 + Alignment: 1 SectionData: 2f696e636c7564653a666f6f00 # /include:foo symbols: - Name: .text diff --git a/test/COFF/Inputs/include1b.yaml b/test/COFF/Inputs/include1b.yaml index e4151be27cc3..78d1b92de8cc 100644 --- a/test/COFF/Inputs/include1b.yaml +++ b/test/COFF/Inputs/include1b.yaml @@ -1,4 +1,4 @@ ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] @@ -9,7 +9,7 @@ sections: SectionData: B800000000506800000000680000000050E80000000050E800000000 - Name: .drectve Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ] - Alignment: 2147483648 + Alignment: 1 SectionData: 2f696e636c7564653a62617200 # /include:bar symbols: - Name: .text diff --git a/test/COFF/Inputs/include1c.yaml b/test/COFF/Inputs/include1c.yaml index 78dd29659e22..6cf9db6e3185 100644 --- a/test/COFF/Inputs/include1c.yaml +++ b/test/COFF/Inputs/include1c.yaml @@ -1,4 +1,4 @@ ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/Inputs/machine-x64.yaml b/test/COFF/Inputs/machine-x64.yaml index d70e0808a2e1..36bdfe6d14c3 100644 --- a/test/COFF/Inputs/machine-x64.yaml +++ b/test/COFF/Inputs/machine-x64.yaml @@ -1,4 +1,4 @@ ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/Inputs/machine-x86.yaml b/test/COFF/Inputs/machine-x86.yaml index 6b6cfae09c57..197143bde2e9 100644 --- a/test/COFF/Inputs/machine-x86.yaml +++ b/test/COFF/Inputs/machine-x86.yaml @@ -1,4 +1,4 @@ ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_I386 Characteristics: [] diff --git a/test/COFF/Inputs/manifestinput.test b/test/COFF/Inputs/manifestinput.test new file mode 100644 index 000000000000..c65739225a59 --- /dev/null +++ b/test/COFF/Inputs/manifestinput.test @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/test/COFF/Inputs/ret42.yaml b/test/COFF/Inputs/ret42.yaml index 2b38cc7f0d6b..b98090166415 100644 --- a/test/COFF/Inputs/ret42.yaml +++ b/test/COFF/Inputs/ret42.yaml @@ -1,4 +1,4 @@ ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/alternatename.test b/test/COFF/alternatename.test index 5b9dc470af16..1be61adb1850 100644 --- a/test/COFF/alternatename.test +++ b/test/COFF/alternatename.test @@ -10,7 +10,7 @@ # RUN: yaml2obj < %s > %t.obj # RUN: lld-link /entry:foo /subsystem:console /out:%t.exe %t.obj ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] @@ -25,7 +25,7 @@ sections: SectionData: '' - Name: .drectve Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ] - Alignment: 2147483648 + Alignment: 1 SectionData: 2f616c7465726e6174656e616d653a666f6f3d6d61696e00 # /alternatename:foo=main symbols: - Name: '.text$mn' diff --git a/test/COFF/ar-comdat.test b/test/COFF/ar-comdat.test index af7d732ea3c0..5420b5be3dd5 100644 --- a/test/COFF/ar-comdat.test +++ b/test/COFF/ar-comdat.test @@ -6,7 +6,7 @@ # CHECK-NOT: .lib ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [ ] diff --git a/test/COFF/armnt-blx23t.test b/test/COFF/armnt-blx23t.test index fdc2bf51afb3..5caf6ebaa127 100644 --- a/test/COFF/armnt-blx23t.test +++ b/test/COFF/armnt-blx23t.test @@ -25,7 +25,7 @@ # AFTER: 1010: 01 30 adds r0, #1 # AFTER: 1012: bd e8 00 88 pop.w {r11, pc} ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_ARMNT Characteristics: [ ] diff --git a/test/COFF/armnt-branch24t.test b/test/COFF/armnt-branch24t.test index 358b603303b3..6e1114c94a18 100644 --- a/test/COFF/armnt-branch24t.test +++ b/test/COFF/armnt-branch24t.test @@ -18,7 +18,7 @@ # AFTER: 1004: 20 20 movs r0, #32 # AFTER: 1006: ff f7 fb bf b.w #-10 ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_ARMNT Characteristics: [] diff --git a/test/COFF/armnt-imports.test b/test/COFF/armnt-imports.test index 3842259a7a72..519886eb0c06 100644 --- a/test/COFF/armnt-imports.test +++ b/test/COFF/armnt-imports.test @@ -10,7 +10,7 @@ # CHECK: Symbol: function (0) # CHECK: } ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_ARMNT Characteristics: [ ] diff --git a/test/COFF/armnt-mov32t-exec.test b/test/COFF/armnt-mov32t-exec.test index 7fa9952e9547..629f0620730d 100644 --- a/test/COFF/armnt-mov32t-exec.test +++ b/test/COFF/armnt-mov32t-exec.test @@ -19,7 +19,7 @@ # AFTER: 1008: c0 f2 40 00 movt r0, #64 # AFTER: 100c: 70 47 bx lr ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_ARMNT Characteristics: [ ] diff --git a/test/COFF/armnt-movt32t.test b/test/COFF/armnt-movt32t.test index be292cb39300..6a9bf256e335 100644 --- a/test/COFF/armnt-movt32t.test +++ b/test/COFF/armnt-movt32t.test @@ -15,7 +15,7 @@ # AFTER: 4: c0 f2 40 00 movt r0, #64 # AFTER: 8: 70 47 bx lr ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_ARMNT Characteristics: [ ] diff --git a/test/COFF/base.test b/test/COFF/base.test index f03e321fc23a..662632bf9076 100644 --- a/test/COFF/base.test +++ b/test/COFF/base.test @@ -16,7 +16,7 @@ # BASE-TEXT: Contents of section .text: # BASE-TEXT-NEXT: 1000 00000080 02000000 ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/baserel.test b/test/COFF/baserel.test index bac9c22cbc3d..ce0b27621caf 100644 --- a/test/COFF/baserel.test +++ b/test/COFF/baserel.test @@ -72,7 +72,7 @@ # BASEREL-HEADER-NEXT: IMAGE_SCN_MEM_READ (0x40000000) # BASEREL-HEADER-NEXT: ] ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/common.test b/test/COFF/common.test index de25848674ed..d57ced457d10 100644 --- a/test/COFF/common.test +++ b/test/COFF/common.test @@ -9,7 +9,7 @@ # CHECK: 300f: b8 60 10 00 40 # CHECK: 3014: b8 80 10 00 40 ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/conflict.test b/test/COFF/conflict.test index 3d5725ab79ee..65dda51f498d 100644 --- a/test/COFF/conflict.test +++ b/test/COFF/conflict.test @@ -10,7 +10,7 @@ # CHECK: duplicate symbol: foo {{.+}}1.obj and foo {{.+}}2.obj ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/debug.test b/test/COFF/debug.test index 52e0f60fe3f5..3921e0ccbb33 100644 --- a/test/COFF/debug.test +++ b/test/COFF/debug.test @@ -1,7 +1,7 @@ # RUN: yaml2obj %s > %t.obj # RUN: lld-link /out:%t.exe /entry:main /subsystem:console %t.obj ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/dllorder.test b/test/COFF/dllorder.test deleted file mode 100644 index 417483d33086..000000000000 --- a/test/COFF/dllorder.test +++ /dev/null @@ -1,65 +0,0 @@ -# REQUIRES: winlib - -# RUN: yaml2obj < %s > %t.obj -# RUN: mkdir -p %tlib -# RUN: rm -f %tlib/lib1.lib -# RUN: rm -f %tlib/lib2.lib - -# RUN: echo EXPORTS sym1 > %t1.def -# RUN: echo EXPORTS sym2 > %t2.def -# RUN: lib /nologo /machine:amd64 /def:%t1.def /out:%tlib\lib1.lib -# RUN: lib /nologo /machine:amd64 /def:%t2.def /out:%tlib\lib2.lib - -# RUN: lld-link /out:%t1.exe /entry:main /libpath:%tlib %t.obj /defaultlib:lib1 /defaultlib:lib2 -# RUN: lld-link /out:%t2.exe /entry:main /libpath:%tlib %t.obj /defaultlib:lib2 /defaultlib:lib1 - -# RUN: llvm-readobj -coff-imports %t1.exe | FileCheck -check-prefix=CHECK1 %s -# RUN: llvm-readobj -coff-imports %t2.exe | FileCheck -check-prefix=CHECK2 %s - -# CHECK1: Name: dllorder.test.tmp1.dll -# CHECK1: Name: dllorder.test.tmp2.dll - -# CHECK2: Name: dllorder.test.tmp2.dll -# CHECK2: Name: dllorder.test.tmp1.dll - ---- -header: - Machine: IMAGE_FILE_MACHINE_AMD64 - Characteristics: [] -sections: - - Name: .text - Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] - Alignment: 4096 - SectionData: 0000000000000000 -symbols: - - Name: .text - Value: 0 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - SectionDefinition: - Length: 8 - NumberOfRelocations: 0 - NumberOfLinenumbers: 0 - CheckSum: 0 - Number: 0 - - Name: main - Value: 0 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: __imp_sym1 - Value: 0 - SectionNumber: 0 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: __imp_sym2 - Value: 0 - SectionNumber: 0 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_EXTERNAL -... diff --git a/test/COFF/entry-inference.test b/test/COFF/entry-inference.test index 2063f28edc77..2eb9a6863983 100644 --- a/test/COFF/entry-inference.test +++ b/test/COFF/entry-inference.test @@ -19,7 +19,7 @@ # WINMAIN: : undefined symbol: WinMainCRTStartup # WWINMAIN: : undefined symbol: wWinMainCRTStartup ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/entry-inference2.test b/test/COFF/entry-inference2.test index afac80859d10..a66422fbabe2 100644 --- a/test/COFF/entry-inference2.test +++ b/test/COFF/entry-inference2.test @@ -4,7 +4,7 @@ # CHECK: Entry name inferred: WinMainCRTStartup ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] @@ -15,7 +15,7 @@ sections: SectionData: B82A000000C3 - Name: .drectve Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ] - Alignment: 2147483648 + Alignment: 1 SectionData: 2f616c7465726e6174656e616d653a6d61696e3d57696e4d61696e00 # /alternatename:main=WinMain symbols: - Name: .text diff --git a/test/COFF/entry-inference32.test b/test/COFF/entry-inference32.test index 6e1a5f925180..231b468b47f6 100644 --- a/test/COFF/entry-inference32.test +++ b/test/COFF/entry-inference32.test @@ -4,7 +4,7 @@ # CHECK: Entry name inferred: _WinMainCRTStartup ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_I386 Characteristics: [] diff --git a/test/COFF/entry-mangled.test b/test/COFF/entry-mangled.test index 41620336513e..acf54ba07973 100644 --- a/test/COFF/entry-mangled.test +++ b/test/COFF/entry-mangled.test @@ -3,7 +3,7 @@ # RUN: llvm-as -o %t.lto.obj %S/Inputs/entry-mangled.ll # RUN: lld-link /out:%t.exe /entry:main %t.lto.obj ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/export32.test b/test/COFF/export32.test index 5d7b2708dcba..86cd27bb9af6 100644 --- a/test/COFF/export32.test +++ b/test/COFF/export32.test @@ -74,7 +74,7 @@ # CHECK6: duplicate /export option: _exportfn2 # CHECK6-NOT: duplicate /export option: _exportfn1 ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_I386 Characteristics: [] @@ -85,7 +85,7 @@ sections: SectionData: B800000000506800000000680000000050E80000000050E800000000 - Name: .drectve Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ] - Alignment: 2147483648 + Alignment: 1 SectionData: 2f6578706f72743a5f6578706f7274666e3300 # /export:_exportfn3 symbols: - Name: .text diff --git a/test/COFF/force.test b/test/COFF/force.test index 44e5722dab5d..80bd275558f6 100644 --- a/test/COFF/force.test +++ b/test/COFF/force.test @@ -6,7 +6,7 @@ # CHECK: .obj: undefined symbol: foo ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/icf-circular.test b/test/COFF/icf-circular.test index 7319e135e2e6..c1135660a780 100644 --- a/test/COFF/icf-circular.test +++ b/test/COFF/icf-circular.test @@ -6,7 +6,7 @@ # CHECK: Selected foo # CHECK: Removed bar ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/icf-circular2.test b/test/COFF/icf-circular2.test index e7598c124365..3b8eb8f424ac 100644 --- a/test/COFF/icf-circular2.test +++ b/test/COFF/icf-circular2.test @@ -6,7 +6,7 @@ # CHECK: Selected foo # CHECK: Removed bar ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/icf-different-align.test b/test/COFF/icf-different-align.test index 6876048a5d40..3502ed3449a4 100644 --- a/test/COFF/icf-different-align.test +++ b/test/COFF/icf-different-align.test @@ -6,7 +6,7 @@ # CHECK-NOT: Selected foo # CHECK-NOT: Removed bar ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/icf-local.test b/test/COFF/icf-local.test index a0b4c91559a3..db690b8dc813 100644 --- a/test/COFF/icf-local.test +++ b/test/COFF/icf-local.test @@ -8,7 +8,7 @@ # CHECK-NOT: Removed bar ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/icf-simple.test b/test/COFF/icf-simple.test index ae72fd9d9d73..c302c8796a95 100644 --- a/test/COFF/icf-simple.test +++ b/test/COFF/icf-simple.test @@ -16,7 +16,7 @@ # NOICF-NOT: Removed foo # NOICF-NOT: Removed bar ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/imports-mangle.test b/test/COFF/imports-mangle.test index 35b385559005..5d8ccae23009 100644 --- a/test/COFF/imports-mangle.test +++ b/test/COFF/imports-mangle.test @@ -10,7 +10,7 @@ # CHECK: Symbol: (2) # CHECK: } ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/include.test b/test/COFF/include.test index b9e5f49b4fb6..e7b0c58d5a19 100644 --- a/test/COFF/include.test +++ b/test/COFF/include.test @@ -14,7 +14,7 @@ # CHECK2-NOT: Discarded unused # CHECK2-NOT: Discarded used ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] @@ -33,7 +33,7 @@ sections: SectionData: B82A000000C3 - Name: .drectve Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ] - Alignment: 2147483648 + Alignment: 1 SectionData: 2f696e636c7564653a7573656400 # /include:used symbols: - Name: '.text$mn' diff --git a/test/COFF/internal.test b/test/COFF/internal.test index 80a5332847de..bc958cb4bd19 100644 --- a/test/COFF/internal.test +++ b/test/COFF/internal.test @@ -5,7 +5,7 @@ # RUN: yaml2obj < %p/Inputs/ret42.yaml > %t3.obj # RUN: lld-link /out:%t.exe /entry:main %t1.obj %t2.obj %t3.obj ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/invalid-obj.test b/test/COFF/invalid-obj.test index fd63f7874cc1..6f76c3702aa7 100644 --- a/test/COFF/invalid-obj.test +++ b/test/COFF/invalid-obj.test @@ -3,7 +3,7 @@ # CHECK: getSectionName failed: #1: ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/loadcfg.ll b/test/COFF/loadcfg.ll index 3166881032b4..c49ae2f6ebd5 100644 --- a/test/COFF/loadcfg.ll +++ b/test/COFF/loadcfg.ll @@ -8,7 +8,7 @@ target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-windows-msvc" -@_load_config_used = constant i32 1 +@_load_config_used = constant [28 x i32] [i32 112, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0] define void @main() { ret void diff --git a/test/COFF/loadcfg.test b/test/COFF/loadcfg.test index a84f864b4b53..b74917f15707 100644 --- a/test/COFF/loadcfg.test +++ b/test/COFF/loadcfg.test @@ -2,10 +2,10 @@ # RUN: lld-link /out:%t.exe %t.obj /entry:main /subsystem:console # RUN: llvm-readobj -file-headers %t.exe | FileCheck %s -# CHECK: LoadConfigTableRVA: 0x1008 +# CHECK: LoadConfigTableRVA: 0x1000 # CHECK: LoadConfigTableSize: 0x70 ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] @@ -18,6 +18,10 @@ sections: Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] Alignment: 4 SectionData: B82A000000C3 + - Name: .rdata + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] + Alignment: 16 + SectionData: '70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' symbols: - Name: .text Value: 0 @@ -50,9 +54,21 @@ symbols: SimpleType: IMAGE_SYM_TYPE_NULL ComplexType: IMAGE_SYM_DTYPE_NULL StorageClass: IMAGE_SYM_CLASS_EXTERNAL + - Name: .rdata + Value: 0 + SectionNumber: 3 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 112 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 3 - Name: _load_config_used Value: 0 - SectionNumber: 2 + SectionNumber: 3 SimpleType: IMAGE_SYM_TYPE_NULL ComplexType: IMAGE_SYM_DTYPE_NULL StorageClass: IMAGE_SYM_CLASS_EXTERNAL diff --git a/test/COFF/loadcfg32.test b/test/COFF/loadcfg32.test index f7780e1d0373..03a066c1e552 100644 --- a/test/COFF/loadcfg32.test +++ b/test/COFF/loadcfg32.test @@ -5,7 +5,7 @@ # CHECK: LoadConfigTableRVA: 0x1000 # CHECK: LoadConfigTableSize: 0x40 ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_I386 Characteristics: [] @@ -14,6 +14,10 @@ sections: Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] Alignment: 4 SectionData: B82A000000C3 + - Name: .rdata + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] + Alignment: 4 + SectionData: '40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' symbols: - Name: .text Value: 0 @@ -33,9 +37,21 @@ symbols: SimpleType: IMAGE_SYM_TYPE_NULL ComplexType: IMAGE_SYM_DTYPE_NULL StorageClass: IMAGE_SYM_CLASS_EXTERNAL + - Name: .rdata + Value: 0 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 64 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 2 - Name: __load_config_used Value: 0 - SectionNumber: 1 + SectionNumber: 2 SimpleType: IMAGE_SYM_TYPE_NULL ComplexType: IMAGE_SYM_DTYPE_NULL StorageClass: IMAGE_SYM_CLASS_EXTERNAL diff --git a/test/COFF/locally-imported.test b/test/COFF/locally-imported.test index 7c43666c8c1e..a10da4b11bcb 100644 --- a/test/COFF/locally-imported.test +++ b/test/COFF/locally-imported.test @@ -19,7 +19,7 @@ # BASEREL-NEXT: } # BASEREL-NEXT: ] ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/locally-imported32.test b/test/COFF/locally-imported32.test index 7f604d2a0495..789c8c8f8094 100644 --- a/test/COFF/locally-imported32.test +++ b/test/COFF/locally-imported32.test @@ -8,7 +8,7 @@ # CHECK: Contents of section .rdata: # CHECK-NEXT: 2000 04104000 ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_I386 Characteristics: [] diff --git a/test/COFF/long-section-name.test b/test/COFF/long-section-name.test index a3dad33ec2cf..1de329db0296 100644 --- a/test/COFF/long-section-name.test +++ b/test/COFF/long-section-name.test @@ -5,7 +5,7 @@ # CHECK: Name: .data_long_section_name # CHECK: Name: .text_long_section_name ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [ ] diff --git a/test/COFF/manifestinput.test b/test/COFF/manifestinput.test new file mode 100644 index 000000000000..376d404d604c --- /dev/null +++ b/test/COFF/manifestinput.test @@ -0,0 +1,10 @@ +# REQUIRES: winres + +# RUN: yaml2obj %p/Inputs/ret42.yaml > %t.obj +# RUN: lld-link /out:%t.exe /entry:main \ +# RUN: /manifestuac:"level='requireAdministrator'" \ +# RUN: /manifestinput:%p/Inputs/manifestinput.test %t.obj +# RUN: FileCheck %s < %t.exe.manifest + +CHECK: +CHECK: diff --git a/test/COFF/merge.test b/test/COFF/merge.test index 45ab4efe37a8..4b5c1007f9fb 100644 --- a/test/COFF/merge.test +++ b/test/COFF/merge.test @@ -6,7 +6,7 @@ # CHECK: Name: .def # CHECK: Name: .abc ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/opt.test b/test/COFF/opt.test index 652734b2f68a..a8b0e2eb97ba 100644 --- a/test/COFF/opt.test +++ b/test/COFF/opt.test @@ -14,7 +14,7 @@ # CHECK1: Discarded unused # CHECK2-NOT: Discarded unused ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/out.test b/test/COFF/out.test index a216fc9add8f..67b2ef01b711 100644 --- a/test/COFF/out.test +++ b/test/COFF/out.test @@ -1,3 +1,4 @@ +# REQUIRES: winres # RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj # RUN: mkdir -p %T/out/tmp @@ -5,12 +6,13 @@ # RUN: cp %t.obj %T/out/tmp/out2 # RUN: cp %t.obj %T/out/tmp/out3.xyz +# RUN: rm -f out1.exe out2.exe out3.exe out3.dll # RUN: lld-link /entry:main %T/out/out1.obj # RUN: lld-link /entry:main %T/out/tmp/out2 -# RUN: lld-link /entry:main %T/out/tmp/out3.xyz +# RUN: lld-link /dll /entry:main %T/out/tmp/out3.xyz # RUN: llvm-readobj out1.exe | FileCheck %s # RUN: llvm-readobj out2.exe | FileCheck %s -# RUN: llvm-readobj out3.exe | FileCheck %s +# RUN: llvm-readobj out3.dll | FileCheck %s CHECK: File: diff --git a/test/COFF/reloc-arm.test b/test/COFF/reloc-arm.test index b44c0822bb7f..11b863d4390b 100644 --- a/test/COFF/reloc-arm.test +++ b/test/COFF/reloc-arm.test @@ -11,7 +11,7 @@ # CHECK: 402050 fe07d62f 00000000 00000000 00000000 # CHECK: 402060 00000000 00000000 00000000 00000000 ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_ARMNT Characteristics: [] diff --git a/test/COFF/reloc-x64.test b/test/COFF/reloc-x64.test index 5513f2eaa647..7af8fb24bd38 100644 --- a/test/COFF/reloc-x64.test +++ b/test/COFF/reloc-x64.test @@ -15,7 +15,7 @@ # CHECK: 1051: a1 02 00 00 00 00 00 00 00 # CHECK: 105a: a1 03 00 00 00 00 00 00 00 ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/reloc-x86.test b/test/COFF/reloc-x86.test index d189ca02f015..5e1406913756 100644 --- a/test/COFF/reloc-x86.test +++ b/test/COFF/reloc-x86.test @@ -10,7 +10,7 @@ # CHECK: 1014: a1 00 00 02 00 # CHECK: 1019: a1 03 00 00 00 ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_I386 Characteristics: [] diff --git a/test/COFF/safeseh.test b/test/COFF/safeseh.test index f8308a6131b6..ed928a51350a 100644 --- a/test/COFF/safeseh.test +++ b/test/COFF/safeseh.test @@ -8,7 +8,7 @@ # CHECK: /safeseh: {{.*}} is not compatible with SEH ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_I386 Characteristics: [ ] diff --git a/test/COFF/section.test b/test/COFF/section.test new file mode 100644 index 000000000000..591c04dde73f --- /dev/null +++ b/test/COFF/section.test @@ -0,0 +1,62 @@ +# RUN: yaml2obj < %s > %t.obj +# RUN: lld-link /out:%t.exe /entry:main /subsystem:console /force \ +# RUN: /section:.foo,r %t.obj +# RUN: llvm-readobj -sections %t.exe | FileCheck -check-prefix=R %s + +# RUN: lld-link /out:%t.exe /entry:main /subsystem:console /force \ +# RUN: /section:.foo,w %t.obj +# RUN: llvm-readobj -sections %t.exe | FileCheck -check-prefix=W %s + +# RUN: lld-link /out:%t.exe /entry:main /subsystem:console /force \ +# RUN: /section:.foo,e %t.obj +# RUN: llvm-readobj -sections %t.exe | FileCheck -check-prefix=E %s + +# RUN: lld-link /out:%t.exe /entry:main /subsystem:console /force \ +# RUN: /section:.foo,s %t.obj +# RUN: llvm-readobj -sections %t.exe | FileCheck -check-prefix=S %s + +# R: Characteristics [ +# R-NEXT: IMAGE_SCN_MEM_READ +# R-NEXT: ] + +# W: Characteristics [ +# W-NEXT: IMAGE_SCN_MEM_WRITE +# W-NEXT: ] + +# E: Characteristics [ +# E-NEXT: IMAGE_SCN_MEM_EXECUTE +# E-NEXT: ] + +# S: Characteristics [ +# S-NEXT: IMAGE_SCN_MEM_SHARED +# S-NEXT: ] + +--- !COFF +header: + Machine: IMAGE_FILE_MACHINE_AMD64 + Characteristics: [] +sections: + - Name: .foo + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] + Alignment: 4 + SectionData: 000000000000 +symbols: + - Name: .foo + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 6 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: main + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL +... diff --git a/test/COFF/seh.test b/test/COFF/seh.test index b3ff66cf09b8..f2d0af76a965 100644 --- a/test/COFF/seh.test +++ b/test/COFF/seh.test @@ -5,7 +5,7 @@ # CHECK: Contents of section .rdata: # CHECK: 1000 00200000 02200000 ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_I386 Characteristics: [ ] diff --git a/test/COFF/sort-debug.test b/test/COFF/sort-debug.test index c099f2dc19b1..b04b41ad1c23 100644 --- a/test/COFF/sort-debug.test +++ b/test/COFF/sort-debug.test @@ -11,7 +11,7 @@ # CHECK: Name: .reloc ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_I386 Characteristics: [ ] diff --git a/test/COFF/subsystem-inference.test b/test/COFF/subsystem-inference.test index da4f573c2e02..231fd5491120 100644 --- a/test/COFF/subsystem-inference.test +++ b/test/COFF/subsystem-inference.test @@ -19,7 +19,7 @@ # WINMAIN: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_GUI # WWINMAIN: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_GUI ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/symtab.test b/test/COFF/symtab.test index 14ae9a3e816c..51eb3a374c59 100644 --- a/test/COFF/symtab.test +++ b/test/COFF/symtab.test @@ -111,7 +111,7 @@ # NO: Symbols [ ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/tls.test b/test/COFF/tls.test index 395916dfdd67..a577fe832fb9 100644 --- a/test/COFF/tls.test +++ b/test/COFF/tls.test @@ -5,7 +5,7 @@ # CHECK: TLSTableRVA: 0x1000 # CHECK: TLSTableSize: 0x28 ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [] diff --git a/test/COFF/tls32.test b/test/COFF/tls32.test index 4fe020eb9e10..fa39614f121e 100644 --- a/test/COFF/tls32.test +++ b/test/COFF/tls32.test @@ -3,9 +3,9 @@ # RUN: llvm-readobj -file-headers %t.exe | FileCheck %s # CHECK: TLSTableRVA: 0x1000 -# CHECK: TLSTableSize: 0x28 +# CHECK: TLSTableSize: 0x18 ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_I386 Characteristics: [] diff --git a/test/COFF/unwind.test b/test/COFF/unwind.test index 48e94165b9bd..2415b0542ca5 100644 --- a/test/COFF/unwind.test +++ b/test/COFF/unwind.test @@ -55,7 +55,7 @@ # UNWIND: 0x07: UOP_AllocLarge 8190 # UNWIND: 0x00: UOP_PushMachFrame w/o error code ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [ ] diff --git a/test/COFF/weak-external.test b/test/COFF/weak-external.test index 3997170b897a..e422b2e62761 100644 --- a/test/COFF/weak-external.test +++ b/test/COFF/weak-external.test @@ -8,7 +8,7 @@ # CHECK-NOT: : # CHECK: {{ g$}} ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [ ] diff --git a/test/COFF/weak-external2.test b/test/COFF/weak-external2.test index 6afaac29219d..30101d73096b 100644 --- a/test/COFF/weak-external2.test +++ b/test/COFF/weak-external2.test @@ -2,7 +2,7 @@ # RUN: llvm-as -o %t.lto.obj %S/Inputs/weak-external2.ll # RUN: lld-link /out:%t.exe /entry:g /subsystem:console %t.obj %t.lto.obj ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [ ] diff --git a/test/COFF/weak-external3.test b/test/COFF/weak-external3.test index 9ba32982d505..05ff859993a3 100644 --- a/test/COFF/weak-external3.test +++ b/test/COFF/weak-external3.test @@ -13,7 +13,7 @@ # CHECK2-NOT: : # CHECK2: {{ f$}} ---- +--- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64 Characteristics: [ ] diff --git a/test/Driver/def-lib-search.test b/test/Driver/def-lib-search.test deleted file mode 100644 index 15d5dbbea9ff..000000000000 --- a/test/Driver/def-lib-search.test +++ /dev/null @@ -1,8 +0,0 @@ -# Check that search paths explicitly provided by the -L option -# are used in search before default paths. - -RUN: not lld -flavor old-gnu -target x86_64 -t -ltest \ -RUN: --sysroot=%p/Inputs -L%p/Inputs 2> %t -RUN: FileCheck %s < %t - -CHECK: {{[^ ]+}}{{[\\/]}}Inputs{{[\\/]}}libtest.a diff --git a/test/Driver/flavor-option.test b/test/Driver/flavor-option.test deleted file mode 100644 index 2471bc09519b..000000000000 --- a/test/Driver/flavor-option.test +++ /dev/null @@ -1,8 +0,0 @@ -# a) the -flavor option is position independent and does not need to be the 1st -# argument in the command line (bug 20975); -# b) UniversalDriver correctly removes -flavor along with its value and the -# underlying linker does not get a corrupted command line (bug 20977). -RUN: lld --help -flavor old-gnu | FileCheck %s - -CHECK: --noinhibit-exec -CHECK: --output-filetype diff --git a/test/Driver/lib-search.test b/test/Driver/lib-search.test deleted file mode 100644 index 255b17b1a55e..000000000000 --- a/test/Driver/lib-search.test +++ /dev/null @@ -1,24 +0,0 @@ -RUN: not lld -flavor old-gnu -t -ltest -L%p/Inputs 2> %t.err -RUN: FileCheck %s < %t.err - -RUN: not lld -flavor old-gnu -target x86_64--netbsd -t -ltest \ -RUN: --sysroot=%p/Inputs 2> %t2 -RUN: FileCheck -check-prefix=NETBSD-AMD64 %s < %t2 -RUN: not lld -flavor old-gnu -target x86_64--netbsd -nostdlib -t -ltest \ -RUN: --sysroot=%p/Inputs 2> %t3 -RUN: FileCheck -check-prefix=NETBSD-AMD64-NS %s < %t3 -RUN: not lld -flavor old-gnu -target i386--netbsd -t -ltest \ -RUN: --sysroot=%p/Inputs 2> %t4 -RUN: FileCheck -check-prefix=NETBSD-I386 %s < %t4 -RUN: not lld -flavor old-gnu -target x86_64--netbsd -m elf_i386 -t -ltest \ -RUN: --sysroot=%p/Inputs 2> %t5 -RUN: FileCheck -check-prefix=NETBSD-AMD64_32 %s < %t5 - -# run linker with -t mode to dump full paths to input files - -CHECK: {{[^ ]+[\\/]}}Inputs{{[\\/]}}libtest.a - -NETBSD-AMD64: {{[^ ]+}}{{[\\/]}}Inputs{{[\\/]}}usr{{[\\/]}}lib{{[\\/]}}libtest.a -NETBSD-AMD64-NS-NOT: {{[^ ]+}}{{[\\/]}}Inputs{{[\\/]}}usr{{[\\/]}}lib{{[\\/]}}libtest.a -NETBSD-I386: {{[^ ]+}}{{[\\/]}}Inputs{{[\\/]}}usr{{[\\/]}}lib{{[\\/]}}libtest.a -NETBSD-AMD64_32: {{[^ ]+}}{{[\\/]}}Inputs{{[\\/]}}usr{{[\\/]}}lib{{[\\/]}}i386{{[\\/]}}libtest.a diff --git a/test/Driver/so-whole-archive.test b/test/Driver/so-whole-archive.test deleted file mode 100644 index 8ab879082bf1..000000000000 --- a/test/Driver/so-whole-archive.test +++ /dev/null @@ -1,63 +0,0 @@ -# Check that LLD does not show any error if the --whole-archive -# is around non-archive. - -# RUN: yaml2obj -format=elf -docnum=1 %s > %t-so.o -# RUN: yaml2obj -format=elf -docnum=2 %s > %t-exe.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -o %t.exe %t-exe.o --whole-archive %t.so - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x04 -Symbols: - Global: - - Name: foo - Type: STT_FUNC - Section: .text - Size: 0x04 - -# exe.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x04 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: foo - Type: R_MIPS_26 - -Symbols: - Global: - - Name: __start - Type: STT_FUNC - Section: .text - Size: 0x04 - - Name: foo -... diff --git a/test/Driver/trivial-driver.test b/test/Driver/trivial-driver.test deleted file mode 100644 index 46de60c543f6..000000000000 --- a/test/Driver/trivial-driver.test +++ /dev/null @@ -1,5 +0,0 @@ -# This test, tests the Gnu lld option --help -RUN: lld -flavor old-gnu --help | FileCheck %s - -CHECK: --noinhibit-exec -CHECK: --output-filetype diff --git a/test/Driver/undef-basic.objtxt b/test/Driver/undef-basic.objtxt deleted file mode 100644 index 7b11a7e8c982..000000000000 --- a/test/Driver/undef-basic.objtxt +++ /dev/null @@ -1,22 +0,0 @@ -# RUN: lld -flavor old-gnu -u undefinedsymbol -e entrysymbol %s \ -# RUN: --output-filetype=yaml --noinhibit-exec | FileCheck %s - -# -# Test that we are able to add undefined atoms from the command line -# - ---- -absolute-atoms: - - name: putchar - value: 0xFFFF0040 - - - name: reset - value: 0xFFFF0080 - -... - - -# CHECK: undefined-atoms: -# CHECK: - name: entrysymbol -# CHECK: - name: undefinedsymbol -# CHECK: can-be-null: at-buildtime diff --git a/test/ELF/Inputs/aarch64-copy2.s b/test/ELF/Inputs/aarch64-copy2.s new file mode 100644 index 000000000000..8f3f748366be --- /dev/null +++ b/test/ELF/Inputs/aarch64-copy2.s @@ -0,0 +1,5 @@ + .global foo + .type foo, @function +foo: + .global bar +bar: diff --git a/test/ELF/Inputs/aarch64-tls-gdie.s b/test/ELF/Inputs/aarch64-tls-gdie.s new file mode 100644 index 000000000000..289cae523fe8 --- /dev/null +++ b/test/ELF/Inputs/aarch64-tls-gdie.s @@ -0,0 +1,4 @@ + .section .tdata,"awT",@progbits + .globl a +a: + .word 42 diff --git a/test/ELF/Inputs/abs-hidden.s b/test/ELF/Inputs/abs-hidden.s new file mode 100644 index 000000000000..44bff383a8e0 --- /dev/null +++ b/test/ELF/Inputs/abs-hidden.s @@ -0,0 +1,3 @@ +.global foo +.hidden foo +foo = 0x42 diff --git a/test/ELF/Inputs/allow-shlib-undefined.s b/test/ELF/Inputs/allow-shlib-undefined.s index e2fb7de2301a..5e3a46179027 100644 --- a/test/ELF/Inputs/allow-shlib-undefined.s +++ b/test/ELF/Inputs/allow-shlib-undefined.s @@ -1,3 +1,3 @@ .globl _shared _shared: - call _unresolved + callq _unresolved@PLT diff --git a/test/ELF/Inputs/archive.s b/test/ELF/Inputs/archive.s index 42ccfd47b48b..568bc1fc0a49 100644 --- a/test/ELF/Inputs/archive.s +++ b/test/ELF/Inputs/archive.s @@ -1,5 +1,5 @@ -.globl _start; +.globl _start _start: -.globl end; +.globl end end: diff --git a/test/ELF/Inputs/arm-plt-reloc.s b/test/ELF/Inputs/arm-plt-reloc.s new file mode 100644 index 000000000000..29f133e6eb8f --- /dev/null +++ b/test/ELF/Inputs/arm-plt-reloc.s @@ -0,0 +1,14 @@ +.text + .align 2 + .globl func1 + .type func1,%function +func1: + bx lr + .globl func2 + .type func2,%function +func2: + bx lr + .globl func3 + .type func3,%function +func3: + bx lr diff --git a/test/ELF/Inputs/arm-thumb-blx-targets.s b/test/ELF/Inputs/arm-thumb-blx-targets.s new file mode 100644 index 000000000000..4585ac4399cb --- /dev/null +++ b/test/ELF/Inputs/arm-thumb-blx-targets.s @@ -0,0 +1,36 @@ + .syntax unified + .arm + .section .R_ARM_CALL24_callee_low, "ax",%progbits + .align 2 + .globl callee_low + .type callee_low,%function +callee_low: + bx lr + + .section .R_ARM_CALL24_callee_thumb_low, "ax",%progbits + .balign 0x100 + .thumb + .type callee_thumb_low,%function + .globl callee_thumb_low +callee_thumb_low: + bx lr + + .section .R_ARM_CALL24_callee_high, "ax",%progbits + .balign 0x100 + .arm + .globl callee_high + .type callee_high,%function +callee_high: + bx lr + + .section .R_ARM_CALL24_callee_thumb_high, "ax",%progbits + .balign 0x100 + .thumb + .type callee_thumb_high,%function + .globl callee_thumb_high +callee_thumb_high: + bx lr + + .globl blx_far + .type blx_far, %function +blx_far = 0x1010018 diff --git a/test/ELF/Inputs/arm-thumb-narrow-branch.s b/test/ELF/Inputs/arm-thumb-narrow-branch.s new file mode 100644 index 000000000000..473a8e64ef74 --- /dev/null +++ b/test/ELF/Inputs/arm-thumb-narrow-branch.s @@ -0,0 +1,18 @@ +// This input must be assembled by the GNU assembler, as llvm-mc does not emit +// the R_ARM_JUMP11 relocation for a Thumb narrow branch. This is permissible +// by the ABI for the ARM architecture as the range of the Thumb narrow branch +// is short enough (+- 2048 bytes) that widespread use would be impractical. +// +// The test case will use a pre compiled object arm-thumb-narrow-branch.o + .syntax unified + .section .caller, "ax",%progbits + .thumb + .align 2 + .type callers,%function + .globl callers +callers: + b.n callee_low_far + b.n callee_low + b.n callee_high + b.n callee_high_far + bx lr diff --git a/test/ELF/Inputs/conflict.s b/test/ELF/Inputs/conflict.s new file mode 100644 index 000000000000..545ae99c845a --- /dev/null +++ b/test/ELF/Inputs/conflict.s @@ -0,0 +1,7 @@ +.globl _Z3muldd, foo, baz +_Z3muldd: +foo: +baz: + mov $60, %rax + mov $42, %rdi + syscall diff --git a/test/ELF/Inputs/copy-in-shared.s b/test/ELF/Inputs/copy-in-shared.s new file mode 100644 index 000000000000..52e99c6707a7 --- /dev/null +++ b/test/ELF/Inputs/copy-in-shared.s @@ -0,0 +1,4 @@ +.type foo, @object +.global foo +foo: +.size foo, 4 diff --git a/test/ELF/Inputs/copy-rel-corrupted.s b/test/ELF/Inputs/copy-rel-corrupted.s new file mode 100644 index 000000000000..b8d1b1aa04c4 --- /dev/null +++ b/test/ELF/Inputs/copy-rel-corrupted.s @@ -0,0 +1,4 @@ +.type x,@object +.globl x +x: +.size x, 0 diff --git a/test/ELF/Inputs/copy-rel-pie.s b/test/ELF/Inputs/copy-rel-pie.s new file mode 100644 index 000000000000..6cd681fcecb4 --- /dev/null +++ b/test/ELF/Inputs/copy-rel-pie.s @@ -0,0 +1,9 @@ +.global foo +.type foo, @object +.size foo, 4 +foo: +.long 0 + +.global bar +.type bar, @function +bar: diff --git a/test/ELF/Inputs/ctors_dtors_priority1.s b/test/ELF/Inputs/ctors_dtors_priority1.s new file mode 100644 index 000000000000..2eb19d7edad9 --- /dev/null +++ b/test/ELF/Inputs/ctors_dtors_priority1.s @@ -0,0 +1,5 @@ +.section .ctors, "aw", @progbits + .byte 0xA1 + +.section .dtors, "aw", @progbits + .byte 0xA2 diff --git a/test/ELF/Inputs/ctors_dtors_priority2.s b/test/ELF/Inputs/ctors_dtors_priority2.s new file mode 100644 index 000000000000..fb85ce87c5c5 --- /dev/null +++ b/test/ELF/Inputs/ctors_dtors_priority2.s @@ -0,0 +1,5 @@ +.section .ctors, "aw", @progbits + .byte 0xB1 + +.section .dtors, "aw", @progbits + .byte 0xB2 diff --git a/test/ELF/Inputs/ctors_dtors_priority3.s b/test/ELF/Inputs/ctors_dtors_priority3.s new file mode 100644 index 000000000000..96418d351a85 --- /dev/null +++ b/test/ELF/Inputs/ctors_dtors_priority3.s @@ -0,0 +1,5 @@ +.section .ctors, "aw", @progbits + .byte 0xC1 + +.section .dtors, "aw", @progbits + .byte 0xC2 diff --git a/test/ELF/Inputs/duplicated-plt-entry.s b/test/ELF/Inputs/duplicated-plt-entry.s new file mode 100644 index 000000000000..689f3af0ef4a --- /dev/null +++ b/test/ELF/Inputs/duplicated-plt-entry.s @@ -0,0 +1,3 @@ +.global bar +.type bar, @gnu_indirect_function +bar: diff --git a/test/ELF/Inputs/dynamic-reloc-weak.s b/test/ELF/Inputs/dynamic-reloc-weak.s new file mode 100644 index 000000000000..2310749d9f85 --- /dev/null +++ b/test/ELF/Inputs/dynamic-reloc-weak.s @@ -0,0 +1,11 @@ + .type sym1,@function + .global sym1 +sym1: + + .type sym2,@function + .global sym2 +sym2: + + .type sym3,@function + .global sym3 +sym3: diff --git a/test/ELF/Inputs/ehframe-relocation.s b/test/ELF/Inputs/ehframe-relocation.s new file mode 100644 index 000000000000..7ba6c0510cc8 --- /dev/null +++ b/test/ELF/Inputs/ehframe-relocation.s @@ -0,0 +1,2 @@ + .cfi_startproc + .cfi_endproc diff --git a/test/ELF/Inputs/empty-ver.ver b/test/ELF/Inputs/empty-ver.ver new file mode 100644 index 000000000000..7d4b4ede7675 --- /dev/null +++ b/test/ELF/Inputs/empty-ver.ver @@ -0,0 +1,2 @@ +ver { +}; diff --git a/test/ELF/Inputs/far-arm-abs.s b/test/ELF/Inputs/far-arm-abs.s new file mode 100644 index 000000000000..68d6aabe00b8 --- /dev/null +++ b/test/ELF/Inputs/far-arm-abs.s @@ -0,0 +1,13 @@ +.global far +.type far,%function +far = 0x201001c + +.global too_far1 +.type too_far1,%function +too_far1 = 0x2020008 +.global too_far2 +.type too_far2,%function +too_far2 = 0x202000c +.global too_far3 +.type too_far3,%function +too_far3 = 0x2020010 diff --git a/test/ELF/Inputs/far-arm-thumb-abs.s b/test/ELF/Inputs/far-arm-thumb-abs.s new file mode 100644 index 000000000000..0eb99b8e6ee9 --- /dev/null +++ b/test/ELF/Inputs/far-arm-thumb-abs.s @@ -0,0 +1,24 @@ +.global far_cond +.type far_cond,%function +far_cond = 0x110023 +.global far_uncond +.type far_uncond,%function +far_uncond = 0x101001b + +.global too_far1 +.type too_far1,%function +too_far1 = 0x1020005 +.global too_far2 +.type too_far1,%function +too_far2 = 0x1020009 +.global too_far3 +.type too_far3,%function +too_far3 = 0x12000d + +.global blx_far +.type blx_far, %function +blx_far = 0x2010025 + +.global blx_far2 +.type blx_far2, %function +blx_far2 = 0x2010029 diff --git a/test/ELF/Inputs/gc-sections-weak.s b/test/ELF/Inputs/gc-sections-weak.s new file mode 100644 index 000000000000..27baa6694e3d --- /dev/null +++ b/test/ELF/Inputs/gc-sections-weak.s @@ -0,0 +1,8 @@ +.weak foo +foo: + nop + +.data +.global bar2 +bar2: +.quad foo diff --git a/test/ELF/Inputs/gnu-ifunc-gotpcrel.s b/test/ELF/Inputs/gnu-ifunc-gotpcrel.s new file mode 100644 index 000000000000..83b06e05d461 --- /dev/null +++ b/test/ELF/Inputs/gnu-ifunc-gotpcrel.s @@ -0,0 +1,4 @@ +.type foo STT_GNU_IFUNC +.globl foo +foo: +ret diff --git a/test/ELF/Inputs/gotpc-relax-und-dso.s b/test/ELF/Inputs/gotpc-relax-und-dso.s new file mode 100644 index 000000000000..cbe39f38ef0b --- /dev/null +++ b/test/ELF/Inputs/gotpc-relax-und-dso.s @@ -0,0 +1,4 @@ +.globl dsofoo +.type dsofoo, @function +dsofoo: + nop diff --git a/test/ELF/Inputs/icf2.s b/test/ELF/Inputs/icf2.s new file mode 100644 index 000000000000..d332130bc935 --- /dev/null +++ b/test/ELF/Inputs/icf2.s @@ -0,0 +1,5 @@ +.globl f1, f2 +.section .text.f2, "ax" +f2: + mov $60, %rdi + call f1 diff --git a/test/ELF/Inputs/invalid-cie-version2.elf b/test/ELF/Inputs/invalid-cie-version2.elf new file mode 100644 index 000000000000..87f8a5be76f4 Binary files /dev/null and b/test/ELF/Inputs/invalid-cie-version2.elf differ diff --git a/test/ELF/Inputs/libsearch-dyn.s b/test/ELF/Inputs/libsearch-dyn.s index c0c33f92944d..091b3b9b6ece 100644 --- a/test/ELF/Inputs/libsearch-dyn.s +++ b/test/ELF/Inputs/libsearch-dyn.s @@ -1,3 +1,3 @@ -.globl _bar,_dynamic; +.globl _bar,_dynamic _bar: _dynamic: diff --git a/test/ELF/Inputs/libsearch-st.s b/test/ELF/Inputs/libsearch-st.s index c02ee741c803..6da62f79d52f 100644 --- a/test/ELF/Inputs/libsearch-st.s +++ b/test/ELF/Inputs/libsearch-st.s @@ -1,3 +1,3 @@ -.globl _bar,_static; +.globl _bar,_static _bar: _static: diff --git a/test/ELF/Inputs/mips-align-err.s b/test/ELF/Inputs/mips-align-err.s new file mode 100644 index 000000000000..2d813b754a45 --- /dev/null +++ b/test/ELF/Inputs/mips-align-err.s @@ -0,0 +1,2 @@ + .global _foo +_foo: diff --git a/test/ELF/Inputs/mips-dynamic.s b/test/ELF/Inputs/mips-dynamic.s index eba5b7f327b4..6f15cf334d9d 100644 --- a/test/ELF/Inputs/mips-dynamic.s +++ b/test/ELF/Inputs/mips-dynamic.s @@ -1,4 +1,28 @@ + .option pic2 .text .globl _foo _foo: nop + + .globl foo0 + .type foo0, @function +foo0: + nop + + .globl foo1 + .type foo1, @function +foo1: + nop + + .data + .globl data0 + .type data0, @object + .size data0, 4 +data0: + .word 0 + + .globl data1 + .type data1, @object + .size data1, 4 +data1: + .word 0 diff --git a/test/ELF/Inputs/mips-gp-disp.so b/test/ELF/Inputs/mips-gp-disp.so index 9cbb43720606..150de18fcca1 100644 Binary files a/test/ELF/Inputs/mips-gp-disp.so and b/test/ELF/Inputs/mips-gp-disp.so differ diff --git a/test/ELF/Inputs/mips-nonalloc.s b/test/ELF/Inputs/mips-nonalloc.s new file mode 100644 index 000000000000..72bfd274335c --- /dev/null +++ b/test/ELF/Inputs/mips-nonalloc.s @@ -0,0 +1,2 @@ + .section .debug_info + .word __start diff --git a/test/ELF/Inputs/mips-pic.s b/test/ELF/Inputs/mips-pic.s new file mode 100644 index 000000000000..880903241d3d --- /dev/null +++ b/test/ELF/Inputs/mips-pic.s @@ -0,0 +1,19 @@ + .option pic2 + + .section .text.1,"ax",@progbits + .align 4 + .globl foo1a + .type foo1a, @function +foo1a: + nop + .globl foo1b + .type foo1b, @function +foo1b: + nop + + .section .text.2,"ax",@progbits + .align 4 + .globl foo2 + .type foo2, @function +foo2: + nop diff --git a/test/ELF/Inputs/mips-tls.s b/test/ELF/Inputs/mips-tls.s new file mode 100644 index 000000000000..9e0a0983e1cd --- /dev/null +++ b/test/ELF/Inputs/mips-tls.s @@ -0,0 +1,5 @@ + .globl foo + .section .tdata,"awT",%progbits + .type foo, %object +foo: + .word 0 diff --git a/test/ELF/Inputs/plt-aarch64.s b/test/ELF/Inputs/plt-aarch64.s new file mode 100644 index 000000000000..0f7a4eda7be1 --- /dev/null +++ b/test/ELF/Inputs/plt-aarch64.s @@ -0,0 +1,5 @@ +.global bar +bar: + +.global weak +weak: diff --git a/test/ELF/Inputs/ppc64-addr16-error.s b/test/ELF/Inputs/ppc64-addr16-error.s new file mode 100644 index 000000000000..d83a9f929c6e --- /dev/null +++ b/test/ELF/Inputs/ppc64-addr16-error.s @@ -0,0 +1,3 @@ +.global sym +.hidden sym +sym = 0 diff --git a/test/ELF/Inputs/protected-shared.s b/test/ELF/Inputs/protected-shared.s new file mode 100644 index 000000000000..5f4b1daf63cc --- /dev/null +++ b/test/ELF/Inputs/protected-shared.s @@ -0,0 +1,10 @@ + .global foo + .protected foo +foo: + + .global bar + .protected bar +bar: + + .global zed +zed: diff --git a/test/ELF/Inputs/relocatable-ehframe.s b/test/ELF/Inputs/relocatable-ehframe.s new file mode 100644 index 000000000000..384aac6e7ced --- /dev/null +++ b/test/ELF/Inputs/relocatable-ehframe.s @@ -0,0 +1,14 @@ +.section foo1,"ax",@progbits +.cfi_startproc + nop +.cfi_endproc + +.section bar1,"ax",@progbits +.cfi_startproc + nop +.cfi_endproc + +.section dah1,"ax",@progbits +.cfi_startproc + nop +.cfi_endproc diff --git a/test/ELF/Inputs/relocatable.s b/test/ELF/Inputs/relocatable.s new file mode 100644 index 000000000000..de34a6b3bf0e --- /dev/null +++ b/test/ELF/Inputs/relocatable.s @@ -0,0 +1,22 @@ +.text +.type xx,@object +.bss +.globl xx +.align 4 +xx: +.long 0 +.size xx, 4 +.type yy,@object +.globl yy +.align 4 +yy: +.long 0 +.size yy, 4 + +.text +.globl foo +.align 16, 0x90 +.type foo,@function +foo: +movl $1, xx +movl $2, yy diff --git a/test/ELF/Inputs/relocatable2.s b/test/ELF/Inputs/relocatable2.s new file mode 100644 index 000000000000..93e23bc7ae69 --- /dev/null +++ b/test/ELF/Inputs/relocatable2.s @@ -0,0 +1,22 @@ +.text +.type xxx,@object +.bss +.globl xxx +.align 4 +xxx: +.long 0 +.size xxx, 4 +.type yyy,@object +.globl yyy +.align 4 +yyy: +.long 0 +.size yyy, 4 + +.text +.globl bar +.align 16, 0x90 +.type bar,@function +bar: +movl $8, xxx +movl $9, yyy diff --git a/test/ELF/Inputs/relocation-copy-alias.s b/test/ELF/Inputs/relocation-copy-alias.s new file mode 100644 index 000000000000..a9bc3d76a12c --- /dev/null +++ b/test/ELF/Inputs/relocation-copy-alias.s @@ -0,0 +1,25 @@ +.data + +.globl a1 +.type a1, @object +.size a1, 1 +a1: +.weak a2 +.type a2, @object +.size a2, 1 +a2: +.byte 1 + +.weak b1 +.type b1, @object +.size b1, 1 +b1: +.weak b2 +.type b2, @object +.size b2, 1 +b2: +.globl b3 +.type b3, @object +.size b3, 1 +b3: +.byte 1 diff --git a/test/ELF/Inputs/relocation-copy-arm.s b/test/ELF/Inputs/relocation-copy-arm.s new file mode 100644 index 000000000000..ba5ab73043c9 --- /dev/null +++ b/test/ELF/Inputs/relocation-copy-arm.s @@ -0,0 +1,22 @@ +.bss + +.type x,%object +.globl x +.balign 16 +x: +.long 0 +.size x, 4 + +.type y,%object +.globl y +.balign 16 +y: +.long 0 +.size y, 4 + +.type z,%object +.globl z +.balign 4 +z: +.long 0 +.size z, 4 diff --git a/test/ELF/Inputs/resolution-shared.s b/test/ELF/Inputs/resolution-shared.s new file mode 100644 index 000000000000..2f0ccf81e395 --- /dev/null +++ b/test/ELF/Inputs/resolution-shared.s @@ -0,0 +1,2 @@ + .global foo +foo: diff --git a/test/ELF/Inputs/shared.s b/test/ELF/Inputs/shared.s index 1cfebbfaf373..c3c22fe4b4fb 100644 --- a/test/ELF/Inputs/shared.s +++ b/test/ELF/Inputs/shared.s @@ -2,5 +2,9 @@ .type bar, @function bar: +.global bar2 +.type bar2, @function +bar2: + .global zed zed: diff --git a/test/ELF/Inputs/start-lib-comdat.s b/test/ELF/Inputs/start-lib-comdat.s new file mode 100644 index 000000000000..dcbaaf443851 --- /dev/null +++ b/test/ELF/Inputs/start-lib-comdat.s @@ -0,0 +1,5 @@ + .global bar +bar: + .section .sec,"aG",@progbits,zed,comdat + .global zed +zed: diff --git a/test/ELF/Inputs/start-lib1.s b/test/ELF/Inputs/start-lib1.s new file mode 100644 index 000000000000..d401b20e65dc --- /dev/null +++ b/test/ELF/Inputs/start-lib1.s @@ -0,0 +1,3 @@ +.globl foo +foo: + call bar diff --git a/test/ELF/Inputs/start-lib2.s b/test/ELF/Inputs/start-lib2.s new file mode 100644 index 000000000000..f500936565f7 --- /dev/null +++ b/test/ELF/Inputs/start-lib2.s @@ -0,0 +1,2 @@ +.globl bar +bar: diff --git a/test/ELF/Inputs/symbol-override.s b/test/ELF/Inputs/symbol-override.s new file mode 100644 index 000000000000..21f3ae244c77 --- /dev/null +++ b/test/ELF/Inputs/symbol-override.s @@ -0,0 +1,16 @@ +.text +.globl foo +.type foo,@function +foo: +nop + +.globl bar +.type bar,@function +bar: +nop + +.globl do +.type do,@function +do: +callq foo@PLT +callq bar@PLT diff --git a/test/ELF/Inputs/tls-got-entry.s b/test/ELF/Inputs/tls-got-entry.s new file mode 100644 index 000000000000..e1e09a3306a2 --- /dev/null +++ b/test/ELF/Inputs/tls-got-entry.s @@ -0,0 +1,13 @@ +.globl __tls_get_addr +.align 16, 0x90 +.type __tls_get_addr,@function +__tls_get_addr: + +.type tlsshared0,@object +.section .tbss,"awT",@nobits +.globl tlsshared0 +.align 4 +tlsshared0: + .long 0 + .size tlsshared0, 4 + diff --git a/test/ELF/Inputs/tls-in-archive.s b/test/ELF/Inputs/tls-in-archive.s new file mode 100644 index 000000000000..0474a417659e --- /dev/null +++ b/test/ELF/Inputs/tls-in-archive.s @@ -0,0 +1,3 @@ + .type foo, @tls_object + .globl foo +foo: diff --git a/test/ELF/Inputs/trace-ar1.s b/test/ELF/Inputs/trace-ar1.s new file mode 100644 index 000000000000..0292bae6b4d4 --- /dev/null +++ b/test/ELF/Inputs/trace-ar1.s @@ -0,0 +1,2 @@ +.globl _used +_used: diff --git a/test/ELF/Inputs/trace-ar2.s b/test/ELF/Inputs/trace-ar2.s new file mode 100644 index 000000000000..d56f304c82f3 --- /dev/null +++ b/test/ELF/Inputs/trace-ar2.s @@ -0,0 +1,2 @@ +.globl _notused +_notused: diff --git a/test/ELF/Inputs/trace-symbols-foo-strong.s b/test/ELF/Inputs/trace-symbols-foo-strong.s new file mode 100644 index 000000000000..874642978c9b --- /dev/null +++ b/test/ELF/Inputs/trace-symbols-foo-strong.s @@ -0,0 +1,14 @@ +.text +.globl foo +.type foo, @function +foo: +nop + +.globl bar +.type bar, @function +bar: +nop + +.global func2 +.type func2, @function +func2: diff --git a/test/ELF/Inputs/trace-symbols-foo-weak.s b/test/ELF/Inputs/trace-symbols-foo-weak.s new file mode 100644 index 000000000000..d071ebecc4b5 --- /dev/null +++ b/test/ELF/Inputs/trace-symbols-foo-weak.s @@ -0,0 +1,12 @@ +.comm common,4,4 +.text +.weak foo +.type foo, @function +foo: +callq bar@PLT + +.globl func1 +.type func1, @function +func1: +call func2@PLT + diff --git a/test/ELF/Inputs/undef-with-plt-addr.s b/test/ELF/Inputs/undef-with-plt-addr.s new file mode 100644 index 000000000000..b12737d9e098 --- /dev/null +++ b/test/ELF/Inputs/undef-with-plt-addr.s @@ -0,0 +1,7 @@ + .globl set_data + .type set_data,@function +set_data: + + .globl foo + .type foo,@function +foo: diff --git a/test/ELF/Inputs/undef.s b/test/ELF/Inputs/undef.s new file mode 100644 index 000000000000..01776bf3505e --- /dev/null +++ b/test/ELF/Inputs/undef.s @@ -0,0 +1,3 @@ + .global zed1 +zed1: + .quad zed2 diff --git a/test/ELF/Inputs/unresolved-symbols.s b/test/ELF/Inputs/unresolved-symbols.s new file mode 100644 index 000000000000..b504708e43da --- /dev/null +++ b/test/ELF/Inputs/unresolved-symbols.s @@ -0,0 +1,3 @@ +.globl _shared +_shared: + callq undef@PLT diff --git a/test/ELF/Inputs/verdef-defaultver.s b/test/ELF/Inputs/verdef-defaultver.s new file mode 100644 index 000000000000..2e1d1c36fb92 --- /dev/null +++ b/test/ELF/Inputs/verdef-defaultver.s @@ -0,0 +1,22 @@ +b@LIBSAMPLE_1.0 = b_1 +b@@LIBSAMPLE_2.0 = b_2 + +.globl a +.type a,@function +a: +retq + +.globl b_1 +.type b_1,@function +b_1: +retq + +.globl b_2 +.type b_2,@function +b_2: +retq + +.globl c +.type c,@function +c: +retq diff --git a/test/ELF/Inputs/verdef.s b/test/ELF/Inputs/verdef.s new file mode 100644 index 000000000000..349d5fd0c261 --- /dev/null +++ b/test/ELF/Inputs/verdef.s @@ -0,0 +1,6 @@ +.text +.globl _start +_start: + callq a + callq b + callq c diff --git a/test/ELF/Inputs/verneed.so.sh b/test/ELF/Inputs/verneed.so.sh new file mode 100755 index 000000000000..3423f678e47a --- /dev/null +++ b/test/ELF/Inputs/verneed.so.sh @@ -0,0 +1,58 @@ +#!/bin/sh -eu + +# This script was used to produce the verneed{1,2}.so files. + +tmp=$(mktemp -d) + +echo "v1 {}; v2 {}; v3 {}; { local: *; };" > $tmp/verneed.script + +cat > $tmp/verneed1.s < $tmp/verneed2.s <&1 | FileCheck %s -// CHECK: Relocation R_AARCH64_ABS16 cannot be used when making a shared object; recompile with -fPIC. +// CHECK: relocation R_AARCH64_ABS16 cannot be used against shared object; recompile with -fPIC. .data .hword foo diff --git a/test/ELF/aarch64-fpic-add_abs_lo12_nc.s b/test/ELF/aarch64-fpic-add_abs_lo12_nc.s index 9e3216b1e090..7e0b6b833006 100644 --- a/test/ELF/aarch64-fpic-add_abs_lo12_nc.s +++ b/test/ELF/aarch64-fpic-add_abs_lo12_nc.s @@ -1,7 +1,7 @@ // REQUIRES: aarch64 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s -// CHECK: Relocation R_AARCH64_ADD_ABS_LO12_NC cannot be used when making a shared object; recompile with -fPIC. +// CHECK: can't create dynamic relocation R_AARCH64_ADD_ABS_LO12_NC against readonly segment add x0, x0, :lo12:dat .data diff --git a/test/ELF/aarch64-fpic-adr_prel_lo21.s b/test/ELF/aarch64-fpic-adr_prel_lo21.s index 2246b64c6a71..501a724616e3 100644 --- a/test/ELF/aarch64-fpic-adr_prel_lo21.s +++ b/test/ELF/aarch64-fpic-adr_prel_lo21.s @@ -1,7 +1,7 @@ // REQUIRES: aarch64 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s -// CHECK: Relocation R_AARCH64_ADR_PREL_LO21 cannot be used when making a shared object; recompile with -fPIC. +// CHECK: can't create dynamic relocation R_AARCH64_ADR_PREL_LO21 against readonly segment adr x0, dat .data diff --git a/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s b/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s index af6ebfc3e879..572ecffa6d71 100644 --- a/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s +++ b/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s @@ -1,7 +1,7 @@ // REQUIRES: aarch64 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s -// CHECK: Relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used when making a shared object; recompile with -fPIC. +// CHECK: can't create dynamic relocation R_AARCH64_ADR_PREL_PG_HI21 against readonly segment adrp x0, dat .data diff --git a/test/ELF/aarch64-fpic-got.s b/test/ELF/aarch64-fpic-got.s new file mode 100644 index 000000000000..70b2a7a76f86 --- /dev/null +++ b/test/ELF/aarch64-fpic-got.s @@ -0,0 +1,18 @@ +# REQUIRES: aarch64 + +# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux %s -o %t.o +# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux %p/Inputs/shared.s -o %t-lib.o +# RUN: ld.lld -shared %t-lib.o -o %t-lib.so +# RUN: ld.lld %t-lib.so %t.o -o %t.exe +# RUN: llvm-readobj -dyn-relocations %t.exe | FileCheck %s + +## Checks if got access to dynamic objects is done through a got relative +## dynamic relocation and not using plt relative (R_AARCH64_JUMP_SLOT). +# CHECK: Dynamic Relocations { +# CHECK-NEXT: 0x{{[0-9A-F]+}} R_AARCH64_GLOB_DAT bar 0x0 +# CHECK-NEXT: } + +.globl _start +_start: + adrp x0, :got:bar + ldr x0, [x0, :got_lo12:bar] diff --git a/test/ELF/aarch64-fpic-ldst32_abs_lo12_nc.s b/test/ELF/aarch64-fpic-ldst32_abs_lo12_nc.s index 2b1e6769e1a0..85772f10fcc7 100644 --- a/test/ELF/aarch64-fpic-ldst32_abs_lo12_nc.s +++ b/test/ELF/aarch64-fpic-ldst32_abs_lo12_nc.s @@ -1,7 +1,7 @@ // REQUIRES: aarch64 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s -// CHECK: Relocation R_AARCH64_LDST32_ABS_LO12_NC cannot be used when making a shared object; recompile with -fPIC. +// CHECK: can't create dynamic relocation R_AARCH64_LDST32_ABS_LO12_NC against readonly segment ldr s4, [x0, :lo12:dat] .data diff --git a/test/ELF/aarch64-fpic-ldst64_abs_lo12_nc.s b/test/ELF/aarch64-fpic-ldst64_abs_lo12_nc.s index f2553879cf37..d9f7b0c9ad1b 100644 --- a/test/ELF/aarch64-fpic-ldst64_abs_lo12_nc.s +++ b/test/ELF/aarch64-fpic-ldst64_abs_lo12_nc.s @@ -1,7 +1,7 @@ // REQUIRES: aarch64 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s -// CHECK: Relocation R_AARCH64_LDST64_ABS_LO12_NC cannot be used when making a shared object; recompile with -fPIC. +// CHECK: can't create dynamic relocation R_AARCH64_LDST64_ABS_LO12_NC against readonly segment ldr x0, [x0, :lo12:dat] .data diff --git a/test/ELF/aarch64-fpic-ldst8_abs_lo12_nc.s b/test/ELF/aarch64-fpic-ldst8_abs_lo12_nc.s index f7b465731b46..20e1bba49d1e 100644 --- a/test/ELF/aarch64-fpic-ldst8_abs_lo12_nc.s +++ b/test/ELF/aarch64-fpic-ldst8_abs_lo12_nc.s @@ -1,7 +1,7 @@ // REQUIRES: aarch64 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s -// CHECK: Relocation R_AARCH64_LDST8_ABS_LO12_NC cannot be used when making a shared object; recompile with -fPIC. +// CHECK: can't create dynamic relocation R_AARCH64_LDST8_ABS_LO12_NC against readonly segment ldrsb x0, [x1, :lo12:dat] .data diff --git a/test/ELF/aarch64-fpic-prel16.s b/test/ELF/aarch64-fpic-prel16.s index d80b6e88a67a..52e2402a4831 100644 --- a/test/ELF/aarch64-fpic-prel16.s +++ b/test/ELF/aarch64-fpic-prel16.s @@ -1,7 +1,7 @@ // REQUIRES: aarch64 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s -// CHECK: Relocation R_AARCH64_PREL16 cannot be used when making a shared object; recompile with -fPIC. +// CHECK: relocation R_AARCH64_PREL16 cannot be used against shared object; recompile with -fPIC. .data .hword foo - . diff --git a/test/ELF/aarch64-fpic-prel32.s b/test/ELF/aarch64-fpic-prel32.s index af540ce734bb..72ba58f84d56 100644 --- a/test/ELF/aarch64-fpic-prel32.s +++ b/test/ELF/aarch64-fpic-prel32.s @@ -1,7 +1,7 @@ // REQUIRES: aarch64 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s -// CHECK: Relocation R_AARCH64_PREL32 cannot be used when making a shared object; recompile with -fPIC. +// CHECK: relocation R_AARCH64_PREL32 cannot be used against shared object; recompile with -fPIC. .data .word foo - . diff --git a/test/ELF/aarch64-fpic-prel64.s b/test/ELF/aarch64-fpic-prel64.s index 2cf4cc916b3e..53a4820962b6 100644 --- a/test/ELF/aarch64-fpic-prel64.s +++ b/test/ELF/aarch64-fpic-prel64.s @@ -1,7 +1,7 @@ // REQUIRES: aarch64 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s -// CHECK: Relocation R_AARCH64_PREL64 cannot be used when making a shared object; recompile with -fPIC. +// CHECK: relocation R_AARCH64_PREL64 cannot be used against shared object; recompile with -fPIC. .data .xword foo - . diff --git a/test/ELF/aarch64-gnu-ifunc-nosym.s b/test/ELF/aarch64-gnu-ifunc-nosym.s index d85bf1076601..bb3a0b8b5116 100644 --- a/test/ELF/aarch64-gnu-ifunc-nosym.s +++ b/test/ELF/aarch64-gnu-ifunc-nosym.s @@ -6,20 +6,18 @@ // Check that no __rela_iplt_end/__rela_iplt_start // appear in symtab if there is no references to them. // CHECK: Symbols [ -// CHECK-NEXT-NOT: __rela_iplt_end -// CHECK-NEXT-NOT: __rela_iplt_start +// CHECK-NOT: __rela_iplt_end +// CHECK-NOT: __rela_iplt_start // CHECK: ] .text .type foo STT_GNU_IFUNC .globl foo -.type foo, @function foo: ret .type bar STT_GNU_IFUNC .globl bar -.type bar, @function bar: ret diff --git a/test/ELF/aarch64-gnu-ifunc.s b/test/ELF/aarch64-gnu-ifunc.s index 4cc94200789d..351d0ed0440a 100644 --- a/test/ELF/aarch64-gnu-ifunc.s +++ b/test/ELF/aarch64-gnu-ifunc.s @@ -1,7 +1,7 @@ // RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux-gnu %s -o %t.o // RUN: ld.lld -static %t.o -o %tout // RUN: llvm-objdump -d %tout | FileCheck %s --check-prefix=DISASM -// RUN: llvm-readobj -r -symbols -sections %tout | FileCheck %s --check-prefix=CHECK +// RUN: llvm-readobj -r -symbols -sections %tout | FileCheck %s // REQUIRES: aarch64 // CHECK: Sections [ @@ -51,8 +51,10 @@ // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 0 -// CHECK-NEXT: Section: Absolute +// CHECK-NEXT: Other [ +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] +// CHECK-NEXT: Section: .rela.plt // CHECK-NEXT: } // CHECK-NEXT: Symbol { // CHECK-NEXT: Name: __rela_iplt_start @@ -60,8 +62,10 @@ // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 0 -// CHECK-NEXT: Section: Absolute +// CHECK-NEXT: Other [ +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] +// CHECK-NEXT: Section: .rela.plt // CHECK-NEXT: } // CHECK-NEXT: Symbol { // CHECK-NEXT: Name: _start @@ -126,13 +130,11 @@ .text .type foo STT_GNU_IFUNC .globl foo -.type foo, @function foo: ret .type bar STT_GNU_IFUNC .globl bar -.type bar, @function bar: ret diff --git a/test/ELF/aarch64-got-relocations.s b/test/ELF/aarch64-got-relocations.s new file mode 100644 index 000000000000..13ee09a892e9 --- /dev/null +++ b/test/ELF/aarch64-got-relocations.s @@ -0,0 +1,21 @@ +# REQUIRES: aarch64 +# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-cloudabi %s -o %t.o +# RUN: ld.lld -pie %t.o -o %t +# RUN: llvm-readobj -r %t | FileCheck %s + +# If we're addressing a global relatively through the GOT, we still need to +# emit a relocation for the entry in the GOT itself. +# CHECK: Relocations [ +# CHECK: Section (4) .rela.dyn { +# CHECK: 0x{{[0-9A-F]+}} R_AARCH64_RELATIVE - 0x{{[0-9A-F]+}} +# CHECK: } +# CHECK: ] + + .globl _start + .type _start,@function +_start: + adrp x8, :got:i + ldr x8, [x8, :got_lo12:i] + + .type i,@object + .comm i,4,4 diff --git a/test/ELF/aarch64-got.s b/test/ELF/aarch64-got.s new file mode 100644 index 000000000000..f56d8a734784 --- /dev/null +++ b/test/ELF/aarch64-got.s @@ -0,0 +1,18 @@ +# REQUIRES: aarch64 +# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %s -o %t.o +# RUN: ld.lld %t.o -o %t +# RUN: llvm-readobj -s %t | FileCheck %s + +# CHECK-NOT: Name: .got + +.globl _start +_start: + adrp x0, :gottprel:foo + + .global foo + .section .tdata,"awT",%progbits + .align 2 + .type foo, %object + .size foo, 4 +foo: + .word 5 diff --git a/test/ELF/aarch64-relative.s b/test/ELF/aarch64-relative.s new file mode 100644 index 000000000000..b10dd80fae6c --- /dev/null +++ b/test/ELF/aarch64-relative.s @@ -0,0 +1,26 @@ +// REQUIRES: aarch64 +// RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %s -o %t.o +// RUN: ld.lld %t.o -o %t.so -shared +// RUN: llvm-readobj -r %t.so | FileCheck %s + + adr x8, .Lfoo // R_AARCH64_ADR_PREL_LO21 + adrp x8, .Lfoo // R_AARCH64_ADR_PREL_PG_HI21 + strb w9, [x8, :lo12:.Lfoo] // R_AARCH64_LDST8_ABS_LO12_NC + ldr h17, [x19, :lo12:.Lfoo] // R_AARCH64_LDST16_ABS_LO12_NC + ldr w0, [x8, :lo12:.Lfoo] // R_AARCH64_LDST32_ABS_LO12_NC + ldr x0, [x8, :lo12:.Lfoo] // R_AARCH64_LDST64_ABS_LO12_NC + ldr q20, [x19, #:lo12:.Lfoo] // R_AARCH64_LDST128_ABS_LO12_NC + add x0, x0, :lo12:.Lfoo // R_AARCH64_ADD_ABS_LO12_NC + bl .Lfoo // R_AARCH64_CALL26 + b .Lfoo // R_AARCH64_JUMP26 + beq .Lfoo // R_AARCH64_CONDBR19 +.Lbranch: + tbz x1, 7, .Lbranch // R_AARCH64_TSTBR14 +.data +.Lfoo: + +.rodata +.long .Lfoo - . +.xword .Lfoo - . // R_AARCH64_PREL64 +// CHECK: Relocations [ +// CHECK-NEXT: ] diff --git a/test/ELF/aarch64-relocs.s b/test/ELF/aarch64-relocs.s index 56b04a679111..90541329587a 100644 --- a/test/ELF/aarch64-relocs.s +++ b/test/ELF/aarch64-relocs.s @@ -120,3 +120,33 @@ foo8: # CHECK: Disassembly of section .R_AARCH64_LDST8_ABS_LO12_NC: # CHECK-NEXT: ldst8: # CHECK-NEXT: 11044: ab 21 81 39 ldrsb x11, [x13, #72] + +.section .R_AARCH64_LDST128_ABS_LO12_NC,"ax",@progbits +ldst128: + ldr q20, [x19, #:lo12:foo128] +foo128: + .asciz "foo" + .size mystr, 3 + +# S = 0x1104c, A = 0x4 +# R = ((S + A) & 0xFF8) << 6 = 0x00001400 +# 0x00001400 | 0x3dc00274 = 0x3dc01674 +# CHECK: Disassembly of section .R_AARCH64_LDST128_ABS_LO12_NC: +# CHECK: ldst128: +# CHECK: 1104c: 74 16 c0 3d ldr q20, [x19, #80] +#foo128: +# 11050: 66 6f 6f 00 .word + +.section .R_AARCH64_LDST16_ABS_LO12_NC,"ax",@progbits +ldst16: + ldr h17, [x19, :lo12:foo16] +foo16: + .asciz "foo" + .size mystr, 3 + +# S = 0x11054, A = 0x4 +# R = ((S + A) & 0x0FFC) << 9 = 0xb000 +# 0xb000 | 0x7d400271 = 0x7d40b271 +# CHECK: Disassembly of section .R_AARCH64_LDST16_ABS_LO12_NC: +# CHECK-NEXT: ldst16: +# CHECK-NEXT: 11054: 71 b2 40 7d ldr h17, [x19, #88] diff --git a/test/ELF/aarch64-tls-gdie.s b/test/ELF/aarch64-tls-gdie.s new file mode 100644 index 000000000000..709cc53a8c47 --- /dev/null +++ b/test/ELF/aarch64-tls-gdie.s @@ -0,0 +1,34 @@ +// REQUIRES: aarch64 +// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=aarch64-pc-linux +// RUN: llvm-mc %p/Inputs/aarch64-tls-gdie.s -o %t2.o -filetype=obj -triple=aarch64-pc-linux +// RUN: ld.lld %t2.o -o %t2.so -shared +// RUN: ld.lld %t.o %t2.so -o %t +// RUN: llvm-readobj -s %t | FileCheck --check-prefix=SEC %s +// RUN: llvm-objdump -d %t | FileCheck %s + + .globl _start +_start: + nop + adrp x0, :tlsdesc:a + ldr x1, [x0, :tlsdesc_lo12:a] + add x0, x0, :tlsdesc_lo12:a + .tlsdesccall a + blr x1 + +// SEC: Name: .got +// SEC-NEXT: Type: SHT_PROGBITS +// SEC-NEXT: Flags [ +// SEC-NEXT: SHF_ALLOC +// SEC-NEXT: SHF_WRITE +// SEC-NEXT: ] +// SEC-NEXT: Address: 0x120B0 + +// page(0x120B0) - page(0x11004) = 4096 +// 0x0B0 = 176 + +// CHECK: _start: +// CHECK-NEXT: 11000: {{.*}} nop +// CHECK-NEXT: 11004: {{.*}} adrp x0, #4096 +// CHECK-NEXT: 11008: {{.*}} ldr x0, [x0, #176] +// CHECK-NEXT: 1100c: {{.*}} nop +// CHECK-NEXT: 11010: {{.*}} nop diff --git a/test/ELF/aarch64-tls-gdle.s b/test/ELF/aarch64-tls-gdle.s new file mode 100644 index 000000000000..dc0c02a31d1c --- /dev/null +++ b/test/ELF/aarch64-tls-gdle.s @@ -0,0 +1,26 @@ +# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %p/Inputs/aarch64-tls-ie.s -o %ttlsie.o +# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %s -o %tmain.o +# RUN: ld.lld %tmain.o %ttlsie.o -o %tout +# RUN: llvm-objdump -d %tout | FileCheck %s +# RUN: llvm-readobj -s -r %tout | FileCheck -check-prefix=RELOC %s +# REQUIRES: aarch64 + +#Local-Dynamic to Initial-Exec relax creates no +#RELOC: Relocations [ +#RELOC-NEXT: ] + +# TCB size = 0x16 and foo is first element from TLS register. +# CHECK: Disassembly of section .text: +# CHECK: _start: +# CHECK: 11000: 00 00 a0 d2 movz x0, #0, lsl #16 +# CHECK: 11004: 00 02 80 f2 movk x0, #16 +# CHECK: 11008: 1f 20 03 d5 nop +# CHECK: 1100c: 1f 20 03 d5 nop + +.globl _start +_start: + adrp x0, :tlsdesc:foo + ldr x1, [x0, :tlsdesc_lo12:foo] + add x0, x0, :tlsdesc_lo12:foo + .tlsdesccall foo + blr x1 diff --git a/test/ELF/aarch64-tls-ie.s b/test/ELF/aarch64-tls-ie.s index 0462addba22d..0cec402b294a 100644 --- a/test/ELF/aarch64-tls-ie.s +++ b/test/ELF/aarch64-tls-ie.s @@ -1,3 +1,4 @@ +// REQUIRES: aarch64 # RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %p/Inputs/aarch64-tls-ie.s -o %tdso.o # RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %s -o %tmain.o # RUN: ld.lld -shared %tdso.o -o %tdso.so @@ -24,8 +25,8 @@ #RELOC-NEXT: } #RELOC: Relocations [ #RELOC-NEXT: Section ({{.*}}) .rela.dyn { -#RELOC-NEXT: 0x120B0 R_AARCH64_TLS_TPREL64 foo 0x0 #RELOC-NEXT: 0x120B8 R_AARCH64_TLS_TPREL64 bar 0x0 +#RELOC-NEXT: 0x120B0 R_AARCH64_TLS_TPREL64 foo 0x0 #RELOC-NEXT: } #RELOC-NEXT:] diff --git a/test/ELF/aarch64-tls-iele.s b/test/ELF/aarch64-tls-iele.s new file mode 100644 index 000000000000..91efc092a2cf --- /dev/null +++ b/test/ELF/aarch64-tls-iele.s @@ -0,0 +1,33 @@ +# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %p/Inputs/aarch64-tls-ie.s -o %ttlsie.o +# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %s -o %tmain.o +# RUN: ld.lld %tmain.o %ttlsie.o -o %tout +# RUN: llvm-objdump -d %tout | FileCheck %s +# RUN: llvm-readobj -s -r %tout | FileCheck -check-prefix=RELOC %s +# REQUIRES: aarch64 + +# Initial-Exec to Local-Exec relax creates no dynamic relocations. +# RELOC: Relocations [ +# RELOC-NEXT: ] + +# TCB size = 0x16 and foo is first element from TLS register. +# CHECK: Disassembly of section .text: +# CHECK: _start: +# CHECK-NEXT: 11000: 00 00 a0 d2 movz x0, #0, lsl #16 +# CHECK-NEXT: 11004: 80 02 80 f2 movk x0, #20 +# CHECK-NEXT: 11008: 00 00 a0 d2 movz x0, #0, lsl #16 +# CHECK-NEXT: 1100c: 00 02 80 f2 movk x0, #16 + +.section .tdata +.align 2 +.type foo_local, %object +.size foo_local, 4 +foo_local: +.word 5 +.text + +.globl _start +_start: + adrp x0, :gottprel:foo + ldr x0, [x0, :gottprel_lo12:foo] + adrp x0, :gottprel:foo_local + ldr x0, [x0, :gottprel_lo12:foo_local] diff --git a/test/ELF/aarch64-tls-le.s b/test/ELF/aarch64-tls-le.s new file mode 100644 index 000000000000..22bd0ef2dad7 --- /dev/null +++ b/test/ELF/aarch64-tls-le.s @@ -0,0 +1,31 @@ +# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %s -o %tmain.o +# RUN: ld.lld %tmain.o -o %tout +# RUN: llvm-objdump -d %tout | FileCheck %s +# RUN: llvm-readobj -s -r %tout | FileCheck -check-prefix=RELOC %s +# REQUIRES: aarch64 + +#Local-Dynamic to Initial-Exec relax creates no +#RELOC: Relocations [ +#RELOC-NEXT: ] + +.globl _start +_start: + mrs x0, TPIDR_EL0 + add x0, x0, :tprel_hi12:v1 + add x0, x0, :tprel_lo12_nc:v1 + +# TCB size = 0x16 and foo is first element from TLS register. +#CHECK: Disassembly of section .text: +#CHECK: _start: +#CHECK: 11000: 40 d0 3b d5 mrs x0, TPIDR_EL0 +#CHECK: 11004: 00 00 00 91 add x0, x0, #0 +#CHECK: 11008: 00 40 00 91 add x0, x0, #16 + +.type v1,@object +.section .tbss,"awT",@nobits +.globl v1 +.p2align 2 +v1: +.word 0 +.size v1, 4 + diff --git a/test/ELF/aarch64-tls-pie.s b/test/ELF/aarch64-tls-pie.s new file mode 100644 index 000000000000..466045d6765d --- /dev/null +++ b/test/ELF/aarch64-tls-pie.s @@ -0,0 +1,28 @@ +# REQUIRES: aarch64 +# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-cloudabi %s -o %t1.o +# RUN: ld.lld -pie %t1.o -o %t +# RUN: llvm-readobj -r %t | FileCheck %s + +# Similar to bug 27174: R_AARCH64_TLSLE_*TPREL* relocations should be +# eliminated when building a PIE executable, as the static TLS layout is +# fixed. +# +# CHECK: Relocations [ +# CHECK-NEXT: ] + + .globl _start +_start: + # Accessing the variable directly. + add x11, x8, :tprel_hi12:i + add x11, x11, :tprel_lo12_nc:i + + # Accessing the variable through the GOT. + adrp x10, :gottprel:i + mrs x8, TPIDR_EL0 + ldr x10, [x10, :gottprel_lo12:i] + + .section .tbss.i,"awT",@nobits + .globl i +i: + .word 0 + .size i, 4 diff --git a/test/ELF/aarch64-tls-static.s b/test/ELF/aarch64-tls-static.s new file mode 100644 index 000000000000..c8508ee58b7f --- /dev/null +++ b/test/ELF/aarch64-tls-static.s @@ -0,0 +1,37 @@ +// REQUIRES: aarch64 +// RUN: llvm-mc %s -o %t.o -triple aarch64-pc-linux -filetype=obj +// RUN: ld.lld %t.o -o %t.so -shared +// RUN: llvm-readobj -s %t.so | FileCheck --check-prefix=SEC %s +// RUN: llvm-objdump -d %t.so | FileCheck %s + +foo: + adrp x0, :tlsdesc:bar + ldr x1, [x0, :tlsdesc_lo12:bar] + add x0, x0, :tlsdesc_lo12:bar + .tlsdesccall bar + blr x1 + + + .section .tdata,"awT",@progbits +bar: + .word 42 + + +// SEC: Name: .got +// SEC-NEXT: Type: SHT_PROGBITS +// SEC-NEXT: Flags [ +// SEC-NEXT: SHF_ALLOC +// SEC-NEXT: SHF_WRITE +// SEC-NEXT: ] +// SEC-NEXT: Address: 0x2098 +// SEC-NEXT: Offset: 0x2098 +// SEC-NEXT: Size: 16 + +// page(0x2098) - page(0x1000) = 4096 +// 0x98 = 152 + +// CHECK: foo: +// CHECK-NEXT: 1000: {{.*}} adrp x0, #4096 +// CHECK-NEXT: 1004: {{.*}} ldr x1, [x0, #152] +// CHECK-NEXT: 1008: {{.*}} add x0, x0, #152 +// CHECK-NEXT: 100c: {{.*}} blr x1 diff --git a/test/ELF/aarch64-tlsdesc.s b/test/ELF/aarch64-tlsdesc.s new file mode 100644 index 000000000000..f8c73aff243d --- /dev/null +++ b/test/ELF/aarch64-tlsdesc.s @@ -0,0 +1,24 @@ +// REQUIRES: aarch64 +// RUN: llvm-mc -filetype=obj -triple=aarch64-pc-linux %s -o %t.o +// RUN: ld.lld -shared %t.o -o %t.so +// RUN: llvm-objdump -d %t.so | FileCheck %s +// RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=REL %s + + adrp x0, :tlsdesc:a + ldr x1, [x0, :tlsdesc_lo12:a] + add x0, x0, :tlsdesc_lo12:a + .tlsdesccall a + blr x1 + +// CHECK: 1000: {{.*}} adrp x0, #4096 +// CHECK-NEXT: 1004: {{.*}} ldr x1, [x0, #144] +// CHECK-NEXT: 1008: {{.*}} add x0, x0, #144 +// CHECK-NEXT: 100c: {{.*}} blr x1 + +// 0x1000 + 4096 + 144 = 0x2090 + +// REL: Relocations [ +// REL-NEXT: Section (4) .rela.dyn { +// REL-NEXT: 0x2090 R_AARCH64_TLSDESC a 0x0 +// REL-NEXT: } +// REL-NEXT: ] diff --git a/test/ELF/abs-hidden.s b/test/ELF/abs-hidden.s new file mode 100644 index 000000000000..b93c2c692919 --- /dev/null +++ b/test/ELF/abs-hidden.s @@ -0,0 +1,46 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/abs-hidden.s -o %t2.o +// RUN: ld.lld %t.o %t2.o -o %t.so -shared +// RUN: llvm-readobj -r -s -section-data %t.so | FileCheck %s + + .quad foo + .long foo@gotpcrel + +// CHECK: Name: .text +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_EXECINSTR +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x1000 +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: 12 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 4 +// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 42000000 00000000 58100000 +// 0x2060 - (0x1000 + 8) = 1058 +// CHECK-NEXT: ) + +// CHECK: Name: .got (38) +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x2060 +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: 8 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 8 +// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 42000000 00000000 +// CHECK-NEXT: ) + +// CHECK: Relocations [ +// CHECK-NEXT: ] diff --git a/test/ELF/allow-shlib-undefined.s b/test/ELF/allow-shlib-undefined.s index 541a7e12007b..2d068b0f60ed 100644 --- a/test/ELF/allow-shlib-undefined.s +++ b/test/ELF/allow-shlib-undefined.s @@ -22,4 +22,4 @@ .globl _start _start: - call _shared + callq _shared@PLT diff --git a/test/ELF/amdgpu-entry.s b/test/ELF/amdgpu-entry.s index a17d243214b7..2a47b1778de8 100644 --- a/test/ELF/amdgpu-entry.s +++ b/test/ELF/amdgpu-entry.s @@ -1,5 +1,5 @@ # RUN: llvm-mc -filetype=obj -triple amdgcn--amdhsa -mcpu=kaveri %s -o %t.o -# RUN: not lld -e kernel0 -flavor gnu %t.o -o %t +# RUN: not ld.lld -e kernel0 %t.o -o %t # REQUIRES: amdgpu diff --git a/test/ELF/amdgpu-globals.s b/test/ELF/amdgpu-globals.s index ff0899f60a98..7f46b989b955 100644 --- a/test/ELF/amdgpu-globals.s +++ b/test/ELF/amdgpu-globals.s @@ -77,7 +77,7 @@ program_global_readonly: # CHECK: Symbol { # CHECK: Name: module_global_agent -# CHECK: Value: 0x0 +# CHECK: Value: # CHECK: Size: 4 # CHECK: Binding: Local # CHECK: Section: .hsadata_global_agent @@ -85,7 +85,7 @@ program_global_readonly: # CHECK: Symbol { # CHECK: Name: module_global_program -# CHECK: Value: 0x0 +# CHECK: Value: # CHECK: Size: 4 # CHECK: Binding: Local # CHECK: Section: .hsadata_global_program @@ -93,7 +93,7 @@ program_global_readonly: # CHECK: Symbol { # CHECK: Name: module_global_readonly -# CHECK: Value: 0x0 +# CHECK: Value: # CHECK: Size: 4 # CHECK: Binding: Local # CHECK: Type: Object @@ -102,7 +102,7 @@ program_global_readonly: # CHECK: Symbol { # CHECK: Name: program_global_agent -# CHECK: Value: 0x4 +# CHECK: Value: # CHECK: Size: 4 # CHECK: Binding: Global # CHECK: Type: Object @@ -111,7 +111,7 @@ program_global_readonly: # CHECK: Symbol { # CHECK: Name: program_global_program -# CHECK: Value: 0x4 +# CHECK: Value: # CHECK: Size: 4 # CHECK: Binding: Global # CHECK: Type: Object @@ -120,7 +120,7 @@ program_global_readonly: # CHECK: Symbol { # CHECK: Name: program_global_readonly -# CHECK: Value: 0x4 +# CHECK: Value: # CHECK: Size: 4 # CHECK: Binding: Global # CHECK: Type: Object @@ -128,11 +128,11 @@ program_global_readonly: # CHECK: } # CHECK: ProgramHeader { -# CHECK: Type: PT_AMDGPU_HSA_LOAD_GLOBAL_PROGRAM -# CHECK: VirtualAddress: [[HSADATA_GLOBAL_PROGRAM_ADDR]] +# CHECK: Type: PT_LOAD +# CHECK: VirtualAddress: # CHECK: } # CHECK: ProgramHeader { -# CHECK: Type: PT_AMDGPU_HSA_LOAD_CODE_AGENT -# CHECK: VirtualAddress: [[HSATEXT_ADDR]] +# CHECK: Type: PT_LOAD +# CHECK: VirtualAddress: # CHECK: } diff --git a/test/ELF/amdgpu-kernels.s b/test/ELF/amdgpu-kernels.s index 3f43c71f65d7..62a8cb74a541 100644 --- a/test/ELF/amdgpu-kernels.s +++ b/test/ELF/amdgpu-kernels.s @@ -1,5 +1,5 @@ # RUN: llvm-mc -filetype=obj -triple amdgcn--amdhsa -mcpu=kaveri %s -o %t.o -# RUN: lld -flavor gnu %t.o -o %t +# RUN: ld.lld %t.o -o %t # RUN: llvm-readobj -sections -symbols -program-headers %t | FileCheck %s # REQUIRES: amdgpu @@ -41,7 +41,7 @@ kernel1: # CHECK: Symbol { # CHECK: Name: kernel0 -# CHECK: Value: 0x0 +# CHECK: Value: # CHECK: Size: 4 # CHECK: Binding: Global # CHECK: Type: AMDGPU_HSA_KERNEL @@ -50,7 +50,7 @@ kernel1: # CHECK: Symbol { # CHECK: Name: kernel1 -# CHECK: Value: 0x100 +# CHECK: Value: # CHECK: Size: 8 # CHECK: Binding: Global # CHECK: Type: AMDGPU_HSA_KERNEL @@ -58,6 +58,6 @@ kernel1: # CHECK: } # CHECK: ProgramHeader { -# CHECK: Type: PT_AMDGPU_HSA_LOAD_CODE_AGENT -# CHECK: VirtualAddress: [[HSATEXT_ADDR]] +# CHECK: Type: PT_LOAD +# CHECK: VirtualAddress: # CHECK: } diff --git a/test/ELF/amdgpu-relocs.s b/test/ELF/amdgpu-relocs.s new file mode 100644 index 000000000000..58c9582a84f1 --- /dev/null +++ b/test/ELF/amdgpu-relocs.s @@ -0,0 +1,33 @@ +# RUN: llvm-mc -filetype=obj -triple=amdgcn--amdhsa -mcpu=fiji %s -o %t.o +# RUN: ld.lld -shared %t.o -o %t.so +# RUN: llvm-readobj -r %t.so | FileCheck %s + +# REQUIRES: amdgpu + + .text + +kernel0: + s_mov_b32 s0, common_var@GOTPCREL+4 + s_mov_b32 s0, extern_var@GOTPCREL+4 + s_mov_b32 s0, local_var+4 + s_mov_b32 s0, global_var@GOTPCREL+4 + s_mov_b32 s0, weak_var@GOTPCREL+4 + s_mov_b32 s0, weakref_var@GOTPCREL+4 + s_endpgm + + .comm common_var,1024,4 + .globl global_var + .local local_var + .weak weak_var + .weakref weakref_var, weakref_alias_var + +# The relocation for local_var should be resolved by the linker. +# CHECK: Relocations [ +# CHECK: .rela.dyn { +# CHECK-NEXT: R_AMDGPU_ABS64 common_var 0x0 +# CHECK-NEXT: R_AMDGPU_ABS64 extern_var 0x0 +# CHECK-NEXT: R_AMDGPU_ABS64 global_var 0x0 +# CHECK-NEXT: R_AMDGPU_ABS64 weak_var 0x0 +# CHECK-NEXT: R_AMDGPU_ABS64 weakref_alias_var 0x0 +# CHECK-NEXT: } +# CHECK-NEXT: ] diff --git a/test/ELF/archive.s b/test/ELF/archive.s index 41d74451cdd6..59c96a5fba9b 100644 --- a/test/ELF/archive.s +++ b/test/ELF/archive.s @@ -6,6 +6,10 @@ # RUN: llvm-ar rcs %tar %t2 %t3 %t4 # RUN: ld.lld %t %tar %t5 -o %tout # RUN: llvm-nm %tout | FileCheck %s +# RUN: rm -f %tarthin +# RUN: llvm-ar --format=gnu rcsT %tarthin %t2 %t3 %t4 +# RUN: ld.lld %t %tarthin %t5 -o %tout +# RUN: llvm-nm %tout | FileCheck %s # REQUIRES: x86 # Nothing here. Just needed for the linker to create a undefined _start symbol. diff --git a/test/ELF/arm-abs32-dyn.s b/test/ELF/arm-abs32-dyn.s new file mode 100644 index 000000000000..68183fe6f198 --- /dev/null +++ b/test/ELF/arm-abs32-dyn.s @@ -0,0 +1,32 @@ +// REQUIRES: arm +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux %s -o %t.o + +// Creates a R_ARM_ABS32 relocation against foo and bar, bar has hidden +// visibility so we expect a R_ARM_RELATIVE + .syntax unified + .globl foo +foo: + .globl bar + .hidden bar +bar: + + .data + .word foo + .word bar + +// RUN: ld.lld -shared -o %t.so %t.o +// RUN: llvm-readobj -symbols -dyn-relocations %t.so | FileCheck %s + +// CHECK: Dynamic Relocations { +// CHECK-NEXT: 0x2004 R_ARM_RELATIVE +// CHECK-NEXT: 0x2000 R_ARM_ABS32 foo 0x0 +// CHECK-NEXT: } + +// CHECK: Symbols [ +// CHECK: Symbol { +// CHECK: Name: bar +// CHECK-NEXT: Value: 0x1000 + +// CHECK: Symbol { +// CHECK: Name: foo +// CHECK-NEXT: Value: 0x1000 diff --git a/test/ELF/arm-attributes-remove.s b/test/ELF/arm-attributes-remove.s new file mode 100644 index 000000000000..010f366cd7fb --- /dev/null +++ b/test/ELF/arm-attributes-remove.s @@ -0,0 +1,45 @@ +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o +// RUN: ld.lld %t.o -o %t +// RUN: llvm-readobj -s %t | FileCheck %s +// RUN: ld.lld %t.o -shared -o %t2 +// RUN: llvm-readobj -s %t2 | FileCheck %s +// RUN: ld.lld %t.o -r -o %t3 +// RUN: llvm-readobj -s %t3 | FileCheck %s + +// The .ARM.attributes section should be removed from executables and +// shared objects. + +// At present we remove it from the -r object output as well which isn't ideal. +// Unfortunately combining per-object attributes cannot be safely done by just +// concatentation of input sections. + +// CHECK-NOT: Name: .ARM.attributes +// REQUIRES: arm + .text + .syntax unified + .eabi_attribute 67, "2.09" @ Tag_conformance + .cpu cortex-a8 + .eabi_attribute 6, 10 @ Tag_CPU_arch + .eabi_attribute 7, 65 @ Tag_CPU_arch_profile + .eabi_attribute 8, 1 @ Tag_ARM_ISA_use + .eabi_attribute 9, 2 @ Tag_THUMB_ISA_use + .fpu neon + .eabi_attribute 15, 1 @ Tag_ABI_PCS_RW_data + .eabi_attribute 16, 1 @ Tag_ABI_PCS_RO_data + .eabi_attribute 17, 2 @ Tag_ABI_PCS_GOT_use + .eabi_attribute 20, 1 @ Tag_ABI_FP_denormal + .eabi_attribute 21, 1 @ Tag_ABI_FP_exceptions + .eabi_attribute 23, 3 @ Tag_ABI_FP_number_model + .eabi_attribute 34, 1 @ Tag_CPU_unaligned_access + .eabi_attribute 24, 1 @ Tag_ABI_align_needed + .eabi_attribute 25, 1 @ Tag_ABI_align_preserved + .eabi_attribute 38, 1 @ Tag_ABI_FP_16bit_format + .eabi_attribute 18, 4 @ Tag_ABI_PCS_wchar_t + .eabi_attribute 26, 2 @ Tag_ABI_enum_size + .eabi_attribute 14, 0 @ Tag_ABI_PCS_R9_use + .eabi_attribute 68, 1 @ Tag_Virtualization_use + .globl _start + .p2align 2 + .type _start,%function +_start: + bx lr diff --git a/test/ELF/arm-blx.s b/test/ELF/arm-blx.s new file mode 100644 index 000000000000..cccb1324fc8b --- /dev/null +++ b/test/ELF/arm-blx.s @@ -0,0 +1,113 @@ +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %S/Inputs/far-arm-thumb-abs.s -o %tfar +// RUN: echo "SECTIONS { \ +// RUN: .callee1 : { *(.callee_low) } \ +// RUN: .callee2 : { *(.callee_arm_low) } \ +// RUN: .caller : { *(.text) } \ +// RUN: .callee3 : { *(.callee_high) } \ +// RUN: .callee4 : { *(.callee_arm_high) } } " > %t.script +// RUN: ld.lld --script %t.script %t %tfar -o %t2 2>&1 +// RUN: llvm-objdump -d -triple=armv7a-none-linux-gnueabi %t2 | FileCheck -check-prefix=CHECK-ARM %s +// RUN: llvm-objdump -d -triple=thumbv7a-none-linux-gnueabi %t2 | FileCheck -check-prefix=CHECK-THUMB %s +// REQUIRES: arm + +// Test BLX instruction is chosen for ARM BL/BLX instruction and Thumb callee +// Using two callees to ensure at least one has 2-byte alignment. + .syntax unified + .thumb + .section .callee_low, "ax",%progbits + .align 2 + .type callee_low,%function +callee_low: + bx lr + .type callee_low2, %function +callee_low2: + bx lr + + .section .callee_arm_low, "ax",%progbits + .arm + .balign 0x100 + .type callee_arm_low,%function + .align 2 +callee_arm_low: + bx lr + +.section .text, "ax",%progbits + .arm + .globl _start + .balign 0x10000 + .type _start,%function +_start: + bl callee_low + blx callee_low + bl callee_low2 + blx callee_low2 + bl callee_high + blx callee_high + bl callee_high2 + blx callee_high2 + bl blx_far + blx blx_far2 +// blx to ARM instruction should be written as a BL + bl callee_arm_low + blx callee_arm_low + bl callee_arm_high + blx callee_arm_high + bx lr + + .section .callee_high, "ax",%progbits + .balign 0x100 + .thumb + .type callee_high,%function +callee_high: + bx lr + .type callee_high2,%function +callee_high2: + bx lr + + .section .callee_arm_high, "ax",%progbits + .arm + .balign 0x100 + .type callee_arm_high,%function +callee_arm_high: + bx lr + +// CHECK-THUMB: Disassembly of section .callee1: +// CHECK-THUMB-NEXT: callee_low: +// CHECK-THUMB-NEXT: b4: 70 47 bx lr +// CHECK-THUMB: callee_low2: +// CHECK-THUMB-NEXT: b6: 70 47 bx lr + +// CHECK-ARM: Disassembly of section .callee2: +// CHECK-ARM-NEXT: callee_arm_low: +// CHECK-ARM-NEXT: 100: 1e ff 2f e1 bx lr + +// CHECK-ARM: Disassembly of section .caller: +// CHECK-ARM-NEXT: _start: +// CHECK-ARM-NEXT: 10000: 2b c0 ff fa blx #-65364 +// CHECK-ARM-NEXT: 10004: 2a c0 ff fa blx #-65368 +// CHECK-ARM-NEXT: 10008: 29 c0 ff fb blx #-65370 +// CHECK-ARM-NEXT: 1000c: 28 c0 ff fb blx #-65374 +// CHECK-ARM-NEXT: 10010: 3a 00 00 fa blx #232 +// CHECK-ARM-NEXT: 10014: 39 00 00 fa blx #228 +// CHECK-ARM-NEXT: 10018: 38 00 00 fb blx #226 +// CHECK-ARM-NEXT: 1001c: 37 00 00 fb blx #222 +// 10020 + 1FFFFFC + 8 = 0x2010024 = blx_far +// CHECK-ARM-NEXT: 10020: ff ff 7f fa blx #33554428 +// 10024 + 1FFFFFC + 8 = 0x2010028 = blx_far2 +// CHECK-ARM-NEXT: 10024: ff ff 7f fa blx #33554428 +// CHECK-ARM-NEXT: 10028: 34 c0 ff eb bl #-65328 +// CHECK-ARM-NEXT: 1002c: 33 c0 ff eb bl #-65332 +// CHECK-ARM-NEXT: 10030: 72 00 00 eb bl #456 +// CHECK-ARM-NEXT: 10034: 71 00 00 eb bl #452 +// CHECK-ARM-NEXT: 10038: 1e ff 2f e1 bx lr + +// CHECK-THUMB: Disassembly of section .callee3: +// CHECK-THUMB: callee_high: +// CHECK-THUMB-NEXT: 10100: 70 47 bx lr +// CHECK-THUMB: callee_high2: +// CHECK-THUMB-NEXT: 10102: 70 47 bx lr + +// CHECK-ARM: Disassembly of section .callee4: +// CHECK-NEXT-ARM: callee_arm_high: +// CHECK-NEXT-ARM: 10200: 1e ff 2f e1 bx lr diff --git a/test/ELF/arm-branch-error.s b/test/ELF/arm-branch-error.s new file mode 100644 index 000000000000..f1a855d7373f --- /dev/null +++ b/test/ELF/arm-branch-error.s @@ -0,0 +1,19 @@ +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %S/Inputs/far-arm-abs.s -o %tfar +// RUN: not ld.lld %t %tfar -o %t2 2>&1 | FileCheck %s +// REQUIRES: arm + .syntax unified + .section .text, "ax",%progbits + .globl _start + .balign 0x10000 + .type _start,%function +_start: + // address of too_far symbols are just out of range of ARM branch with + // 26-bit immediate field and an addend of -8 + bl too_far1 + b too_far2 + beq too_far3 + +// CHECK: R_ARM_CALL out of range +// CHECK-NEXT: R_ARM_JUMP24 out of range +// CHECK-NEXT: R_ARM_JUMP24 out of range diff --git a/test/ELF/arm-branch.s b/test/ELF/arm-branch.s new file mode 100644 index 000000000000..38266fabf852 --- /dev/null +++ b/test/ELF/arm-branch.s @@ -0,0 +1,59 @@ +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %S/Inputs/far-arm-abs.s -o %tfar +// RUN: echo "SECTIONS { \ +// RUN: .callee1 : { *(.callee_low) } \ +// RUN: .caller : { *(.text) } \ +// RUN: .callee2 : { *(.callee_high) } } " > %t.script +// RUN: ld.lld --script %t.script %t %tfar -o %t2 2>&1 +// RUN: llvm-objdump -d -triple=armv7a-none-linux-gnueabi %t2 | FileCheck %s +// REQUIRES: arm + .syntax unified + .section .callee_low, "ax",%progbits + .align 2 + .type callee_low,%function +callee_low: + bx lr + + .section .text, "ax",%progbits + .globl _start + .balign 0x10000 + .type _start,%function +_start: + bl callee_low + b callee_low + beq callee_low + bl callee_high + b callee_high + bne callee_high + bl far + b far + bgt far + bx lr + + .section .callee_high, "ax",%progbits + .align 2 + .type callee_high,%function +callee_high: + bx lr + +// CHECK: Disassembly of section .caller: +// CHECK-NEXT: _start: +// S(callee_low) = 0xb4 P = 0x10000 A = -8 = -0xff54 = -65364 +// CHECK-NEXT: 10000: 2b c0 ff eb bl #-65364 +// S(callee_low) = 0xb4 P = 0x10004 A = -8 = -0xff58 = -65368 +// CHECK-NEXT: 10004: 2a c0 ff ea b #-65368 +// S(callee_low) = 0xb4 P = 0x10008 A = -8 = -0xff5c -65372 +// CHECK-NEXT: 10008: 29 c0 ff 0a beq #-65372 +// S(callee_high) = 0x10028 P = 0x1000c A = -8 = 0x14 = 20 +// CHECK-NEXT: 1000c: 05 00 00 eb bl #20 +// S(callee_high) = 0x10028 P = 0x10010 A = -8 = 0x10 = 16 +// CHECK-NEXT: 10010: 04 00 00 ea b #16 +// S(callee_high) = 0x10028 P = 0x10014 A = -8 = 0x0c =12 +// CHECK-NEXT: 10014: 03 00 00 1a bne #12 +// S(far) = 0x201001c P = 0x10018 A = -8 = 0x1fffffc = 33554428 +// CHECK-NEXT: 10018: ff ff 7f eb bl #33554428 +// S(far) = 0x201001c P = 0x1001c A = -8 = 0x1fffff8 = 33554424 +// CHECK-NEXT: 1001c: fe ff 7f ea b #33554424 +// S(far) = 0x201001c P = 0x10020 A = -8 = 0x1fffff4 = 33554420 +// CHECK-NEXT: 10020: fd ff 7f ca bgt #33554420 +// CHECK-NEXT: 10024: 1e ff 2f e1 bx lr diff --git a/test/ELF/arm-copy.s b/test/ELF/arm-copy.s new file mode 100644 index 000000000000..e5ce1577babd --- /dev/null +++ b/test/ELF/arm-copy.s @@ -0,0 +1,81 @@ +// REQUIRES: arm +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %p/Inputs/relocation-copy-arm.s -o %t2.o +// RUN: ld.lld -shared %t2.o -o %t2.so +// RUN: ld.lld %t.o %t2.so -o %t3 +// RUN: llvm-readobj -s -r --expand-relocs -symbols %t3 | FileCheck %s +// RUN: llvm-objdump -d -triple=armv7a-none-linux-gnueabi %t3 | FileCheck -check-prefix=CODE %s +// RUN: llvm-objdump -s -triple=armv7a-none-linux-gnueabi -section=.rodata %t3 | FileCheck -check-prefix=RODATA %s + +// Copy relocations R_ARM_COPY are required for y and z + .syntax unified + .text + .globl _start +_start: + movw r2,:lower16: y + movt r2,:upper16: y + ldr r3,[pc,#4] + ldr r3,[r3,#0] + .rodata + .word z + +// CHECK: Name: .bss +// CHECK-NEXT: Type: SHT_NOBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x13000 +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: 8 +// CHECK-NEXT: Link: +// CHECK-NEXT: Info: +// CHECK-NEXT: AddressAlignment: 16 + +// CHECK: Relocations [ +// CHECK-NEXT: Section (5) .rel.dyn { +// CHECK-NEXT: Relocation { +// CHECK-NEXT: Offset: 0x13000 +// CHECK-NEXT: Type: R_ARM_COPY +// CHECK-NEXT: Symbol: y +// CHECK-NEXT: Addend: 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: Relocation { +// CHECK-NEXT: Offset: 0x13004 +// CHECK-NEXT: Type: R_ARM_COPY +// CHECK-NEXT: Symbol: z +// CHECK-NEXT: Addend: 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: } + +// CHECK: Symbols [ +// CHECK: Name: y +// CHECK-NEXT: Value: 0x13000 +// CHECK-NEXT: Size: 4 +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: Object +// CHECK-NEXT: Other: +// CHECK-NEXT: Section: .bss +// CHECK: Name: z +// CHECK-NEXT: Value: 0x13004 +// CHECK-NEXT: Size: 4 +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: Object +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .bss + +// CODE: Disassembly of section .text: +// CODE-NEXT: _start: +// S(y) = 0x13000, A = 0 +// (S + A) & 0x0000ffff = 0x3000 = #12288 +// CODE-NEXT: 11000: 00 20 03 e3 movw r2, #12288 +// S(y) = 0x13000, A = 0 +// ((S + A) & 0xffff0000) >> 16 = 0x1 +// CODE-NEXT: 11004: 01 20 40 e3 movt r2, #1 +// CODE-NEXT: 11008: 04 30 9f e5 ldr r3, [pc, #4] +// CODE-NEXT: 1100c: 00 30 93 e5 ldr r3, [r3] + + +// RODATA: Contents of section .rodata: +// S(z) = 0x13004 +// RODATA-NEXT: 10114 04300100 diff --git a/test/ELF/arm-data-prel.s b/test/ELF/arm-data-prel.s new file mode 100644 index 000000000000..590d8118ae6e --- /dev/null +++ b/test/ELF/arm-data-prel.s @@ -0,0 +1,63 @@ +// RUN: llvm-mc %s -triple=armv7-unknown-linux-gnueabi -filetype=obj -o %t.o +// RUN: echo "SECTIONS { \ +// RUN: .text : { *(.text) } \ +// RUN: .ARM.exidx : { *(.ARM.exidx) } \ +// RUN: .ARM.exidx.TEST1 : { *(.ARM.exidx.TEST1) } \ +// RUN: .TEST1 : { *(.TEST1) } } " > %t.script +// RUN: ld.lld --script %t.script %t.o -o %t +// RUN: llvm-readobj -s -sd %t | FileCheck --check-prefix=CHECK %s +// REQUIRES: arm + +// The R_ARM_PREL31 relocation is used in by the .ARM.exidx exception tables +// bit31 of the place denotes whether the field is an inline table entry +// (bit31=1) or relocation (bit31=0) +// The linker must preserve the value of bit31 + +// This test case is adapted from llvm/test/MC/ARM/eh-compact-pr0.s +// We use a linker script to place the .ARM.exidx sections in between +// the code sections so that we can test positive and negative offsets + .syntax unified + + .section .TEST1, "ax",%progbits + .globl _start + .align 2 + .type _start,%function +_start: + .fnstart + .save {r11, lr} + push {r11, lr} + .setfp r11, sp + mov r11, sp + pop {r11, lr} + mov pc, lr + .fnend + + .section .text, "ax",%progbits +// The generated .ARM.exidx section will refer to the personality +// routine __aeabi_unwind_cpp_pr0. Provide a dummy implementation +// to stop an undefined symbol error + .globl __aeabi_unwind_cpp_pr0 + .align 2 + .type __aeabi_unwind_cpp_pr0,%function +__aeabi_unwind_cpp_pr0: + .fnstart + bx lr + .fnend + +// The expected value of the exception table is +// Word0 0 in bit 31, -4 encoded in 31-bit signed offset +// Word1 Inline table entry EHT Inline Personality Routine #0 +// CHECK: Name: .ARM.exidx +// CHECK: SectionData ( +// CHECK: 0000: FCFFFF7F B0B0B080 +// CHECK: ) + +// The expected value of the exception table is +// Word0 0 in bit 31, +8 encoded in 31-bit signed offset +// Word1 Inline table entry EHT Inline Personality Routine #0 +// set vsp = r11 +// pop r11, r14 +// CHECK: Name: .ARM.exidx.TEST1 +// CHECK: SectionData ( +// CHECK: 0000: 08000000 80849B80 +// CHECK: ) diff --git a/test/ELF/arm-data-relocs.s b/test/ELF/arm-data-relocs.s new file mode 100644 index 000000000000..ed237850c4c1 --- /dev/null +++ b/test/ELF/arm-data-relocs.s @@ -0,0 +1,20 @@ +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %S/Inputs/abs256.s -o %t256.o +// RUN: ld.lld %t %t256.o -o %t2 +// RUN: llvm-objdump -d %t2 | FileCheck %s +// REQUIRES: arm + .syntax unified + .globl _start +_start: + .section .R_ARM_ABS32POS, "ax",%progbits + .word foo + 0x24 + +// S = 0x100, A = 0x24 +// S + A = 0x124 +// CHECK: Disassembly of section .R_ARM_ABS32POS: +// CHECK: 11000: 24 01 00 00 + .section .R_ARM_ABS32NEG, "ax",%progbits + .word foo - 0x24 +// S = 0x100, A = -0x24 +// CHECK: Disassembly of section .R_ARM_ABS32NEG: +// CHECK: 11004: dc 00 00 00 diff --git a/test/ELF/arm-fpic-got.s b/test/ELF/arm-fpic-got.s new file mode 100644 index 000000000000..4b6002d3c077 --- /dev/null +++ b/test/ELF/arm-fpic-got.s @@ -0,0 +1,63 @@ +// REQUIRES: arm +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o +// RUN: ld.lld %t.o -o %t +// RUN: llvm-readobj -s %t | FileCheck %s +// RUN: llvm-readobj -s -symbols %t | FileCheck -check-prefix=SYMBOLS %s +// RUN: llvm-objdump -d -triple=armv7a-none-linux-gnueabi %t | FileCheck -check-prefix=CODE %s + +// Test the R_ARM_GOT_PREL relocation + .syntax unified + .text + .globl _start + .align 2 +_start: + ldr r0, .LCPI0_0 +.LPC0_0: + ldr r0, [pc, r0] + ldr r0, [r0] + bx lr +.LCPI0_0: +.Ltmp0: + // Generate R_ARM_GOT_PREL + .long val(GOT_PREL)-((.LPC0_0+8)-.Ltmp0) + + .data + .type val,%object + .globl val + .align 2 +val: + .long 10 + .size val, 4 + +// CHECK: Section { +// CHECK: Name: .got +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x12000 +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: 4 +// CHECK-NEXT: Link: +// CHECK-NEXT: Info: +// CHECK-NEXT: AddressAlignment: 4 +// CHECK-NEXT: EntrySize: + +// SYMBOLS: Name: val +// SYMBOLS-NEXT: Value: 0x13000 +// SYMBOLS-NEXT: Size: 4 +// SYMBOLS-NEXT: Binding: Global +// SYMBOLS-NEXT: Type: Object +// SYMBOLS-NEXT: Other: +// SYMBOLS-NEXT: Section: .data + +// CODE: Disassembly of section .text: +// CODE-NEXT: _start: +// CODE-NEXT: 11000: 08 00 9f e5 ldr r0, [pc, #8] +// CODE-NEXT: 11004: 00 00 9f e7 ldr r0, [pc, r0] +// CODE-NEXT: 11008: 00 00 90 e5 ldr r0, [r0] +// CODE-NEXT: 1100c: 1e ff 2f e1 bx lr +// CODE: $d.1: +// 0x11004 + 0x0ff4 + 8 = 0x12000 = .got +// CODE-NEXT: 11010: f4 0f 00 00 diff --git a/test/ELF/arm-gnu-ifunc-nosym.s b/test/ELF/arm-gnu-ifunc-nosym.s new file mode 100644 index 000000000000..fa79aef7ced8 --- /dev/null +++ b/test/ELF/arm-gnu-ifunc-nosym.s @@ -0,0 +1,27 @@ +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o +// RUN: ld.lld -static %t.o -o %tout +// RUN: llvm-readobj -symbols %tout | FileCheck %s +// REQUIRES: arm + +// Check that no __rel_iplt_end/__rel_iplt_start +// appear in symtab if there are no references to them. +// CHECK: Symbols [ +// CHECK-NOT: __rel_iplt_end +// CHECK-NOT: __rel_iplt_start +// CHECK: ] + .syntax unified + .text + .type foo STT_GNU_IFUNC + .globl foo +foo: + bx lr + + .type bar STT_GNU_IFUNC + .globl bar +bar: + bx lr + + .globl _start +_start: + bl foo + bl bar diff --git a/test/ELF/arm-gnu-ifunc.s b/test/ELF/arm-gnu-ifunc.s new file mode 100644 index 000000000000..c1e8a7183530 --- /dev/null +++ b/test/ELF/arm-gnu-ifunc.s @@ -0,0 +1,131 @@ +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o +// RUN: ld.lld -static %t.o -o %tout +// RUN: llvm-objdump -triple armv7a-none-linux-gnueabi -d %tout | FileCheck %s --check-prefix=DISASM +// RUN: llvm-readobj -r -symbols -sections %tout | FileCheck %s +// REQUIRES: arm + .syntax unified + .text + .type foo STT_GNU_IFUNC + .globl foo +foo: + bx lr + + .type bar STT_GNU_IFUNC + .globl bar +bar: + bx lr + + .globl _start +_start: + bl foo + bl bar + movw r0,:lower16:__rel_iplt_start + movt r0,:upper16:__rel_iplt_start + movw r0,:lower16:__rel_iplt_end + movt r0,:upper16:__rel_iplt_end + +// CHECK: Sections [ +// CHECK: Section { +// CHECK: Index: 1 +// CHECK-NEXT: Name: .rel.plt +// CHECK-NEXT: Type: SHT_REL +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: ] +// CHECK-NEXT: Address: [[REL:.*]] +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: 16 +// CHECK-NEXT: Link: +// CHECK-NEXT: Info: +// CHECK-NEXT: AddressAlignment: 4 +// CHECK-NEXT: EntrySize: 8 +// CHECK-NEXT: } +// CHECK: Relocations [ +// CHECK-NEXT: Section (1) .rel.plt { +// CHECK-NEXT: 0x1200C R_ARM_IRELATIVE +// CHECK-NEXT: 0x12010 R_ARM_IRELATIVE +// CHECK-NEXT: } +// CHECK-NEXT:] +// CHECK: Symbols [ +// CHECK: Symbol { +// CHECK: Name: __rel_iplt_end +// CHECK-NEXT: Value: 0x100E4 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other [ +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] +// CHECK-NEXT: Section: .rel.plt +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: __rel_iplt_start +// CHECK-NEXT: Value: 0x100D4 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other [ +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] +// CHECK-NEXT: Section: .rel.plt +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: _start (6) +// CHECK-NEXT: Value: 0x11008 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other: +// CHECK-NEXT: Section: .text +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: bar +// CHECK-NEXT: Value: 0x11004 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: GNU_IFunc +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .text +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: foo +// CHECK-NEXT: Value: 0x11000 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: GNU_IFunc +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .text +// CHECK-NEXT: } + +// DISASM: Disassembly of section .text: +// DISASM-NEXT: foo: +// DISASM-NEXT: 11000: 1e ff 2f e1 bx lr +// DISASM: bar: +// DISASM-NEXT: 11004: 1e ff 2f e1 bx lr +// DISASM: _start: +// DISASM-NEXT: 11008: 09 00 00 eb bl #36 +// DISASM-NEXT: 1100c: 0c 00 00 eb bl #48 +// DISASM-NEXT: 11010: d4 00 00 e3 movw r0, #212 +// DISASM-NEXT: 11014: 01 00 40 e3 movt r0, #1 +// r0 = 212 + 1 * 65536 = 100D4 = __rel_iplt_start +// DISASM-NEXT: 11018: e4 00 00 e3 movw r0, #228 +// DISASM-NEXT: 1101c: 01 00 40 e3 movt r0, #1 +// r1 = 228 + 1 * 65536 = 100E4 = __rel_iplt_end +// DISASM-NEXT: Disassembly of section .plt: +// DISASM-NEXT: .plt: +// DISASM-NEXT: 11020: 04 e0 2d e5 str lr, [sp, #-4]! +// DISASM-NEXT: 11024: 04 e0 9f e5 ldr lr, [pc, #4] +// DISASM-NEXT: 11028: 0e e0 8f e0 add lr, pc, lr +// DISASM-NEXT: 1102c: 08 f0 be e5 ldr pc, [lr, #8]! +// 0x0fd0 + 0x11028 + 0x8 = 0x12000 +// DISASM-NEXT: 11030: d0 0f 00 00 +// DISASM-NEXT: 11034: 04 c0 9f e5 ldr r12, [pc, #4] +// DISASM-NEXT: 11038: 0f c0 8c e0 add r12, r12, pc +// DISASM-NEXT: 1103c: 00 f0 9c e5 ldr pc, [r12] +// 0x0fcc + 0x11038 + 0x8 = 0x1200C +// DISASM-NEXT: 11040: cc 0f 00 00 +// DISASM-NEXT: 11044: 04 c0 9f e5 ldr r12, [pc, #4] +// DISASM-NEXT: 11048: 0f c0 8c e0 add r12, r12, pc +// DISASM-NEXT: 1104c: 00 f0 9c e5 ldr pc, [r12] +// 0x0fc0 + 0x11048 + 0x8 = 0x12010 +// DISASM-NEXT: 11050: c0 0f 00 00 diff --git a/test/ELF/arm-got-relative.s b/test/ELF/arm-got-relative.s new file mode 100644 index 000000000000..22ccb16a2a58 --- /dev/null +++ b/test/ELF/arm-got-relative.s @@ -0,0 +1,53 @@ +// REQUIRES: arm +// RUN: llvm-mc -position-independent -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o +// RUN: ld.lld %t.o -shared -o %t +// RUN: llvm-readobj -s -symbols -dyn-relocations %t | FileCheck %s +// RUN: llvm-objdump -d -triple=armv7a-none-linux-gnueabi %t | FileCheck -check-prefix=CODE %s + .syntax unified + .text + .globl _start + .align 2 +_start: + .type _start, %function + ldr r3, .LGOT + ldr r2, .LGOT+4 +.LPIC: + add r0, pc, r3 + bx lr + .align 2 +.LGOT: + // gas implicitly uses (GOT_PREL) for _GLOBAL_OFFSET_TABLE_ in PIC + // llvm-mc needs the (GOT_PREL) suffix or it generates R_ARM_REL32 + .word _GLOBAL_OFFSET_TABLE_(GOT_PREL) - (.LPIC+8) + .word function(GOT) + + .globl function + .align 2 +function: + .type function, %function + bx lr + +// CHECK: Dynamic Relocations { +// CHECK-NEXT: 0x204C R_ARM_GLOB_DAT function 0x0 + +// CHECK: Name: _GLOBAL_OFFSET_TABLE_ (16) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: +// CHECK-NEXT: Binding: Local +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other [ +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] +// CHECK-NEXT: Section: Absolute + +// CODE: Disassembly of section .text: +// CODE-NEXT: _start: +// CODE-NEXT: 1000: 08 30 9f e5 ldr r3, [pc, #8] +// CODE-NEXT: 1004: 08 20 9f e5 ldr r2, [pc, #8] +// CODE-NEXT: 1008: 03 00 8f e0 add r0, pc, r3 +// CODE-NEXT: 100c: 1e ff 2f e1 bx lr +// CODE:$d.1: +// (_GLOBAL_OFFSET_TABLE_ = 0x2048) - (0x1008 + 8) 0x1038 +// CODE-NEXT: 1010: 38 10 00 00 +// (Got(function) - GotBase = 0x4 +// CODE-NEXT: 1014: 04 00 00 00 diff --git a/test/ELF/arm-gotoff.s b/test/ELF/arm-gotoff.s new file mode 100644 index 000000000000..5169f84e6a01 --- /dev/null +++ b/test/ELF/arm-gotoff.s @@ -0,0 +1,74 @@ +// RUN: llvm-mc -filetype=obj -triple=armv7a-linux-gnueabi %s -o %t.o +// RUN: ld.lld %t.o -o %t +// RUN: llvm-readobj -s -r -t %t | FileCheck %s +// RUN: llvm-objdump -triple=armv7a-linux-gnueabi -d %t | FileCheck --check-prefix=DISASM %s +// REQUIRES: arm + +// Test the R_ARM_GOTOFF32 relocation + +// CHECK: Name: .got +// CHECK-NEXT: Type: SHT_PROGBITS (0x1) +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x12000 +// CHECK-NEXT: Offset: 0x2000 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Link: +// CHECK-NEXT: Info: +// CHECK-NEXT: AddressAlignment: + +// CHECK: Name: .bss +// CHECK-NEXT: Type: SHT_NOBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x12000 +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: 20 +// CHECK-NEXT: Link: +// CHECK-NEXT: Info: +// CHECK-NEXT: AddressAlignment: 1 + +// CHECK-NEXT: EntrySize: 0 + +// CHECK: Symbol { +// CHECK: Name: bar +// CHECK-NEXT: Value: 0x12000 +// CHECK-NEXT: Size: 10 +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: Object +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .bss +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: obj +// CHECK-NEXT: Value: 0x1200A +// CHECK-NEXT: Size: 10 +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: Object +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .bss + +// DISASM: Disassembly of section .text: +// DISASM-NEXT :_start: +// DISASM-NEXT 11000: 1e ff 2f e1 bx lr +// Offset 0 from .got = bar +// DISASM 11004: 00 00 00 00 +// Offset 10 from .got = obj +// DISASM-NEXT 11008: 0a 00 00 00 +// Offset 15 from .got = obj +5 +// DISASM-NEXT 1100c: 0f 00 00 00 + .syntax unified + .globl _start +_start: + bx lr + .word bar(GOTOFF) + .word obj(GOTOFF) + .word obj(GOTOFF)+5 + .type bar, %object + .comm bar, 10 + .type obj, %object + .comm obj, 10 diff --git a/test/ELF/arm-mov-relocs.s b/test/ELF/arm-mov-relocs.s new file mode 100644 index 000000000000..31ccba4cceaf --- /dev/null +++ b/test/ELF/arm-mov-relocs.s @@ -0,0 +1,94 @@ +// RUN: llvm-mc -filetype=obj -triple=armv7a-unknown-linux-gnueabi %s -o %t +// RUN: ld.lld %t -o %t2 +// RUN: llvm-objdump -d %t2 -triple=armv7a-unknown-linux-gnueabi | FileCheck %s +// RUN: llvm-mc -filetype=obj -triple=thumbv7a-unknown-linux-gnueabi %s -o %t3 +// RUN: ld.lld %t3 -o %t4 +// RUN: llvm-objdump -d %t4 -triple=thumbv7a-unknown-linux-gnueabi | FileCheck %s +// REQUIRES: arm + +// Test the R_ARM_MOVW_ABS_NC and R_ARM_MOVT_ABS relocations as well as +// the R_ARM_THM_MOVW_ABS_NC and R_ARM_THM_MOVT_ABS relocations. + .syntax unified + .globl _start +_start: + .section .R_ARM_MOVW_ABS_NC, "ax",%progbits + movw r0, :lower16:label + movw r1, :lower16:label1 + movw r2, :lower16:label2 + 4 + movw r3, :lower16:label3 + movw r4, :lower16:label3 + 4 +// CHECK: Disassembly of section .R_ARM_MOVW_ABS_NC +// CHECK: movw r0, #0 +// CHECK: movw r1, #4 +// CHECK: movw r2, #12 +// CHECK: movw r3, #65532 +// CHECK: movw r4, #0 + .section .R_ARM_MOVT_ABS, "ax",%progbits + movt r0, :upper16:label + movt r1, :upper16:label1 +// FIXME: We shouldn't need to multiply by 65536. +// arguably llvm-mc incorrectly assembles addends for +// SHT_REL relocated movt instructions. When there is a relocation +// the interpretation of the addend for SHT_REL is not shifted + movt r2, :upper16:label2 + (4 * 65536) + movt r3, :upper16:label3 +// FIXME: We shouldn't need to multiply by 65536 see comment above. + movt r4, :upper16:label3 + (4 * 65536) +// CHECK: Disassembly of section .R_ARM_MOVT_ABS +// CHECK: movt r0, #2 +// CHECK: movt r1, #2 +// CHECK: movt r2, #2 +// CHECK: movt r3, #2 +// CHECK: movt r4, #3 + +.section .R_ARM_MOVW_PREL_NC, "ax",%progbits + movw r0, :lower16:label - . + movw r1, :lower16:label1 - . + movw r2, :lower16:label2 + 4 - . + movw r3, :lower16:label3 - . + movw r4, :lower16:label3 + 0x103c - . +// 0x20000 - 0x11028 = :lower16:0xefd8 (61400) +// CHECK: 11028: {{.*}} movw r0, #61400 +// 0x20004 = 0x1102c = :lower16:0xefd8 (61400) +// CHECK: 1102c: {{.*}} movw r1, #61400 +// 0x20008 - 0x11030 + 4 = :lower16:0xefdc (61404) +// CHECK: 11030: {{.*}} movw r2, #61404 +// 0x2fffc - 0x11034 = :lower16:0x1efc8 (61384) +// CHECK: 11034: {{.*}} movw r3, #61384 +// 0x2fffc - 0x11038 +0x103c :lower16:0x20000 (0) +// CHECK: 11038: {{.*}} movw r4, #0 + +.section .R_ARM_MOVT_PREL, "ax",%progbits + movt r0, :upper16:label - . + movt r1, :upper16:label1 - . + movt r2, :upper16:label2 + 0x4 - . + movt r3, :upper16:label3 - . + movt r4, :upper16:label3 + 0x1050 - . +// 0x20000 - 0x1103c = :upper16:0xefc4 = 0 +// CHECK: 1103c: {{.*}} movt r0, #0 +// 0x20004 - 0x11040 = :upper16:0xefc0 = 0 +// CHECK: 11040: {{.*}} movt r1, #0 +// 0x20008 - 0x11044 + 4 = :upper16:0xefc8 = 0 +// CHECK: 11044: {{.*}} movt r2, #0 +// 0x2fffc - 0x11048 = :upper16:0x1efb4 = 1 +// CHECK: 11048: {{.*}} movt r3, #1 +// 0x2fffc - 0x1104c + 0x1050 = :upper16:0x20000 = 2 +// CHECK: 1104c: {{.*}} movt r4, #2 + .section .destination, "aw",%progbits + .balign 65536 +// 0x20000 +label: + .word 0 +// 0x20004 +label1: + .word 1 +// 0x20008 +label2: + .word 2 +// Test label3 is immediately below 2^16 alignment boundary + .space 65536 - 16 +// 0x2fffc +label3: + .word 3 +// label3 + 4 is on a 2^16 alignment boundary + .word 4 diff --git a/test/ELF/arm-plt-reloc.s b/test/ELF/arm-plt-reloc.s new file mode 100644 index 000000000000..0616aa7966a9 --- /dev/null +++ b/test/ELF/arm-plt-reloc.s @@ -0,0 +1,90 @@ +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %p/Inputs/arm-plt-reloc.s -o %t1 +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t2 +// RUN: ld.lld %t1 %t2 -o %t +// RUN: llvm-objdump -triple=armv7a-none-linux-gnueabi -d %t | FileCheck %s +// RUN: ld.lld -shared %t1 %t2 -o %t3 +// RUN: llvm-objdump -triple=armv7a-none-linux-gnueabi -d %t3 | FileCheck -check-prefix=DSO %s +// RUN: llvm-readobj -s -r %t3 | FileCheck -check-prefix=DSOREL %s +// REQUIRES: arm +// +// Test PLT entry generation + .syntax unified + .text + .align 2 + .globl _start + .type _start,%function +_start: + b func1 + bl func2 + beq func3 + +// Executable, expect no PLT +// CHECK: Disassembly of section .text: +// CHECK-NEXT: func1: +// CHECK-NEXT: 11000: 1e ff 2f e1 bx lr +// CHECK: func2: +// CHECK-NEXT: 11004: 1e ff 2f e1 bx lr +// CHECK: func3: +// CHECK-NEXT: 11008: 1e ff 2f e1 bx lr +// CHECK: _start: +// CHECK-NEXT: 1100c: fb ff ff ea b #-20 +// CHECK-NEXT: 11010: fb ff ff eb bl #-20 +// CHECK-NEXT: 11014: fb ff ff 0a beq #-20 + +// Expect PLT entries as symbols can be preempted +// DSO: Disassembly of section .text: +// DSO-NEXT: func1: +// DSO-NEXT: 1000: 1e ff 2f e1 bx lr +// DSO: func2: +// DSO-NEXT: 1004: 1e ff 2f e1 bx lr +// DSO: func3: +// DSO-NEXT: 1008: 1e ff 2f e1 bx lr +// DSO: _start: +// S(0x1034) - P(0x100c) + A(-8) = 0x20 = 32 +// DSO-NEXT: 100c: 08 00 00 ea b #32 +// S(0x1044) - P(0x1010) + A(-8) = 0x2c = 44 +// DSO-NEXT: 1010: 0b 00 00 eb bl #44 +// S(0x1054) - P(0x1014) + A(-8) = 0x38 = 56 +// DSO-NEXT: 1014: 0e 00 00 0a beq #56 +// DSO: Disassembly of section .plt: +// DSO-NEXT:.plt: +// DSO-NEXT: 1020: 04 e0 2d e5 str lr, [sp, #-4]! +// DSO-NEXT: 1024: 04 e0 9f e5 ldr lr, [pc, #4] +// DSO-NEXT: 1028: 0e e0 8f e0 add lr, pc, lr +// DSO-NEXT: 102c: 08 f0 be e5 ldr pc, [lr, #8]! +// 0x1028 + 8 + 1fd0 = 0x3000 +// DSO-NEXT: 1030: d0 1f 00 00 +// DSO-NEXT: 1034: 04 c0 9f e5 ldr r12, [pc, #4] +// DSO-NEXT: 1038: 0f c0 8c e0 add r12, r12, pc +// DSO-NEXT: 103c: 00 f0 9c e5 ldr pc, [r12] +// 0x1038 + 8 + 1fcc = 0x300c +// DSO-NEXT: 1040: cc 1f 00 00 +// DSO-NEXT: 1044: 04 c0 9f e5 ldr r12, [pc, #4] +// DSO-NEXT: 1048: 0f c0 8c e0 add r12, r12, pc +// DSO-NEXT: 104c: 00 f0 9c e5 ldr pc, [r12] +// 0x1048 + 8 + 1fc0 = 0x3010 +// DSO-NEXT: 1050: c0 1f 00 00 +// DSO-NEXT: 1054: 04 c0 9f e5 ldr r12, [pc, #4] +// DSO-NEXT: 1058: 0f c0 8c e0 add r12, r12, pc +// DSO-NEXT: 105c: 00 f0 9c e5 ldr pc, [r12] +// 0x1058 + 8 + 1fb4 = 0x3014 +// DSO-NEXT: 1060: b4 1f 00 00 + +// DSOREL: Name: .got.plt +// DSOREL-NEXT: Type: SHT_PROGBITS +// DSOREL-NEXT: Flags [ +// DSOREL-NEXT: SHF_ALLOC +// DSOREL-NEXT: SHF_WRITE +// DSOREL-NEXT: ] +// DSOREL-NEXT: Address: 0x3000 +// DSOREL-NEXT: Offset: +// DSOREL-NEXT: Size: 24 +// DSOREL-NEXT: Link: +// DSOREL-NEXT: Info: +// DSOREL-NEXT: AddressAlignment: 4 +// DSOREL-NEXT: EntrySize: +// DSOREL: Relocations [ +// DSOREL-NEXT: Section (4) .rel.plt { +// DSOREL-NEXT: 0x300C R_ARM_JUMP_SLOT func1 0x0 +// DSOREL-NEXT: 0x3010 R_ARM_JUMP_SLOT func2 0x0 +// DSOREL-NEXT: 0x3014 R_ARM_JUMP_SLOT func3 0x0 diff --git a/test/ELF/arm-thumb-blx.s b/test/ELF/arm-thumb-blx.s new file mode 100644 index 000000000000..b581d1dd3acd --- /dev/null +++ b/test/ELF/arm-thumb-blx.s @@ -0,0 +1,85 @@ +// RUN: llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t +// RUN: llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi %S/Inputs/arm-thumb-blx-targets.s -o %ttarget +// RUN: echo "SECTIONS { \ +// RUN: .R_ARM_CALL24_callee1 : { *(.R_ARM_CALL24_callee_low) } \ +// RUN: .R_ARM_CALL24_callee2 : { *(.R_ARM_CALL24_callee_thumb_low) } \ +// RUN: .caller : { *(.text) } \ +// RUN: .R_ARM_CALL24_callee3 : { *(.R_ARM_CALL24_callee_high) } \ +// RUN: .R_ARM_CALL24_callee4 : { *(.R_ARM_CALL24_callee_thumb_high) } } " > %t.script +// RUN: ld.lld --script %t.script %t %ttarget -o %t2 2>&1 +// RUN: llvm-objdump -d -triple=thumbv7a-none-linux-gnueabi %t2 | FileCheck -check-prefix=CHECK-THUMB %s +// RUN: llvm-objdump -d -triple=armv7a-none-linux-gnueabi %t2 | FileCheck -check-prefix=CHECK-ARM %s +// REQUIRES: arm +// Test BLX instruction is chosen for Thumb BL/BLX instruction and ARM callee +// 2 byte nops are used to test the pc-rounding behaviour. As a BLX from a +// 2 byte aligned destination is defined as Align(PC,4) + immediate:00 +// FIXME: llvm-mc has problems assembling BLX unless the destination is +// external. The targets of the BL and BLX instructions are in arm-thumb-blx-target.s + .syntax unified + .section .text, "ax",%progbits + .thumb + .globl _start + .balign 0x10000 + .type _start,%function +_start: + blx callee_low + nop + bl callee_low + nop + blx callee_high + nop + bl callee_high + nop + blx blx_far + nop + bl blx_far + nop +// Expect BLX to thumb target to be written out as a BL + blx callee_thumb_low + nop + blx callee_thumb_high + bx lr + +// CHECK-ARM: Disassembly of section .R_ARM_CALL24_callee1: +// CHECK-NEXT-ARM: callee_low: +// CHECK-NEXT-ARM: b4: 1e ff 2f e1 bx lr + +// CHECK-THUMB: Disassembly of section .R_ARM_CALL24_callee2: +// CHECK-NEXT-THUMB: callee_thumb_low: +// CHECK-NEXT-THUMB: 100: 70 47 bx lr + +// CHECK-THUMB: Disassembly of section .caller: +// CHECK-THUMB: _start: +// Align(0x10000,4) - 0xff50 (65360) + 4 = 0xb4 = callee_low +// CHECK-NEXT-THUMB: 10000: f0 f7 58 e8 blx #-65360 +// CHECK-NEXT-THUMB: 10004: 00 bf nop +// Align(0x10006,4) - 0xff54 (65364) + 4 = 0xb4 = callee_low +// CHECK-NEXT-THUMB: 10006: f0 f7 56 e8 blx #-65364 +// CHECK-NEXT-THUMB: 1000a: 00 bf nop +// Align(0x1000c,4) + 0xf0 (240) + 4 = 0x10100 = callee_high +// CHECK-NEXT-THUMB: 1000c: 00 f0 78 e8 blx #240 +// CHECK-NEXT-THUMB: 10010: 00 bf nop +// Align(0x10012,4) + 0xec (236) + 4 = 0x10100 = callee_high +// CHECK-NEXT-THUMB: 10012: 00 f0 76 e8 blx #236 +// CHECK-NEXT-THUMB: 10016: 00 bf nop +// Align(0x10018,4) + 0xfffffc (16777212) = 0x1010018 = blx_far +// CHECK-NEXT-THUMB: 10018: ff f3 fe c7 blx #16777212 +// CHECK-NEXT-THUMB: 1001c: 00 bf nop +// Align(0x1001e,4) + 0xfffff8 (16777208) = 0x1010018 = blx_far +// CHECK-NEXT-THUMB: 1001e: ff f3 fc c7 blx #16777208 +// CHECK-NEXT-THUMB: 10022: 00 bf nop +// 10024 - 0xff28 (65320) + 4 = 0x100 = callee_thumb_low +// CHECK-NEXT-THUMB: 10024: f0 f7 6c f8 bl #-65320 +// CHECK-NEXT-THUMB: 10028: 00 bf nop +// 1002a + 0x1d2 (466) + 4 = 0x10200 = callee_thumb_high +// CHECK-NEXT-THUMB: 1002a: 00 f0 e9 f8 bl #466 +// CHECK-NEXT-THUMB: 1002e: 70 47 bx lr + + +// CHECK-ARM: Disassembly of section .R_ARM_CALL24_callee3: +// CHECK-NEXT-ARM: callee_high: +// CHECK-NEXT-ARM: 10100: 1e ff 2f e1 bx lr + +// CHECK: Disassembly of section .R_ARM_CALL24_callee4: +// CHECK-NEXT-THUMB:callee_thumb_high: +// CHECK-NEXT-THUMB: 10200: 70 47 bx lr diff --git a/test/ELF/arm-thumb-branch-error.s b/test/ELF/arm-thumb-branch-error.s new file mode 100644 index 000000000000..de6c1bc16c96 --- /dev/null +++ b/test/ELF/arm-thumb-branch-error.s @@ -0,0 +1,19 @@ +// RUN: llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t +// RUN: llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi %S/Inputs/far-arm-thumb-abs.s -o %tfar +// RUN: not ld.lld %t %tfar -o %t2 2>&1 | FileCheck %s +// REQUIRES: arm + .syntax unified + .section .text, "ax",%progbits + .globl _start + .balign 0x10000 + .type _start,%function +_start: + // address of too_far symbols are just out of range of ARM branch with + // 26-bit immediate field and an addend of -8 + bl too_far1 + b too_far2 + beq.w too_far3 + +// CHECK: R_ARM_THM_CALL out of range +// CHECK-NEXT: R_ARM_THM_JUMP24 out of range +// CHECK-NEXT: R_ARM_THM_JUMP19 out of range diff --git a/test/ELF/arm-thumb-branch.s b/test/ELF/arm-thumb-branch.s new file mode 100644 index 000000000000..94be9ecb6e53 --- /dev/null +++ b/test/ELF/arm-thumb-branch.s @@ -0,0 +1,59 @@ +// RUN: llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t +// RUN: llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi %S/Inputs/far-arm-thumb-abs.s -o %tfar +// RUN: echo "SECTIONS { \ +// RUN: .callee1 : { *(.callee_low) } \ +// RUN: .caller : { *(.text) } \ +// RUN: .callee2 : { *(.callee_high) } } " > %t.script +// RUN: ld.lld --script %t.script %t %tfar -o %t2 2>&1 +// RUN: llvm-objdump -d -triple=thumbv7a-none-linux-gnueabi %t2 | FileCheck %s +// REQUIRES: arm + + .syntax unified + .thumb + .section .callee_low, "ax",%progbits + .align 2 + .type callee_low,%function +callee_low: + bx lr + + .section .text, "ax",%progbits + .globl _start + .balign 0x10000 + .type _start,%function +_start: + bl callee_low + b callee_low + beq callee_low + bl callee_high + b callee_high + bne callee_high + bl far_uncond + b far_uncond + bgt far_cond + bx lr + + .section .callee_high, "ax",%progbits + .align 2 + .type callee_high,%function +callee_high: + bx lr + +// CHECK: Disassembly of section .callee1: +// CHECK-NEXT: callee_low: +// CHECK-NEXT: b4: 70 47 bx lr +// CHECK-NEXT: Disassembly of section .caller: +// CHECK-NEXT: _start: +// CHECK-NEXT: 10000: f0 f7 58 f8 bl #-65360 +// CHECK-NEXT: 10004: f0 f7 56 b8 b.w #-65364 +// CHECK-NEXT: 10008: 30 f4 54 a8 beq.w #-65368 +// CHECK-NEXT: 1000c: 00 f0 0c f8 bl #24 +// CHECK-NEXT: 10010: 00 f0 0a b8 b.w #20 +// CHECK-NEXT: 10014: 40 f0 08 80 bne.w #16 +// CHECK-NEXT: 10018: ff f3 ff d7 bl #16777214 +// CHECK-NEXT: 1001c: ff f3 fd 97 b.w #16777210 +// CHECK-NEXT: 10020: 3f f3 ff af bgt.w #1048574 +// CHECK-NEXT: 10024: 70 47 bx lr +// CHECK-NEXT: 10026: 00 00 movs r0, r0 +// CHECK-NEXT: Disassembly of section .callee2: +// CHECK-NEXT: callee_high: +// CHECK-NEXT: 10028: 70 47 bx lr diff --git a/test/ELF/arm-thumb-interwork-thunk.s b/test/ELF/arm-thumb-interwork-thunk.s new file mode 100644 index 000000000000..6173df3c066b --- /dev/null +++ b/test/ELF/arm-thumb-interwork-thunk.s @@ -0,0 +1,375 @@ +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t +// RUN: echo "SECTIONS { \ +// RUN: .R_ARM_JUMP24_callee_1 : { *(.R_ARM_JUMP24_callee_low) } \ +// RUN: .R_ARM_THM_JUMP_callee_1 : { *(.R_ARM_THM_JUMP_callee_low)} \ +// RUN: .text : { *(.text) } \ +// RUN: .arm_caller : { *(.arm_caller) } \ +// RUN: .thumb_caller : { *(.thumb_caller) } \ +// RUN: .R_ARM_JUMP24_callee_2 : { *(.R_ARM_JUMP24_callee_high) } \ +// RUN: .R_ARM_THM_JUMP_callee_2 : { *(.R_ARM_THM_JUMP_callee_high) } } " > %t.script +// RUN: ld.lld --script %t.script %t -o %t2 2>&1 +// RUN: llvm-objdump -d -triple=thumbv7a-none-linux-gnueabi %t2 | FileCheck -check-prefix=CHECK-THUMB -check-prefix=CHECK-ABS-THUMB %s +// RUN: llvm-objdump -d -triple=armv7a-none-linux-gnueabi %t2 | FileCheck -check-prefix=CHECK-ARM -check-prefix=CHECK-ABS-ARM %s +// RUN: ld.lld --script %t.script %t -pie -o %t3 2>&1 +// RUN: ld.lld --script %t.script %t --shared -o %t4 2>&1 +// RUN: llvm-objdump -d -triple=thumbv7a-none-linux-gnueabi %t3 | FileCheck -check-prefix=CHECK-THUMB -check-prefix=CHECK-PI-THUMB %s +// RUN: llvm-objdump -d -triple=armv7a-none-linux-gnueabi %t3 | FileCheck -check-prefix=CHECK-ARM -check-prefix=CHECK-PI-ARM %s +// RUN: llvm-objdump -d -triple=thumbv7a-none-linux-gnueabi %t4 | FileCheck -check-prefix=CHECK-THUMB -check-prefix=CHECK-PI-PLT-THUMB %s +// RUN: llvm-objdump -d -triple=armv7a-none-linux-gnueabi %t4 | FileCheck -check-prefix=CHECK-ARM -check-prefix=CHECK-PI-PLT-ARM %s +// RUN: llvm-readobj -s -r %t4 | FileCheck -check-prefix=CHECK-DSO-REL %s +// REQUIRES: arm + +// Test ARM Thumb Interworking +// The file is linked and checked 3 times to check the following contexts +// - Absolute executables, absolute Thunks are used. +// - Position independent executables, position independent Thunks are used. +// - Shared object, position independent Thunks to PLT entries are used. + + .syntax unified + +// Target Sections for thunks at a lower address than the callers. +.section .R_ARM_JUMP24_callee_low, "ax", %progbits + .thumb + .balign 0x1000 + .globl thumb_callee1 + .type thumb_callee1, %function +thumb_callee1: + bx lr + +// CHECK-THUMB: Disassembly of section .R_ARM_JUMP24_callee_1: +// CHECK-THUMB: thumb_callee1: +// CHECK-THUMB: 1000: 70 47 bx + .section .R_ARM_THM_JUMP_callee_low, "ax", %progbits + .arm + .balign 0x100 + .globl arm_callee1 + .type arm_callee1, %function +arm_callee1: + bx lr +// Disassembly of section .R_ARM_THM_JUMP_callee_1: +// CHECK-ARM: arm_callee1: +// CHECK-ARM-NEXT: 1100: 1e ff 2f e1 bx lr + + // Calling sections + // At present ARM and Thumb interworking thunks are always added to the calling + // section. + .section .arm_caller, "ax", %progbits + .arm + .balign 0x100 + .globl arm_caller + .type arm_caller, %function +arm_caller: + // If target supports BLX and target is in range we don't need an + // interworking thunk for a BL or BLX instruction. + bl thumb_callee1 + blx thumb_callee1 + // A B instruction can't be transformed into a BLX and needs an interworking + // thunk + b thumb_callee1 + // As long as the thunk is in range it can be reused + b thumb_callee1 + // There can be more than one thunk associated with a section + b thumb_callee2 + b thumb_callee3 + // In range ARM targets do not require interworking thunks + b arm_callee1 + beq arm_callee2 + bne arm_callee3 + bx lr +// CHECK-ABS-ARM: Disassembly of section .arm_caller: +// CHECK-ABS-ARM-NEXT: arm_caller: +// CHECK-ABS-ARM-NEXT: 1300: 3e ff ff fa blx #-776 +// CHECK-ABS-ARM-NEXT: 1304: 3d ff ff fa blx #-780 +// CHECK-ABS-ARM-NEXT: 1308: 06 00 00 ea b #24 +// CHECK-ABS-ARM-NEXT: 130c: 05 00 00 ea b #20 +// CHECK-ABS-ARM-NEXT: 1310: 07 00 00 ea b #28 +// CHECK-ABS-ARM-NEXT: 1314: 09 00 00 ea b #36 +// CHECK-ABS-ARM-NEXT: 1318: 78 ff ff ea b #-544 +// CHECK-ABS-ARM-NEXT: 131c: b7 00 00 0a beq #732 +// CHECK-ABS-ARM-NEXT: 1320: b7 00 00 1a bne #732 +// CHECK-ABS-ARM-NEXT: 1324: 1e ff 2f e1 bx lr +// 0x1001 = thumb_callee1 +// CHECK-ABS-ARM-NEXT: 1328: 01 c0 01 e3 movw r12, #4097 +// CHECK-ABS-ARM-NEXT: 132c: 00 c0 40 e3 movt r12, #0 +// CHECK-ABS-ARM-NEXT: 1330: 1c ff 2f e1 bx r12 +// 0x1501 = thumb_callee2 +// CHECK-ABS-ARM-NEXT: 1334: 01 c5 01 e3 movw r12, #5377 +// CHECK-ABS-ARM-NEXT: 1338: 00 c0 40 e3 movt r12, #0 +// CHECK-ABS-ARM-NEXT: 133c: 1c ff 2f e1 bx r12 +// 0x1503 = thumb_callee3 +// CHECK-ABS-ARM-NEXT: 1340: 03 c5 01 e3 movw r12, #5379 +// CHECK-ABS-ARM-NEXT: 1344: 00 c0 40 e3 movt r12, #0 +// CHECK-ABS-ARM-NEXT: 1348: 1c ff 2f e1 bx r12 + +// CHECK-PI-ARM: Disassembly of section .arm_caller: +// CHECK-PI-ARM-NEXT: arm_caller: +// CHECK-PI-ARM-NEXT: 1300: 3e ff ff fa blx #-776 +// CHECK-PI-ARM-NEXT: 1304: 3d ff ff fa blx #-780 +// 0x1308 + 8 + 0x18 = 0x1328 +// CHECK-PI-ARM-NEXT: 1308: 06 00 00 ea b #24 +// 0x130c + 8 + 0x14 = 0x1328 +// CHECK-PI-ARM-NEXT: 130c: 05 00 00 ea b #20 +// 0x1310 + 8 + 0x20 = 0x1338 +// CHECK-PI-ARM-NEXT: 1310: 08 00 00 ea b #32 +// 0x1314 + 8 + 0x2c = 0x1348 +// CHECK-PI-ARM-NEXT: 1314: 0b 00 00 ea b #44 +// CHECK-PI-ARM-NEXT: 1318: 78 ff ff ea b #-544 +// CHECK-PI-ARM-NEXT: 131c: b7 00 00 0a beq #732 +// CHECK-PI-ARM-NEXT: 1320: b7 00 00 1a bne #732 +// CHECK-PI-ARM-NEXT: 1324: 1e ff 2f e1 bx lr +// 0x1330 + 8 - 0x337 = 0x1001 = thumb_callee1 +// CHECK-PI-ARM-NEXT: 1328: c9 cc 0f e3 movw r12, #64713 +// CHECK-PI-ARM-NEXT: 132c: ff cf 4f e3 movt r12, #65535 +// CHECK-PI-ARM-NEXT: 1330: 0f c0 8c e0 add r12, r12, pc +// CHECK-PI-ARM-NEXT: 1334: 1c ff 2f e1 bx r12 +// 0x1340 + 8 + 0x1b9 = 0x1501 +// CHECK-PI-ARM-NEXT: 1338: b9 c1 00 e3 movw r12, #441 +// CHECK-PI-ARM-NEXT: 133c: 00 c0 40 e3 movt r12, #0 +// CHECK-PI-ARM-NEXT: 1340: 0f c0 8c e0 add r12, r12, pc +// CHECK-PI-ARM-NEXT: 1344: 1c ff 2f e1 bx r12 +// 1350 + 8 + 0x1ab = 0x1503 +// CHECK-PI-ARM-NEXT: 1348: ab c1 00 e3 movw r12, #427 +// CHECK-PI-ARM-NEXT: 134c: 00 c0 40 e3 movt r12, #0 +// CHECK-PI-ARM-NEXT: 1350: 0f c0 8c e0 add r12, r12, pc +// CHECK-PI-ARM-NEXT: 1354: 1c ff 2f e1 bx r12 + +// All PLT entries are ARM, no need for interworking thunks +// CHECK-PI-ARM-PLT: Disassembly of section .arm_caller: +// CHECK-PI-ARM-PLT-NEXT: arm_caller: +// 0x17e4 PLT(thumb_callee1) +// CHECK-PI-ARM-PLT-NEXT: 1300: 37 01 00 eb bl #1244 +// 0x17e4 PLT(thumb_callee1) +// CHECK-PI-ARM-PLT-NEXT: 1304: 36 01 00 eb bl #1240 +// 0x17e4 PLT(thumb_callee1) +// CHECK-PI-ARM-PLT-NEXT: 1308: 35 01 00 ea b #1236 +// 0x17e4 PLT(thumb_callee1) +// CHECK-PI-ARM-PLT-NEXT: 130c: 34 01 00 ea b #1232 +// 0x17f4 PLT(thumb_callee2) +// CHECK-PI-ARM-PLT-NEXT: 1310: 37 01 00 ea b #1244 +// 0x1804 PLT(thumb_callee3) +// CHECK-PI-ARM-PLT-NEXT: 1314: 3a 01 00 ea b #1256 +// 0x1814 PLT(arm_callee1) +// CHECK-PI-ARM-PLT-NEXT: 1318: 3d 01 00 ea b #1268 +// 0x1824 PLT(arm_callee2) +// CHECK-PI-ARM-PLT-NEXT: 131c: 40 01 00 0a beq #1280 +// 0x1834 PLT(arm_callee3) +// CHECK-PI-ARM-PLT-NEXT: 1320: 43 01 00 1a bne #1292 +// CHECK-PI-ARM-PLT-NEXT: 1324: 1e ff 2f e1 bx lr + + .section .thumb_caller, "ax", %progbits + .balign 0x100 + .thumb + .globl thumb_caller + .type thumb_caller, %function +thumb_caller: + // If target supports BLX and target is in range we don't need an + // interworking thunk for a BL or BLX instruction. + bl arm_callee1 + blx arm_callee1 + // A B instruction can't be transformed into a BLX and needs an interworking + // thunk + b.w arm_callee1 + // As long as the thunk is in range it can be reused + b.w arm_callee2 + // There can be more than one thunk associated with a section + b.w arm_callee3 + // Conditional branches also require interworking thunks, they can use the + // same interworking thunks. + beq.w arm_callee1 + beq.w arm_callee2 + bne.w arm_callee3 +// CHECK-ABS-THUMB: Disassembly of section .thumb_caller: +// CHECK-ABS-THUMB-NEXT: thumb_caller: +// 0x1400 + 4 - 0x304 = 0x1100 = arm_callee1 +// CHECK-ABS-THUMB-NEXT: 1400: ff f7 7e ee blx #-772 +// 0x1404 + 4 - 0x308 = 0x1100 = arm_callee1 +// CHECK-ABS-THUMB-NEXT: 1404: ff f7 7c ee blx #-776 +// 0x1408 + 4 + 0x14 = 0x520 +// CHECK-ABS-THUMB-NEXT: 1408: 00 f0 0a b8 b.w #20 +// 0x140c + 4 + 0x1a = 0x52a +// CHECK-ABS-THUMB-NEXT: 140c: 00 f0 0d b8 b.w #26 +// 0x1410 + 4 + 0x20 = 0x534 +// CHECK-ABS-THUMB-NEXT: 1410: 00 f0 10 b8 b.w #32 +// 0x1414 + 4 + 8 = 0x520 +// CHECK-ABS-THUMB-NEXT: 1414: 00 f0 04 80 beq.w #8 +// 0x1418 + 4 + 0xe = 0x52a +// CHECK-ABS-THUMB-NEXT: 1418: 00 f0 07 80 beq.w #14 +// 0x141c + 4 + 0x14 = 0x534 +// CHECK-ABS-THUMB-NEXT: 141c: 40 f0 0a 80 bne.w #20 +// 0x1100 = arm_callee1 +// CHECK-ABS-THUMB-NEXT: 1420: 41 f2 00 1c movw r12, #4352 +// CHECK-ABS-THUMB-NEXT: 1424: c0 f2 00 0c movt r12, #0 +// CHECK-ABS-THUMB-NEXT: 1428: 60 47 bx r12 +// 0x1600 = arm_callee2 +// CHECK-ABS-THUMB-NEXT: 142a: 41 f2 00 6c movw r12, #5632 +// CHECK-ABS-THUMB-NEXT: 142e: c0 f2 00 0c movt r12, #0 +// CHECK-ABS-THUMB-NEXT: 1432: 60 47 bx r12 +// 0x1604 = arm_callee3 +// CHECK-ABS-THUMB-NEXT: 1434: 41 f2 04 6c movw r12, #5636 +// CHECK-ABS-THUMB-NEXT: 1438: c0 f2 00 0c movt r12, #0 +// CHECK-ABS-THUMB-NEXT: 143c: 60 47 bx r12 + +// CHECK-PI-THUMB: Disassembly of section .thumb_caller: +// CHECK-PI-THUMB-NEXT: thumb_caller: +// CHECK-PI-THUMB-NEXT: 1400: ff f7 7e ee blx #-772 +// CHECK-PI-THUMB-NEXT: 1404: ff f7 7c ee blx #-776 +// CHECK-PI-THUMB-NEXT: 1408: 00 f0 0a b8 b.w #20 +// CHECK-PI-THUMB-NEXT: 140c: 00 f0 0e b8 b.w #28 +// CHECK-PI-THUMB-NEXT: 1410: 00 f0 12 b8 b.w #36 +// CHECK-PI-THUMB-NEXT: 1414: 00 f0 04 80 beq.w #8 +// CHECK-PI-THUMB-NEXT: 1418: 00 f0 08 80 beq.w #16 +// CHECK-PI-THUMB-NEXT: 141c: 40 f0 0c 80 bne.w #24 +// 0x1428 + 4 - 0x32c = 0x1100 = arm_callee1 +// CHECK-PI-THUMB-NEXT: 1420: 4f f6 d4 4c movw r12, #64724 +// CHECK-PI-THUMB-NEXT: 1424: cf f6 ff 7c movt r12, #65535 +// CHECK-PI-THUMB-NEXT: 1428: fc 44 add r12, pc +// CHECK-PI-THUMB-NEXT: 142a: 60 47 bx r12 +// 0x1434 + 4 + 0x1c8 = 0x1600 = arm_callee2 +// CHECK-PI-THUMB-NEXT: 142c: 40 f2 c8 1c movw r12, #456 +// CHECK-PI-THUMB-NEXT: 1430: c0 f2 00 0c movt r12, #0 +// CHECK-PI-THUMB-NEXT: 1434: fc 44 add r12, pc +// CHECK-PI-THUMB-NEXT: 1436: 60 47 bx r12 +// 0x1440 + 4 + 0x1c0 = 0x1604 = arm_callee3 +// CHECK-PI-THUMB-NEXT: 1438: 40 f2 c0 1c movw r12, #448 +// CHECK-PI-THUMB-NEXT: 143c: c0 f2 00 0c movt r12, #0 +// CHECK-PI-THUMB-NEXT: 1440: fc 44 add r12, pc +// CHECK-PI-THUMB-NEXT: 1442: 60 47 bx r12 + +// CHECK-PI-THUMB-PLT: Disassembly of section .arm_caller: +// CHECK-PI-THUMB-PLT-NEXT: thumb_caller: +// 0x1400 + 4 + 0x410 = 0x1814 = PLT(arm_callee1) +// CHECK-PI-THUMB-PLT-NEXT: 1400: 00 f0 08 ea blx #1040 +// 0x1404 + 4 + 0x40c = 0x1814 = PLT(arm_callee1) +// CHECK-PI-THUMB-PLT-NEXT: 1404: 00 f0 06 ea blx #1036 +// 0x1408 + 4 + 0x14 = 0x1420 = IWV(PLT(arm_callee1) +// CHECK-PI-THUMB-PLT-NEXT: 1408: 00 f0 0a b8 b.w #20 +// 0x140c + 4 + 0x1c = 0x142c = IWV(PLT(arm_callee2) +// CHECK-PI-THUMB-PLT-NEXT: 140c: 00 f0 0e b8 b.w #28 +// 0x1410 + 4 + 0x24 = 0x1438 = IWV(PLT(arm_callee3) +// CHECK-PI-THUMB-PLT-NEXT: 1410: 00 f0 12 b8 b.w #36 +// 0x1414 + 4 + 8 = 0x1420 = IWV(PLT(arm_callee1) +// CHECK-PI-THUMB-PLT-NEXT: 1414: 00 f0 04 80 beq.w #8 +// 0x1418 + 4 + 0x10 = 0x142c = IWV(PLT(arm_callee2) +// CHECK-PI-THUMB-PLT-NEXT: 1418: 00 f0 08 80 beq.w #16 +// 0x141c + 4 + 0x18 = 0x1438 = IWV(PLT(arm_callee3) +// CHECK-PI-THUMB-PLT-NEXT: 141c: 40 f0 0c 80 bne.w #24 +// 0x1428 + 4 + 0x3e8 = 0x1814 = PLT(arm_callee1) +// CHECK-PI-THUMB-PLT-NEXT: 1420: 40 f2 e8 3c movw r12, #1000 +// CHECK-PI-THUMB-PLT-NEXT: 1424: c0 f2 00 0c movt r12, #0 +// CHECK-PI-THUMB-PLT-NEXT: 1428: fc 44 add r12, pc +// CHECK-PI-THUMB-PLT-NEXT: 142a: 60 47 bx r12 +// 0x1434 + 4 + 0x3ec = 0x1824 = PLT(arm_callee2) +// CHECK-PI-THUMB-PLT-NEXT: 142c: 40 f2 ec 3c movw r12, #1004 +// CHECK-PI-THUMB-PLT-NEXT: 1430: c0 f2 00 0c movt r12, #0 +// CHECK-PI-THUMB-PLT-NEXT: 1434: fc 44 add r12, pc +// CHECK-PI-THUMB-PLT-NEXT: 1436: 60 47 bx r12 +// 0x1440 + 4 + 0x3f0 = 0x1834 = PLT(arm_callee3) +// CHECK-PI-THUMB-PLT-NEXT: 1438: 40 f2 f0 3c movw r12, #1008 +// CHECK-PI-THUMB-PLT-NEXT: 143c: c0 f2 00 0c movt r12, #0 +// CHECK-PI-THUMB-PLT-NEXT: 1440: fc 44 add r12, pc +// CHECK-PI-THUMB-PLT-NEXT: 1442: 60 47 bx r12 + +// Target Sections for thunks at a higher address than the callers. +.section .R_ARM_JUMP24_callee_high, "ax", %progbits + .thumb + .balign 0x100 + .globl thumb_callee2 + .type thumb_callee2, %function +thumb_callee2: + bx lr + + .globl thumb_callee3 + .type thumb_callee3, %function +thumb_callee3: + bx lr +// CHECK-THUMB: Disassembly of section .R_ARM_JUMP24_callee_2: +// CHECK-THUMB-NEXT: thumb_callee2: +// CHECK-THUMB-NEXT: 1500: 70 47 bx lr +// CHECK-THUMB: thumb_callee3: +// CHECK-THUMB-NEXT: 1502: 70 47 bx lr + + .section .R_ARM_THM_JUMP_callee_high, "ax", %progbits + .arm + .balign 0x100 + .globl arm_callee2 + .type arm_callee2, %function +arm_callee2: + bx lr + .globl arm_callee3 + .type arm_callee3, %function +arm_callee3: + bx lr +// CHECK-ARM: Disassembly of section .R_ARM_THM_JUMP_callee_2: +// CHECK-ARM-NEXT: arm_callee2: +// CHECK-ARM-NEXT: 1600: 1e ff 2f e1 bx lr +// CHECK-ARM: arm_callee3: +// CHECK-ARM-NEXT: 1604: 1e ff 2f e1 bx lr + +// _start section just calls the arm and thumb calling sections + .text + .arm + .globl _start + .balign 0x100 + .type _start, %function +_start: + bl arm_caller + bl thumb_caller + bx lr + + +// CHECK-PI-ARM-PLT: Disassembly of section .plt: +// CHECK-PI-ARM-PLT-NEXT: .plt: +// CHECK-PI-ARM-PLT-NEXT: 17b0: 04 e0 2d e5 str lr, [sp, #-4]! +// CHECK-PI-ARM-PLT-NEXT: 17b4: 04 e0 9f e5 ldr lr, [pc, #4] +// CHECK-PI-ARM-PLT-NEXT: 17b8: 0e e0 8f e0 add lr, pc, lr +// CHECK-PI-ARM-PLT-NEXT: 17bc: 08 f0 be e5 ldr pc, [lr, #8]! +// CHECK-PI-ARM-PLT-NEXT: 17c0: d4 00 00 00 +// 0x17c8 + 8 + 0xd0 = 0x18a0 arm_caller +// CHECK-PI-ARM-PLT-NEXT: 17c4: 04 c0 9f e5 ldr r12, [pc, #4] +// CHECK-PI-ARM-PLT-NEXT: 17c8: 0f c0 8c e0 add r12, r12, pc +// CHECK-PI-ARM-PLT-NEXT: 17cc: 00 f0 9c e5 ldr pc, [r12] +// CHECK-PI-ARM-PLT-NEXT: 17d0: d0 00 00 00 +// 0x17d8 + 8 + 0xc4 = 0x18a4 thumb_caller +// CHECK-PI-ARM-PLT-NEXT: 17d4: 04 c0 9f e5 ldr r12, [pc, #4] +// CHECK-PI-ARM-PLT-NEXT: 17d8: 0f c0 8c e0 add r12, r12, pc +// CHECK-PI-ARM-PLT-NEXT: 17dc: 00 f0 9c e5 ldr pc, [r12] +// CHECK-PI-ARM-PLT-NEXT: 17e0: c4 00 00 00 +// 0x17e8 + 8 + 0xb8 = 0x18a8 thumb_callee1 +// CHECK-PI-ARM-PLT-NEXT: 17e4: 04 c0 9f e5 ldr r12, [pc, #4] +// CHECK-PI-ARM-PLT-NEXT: 17e8: 0f c0 8c e0 add r12, r12, pc +// CHECK-PI-ARM-PLT-NEXT: 17ec: 00 f0 9c e5 ldr pc, [r12] +// CHECK-PI-ARM-PLT-NEXT: 17f0: b8 00 00 00 +// 0x17f8 + 8 + 0xac = 0x18ac thumb_callee2 +// CHECK-PI-ARM-PLT-NEXT: 17f4: 04 c0 9f e5 ldr r12, [pc, #4] +// CHECK-PI-ARM-PLT-NEXT: 17f8: 0f c0 8c e0 add r12, r12, pc +// CHECK-PI-ARM-PLT-NEXT: 17fc: 00 f0 9c e5 ldr pc, [r12] +// CHECK-PI-ARM-PLT-NEXT: 1800: ac 00 00 00 +// 0x1808 + 8 + 0xa0 = 0x18b0 thumb_callee3 +// CHECK-PI-ARM-PLT-NEXT: 1804: 04 c0 9f e5 ldr r12, [pc, #4] +// CHECK-PI-ARM-PLT-NEXT: 1808: 0f c0 8c e0 add r12, r12, pc +// CHECK-PI-ARM-PLT-NEXT: 180c: 00 f0 9c e5 ldr pc, [r12] +// CHECK-PI-ARM-PLT-NEXT: 1810: a0 00 00 00 +// 0x1818 + 8 + 0x94 = 0x18b4 arm_callee1 +// CHECK-PI-ARM-PLT-NEXT: 1814: 04 c0 9f e5 ldr r12, [pc, #4] +// CHECK-PI-ARM-PLT-NEXT: 1818: 0f c0 8c e0 add r12, r12, pc +// CHECK-PI-ARM-PLT-NEXT: 181c: 00 f0 9c e5 ldr pc, [r12] +// CHECK-PI-ARM-PLT-NEXT: 1820: 94 00 00 00 +// 0x1828 + 8 + 0x88 = 0x18b8 arm_callee2 +// CHECK-PI-ARM-PLT-NEXT: 1824: 04 c0 9f e5 ldr r12, [pc, #4] +// CHECK-PI-ARM-PLT-NEXT: 1828: 0f c0 8c e0 add r12, r12, pc +// CHECK-PI-ARM-PLT-NEXT: 182c: 00 f0 9c e5 ldr pc, [r12] +// CHECK-PI-ARM-PLT-NEXT: 1830: 88 00 00 00 +// 0x1838 + 8 + 0x7c = 0x18bc arm_callee3 +// CHECK-PI-ARM-PLT-NEXT: 1834: 04 c0 9f e5 ldr r12, [pc, #4] +// CHECK-PI-ARM-PLT-NEXT: 1838: 0f c0 8c e0 add r12, r12, pc +// CHECK-PI-ARM-PLT-NEXT: 183c: 00 f0 9c e5 ldr pc, [r12] +// CHECK-PI-ARM-PLT-NEXT: 1840: 7c 00 00 00 + +// CHECK-DSO-REL: 0x18A0 R_ARM_JUMP_SLOT arm_caller +// CHECK-DSO-REL-NEXT: 0x18A4 R_ARM_JUMP_SLOT thumb_caller +// CHECK-DSO-REL-NEXT: 0x18A8 R_ARM_JUMP_SLOT thumb_callee1 +// CHECK-DSO-REL-NEXT: 0x18AC R_ARM_JUMP_SLOT thumb_callee2 +// CHECK-DSO-REL-NEXT: 0x18B0 R_ARM_JUMP_SLOT thumb_callee3 +// CHECK-DSO-REL-NEXT: 0x18B4 R_ARM_JUMP_SLOT arm_callee1 +// CHECK-DSO-REL-NEXT: 0x18B8 R_ARM_JUMP_SLOT arm_callee2 +// CHECK-DSO-REL-NEXT: 0x18BC R_ARM_JUMP_SLOT arm_callee3 diff --git a/test/ELF/arm-thumb-narrow-branch-check.s b/test/ELF/arm-thumb-narrow-branch-check.s new file mode 100644 index 000000000000..b601b6d5dc26 --- /dev/null +++ b/test/ELF/arm-thumb-narrow-branch-check.s @@ -0,0 +1,72 @@ +// RUN: llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t +// RUN: echo "SECTIONS { \ +// RUN: .R_ARM_PC11_1 : { *(.R_ARM_PC11_1) } \ +// RUN: .caller : { *(.caller) } \ +// RUN: .R_ARM_PC11_2 : { *(.R_ARM_PC11_2) } \ +// RUN: .text : { *(.text) } } " > %t.script +// RUN: ld.lld --script %t.script %t %S/Inputs/arm-thumb-narrow-branch.o -o %t2 2>&1 +// RUN: llvm-objdump -d -triple=thumbv7a-none-linux-gnueabi %t2 | FileCheck %s +// REQUIRES: arm + +// Test the R_ARM_PC11 relocation which is used with the narrow encoding of B.N +// the source of these relocations is a binary file arm-thumb-narrow-branch.o +// which has been assembled with the GNU assembler as llvm-mc doesn't emit it +// as the range of +-2048 bytes is too small to be practically useful for out +// of section branches. + .syntax unified + +.global callee_low_far +.type callee_low_far,%function +callee_low_far = 0x809 + + .section .R_ARM_PC11_1,"ax",%progbits + .thumb + .balign 0x1000 + .type callee_low,%function + .globl callee_low +callee_low: + bx lr + + .text + .align 2 + .thumb + .globl _start + .type _start, %function +_start: + bl callers + bx lr + + .section .R_ARM_PC11_2,"ax",%progbits + .thumb + .align 2 + .type callee_high,%function + .globl callee_high +callee_high: + bx lr + +.global callee_high_far +.type callee_high_far,%function +callee_high_far = 0x180d + +// CHECK: Disassembly of section .R_ARM_PC11_1: +// CHECK-NEXT: callee_low: +// CHECK-NEXT: 1000: 70 47 bx lr +// CHECK-NEXT: Disassembly of section .caller: +// CHECK-NEXT: callers: +// 1004 - 0x800 (2048) + 4 = 0x808 = callee_low_far +// CHECK-NEXT: 1004: 00 e4 b #-2048 +// 1006 - 0xa (10) + 4 = 0x1000 = callee_low +// CHECK-NEXT: 1006: fb e7 b #-10 +// 1008 + 4 + 4 = 0x1010 = callee_high +// CHECK-NEXT: 1008: 02 e0 b #4 +// 100a + 0x7fe (2046) + 4 = 0x180c = callee_high_far +// CHECK-NEXT: 100a: ff e3 b #2046 +// CHECK-NEXT: 100c: 70 47 bx lr +// CHECK-NEXT: 100e: 00 bf nop +// CHECK-NEXT: Disassembly of section .R_ARM_PC11_2: +// CHECK-NEXT: callee_high: +// CHECK-NEXT: 1010: 70 47 bx lr +// CHECK-NEXT: Disassembly of section .text: +// CHECK-NEXT: _start: +// CHECK-NEXT: 1014: ff f7 f6 ff bl #-20 +// CHECK-NEXT: 1018: 70 47 bx lr diff --git a/test/ELF/arm-thumb-plt-reloc.s b/test/ELF/arm-thumb-plt-reloc.s new file mode 100644 index 000000000000..6294e909f078 --- /dev/null +++ b/test/ELF/arm-thumb-plt-reloc.s @@ -0,0 +1,101 @@ +// RUN: llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi %p/Inputs/arm-plt-reloc.s -o %t1 +// RUN: llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t2 +// RUN: ld.lld %t1 %t2 -o %t +// RUN: llvm-objdump -triple=thumbv7a-none-linux-gnueabi -d %t | FileCheck %s +// RUN: ld.lld -shared %t1 %t2 -o %t3 +// RUN: llvm-objdump -triple=thumbv7a-none-linux-gnueabi -d %t3 | FileCheck -check-prefix=DSOTHUMB %s +// RUN: llvm-objdump -triple=armv7a-none-linux-gnueabi -d %t3 | FileCheck -check-prefix=DSOARM %s +// RUN: llvm-readobj -s -r %t3 | FileCheck -check-prefix=DSOREL %s +// REQUIRES: arm +// +// Test PLT entry generation + .syntax unified + .text + .align 2 + .globl _start + .type _start,%function +_start: +// FIXME, interworking is only supported for BL via BLX at the moment, when +// interworking thunks are available for b.w and b.w this can be altered +// to test the different forms of interworking. + bl func1 + bl func2 + bl func3 + +// Executable, expect no PLT +// CHECK: Disassembly of section .text: +// CHECK-NEXT: func1: +// CHECK-NEXT: 11000: 70 47 bx lr +// CHECK: func2: +// CHECK-NEXT: 11002: 70 47 bx lr +// CHECK: func3: +// CHECK-NEXT: 11004: 70 47 bx lr +// CHECK-NEXT: 11006: 00 00 movs r0, r0 +// CHECK: _start: +// 11008 + 4 -12 = 0x11000 = func1 +// CHECK-NEXT: 11008: ff f7 fa ff bl #-12 +// 1100c + 4 -14 = 0x11002 = func2 +// CHECK-NEXT: 1100c: ff f7 f9 ff bl #-14 +// 11010 + 4 -16 = 0x11004 = func3 +// CHECK-NEXT: 11010: ff f7 f8 ff bl #-16 + +// Expect PLT entries as symbols can be preempted +// .text is Thumb and .plt is ARM, llvm-objdump can currently only disassemble +// as ARM or Thumb. Work around by disassembling twice. +// DSOTHUMB: Disassembly of section .text: +// DSOTHUMB: func1: +// DSOTHUMB-NEXT: 1000: 70 47 bx lr +// DSOTHUMB: func2: +// DSOTHUMB-NEXT: 1002: 70 47 bx lr +// DSOTHUMB: func3: +// DSOTHUMB-NEXT: 1004: 70 47 bx lr +// DSOTHUMB-NEXT: 1006: 00 00 movs r0, r0 +// DSOTHUMB: _start: +// 0x1008 + 0x28 + 4 = 0x1034 = PLT func1 +// DSOTHUMB-NEXT: 1008: 00 f0 14 e8 blx #40 +// 0x100c + 0x34 + 4 = 0x1044 = PLT func2 +// DSOTHUMB-NEXT: 100c: 00 f0 1a e8 blx #52 +// 0x1010 + 0x40 + 4 = 0x1054 = PLT func3 +// DSOTHUMB-NEXT: 1010: 00 f0 20 e8 blx #64 +// DSOARM: Disassembly of section .plt: +// DSOARM: .plt: +// DSOARM-NEXT: 1020: 04 e0 2d e5 str lr, [sp, #-4]! +// DSOARM-NEXT: 1024: 04 e0 9f e5 ldr lr, [pc, #4] +// DSOARM-NEXT: 1028: 0e e0 8f e0 add lr, pc, lr +// DSOARM-NEXT: 102c: 08 f0 be e5 ldr pc, [lr, #8]! +// DSOARM-NEXT: 1030: d0 1f 00 00 +// 0x1028 + 8 + 1fd0 = 0x3000 +// DSOARM-NEXT: 1034: 04 c0 9f e5 ldr r12, [pc, #4] +// DSOARM-NEXT: 1038: 0f c0 8c e0 add r12, r12, pc +// DSOARM-NEXT: 103c: 00 f0 9c e5 ldr pc, [r12] +// DSOARM-NEXT: 1040: cc 1f 00 00 +// 0x1038 + 8 + 1fcc = 0x300c +// DSOARM-NEXT: 1044: 04 c0 9f e5 ldr r12, [pc, #4] +// DSOARM-NEXT: 1048: 0f c0 8c e0 add r12, r12, pc +// DSOARM-NEXT: 104c: 00 f0 9c e5 ldr pc, [r12] +// DSOARM-NEXT: 1050: c0 1f 00 00 +// 0x1048 + 8 + 1fc0 = 0x3010 +// DSOARM-NEXT: 1054: 04 c0 9f e5 ldr r12, [pc, #4] +// DSOARM-NEXT: 1058: 0f c0 8c e0 add r12, r12, pc +// DSOARM-NEXT: 105c: 00 f0 9c e5 ldr pc, [r12] +// DSOARM-NEXT: 1060: b4 1f 00 00 +// 0x1058 + 8 + 1fb4 = 0x3014 + +// DSOREL: Name: .got.plt +// DSOREL-NEXT: Type: SHT_PROGBITS +// DSOREL-NEXT: Flags [ +// DSOREL-NEXT: SHF_ALLOC +// DSOREL-NEXT: SHF_WRITE +// DSOREL-NEXT: ] +// DSOREL-NEXT: Address: 0x3000 +// DSOREL-NEXT: Offset: +// DSOREL-NEXT: Size: 24 +// DSOREL-NEXT: Link: +// DSOREL-NEXT: Info: +// DSOREL-NEXT: AddressAlignment: 4 +// DSOREL-NEXT: EntrySize: +// DSOREL: Relocations [ +// DSOREL-NEXT: Section (4) .rel.plt { +// DSOREL-NEXT: 0x300C R_ARM_JUMP_SLOT func1 0x0 +// DSOREL-NEXT: 0x3010 R_ARM_JUMP_SLOT func2 0x0 +// DSOREL-NEXT: 0x3014 R_ARM_JUMP_SLOT func3 0x0 diff --git a/test/ELF/as-needed-no-reloc.s b/test/ELF/as-needed-no-reloc.s new file mode 100644 index 000000000000..0706ca0a932d --- /dev/null +++ b/test/ELF/as-needed-no-reloc.s @@ -0,0 +1,23 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/shared.s -o %t2.o +# RUN: ld.lld -shared %t2.o -o %t2.so +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: ld.lld -o %t %t.o --as-needed %t2.so +# RUN: llvm-readobj --dynamic-table --dyn-symbols %t | FileCheck %s + + +# There must be a NEEDED entry for each undefined + +# CHECK: Name: bar +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Global +# CHECK-NEXT: Type: Function +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Undefined + +# CHECK: NEEDED SharedLibrary ({{.*}}2.so) + + .globl _start +_start: + .global bar diff --git a/test/ELF/as-needed.s b/test/ELF/as-needed.s index 2c5174d54077..4f1a48abac36 100644 --- a/test/ELF/as-needed.s +++ b/test/ELF/as-needed.s @@ -20,11 +20,11 @@ /// GROUP directive is the same as --as-needed. -// RUN: echo "GROUP(" %t2.so %t3.so %t4.so ")" > %t.script +// RUN: echo "GROUP(\"%t2.so\" \"%t3.so\" \"%t4.so\")" > %t.script // RUN: ld.lld %t.o %t.script -o %t2 // RUN: llvm-readobj -dynamic-table %t2 | FileCheck %s -// RUN: echo "GROUP(AS_NEEDED(" %t2.so %t3.so %t4.so "))" > %t.script +// RUN: echo "GROUP(AS_NEEDED(\"%t2.so\" \"%t3.so\" \"%t4.so\"))" > %t.script // RUN: ld.lld %t.o %t.script -o %t2 // RUN: llvm-readobj -dynamic-table %t2 | FileCheck -check-prefix=CHECK2 %s @@ -38,6 +38,7 @@ .global _start _start: +.data .long bar .long zed .weak baz diff --git a/test/ELF/avoid-empty-program-headers.s b/test/ELF/avoid-empty-program-headers.s new file mode 100644 index 000000000000..f7315677e1a3 --- /dev/null +++ b/test/ELF/avoid-empty-program-headers.s @@ -0,0 +1,78 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +// RUN: ld.lld %t -o %tout +// RUN: llvm-readobj -program-headers %tout | FileCheck %s + +.global _start +_start: + retq + +.section .tbss,"awT",@nobits + .zero 4 +// FIXME: Test that we don't create unecessary empty PT_LOAD and PT_GNU_RELRO +// for the .tbss section. + +// CHECK: ProgramHeaders [ +// CHECK-NEXT: ProgramHeader { +// CHECK-NEXT: Type: PT_PHDR (0x6) +// CHECK-NEXT: Offset: 0x40 +// CHECK-NEXT: VirtualAddress: 0x10040 +// CHECK-NEXT: PhysicalAddress: 0x10040 +// CHECK-NEXT: FileSize: 280 +// CHECK-NEXT: MemSize: 280 +// CHECK-NEXT: Flags [ (0x4) +// CHECK-NEXT: PF_R (0x4) +// CHECK-NEXT: ] +// CHECK-NEXT: Alignment: 8 +// CHECK-NEXT: } +// CHECK-NEXT: ProgramHeader { +// CHECK-NEXT: Type: PT_LOAD (0x1) +// CHECK-NEXT: Offset: 0x0 +// CHECK-NEXT: VirtualAddress: 0x10000 +// CHECK-NEXT: PhysicalAddress: 0x10000 +// CHECK-NEXT: FileSize: 344 +// CHECK-NEXT: MemSize: 344 +// CHECK-NEXT: Flags [ (0x4) +// CHECK-NEXT: PF_R (0x4) +// CHECK-NEXT: ] +// CHECK-NEXT: Alignment: 4096 +// CHECK-NEXT: } +// CHECK-NEXT: ProgramHeader { +// CHECK-NEXT: Type: PT_LOAD (0x1) +// CHECK-NEXT: Offset: 0x1000 +// CHECK-NEXT: VirtualAddress: 0x11000 +// CHECK-NEXT: PhysicalAddress: 0x11000 +// CHECK-NEXT: FileSize: 1 +// CHECK-NEXT: MemSize: 1 +// CHECK-NEXT: Flags [ (0x5) +// CHECK-NEXT: PF_R (0x4) +// CHECK-NEXT: PF_X (0x1) +// CHECK-NEXT: ] +// CHECK-NEXT: Alignment: 4096 +// CHECK-NEXT: } +// CHECK-NEXT: ProgramHeader { +// CHECK-NEXT: Type: PT_TLS (0x7) +// CHECK-NEXT: Offset: 0x1001 +// CHECK-NEXT: VirtualAddress: 0x11001 +// CHECK-NEXT: PhysicalAddress: 0x11001 +// CHECK-NEXT: FileSize: 0 +// CHECK-NEXT: MemSize: 4 +// CHECK-NEXT: Flags [ (0x4) +// CHECK-NEXT: PF_R (0x4) +// CHECK-NEXT: ] +// CHECK-NEXT: Alignment: 1 +// CHECK-NEXT: } +// CHECK-NEXT: ProgramHeader { +// CHECK-NEXT: Type: PT_GNU_STACK (0x6474E551) +// CHECK-NEXT: Offset: 0x0 +// CHECK-NEXT: VirtualAddress: 0x0 +// CHECK-NEXT: PhysicalAddress: 0x0 +// CHECK-NEXT: FileSize: 0 +// CHECK-NEXT: MemSize: 0 +// CHECK-NEXT: Flags [ (0x6) +// CHECK-NEXT: PF_R (0x4) +// CHECK-NEXT: PF_W (0x2) +// CHECK-NEXT: ] +// CHECK-NEXT: Alignment: 0 +// CHECK-NEXT: } +// CHECK-NEXT: ] diff --git a/test/ELF/basic-aarch64.s b/test/ELF/basic-aarch64.s index 61b6707e49a4..84105f0acdb7 100644 --- a/test/ELF/basic-aarch64.s +++ b/test/ELF/basic-aarch64.s @@ -5,7 +5,7 @@ # REQUIRES: aarch64 # exits with return code 42 on FreeBSD/AArch64 -.globl _start; +.globl _start _start: mov x0, 42 mov x8, 1 diff --git a/test/ELF/basic-mips.s b/test/ELF/basic-mips.s index 7b2ef564f1ce..c598c7b5f2f7 100644 --- a/test/ELF/basic-mips.s +++ b/test/ELF/basic-mips.s @@ -27,7 +27,7 @@ __start: # CHECK-NEXT: Version: 1 # CHECK-NEXT: Entry: 0x20000 # CHECK-NEXT: ProgramHeaderOffset: 0x34 -# CHECK-NEXT: SectionHeaderOffset: 0x20084 +# CHECK-NEXT: SectionHeaderOffset: 0x30088 # CHECK-NEXT: Flags [ # CHECK-NEXT: EF_MIPS_ABI_O32 # CHECK-NEXT: EF_MIPS_ARCH_32R2 @@ -35,10 +35,10 @@ __start: # CHECK-NEXT: ] # CHECK-NEXT: HeaderSize: 52 # CHECK-NEXT: ProgramHeaderEntrySize: 32 -# CHECK-NEXT: ProgramHeaderCount: 5 +# CHECK-NEXT: ProgramHeaderCount: 6 # CHECK-NEXT: SectionHeaderEntrySize: 40 -# CHECK-NEXT: SectionHeaderCount: 9 -# CHECK-NEXT: StringTableSectionIndex: 7 +# CHECK-NEXT: SectionHeaderCount: 10 +# CHECK-NEXT: StringTableSectionIndex: 8 # CHECK-NEXT: } # CHECK-NEXT: Sections [ # CHECK-NEXT: Section { @@ -62,8 +62,8 @@ __start: # CHECK-NEXT: Flags [ (0x2) # CHECK-NEXT: SHF_ALLOC (0x2) # CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x100D4 -# CHECK-NEXT: Offset: 0xD4 +# CHECK-NEXT: Address: 0x100F4 +# CHECK-NEXT: Offset: 0xF4 # CHECK-NEXT: Size: 24 # CHECK-NEXT: Link: 0 # CHECK-NEXT: Info: 0 @@ -77,8 +77,8 @@ __start: # CHECK-NEXT: Flags [ (0x2) # CHECK-NEXT: SHF_ALLOC (0x2) # CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x100F0 -# CHECK-NEXT: Offset: 0xF0 +# CHECK-NEXT: Address: 0x10110 +# CHECK-NEXT: Offset: 0x110 # CHECK-NEXT: Size: 24 # CHECK-NEXT: Link: 0 # CHECK-NEXT: Info: 0 @@ -103,14 +103,31 @@ __start: # CHECK-NEXT: } # CHECK-NEXT: Section { # CHECK-NEXT: Index: 4 -# CHECK-NEXT: Name: .data +# CHECK-NEXT: Name: .got (31) # CHECK-NEXT: Type: SHT_PROGBITS (0x1) -# CHECK-NEXT: Flags [ (0x3) +# CHECK-NEXT: Flags [ (0x10000003) # CHECK-NEXT: SHF_ALLOC (0x2) +# CHECK-NEXT: SHF_MIPS_GPREL (0x10000000) # CHECK-NEXT: SHF_WRITE (0x1) # CHECK-NEXT: ] # CHECK-NEXT: Address: 0x30000 # CHECK-NEXT: Offset: 0x20000 +# CHECK-NEXT: Size: 8 +# CHECK-NEXT: Link: 0 +# CHECK-NEXT: Info: 0 +# CHECK-NEXT: AddressAlignment: 4 +# CHECK-NEXT: EntrySize: 0 +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: 5 +# CHECK-NEXT: Name: .data +# CHECK-NEXT: Type: SHT_PROGBITS (0x1) +# CHECK-NEXT: Flags [ (0x3) +# CHECK-NEXT: SHF_ALLOC (0x2) +# CHECK-NEXT: SHF_WRITE (0x1) +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x40000 +# CHECK-NEXT: Offset: 0x30000 # CHECK-NEXT: Size: 0 # CHECK-NEXT: Link: 0 # CHECK-NEXT: Info: 0 @@ -118,15 +135,15 @@ __start: # CHECK-NEXT: EntrySize: 0 # CHECK-NEXT: } # CHECK-NEXT: Section { -# CHECK-NEXT: Index: 5 -# CHECK-NEXT: Name: .bss (37) +# CHECK-NEXT: Index: 6 +# CHECK-NEXT: Name: .bss # CHECK-NEXT: Type: SHT_NOBITS (0x8) # CHECK-NEXT: Flags [ (0x3) # CHECK-NEXT: SHF_ALLOC (0x2) # CHECK-NEXT: SHF_WRITE (0x1) # CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x30000 -# CHECK-NEXT: Offset: 0x20000 +# CHECK-NEXT: Address: 0x40000 +# CHECK-NEXT: Offset: 0x30000 # CHECK-NEXT: Size: 0 # CHECK-NEXT: Link: 0 # CHECK-NEXT: Info: 0 @@ -134,41 +151,41 @@ __start: # CHECK-NEXT: EntrySize: 0 # CHECK-NEXT: } # CHECK-NEXT: Section { -# CHECK-NEXT: Index: 6 +# CHECK-NEXT: Index: 7 # CHECK-NEXT: Name: .symtab # CHECK-NEXT: Type: SHT_SYMTAB (0x2) # CHECK-NEXT: Flags [ (0x0) # CHECK-NEXT: ] # CHECK-NEXT: Address: 0x0 -# CHECK-NEXT: Offset: 0x20000 +# CHECK-NEXT: Offset: 0x30000 # CHECK-NEXT: Size: 48 -# CHECK-NEXT: Link: 8 +# CHECK-NEXT: Link: 9 # CHECK-NEXT: Info: 1 # CHECK-NEXT: AddressAlignment: 4 # CHECK-NEXT: EntrySize: 16 # CHECK-NEXT: } # CHECK-NEXT: Section { -# CHECK-NEXT: Index: 7 +# CHECK-NEXT: Index: 8 # CHECK-NEXT: Name: .shstrtab # CHECK-NEXT: Type: SHT_STRTAB (0x3) # CHECK-NEXT: Flags [ (0x0) # CHECK-NEXT: ] # CHECK-NEXT: Address: 0x0 -# CHECK-NEXT: Offset: 0x20030 -# CHECK-NEXT: Size: 68 +# CHECK-NEXT: Offset: 0x30030 +# CHECK-NEXT: Size: 73 # CHECK-NEXT: Link: 0 # CHECK-NEXT: Info: 0 # CHECK-NEXT: AddressAlignment: 1 # CHECK-NEXT: EntrySize: 0 # CHECK-NEXT: } # CHECK-NEXT: Section { -# CHECK-NEXT: Index: 8 -# CHECK-NEXT: Name: .strtab (60) +# CHECK-NEXT: Index: 9 +# CHECK-NEXT: Name: .strtab # CHECK-NEXT: Type: SHT_STRTAB (0x3) # CHECK-NEXT: Flags [ (0x0) # CHECK-NEXT: ] # CHECK-NEXT: Address: 0x0 -# CHECK-NEXT: Offset: 0x20074 +# CHECK-NEXT: Offset: 0x30079 # CHECK-NEXT: Size: 13 # CHECK-NEXT: Link: 0 # CHECK-NEXT: Info: 0 @@ -188,12 +205,14 @@ __start: # CHECK-NEXT: } # CHECK-NEXT: Symbol { # CHECK-NEXT: Name: _gp -# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Value: 0x37FF0 # CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Local (0x0) +# CHECK-NEXT: Binding: Local # CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Absolute (0xFFF1) +# CHECK-NEXT: Other [ (0x2) +# CHECK-NEXT: STV_HIDDEN (0x2) +# CHECK-NEXT: ] +# CHECK-NEXT: Section: .got # CHECK-NEXT: } # CHECK-NEXT: Symbol { # CHECK-NEXT: Name: __start @@ -211,20 +230,20 @@ __start: # CHECK-NEXT: Offset: 0x34 # CHECK-NEXT: VirtualAddress: 0x10034 # CHECK-NEXT: PhysicalAddress: 0x10034 -# CHECK-NEXT: FileSize: 160 -# CHECK-NEXT: MemSize: 160 +# CHECK-NEXT: FileSize: 192 +# CHECK-NEXT: MemSize: 192 # CHECK-NEXT: Flags [ (0x4) # CHECK-NEXT: PF_R (0x4) # CHECK-NEXT: ] -# CHECK-NEXT: Alignment: 8 +# CHECK-NEXT: Alignment: 4 # CHECK-NEXT: } # CHECK-NEXT: ProgramHeader { # CHECK-NEXT: Type: PT_LOAD (0x1) # CHECK-NEXT: Offset: 0x0 # CHECK-NEXT: VirtualAddress: 0x10000 # CHECK-NEXT: PhysicalAddress: 0x10000 -# CHECK-NEXT: FileSize: 264 -# CHECK-NEXT: MemSize: 264 +# CHECK-NEXT: FileSize: 296 +# CHECK-NEXT: MemSize: 296 # CHECK-NEXT: Flags [ (0x4) # CHECK-NEXT: PF_R (0x4) # CHECK-NEXT: ] @@ -248,8 +267,8 @@ __start: # CHECK-NEXT: Offset: 0x20000 # CHECK-NEXT: VirtualAddress: 0x30000 # CHECK-NEXT: PhysicalAddress: 0x30000 -# CHECK-NEXT: FileSize: 0 -# CHECK-NEXT: MemSize: 0 +# CHECK-NEXT: FileSize: 65536 +# CHECK-NEXT: MemSize: 65536 # CHECK-NEXT: Flags [ # CHECK-NEXT: PF_R # CHECK-NEXT: PF_W @@ -257,6 +276,18 @@ __start: # CHECK-NEXT: Alignment: 65536 # CHECK-NEXT: } # CHECK-NEXT: ProgramHeader { +# CHECK-NEXT: Type: PT_GNU_RELRO (0x6474E552) +# CHECK-NEXT: Offset: 0x20000 +# CHECK-NEXT: VirtualAddress: 0x30000 +# CHECK-NEXT: PhysicalAddress: 0x30000 +# CHECK-NEXT: FileSize: 8 +# CHECK-NEXT: MemSize: 8 +# CHECK-NEXT: Flags [ (0x4) +# CHECK-NEXT: PF_R (0x4) +# CHECK-NEXT: ] +# CHECK-NEXT: Alignment: 1 +# CHECK-NEXT: } +# CHECK-NEXT: ProgramHeader { # CHECK-NEXT: Type: PT_GNU_STACK # CHECK-NEXT: Offset: 0x0 # CHECK-NEXT: VirtualAddress: 0x0 diff --git a/test/ELF/basic-ppc.s b/test/ELF/basic-ppc.s index 90acd8d8ddac..83ace9a4983d 100644 --- a/test/ELF/basic-ppc.s +++ b/test/ELF/basic-ppc.s @@ -28,7 +28,7 @@ // CHECK-NEXT: Version: 1 // CHECK-NEXT: Entry: 0x0 // CHECK-NEXT: ProgramHeaderOffset: 0x34 -// CHECK-NEXT: SectionHeaderOffset: 0x2084 +// CHECK-NEXT: SectionHeaderOffset: 0x209C // CHECK-NEXT: Flags [ (0x0) // CHECK-NEXT: ] // CHECK-NEXT: HeaderSize: 52 @@ -157,13 +157,14 @@ // CHECK-NEXT: ] // CHECK-NEXT: Address: 0x0 // CHECK-NEXT: Offset: 0x2030 -// CHECK-NEXT: Size: 16 +// CHECK-NEXT: Size: 32 // CHECK-NEXT: Link: 8 // CHECK-NEXT: Info: 1 // CHECK-NEXT: AddressAlignment: 4 // CHECK-NEXT: EntrySize: 16 // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 00000000 00000000 00000000 00000000 |................| +// CHECK-NEXT: 0010: 00000001 00002000 00000000 00020005 |...... .........| // CHECK-NEXT: ) // CHECK-NEXT: } // CHECK-NEXT: Section { @@ -173,7 +174,7 @@ // CHECK-NEXT: Flags [ (0x0) // CHECK-NEXT: ] // CHECK-NEXT: Address: 0x0 -// CHECK-NEXT: Offset: 0x2040 +// CHECK-NEXT: Offset: 0x2050 // CHECK-NEXT: Size: 64 // CHECK-NEXT: Link: 0 // CHECK-NEXT: Info: 0 @@ -193,14 +194,14 @@ // CHECK-NEXT: Flags [ (0x0) // CHECK-NEXT: ] // CHECK-NEXT: Address: 0x0 -// CHECK-NEXT: Offset: 0x2080 +// CHECK-NEXT: Offset: 0x2090 // CHECK-NEXT: Size: 1 // CHECK-NEXT: Link: 0 // CHECK-NEXT: Info: 0 // CHECK-NEXT: AddressAlignment: 1 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: SectionData ( -// CHECK-NEXT: 0000: 00 |.| +// CHECK-NEXT: 0000: 005F4459 4E414D49 4300 |._DYNAMIC.| // CHECK-NEXT: ) // CHECK-NEXT: } // CHECK-NEXT: ] @@ -215,7 +216,7 @@ // CHECK-NEXT: Flags [ (0x4) // CHECK-NEXT: PF_R (0x4) // CHECK-NEXT: ] -// CHECK-NEXT: Alignment: 8 +// CHECK-NEXT: Alignment: 4 // CHECK-NEXT: } // CHECK-NEXT: ProgramHeader { // CHECK-NEXT: Type: PT_LOAD (0x1) diff --git a/test/ELF/basic.s b/test/ELF/basic.s index bbc674ced2ed..28449331d3fa 100644 --- a/test/ELF/basic.s +++ b/test/ELF/basic.s @@ -6,7 +6,7 @@ # RUN: | FileCheck %s # exits with return code 42 on linux -.globl _start; +.globl _start _start: mov $60, %rax mov $42, %rdi @@ -184,12 +184,23 @@ _start: # CHECK-NEXT: } # CHECK-NEXT: ] -# Test for the response file +# Test for the response file (POSIX quoting style) # RUN: echo " -o %t2" > %t.responsefile -# RUN: ld.lld %t @%t.responsefile +# RUN: ld.lld %t --rsp-quoting=posix @%t.responsefile # RUN: llvm-readobj -file-headers -sections -program-headers -symbols %t2 \ # RUN: | FileCheck %s +# Test for the response file (Windows quoting style) +# RUN: echo " c:\blah\foo" > %t.responsefile +# RUN: not ld.lld --rsp-quoting=windows %t @%t.responsefile 2>&1 | FileCheck \ +# RUN: %s --check-prefix=WINRSP +# WINRSP: cannot open c:\blah\foo + +# Test for the response file (invalid quoting style) +# RUN: not ld.lld --rsp-quoting=patatino %t 2>&1 | FileCheck %s \ +# RUN: --check-prefix=INVRSP +# INVRSP: invalid response file quoting: patatino + # RUN: not ld.lld %t.foo -o %t2 2>&1 | \ # RUN: FileCheck --check-prefix=MISSING %s # MISSING: cannot open {{.*}}.foo: {{[Nn]}}o such file or directory @@ -213,4 +224,7 @@ _start: # DUP: duplicate symbol: _start in {{.*}} and {{.*}} # RUN: not ld.lld %t -o %t -m wrong_emul 2>&1 | FileCheck --check-prefix=UNKNOWN_EMUL %s -# UNKNOWN_EMUL: Unknown emulation: wrong_emul +# UNKNOWN_EMUL: unknown emulation: wrong_emul + +# RUN: not ld.lld %t --lto-jobs=0 2>&1 | FileCheck --check-prefix=NOTHREADS %s +# NOTHREADS: number of threads must be > 0 diff --git a/test/ELF/basic32.s b/test/ELF/basic32.s index f4f9c410a048..44ebe7a46225 100644 --- a/test/ELF/basic32.s +++ b/test/ELF/basic32.s @@ -4,7 +4,7 @@ # REQUIRES: x86 # exits with return code 42 on linux -.globl _start; +.globl _start _start: mov $1, %eax mov $42, %ebx @@ -120,7 +120,7 @@ _start: # CHECK-NEXT: Flags [ (0x4) # CHECK-NEXT: PF_R (0x4) # CHECK-NEXT: ] -# CHECK-NEXT: Alignment: 8 +# CHECK-NEXT: Alignment: 4 # CHECK-NEXT: } # CHECK-NEXT: ProgramHeader { # CHECK-NEXT: Type: PT_LOAD (0x1) diff --git a/test/ELF/basic64be.s b/test/ELF/basic64be.s index 32d8974dae01..fb0bf7bfdb80 100644 --- a/test/ELF/basic64be.s +++ b/test/ELF/basic64be.s @@ -43,10 +43,10 @@ _start: # CHECK-NEXT: ] # CHECK-NEXT: HeaderSize: 64 # CHECK-NEXT: ProgramHeaderEntrySize: 56 -# CHECK-NEXT: ProgramHeaderCount: 5 +# CHECK-NEXT: ProgramHeaderCount: 6 # CHECK-NEXT: SectionHeaderEntrySize: 64 -# CHECK-NEXT: SectionHeaderCount: 8 -# CHECK-NEXT: StringTableSectionIndex: 6 +# CHECK-NEXT: SectionHeaderCount: 9 +# CHECK-NEXT: StringTableSectionIndex: 7 # CHECK-NEXT: } # CHECK-NEXT: Sections [ # CHECK-NEXT: Section { @@ -85,6 +85,24 @@ _start: # CHECK-NEXT: } # CHECK-NEXT: Section { # CHECK-NEXT: Index: 2 +# CHECK-NEXT: Name: .got +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: SHF_WRITE +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x10020000 +# CHECK-NEXT: Offset: 0x20000 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Link: 0 +# CHECK-NEXT: Info: 0 +# CHECK-NEXT: AddressAlignment: 8 +# CHECK-NEXT: EntrySize: 0 +# CHECK-NEXT: SectionData ( +# CHECK-NEXT: ) +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: 3 # CHECK-NEXT: Name: .toc # CHECK-NEXT: Type: SHT_PROGBITS (0x1) # CHECK-NEXT: Flags [ (0x3) @@ -104,7 +122,7 @@ _start: # CHECK-NEXT: ) # CHECK-NEXT: } # CHECK-NEXT: Section { -# CHECK-NEXT: Index: 3 +# CHECK-NEXT: Index: 4 # CHECK-NEXT: Name: .toc1 # CHECK-NEXT: Type: SHT_PROGBITS (0x1) # CHECK-NEXT: Flags [ (0x3) @@ -124,7 +142,7 @@ _start: # CHECK-NEXT: ) # CHECK-NEXT: } # CHECK-NEXT: Section { -# CHECK-NEXT: Index: 4 +# CHECK-NEXT: Index: 5 # CHECK-NEXT: Name: .opd # CHECK-NEXT: Type: SHT_PROGBITS (0x1) # CHECK-NEXT: Flags [ (0x3) @@ -139,12 +157,12 @@ _start: # CHECK-NEXT: AddressAlignment: 1 # CHECK-NEXT: EntrySize: 0 # CHECK-NEXT: SectionData ( -# CHECK-NEXT: 0000: 00000000 10010000 00000000 00008000 |................| -# CHECK-NEXT: 0010: 00000000 00000000 |........| +# CHECK-NEXT: 0000: 00000000 10010000 00000000 10028000 |................| +# CHECK-NEXT: 0010: 00000000 00000000 |........| # CHECK-NEXT: ) # CHECK-NEXT: } # CHECK-NEXT: Section { -# CHECK-NEXT: Index: 5 +# CHECK-NEXT: Index: 6 # CHECK-NEXT: Name: .symtab # CHECK-NEXT: Type: SHT_SYMTAB (0x2) # CHECK-NEXT: Flags [ (0x0) @@ -152,7 +170,7 @@ _start: # CHECK-NEXT: Address: 0x0 # CHECK-NEXT: Offset: 0x20058 # CHECK-NEXT: Size: 48 -# CHECK-NEXT: Link: 7 +# CHECK-NEXT: Link: 8 # CHECK-NEXT: Info: 1 # CHECK-NEXT: AddressAlignment: 8 # CHECK-NEXT: EntrySize: 24 @@ -160,14 +178,14 @@ _start: # CHECK: ) # CHECK-NEXT: } # CHECK-NEXT: Section { -# CHECK-NEXT: Index: 6 +# CHECK-NEXT: Index: 7 # CHECK-NEXT: Name: .shstrtab -# CHECK-NEXT: Type: SHT_STRTAB (0x3) -# CHECK-NEXT: Flags [ (0x0) +# CHECK-NEXT: Type: SHT_STRTAB +# CHECK-NEXT: Flags [ # CHECK-NEXT: ] # CHECK-NEXT: Address: 0x0 # CHECK-NEXT: Offset: 0x20088 -# CHECK-NEXT: Size: 49 +# CHECK-NEXT: Size: 54 # CHECK-NEXT: Link: 0 # CHECK-NEXT: Info: 0 # CHECK-NEXT: AddressAlignment: 1 @@ -176,13 +194,13 @@ _start: # CHECK: ) # CHECK-NEXT: } # CHECK-NEXT: Section { -# CHECK-NEXT: Index: 7 -# CHECK-NEXT: Name: .strtab (41) -# CHECK-NEXT: Type: SHT_STRTAB (0x3) +# CHECK-NEXT: Index: 8 +# CHECK-NEXT: Name: .strtab +# CHECK-NEXT: Type: SHT_STRTAB # CHECK-NEXT: Flags [ (0x0) # CHECK-NEXT: ] # CHECK-NEXT: Address: 0x0 -# CHECK-NEXT: Offset: 0x200B9 +# CHECK-NEXT: Offset: 0x200BE # CHECK-NEXT: Size: 8 # CHECK-NEXT: Link: 0 # CHECK-NEXT: Info: 0 @@ -199,10 +217,10 @@ _start: # CHECK-NEXT: Offset: 0x40 # CHECK-NEXT: VirtualAddress: 0x10000040 # CHECK-NEXT: PhysicalAddress: 0x10000040 -# CHECK-NEXT: FileSize: 280 -# CHECK-NEXT: MemSize: 280 -# CHECK-NEXT: Flags [ (0x4) -# CHECK-NEXT: PF_R (0x4) +# CHECK-NEXT: FileSize: 336 +# CHECK-NEXT: MemSize: 336 +# CHECK-NEXT: Flags [ +# CHECK-NEXT: PF_R # CHECK-NEXT: ] # CHECK-NEXT: Alignment: 8 # CHECK-NEXT: } @@ -211,8 +229,8 @@ _start: # CHECK-NEXT: Offset: 0x0 # CHECK-NEXT: VirtualAddress: 0x10000000 # CHECK-NEXT: PhysicalAddress: 0x10000000 -# CHECK-NEXT: FileSize: 344 -# CHECK-NEXT: MemSize: 344 +# CHECK-NEXT: FileSize: 400 +# CHECK-NEXT: MemSize: 400 # CHECK-NEXT: Flags [ # CHECK-NEXT: PF_R # CHECK-NEXT: ] @@ -245,6 +263,18 @@ _start: # CHECK-NEXT: Alignment: 65536 # CHECK-NEXT: } # CHECK-NEXT: ProgramHeader { +# CHECK-NEXT: Type: PT_GNU_RELRO +# CHECK-NEXT: Offset: 0x20000 +# CHECK-NEXT: VirtualAddress: 0x10020000 +# CHECK-NEXT: PhysicalAddress: 0x10020000 +# CHECK-NEXT: FileSize: 0 +# CHECK-NEXT: MemSize: 0 +# CHECK-NEXT: Flags [ (0x4) +# CHECK-NEXT: PF_R (0x4) +# CHECK-NEXT: ] +# CHECK-NEXT: Alignment: 1 +# CHECK-NEXT: } +# CHECK-NEXT: ProgramHeader { # CHECK-NEXT: Type: PT_GNU_STACK (0x6474E551) # CHECK-NEXT: Offset: 0x0 # CHECK-NEXT: VirtualAddress: 0x0 diff --git a/test/ELF/bsymbolic-undef.s b/test/ELF/bsymbolic-undef.s new file mode 100644 index 000000000000..6590bbcb50b7 --- /dev/null +++ b/test/ELF/bsymbolic-undef.s @@ -0,0 +1,26 @@ +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: ld.lld -shared -Bsymbolic %t.o -o %t.so +# RUN: llvm-readobj -dyn-symbols %t.so | FileCheck %s + +# CHECK: DynamicSymbols [ +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: @ (0) +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Local (0x0) +# CHECK-NEXT: Type: None (0x0) +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Undefined (0x0) +# CHECK-NEXT: } +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: undef@ (1) +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Global (0x1) +# CHECK-NEXT: Type: None (0x0) +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Undefined (0x0) +# CHECK-NEXT: } +# CHECK-NEXT: ] + +call undef@PLT diff --git a/test/ELF/bsymbolic.s b/test/ELF/bsymbolic.s new file mode 100644 index 000000000000..d713588d5952 --- /dev/null +++ b/test/ELF/bsymbolic.s @@ -0,0 +1,34 @@ +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +// RUN: ld.lld -shared %t.o -o %t0.so +// RUN: ld.lld -shared -Bsymbolic %t.o -o %t1.so +// RUN: ld.lld -shared -Bsymbolic-functions %t.o -o %t2.so +// RUN: llvm-readobj -s %t0.so | FileCheck -check-prefix=NOOPTION %s +// RUN: llvm-readobj -s %t1.so | FileCheck -check-prefix=SYMBOLIC %s +// RUN: llvm-readobj -s %t2.so | FileCheck -check-prefix=SYMBOLIC %s + +// NOOPTION: Section { +// NOOPTION: Name: .plt + +// SYMBOLIC: Section { +// SYMBOLIC-NOT: Name: .plt + +.text +.globl foo +.type foo,@function +foo: +nop + +.globl bar +.type bar,@function +bar: +nop + +.globl do +.type do,@function +do: +callq foo@PLT +callq bar@PLT + +.weak zed +.protected zed +.quad zed diff --git a/test/ELF/build-id.s b/test/ELF/build-id.s new file mode 100644 index 000000000000..f1eac42812b4 --- /dev/null +++ b/test/ELF/build-id.s @@ -0,0 +1,38 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: ld.lld --build-id %t -o %t2 +# RUN: llvm-objdump -s %t2 | FileCheck -check-prefix=DEFAULT %s +# RUN: ld.lld --build-id=md5 %t -o %t2 +# RUN: llvm-objdump -s %t2 | FileCheck -check-prefix=MD5 %s +# RUN: ld.lld --build-id=sha1 %t -o %t2 +# RUN: llvm-objdump -s %t2 | FileCheck -check-prefix=SHA1 %s +# RUN: ld.lld --build-id=0x12345678 %t -o %t2 +# RUN: llvm-objdump -s %t2 | FileCheck -check-prefix=HEX %s +# RUN: ld.lld %t -o %t2 +# RUN: llvm-objdump -s %t2 | FileCheck -check-prefix=NONE %s +# RUN: ld.lld --build-id=md5 --build-id=none %t -o %t2 +# RUN: llvm-objdump -s %t2 | FileCheck -check-prefix=NONE %s + +.globl _start +_start: + nop + +.section .note.test, "a", @note + .quad 42 + +# DEFAULT: Contents of section .note.gnu.build-id: +# DEFAULT-NEXT: 04000000 08000000 03000000 474e5500 ............GNU. +# DEFAULT: Contents of section .note.test: + +# MD5: Contents of section .note.gnu.build-id: +# MD5-NEXT: 04000000 10000000 03000000 474e5500 ............GNU. + +# SHA1: Contents of section .note.gnu.build-id: +# SHA1-NEXT: 04000000 14000000 03000000 474e5500 ............GNU. + +# HEX: Contents of section .note.gnu.build-id: +# HEX-NEXT: 04000000 04000000 03000000 474e5500 ............GNU. +# HEX-NEXT: 12345678 + +# NONE-NOT: Contents of section .note.gnu.build-id: diff --git a/test/ELF/combrelocs.s b/test/ELF/combrelocs.s new file mode 100644 index 000000000000..5b876ee221a4 --- /dev/null +++ b/test/ELF/combrelocs.s @@ -0,0 +1,92 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: ld.lld -shared %t.o -o %t.out +# RUN: llvm-readobj -r --expand-relocs --dynamic-table %t.out | FileCheck %s + +# CHECK: Relocations [ +# CHECK-NEXT: Section ({{.*}}) .rela.dyn { +# CHECK-NEXT: Relocation { +# CHECK-NEXT: Offset: 0x2000 +# CHECK-NEXT: Type: R_X86_64_64 +# CHECK-NEXT: Symbol: aaa (1) +# CHECK-NEXT: Addend: 0x0 +# CHECK-NEXT: } +# CHECK-NEXT: Relocation { +# CHECK-NEXT: Offset: 0x2018 +# CHECK-NEXT: Type: R_X86_64_64 +# CHECK-NEXT: Symbol: aaa (1) +# CHECK-NEXT: Addend: 0x0 +# CHECK-NEXT: } +# CHECK-NEXT: Relocation { +# CHECK-NEXT: Offset: 0x2010 +# CHECK-NEXT: Type: R_X86_64_64 +# CHECK-NEXT: Symbol: bbb (2) +# CHECK-NEXT: Addend: 0x0 +# CHECK-NEXT: } +# CHECK-NEXT: Relocation { +# CHECK-NEXT: Offset: 0x2008 +# CHECK-NEXT: Type: R_X86_64_64 +# CHECK-NEXT: Symbol: ccc (3) +# CHECK-NEXT: Addend: 0x0 +# CHECK-NEXT: } +# CHECK-NEXT: Relocation { +# CHECK-NEXT: Offset: 0x2020 +# CHECK-NEXT: Type: R_X86_64_64 +# CHECK-NEXT: Symbol: ddd (4) +# CHECK-NEXT: Addend: 0x0 +# CHECK-NEXT: } +# CHECK-NEXT: } +# CHECK-NEXT: ] +# CHECK: DynamicSection [ +# CHECK-NEXT: Tag +# CHECK-NOT: RELACOUNT + +# RUN: ld.lld -z nocombreloc -shared %t.o -o %t.out +# RUN: llvm-readobj -r --expand-relocs --dynamic-table %t.out | \ +# RUN: FileCheck --check-prefix=NOCOMB %s + +# NOCOMB: Relocations [ +# NOCOMB-NEXT: Section ({{.*}}) .rela.dyn { +# NOCOMB-NEXT: Relocation { +# NOCOMB-NEXT: Offset: 0x2000 +# NOCOMB-NEXT: Type: R_X86_64_64 +# NOCOMB-NEXT: Symbol: aaa (1) +# NOCOMB-NEXT: Addend: 0x0 +# NOCOMB-NEXT: } +# NOCOMB-NEXT: Relocation { +# NOCOMB-NEXT: Offset: 0x2008 +# NOCOMB-NEXT: Type: R_X86_64_64 +# NOCOMB-NEXT: Symbol: ccc (3) +# NOCOMB-NEXT: Addend: 0x0 +# NOCOMB-NEXT: } +# NOCOMB-NEXT: Relocation { +# NOCOMB-NEXT: Offset: 0x2010 +# NOCOMB-NEXT: Type: R_X86_64_64 +# NOCOMB-NEXT: Symbol: bbb (2) +# NOCOMB-NEXT: Addend: 0x0 +# NOCOMB-NEXT: } +# NOCOMB-NEXT: Relocation { +# NOCOMB-NEXT: Offset: 0x2018 +# NOCOMB-NEXT: Type: R_X86_64_64 +# NOCOMB-NEXT: Symbol: aaa (1) +# NOCOMB-NEXT: Addend: 0x0 +# NOCOMB-NEXT: } +# NOCOMB-NEXT: Relocation { +# NOCOMB-NEXT: Offset: 0x2020 +# NOCOMB-NEXT: Type: R_X86_64_64 +# NOCOMB-NEXT: Symbol: ddd (4) +# NOCOMB-NEXT: Addend: 0x0 +# NOCOMB-NEXT: } +# NOCOMB-NEXT: } +# NOCOMB-NEXT: ] +# NOCOMB: DynamicSection [ +# NOCOMB-NEXT: Tag +# NOCOMB-NOT: RELACOUNT + +.data + .quad aaa + .quad ccc + .quad bbb + .quad aaa + .quad ddd diff --git a/test/ELF/comdat.s b/test/ELF/comdat.s index 4f8955e289d5..d422ee8fba33 100644 --- a/test/ELF/comdat.s +++ b/test/ELF/comdat.s @@ -61,6 +61,17 @@ foo: // READ-NEXT: Section: .text // READ-NEXT: } // READ-NEXT: Symbol { +// READ-NEXT: Name: _DYNAMIC +// READ-NEXT: Value: 0x2000 +// READ-NEXT: Size: 0 +// READ-NEXT: Binding: Local +// READ-NEXT: Type: None +// READ-NEXT: Other [ (0x2) +// READ-NEXT: STV_HIDDEN +// READ-NEXT: ] +// READ-NEXT: Section: .dynamic +// READ-NEXT: } +// READ-NEXT: Symbol { // READ-NEXT: Name: abc // READ-NEXT: Value: 0x0 // READ-NEXT: Size: 0 diff --git a/test/ELF/common.s b/test/ELF/common.s index 67cedbccb866..f16f948fe64e 100644 --- a/test/ELF/common.s +++ b/test/ELF/common.s @@ -13,6 +13,9 @@ // CHECK-NEXT: Address: 0x11000 // CHECK-NEXT: Offset: // CHECK-NEXT: Size: 22 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 16 // CHECK: Name: sym1 // CHECK-NEXT: Value: 0x11004 diff --git a/test/ELF/compressed-debug-input.s b/test/ELF/compressed-debug-input.s new file mode 100644 index 000000000000..7339833dbb7f --- /dev/null +++ b/test/ELF/compressed-debug-input.s @@ -0,0 +1,61 @@ +# REQUIRES: zlib + +# RUN: llvm-mc -compress-debug-sections=zlib -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: llvm-readobj -sections %t | FileCheck -check-prefix=COMPRESSED %s + +# COMPRESSED: Section { +# COMPRESSED: Index: 2 +# COMPRESSED: Name: .debug_str +# COMPRESSED-NEXT: Type: SHT_PROGBITS +# COMPRESSED-NEXT: Flags [ +# COMPRESSED-NEXT: SHF_COMPRESSED (0x800) +# COMPRESSED-NEXT: SHF_MERGE (0x10) +# COMPRESSED-NEXT: SHF_STRINGS (0x20) +# COMPRESSED-NEXT: ] +# COMPRESSED-NEXT: Address: +# COMPRESSED-NEXT: Offset: +# COMPRESSED-NEXT: Size: 66 +# COMPRESSED-NEXT: Link: +# COMPRESSED-NEXT: Info: +# COMPRESSED-NEXT: AddressAlignment: 1 +# COMPRESSED-NEXT: EntrySize: 1 +# COMPRESSED-NEXT: } + +# RUN: ld.lld %t -o %t.so -shared +# RUN: llvm-readobj -sections -section-data %t.so | FileCheck -check-prefix=UNCOMPRESSED %s + +# UNCOMPRESSED: Section { +# UNCOMPRESSED: Index: 6 +# UNCOMPRESSED: Name: .debug_str +# UNCOMPRESSED-NEXT: Type: SHT_PROGBITS +# UNCOMPRESSED-NEXT: Flags [ +# UNCOMPRESSED-NEXT: SHF_MERGE (0x10) +# UNCOMPRESSED-NEXT: SHF_STRINGS (0x20) +# UNCOMPRESSED-NEXT: ] +# UNCOMPRESSED-NEXT: Address: 0x0 +# UNCOMPRESSED-NEXT: Offset: 0x1060 +# UNCOMPRESSED-NEXT: Size: 69 +# UNCOMPRESSED-NEXT: Link: 0 +# UNCOMPRESSED-NEXT: Info: 0 +# UNCOMPRESSED-NEXT: AddressAlignment: 1 +# UNCOMPRESSED-NEXT: EntrySize: 1 +# UNCOMPRESSED-NEXT: SectionData ( +# UNCOMPRESSED-NEXT: 0000: 73686F72 7420756E 7369676E 65642069 |short unsigned i| +# UNCOMPRESSED-NEXT: 0010: 6E740075 6E736967 6E656420 696E7400 |nt.unsigned int.| +# UNCOMPRESSED-NEXT: 0020: 6C6F6E67 20756E73 69676E65 6420696E |long unsigned in| +# UNCOMPRESSED-NEXT: 0030: 74006368 61720075 6E736967 6E656420 |t.char.unsigned | +# UNCOMPRESSED-NEXT: 0040: 63686172 00 |char.| +# UNCOMPRESSED-NEXT: ) +# UNCOMPRESSED-NEXT: } + +.section .debug_str,"MS",@progbits,1 +.LASF2: + .string "short unsigned int" +.LASF3: + .string "unsigned int" +.LASF0: + .string "long unsigned int" +.LASF8: + .string "char" +.LASF1: + .string "unsigned char" diff --git a/test/ELF/conflict.s b/test/ELF/conflict.s new file mode 100644 index 000000000000..7598eea3711c --- /dev/null +++ b/test/ELF/conflict.s @@ -0,0 +1,26 @@ +# REQUIRES: x86, shell + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o +# RUN: not ld.lld %t1.o %t1.o -o %t2 2>&1 | FileCheck -check-prefix=DEMANGLE %s + +# DEMANGLE: duplicate symbol: mul(double, double) in +# DEMANGLE: duplicate symbol: foo in + +# RUN: not ld.lld %t1.o %t1.o -o %t2 --no-demangle 2>&1 | \ +# RUN: FileCheck -check-prefix=NO_DEMANGLE %s + +# NO_DEMANGLE: duplicate symbol: _Z3muldd in +# NO_DEMANGLE: duplicate symbol: foo in + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/conflict.s -o %t2.o +# RUN: llvm-ar rcs %t3.a %t2.o +# RUN: not ld.lld %t1.o %t3.a -u baz -o %t2 2>&1 | FileCheck -check-prefix=ARCHIVE %s + +# ARCHIVE: duplicate symbol: foo in {{.*}}1.o and {{.*}}3.a({{.*}}2.o) + +.globl _Z3muldd, foo +_Z3muldd: +foo: + mov $60, %rax + mov $42, %rdi + syscall diff --git a/test/ELF/copy-errors.s b/test/ELF/copy-errors.s new file mode 100644 index 000000000000..9d8b72ddb43b --- /dev/null +++ b/test/ELF/copy-errors.s @@ -0,0 +1,15 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/protected-shared.s -o %t2.o +// RUN: ld.lld %t2.o -o %t2.so -shared +// RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck %s + +.global _start +_start: + + +call bar +// CHECK: cannot preempt symbol + +call zed +// CHECK: symbol is missing type diff --git a/test/ELF/copy-in-shared.s b/test/ELF/copy-in-shared.s new file mode 100644 index 000000000000..4114d95fb101 --- /dev/null +++ b/test/ELF/copy-in-shared.s @@ -0,0 +1,10 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/copy-in-shared.s -o %t1.o +// RUN: ld.lld -shared %t1.o -o %t1.so +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t2.o +// RUN: not ld.lld %t2.o %t1.so -o %t2.so -shared 2>&1 | FileCheck %s + + +.quad foo + +// CHECK: can't create dynamic relocation R_X86_64_64 against readonly segment diff --git a/test/ELF/copy-rel-corrupted.s b/test/ELF/copy-rel-corrupted.s new file mode 100644 index 000000000000..a3f72f71c1da --- /dev/null +++ b/test/ELF/copy-rel-corrupted.s @@ -0,0 +1,10 @@ +// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux +// RUN: llvm-mc %p/Inputs/copy-rel-corrupted.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux +// RUN: ld.lld %t2.o -o %t2.so -shared +// RUN: not ld.lld %t.o %t2.so -o %t.exe 2>&1 | FileCheck %s + +// CHECK: cannot create a copy relocation for x + +.global _start +_start: + call x diff --git a/test/ELF/copy-rel-pie-error.s b/test/ELF/copy-rel-pie-error.s new file mode 100644 index 000000000000..1f427023baa5 --- /dev/null +++ b/test/ELF/copy-rel-pie-error.s @@ -0,0 +1,12 @@ +// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux +// RUN: llvm-mc %p/Inputs/copy-rel-pie.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux +// RUN: ld.lld %t2.o -o %t2.so -shared +// RUN: not ld.lld %t.o %t2.so -o %t.exe -pie 2>&1 | FileCheck %s + +// CHECK: can't create dynamic relocation R_X86_64_64 against readonly segment +// CHECK: can't create dynamic relocation R_X86_64_64 against readonly segment + +.global _start +_start: + .quad bar + .quad foo diff --git a/test/ELF/copy-rel-pie.s b/test/ELF/copy-rel-pie.s new file mode 100644 index 000000000000..be7d5acaeba9 --- /dev/null +++ b/test/ELF/copy-rel-pie.s @@ -0,0 +1,44 @@ +// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux +// RUN: llvm-mc %p/Inputs/copy-rel-pie.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux +// RUN: ld.lld %t2.o -o %t2.so -shared +// RUN: ld.lld %t.o %t2.so -o %t.exe -pie +// RUN: llvm-readobj -s -r %t.exe | FileCheck %s +// RUN: llvm-objdump -d %t.exe | FileCheck --check-prefix=DISASM %s + +.global _start +_start: + call bar + call foo + +// CHECK: Name: .plt +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_EXECINSTR +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x1010 + +// CHECK: Name: .bss +// CHECK-NEXT: Type: SHT_NOBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x3020 + +// CHECK: Relocations [ +// CHECK-NEXT: Section (4) .rela.dyn { +// CHECK-NEXT: 0x3020 R_X86_64_COPY foo 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: Section (5) .rela.plt { +// CHECK-NEXT: 0x3018 R_X86_64_JUMP_SLOT bar 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: ] + +// (0x1010 + 0x10) - 0x1005 = 27 +// 0x3020 - 0x100a = 8214 + +// DISASM: Disassembly of section .text: +// DISASM-NEXT: _start: +// DISASM-NEXT: 1000: e8 1b 00 00 00 callq 27 +// DISASM-NEXT: 1005: e8 16 20 00 00 callq 8214 diff --git a/test/ELF/ctors_dtors_priority.s b/test/ELF/ctors_dtors_priority.s new file mode 100644 index 000000000000..10d6471f953a --- /dev/null +++ b/test/ELF/ctors_dtors_priority.s @@ -0,0 +1,41 @@ +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \ +// RUN: %p/Inputs/ctors_dtors_priority1.s -o %t-crtbegin.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \ +// RUN: %p/Inputs/ctors_dtors_priority2.s -o %t2 +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \ +// RUN: %p/Inputs/ctors_dtors_priority3.s -o %t-crtend.o +// RUN: ld.lld %t1 %t2 %t-crtend.o %t-crtbegin.o -o %t.exe +// RUN: llvm-objdump -s %t.exe | FileCheck %s +// REQUIRES: x86 + +.globl _start +_start: + nop + +.section .ctors, "aw", @progbits + .byte 1 +.section .ctors.100, "aw", @progbits + .byte 2 +.section .ctors.005, "aw", @progbits + .byte 3 +.section .ctors, "aw", @progbits + .byte 4 +.section .ctors, "aw", @progbits + .byte 5 + +.section .dtors, "aw", @progbits + .byte 0x11 +.section .dtors.100, "aw", @progbits + .byte 0x12 +.section .dtors.005, "aw", @progbits + .byte 0x13 +.section .dtors, "aw", @progbits + .byte 0x14 +.section .dtors, "aw", @progbits + .byte 0x15 + +// CHECK: Contents of section .ctors: +// CHECK-NEXT: a1010405 b10302c1 +// CHECK: Contents of section .dtors: +// CHECK-NEXT: a2111415 b21312c2 diff --git a/test/ELF/default-output.s b/test/ELF/default-output.s index 8da3bb40eac0..c0766acf6e55 100644 --- a/test/ELF/default-output.s +++ b/test/ELF/default-output.s @@ -9,7 +9,7 @@ # RUN: ld.lld %t # RUN: llvm-readobj a.out > /dev/null 2>&1 -.globl _start; +.globl _start _start: mov $60, %rax mov $42, %rdi diff --git a/test/ELF/discard-merge-locals.s b/test/ELF/discard-merge-locals.s index 51676da192ca..01b4d337cb2d 100644 --- a/test/ELF/discard-merge-locals.s +++ b/test/ELF/discard-merge-locals.s @@ -21,4 +21,15 @@ // CHECK-NEXT: Other: 0 // CHECK-NEXT: Section: Undefined // CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: _DYNAMIC +// CHECK-NEXT: Value: 0x2000 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other [ (0x2) +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] +// CHECK-NEXT: Section: .dynamic +// CHECK-NEXT: } // CHECK-NEXT: ] diff --git a/test/ELF/discard-merge-unnamed.s b/test/ELF/discard-merge-unnamed.s index bd0058cbd7db..be174f27b50b 100644 --- a/test/ELF/discard-merge-unnamed.s +++ b/test/ELF/discard-merge-unnamed.s @@ -13,4 +13,15 @@ // CHECK-NEXT: Other: 0 // CHECK-NEXT: Section: Undefined // CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: _DYNAMIC +// CHECK-NEXT: Value: 0x2000 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other [ (0x2) +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] +// CHECK-NEXT: Section: .dynamic +// CHECK-NEXT: } // CHECK-NEXT: ] diff --git a/test/ELF/discard-none.s b/test/ELF/discard-none.s index c13b544f514d..e3a7a2032082 100644 --- a/test/ELF/discard-none.s +++ b/test/ELF/discard-none.s @@ -21,7 +21,7 @@ // CHECK-NEXT: EntrySize: // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 002E4C6D 796F7468 65727661 72002E4C |..Lmyothervar..L| -// CHECK-NEXT: 0010: 6D797661 7200 |myvar.| +// CHECK-NEXT: 0010: 6D797661 72005F44 594E414D 494300 |myvar._DYNAMIC.| // CHECK-NEXT: ) // CHECK-NEXT: } diff --git a/test/ELF/dont-export-hidden.s b/test/ELF/dont-export-hidden.s new file mode 100644 index 000000000000..8819a6e99fdb --- /dev/null +++ b/test/ELF/dont-export-hidden.s @@ -0,0 +1,39 @@ +// RUN: llvm-mc %p/Inputs/shared.s -o %t.o -filetype=obj -triple=x86_64-pc-linux +// RUN: llvm-mc %s -o %t2.o -filetype=obj -triple=x86_64-pc-linux +// RUN: ld.lld %t.o -o %t.so -shared +// RUN: ld.lld %t2.o %t.so -o %t.exe +// RUN: llvm-readobj --dyn-symbols %t.exe | FileCheck %s + + .global _start +_start: + .global bar + .hidden bar +bar: + + .global bar2 +bar2: + + .global foo +foo: + +// CHECK: DynamicSymbols [ +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: @ (0) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: Undefined +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: bar2 +// CHECK-NEXT: Value: +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .text +// CHECK-NEXT: } +// CHECK-NEXT: ] + diff --git a/test/ELF/driver.test b/test/ELF/driver.test new file mode 100644 index 000000000000..95e2100b4abf --- /dev/null +++ b/test/ELF/driver.test @@ -0,0 +1,49 @@ +# REQUIRES: x86 + +# RUN: not ld.lld --unknown1 --unknown2 -m foo /no/such/file -lnosuchlib \ +# RUN: 2>&1 | FileCheck -check-prefix=UNKNOWN %s + +# UNKNOWN: unknown argument: --unknown1 +# UNKNOWN: unknown argument: --unknown2 +# UNKNOWN: unknown emulation: foo +# UNKNOWN: cannot open /no/such/file +# UNKNOWN: unable to find library -lnosuchlib + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: not ld.lld %t -o /no/such/file 2>&1 | FileCheck -check-prefix=MISSING %s +# MISSING: failed to open /no/such/file + +# RUN: ld.lld --help 2>&1 | FileCheck -check-prefix=HELP %s +# HELP: USAGE: + +# RUN: ld.lld --version 2>&1 | FileCheck -check-prefix=VERSION %s +# VERSION: LLD + +## Attempt to link DSO with -r +# RUN: ld.lld -shared %t -o %t.so +# RUN: not ld.lld -r %t.so %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR %s +# ERR: attempted static link of dynamic object + +## Attempt to use -r and -shared together +# RUN: not ld.lld -r -shared %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR2 %s +# ERR2: -r and -shared may not be used together + +## Attempt to use -r and --gc-sections together +# RUN: not ld.lld -r --gc-sections %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR3 %s +# ERR3: -r and --gc-sections may not be used together + +## Attempt to use -r and --icf together +# RUN: not ld.lld -r --icf=all %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR4 %s +# ERR4: -r and --icf may not be used together + +## Attempt to use -r and -pie together +# RUN: not ld.lld -r -pie %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR5 %s +# ERR5: -r and -pie may not be used together + +## Attempt to use -shared and -pie together +# RUN: not ld.lld -shared -pie %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR6 %s +# ERR6: -shared and -pie may not be used together + +.globl _start +_start: + nop diff --git a/test/ELF/duplicate-internal.s b/test/ELF/duplicate-internal.s index 2395a6cae0db..d1ccf5322127 100644 --- a/test/ELF/duplicate-internal.s +++ b/test/ELF/duplicate-internal.s @@ -3,7 +3,7 @@ # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o # RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s -# CHECK: duplicate symbol: _gp in (internal) and {{.*}} +# CHECK: duplicate symbol: _gp in {{.*}} and (internal) # REQUIRES: mips diff --git a/test/ELF/duplicated-plt-entry.s b/test/ELF/duplicated-plt-entry.s new file mode 100644 index 000000000000..4644bed0ca8b --- /dev/null +++ b/test/ELF/duplicated-plt-entry.s @@ -0,0 +1,17 @@ +// REQUIRES: x86 + +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/duplicated-plt-entry.s -o %t.o +// RUN: ld.lld -shared %t.o -o %t.so + +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t2.o +// RUN: ld.lld %t2.o %t.so -o %t2.so -shared + +// RUN: llvm-readobj -r %t2.so | FileCheck %s +// CHECK: Relocations [ +// CHECK-NEXT: Section ({{.*}}) .rela.plt { +// CHECK-NEXT: R_X86_64_JUMP_SLOT bar 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: ] + +callq bar@PLT +callq bar@PLT diff --git a/test/ELF/dynamic-list.s b/test/ELF/dynamic-list.s new file mode 100644 index 000000000000..5e257b31d1f3 --- /dev/null +++ b/test/ELF/dynamic-list.s @@ -0,0 +1,110 @@ +## There is some bad quoting interaction between lit's internal shell, which is +## implemented in Python, and the Cygwin implementations of the Unix utilities. +## Avoid running these tests on Windows for now by requiring a real shell. + +# REQUIRES: shell + +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o +# RUN: ld.lld -shared %t2.o -soname shared -o %t2.so +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t + +## Check exporting only one symbol. +# RUN: echo "{ foo1; };" > %t.list +# RUN: ld.lld --dynamic-list %t.list %t %t2.so -o %t.exe +# RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck %s + +## And now using quoted strings (the output is the same since it does +## use any wildcard character). +# RUN: echo "{ \"foo1\"; };" > %t.list +# RUN: ld.lld --dynamic-list %t.list %t %t2.so -o %t.exe +# RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck %s + +## And now using --export-dynamic-symbol. +# RUN: ld.lld --export-dynamic-symbol foo1 %t %t2.so -o %t.exe +# RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck %s +# RUN: ld.lld --export-dynamic-symbol=foo1 %t %t2.so -o %t.exe +# RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck %s + +# CHECK: DynamicSymbols [ +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: @ (0) +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Local +# CHECK-NEXT: Type: None +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Undefined +# CHECK-NEXT: } +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: foo1@ (1) +# CHECK-NEXT: Value: 0x11000 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Global (0x1) +# CHECK-NEXT: Type: None (0x0) +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: .text (0x4) +# CHECK-NEXT: } +# CHECK-NEXT: ] + + +## Now export all the foo1, foo2, and foo31 symbols +# RUN: echo "{ foo1; foo2; foo31; };" > %t.list +# RUN: ld.lld --dynamic-list %t.list %t %t2.so -o %t.exe +# RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck -check-prefix=CHECK2 %s + +# CHECK2: DynamicSymbols [ +# CHECK2-NEXT: Symbol { +# CHECK2-NEXT: Name: @ (0) +# CHECK2-NEXT: Value: 0x0 +# CHECK2-NEXT: Size: 0 +# CHECK2-NEXT: Binding: Local +# CHECK2-NEXT: Type: None +# CHECK2-NEXT: Other: 0 +# CHECK2-NEXT: Section: Undefined +# CHECK2-NEXT: } +# CHECK2-NEXT: Symbol { +# CHECK2-NEXT: Name: foo1@ (1) +# CHECK2-NEXT: Value: 0x11000 +# CHECK2-NEXT: Size: 0 +# CHECK2-NEXT: Binding: Global (0x1) +# CHECK2-NEXT: Type: None (0x0) +# CHECK2-NEXT: Other: 0 +# CHECK2-NEXT: Section: .text (0x4) +# CHECK2-NEXT: } +# CHECK2-NEXT: Symbol { +# CHECK2-NEXT: Name: foo2@ (6) +# CHECK2-NEXT: Value: 0x11001 +# CHECK2-NEXT: Size: 0 +# CHECK2-NEXT: Binding: Global (0x1) +# CHECK2-NEXT: Type: None (0x0) +# CHECK2-NEXT: Other: 0 +# CHECK2-NEXT: Section: .text (0x4) +# CHECK2-NEXT: } +# CHECK2-NEXT: Symbol { +# CHECK2-NEXT: Name: foo31@ (11) +# CHECK2-NEXT: Value: 0x11002 +# CHECK2-NEXT: Size: 0 +# CHECK2-NEXT: Binding: Global (0x1) +# CHECK2-NEXT: Type: None (0x0) +# CHECK2-NEXT: Other: 0 +# CHECK2-NEXT: Section: .text (0x4) +# CHECK2-NEXT: } +# CHECK2-NEXT: ] + +.globl foo1 +foo1: + ret + +.globl foo2 +foo2: + ret + +.globl foo31 +foo31: + ret + +.globl _start +_start: + retq diff --git a/test/ELF/dynamic-reloc-in-ro.s b/test/ELF/dynamic-reloc-in-ro.s new file mode 100644 index 000000000000..2ef36f695fb6 --- /dev/null +++ b/test/ELF/dynamic-reloc-in-ro.s @@ -0,0 +1,8 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: not ld.lld %t.o -o %t.so -shared 2>&1 | FileCheck %s + +foo: +.quad foo + +// CHECK: can't create dynamic relocation R_X86_64_64 against readonly segment diff --git a/test/ELF/dynamic-reloc-weak.s b/test/ELF/dynamic-reloc-weak.s index fe1b7eedb6d7..b4da2e552e11 100644 --- a/test/ELF/dynamic-reloc-weak.s +++ b/test/ELF/dynamic-reloc-weak.s @@ -1,5 +1,5 @@ // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o -// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/dynamic-reloc-weak.s -o %t2.o // RUN: ld.lld -shared %t2.o -o %t2.so // RUN: ld.lld %t.o %t2.so -o %t // RUN: llvm-readobj -r %t | FileCheck %s @@ -19,9 +19,12 @@ _start: .weak sym3 .quad sym3 -// Both gold and bfd ld will produce a relocation for sym1 and sym2 only. That -// That seems odd. If the dynamic linker must get a chance to resolve sym1 -// and sym2, that should also be the case for sym3. + .type sym4,@function + .weak sym4 + .quad sym4 + +// Test that we produce dynamic relocation for every weak undefined symbol +// we found. // CHECK: Relocations [ // CHECK-NEXT: Section ({{.*}}) .rela.dyn { @@ -29,5 +32,6 @@ _start: // CHECK-NEXT: } // CHECK-NEXT: Section ({{.*}}) .rela.plt { // CHECK-NEXT: 0x{{.*}} R_X86_64_JUMP_SLOT sym2 0x0 +// CHECK-NEXT: 0x{{.*}} R_X86_64_JUMP_SLOT sym3 0x0 // CHECK-NEXT: } -// CHECK-NEXT: ] \ No newline at end of file +// CHECK-NEXT: ] diff --git a/test/ELF/dynamic-reloc.s b/test/ELF/dynamic-reloc.s index 295396006543..5e23ba93d5a9 100644 --- a/test/ELF/dynamic-reloc.s +++ b/test/ELF/dynamic-reloc.s @@ -43,6 +43,7 @@ // CHECK: DynamicSection [ // CHECK-NEXT: Tag Type Name/Value +// CHECK-NEXT: 0x0000000000000001 NEEDED SharedLibrary ({{.*}}2.so) // CHECK-NEXT: 0x0000000000000017 JMPREL // CHECK-NEXT: 0x0000000000000002 PLTRELSZ 24 (bytes) // CHECK-NEXT: 0x0000000000000003 PLTGOT @@ -52,7 +53,6 @@ // CHECK-NEXT: 0x0000000000000005 STRTAB // CHECK-NEXT: 0x000000000000000A STRSZ // CHECK-NEXT: 0x0000000000000004 HASH -// CHECK-NEXT: 0x0000000000000001 NEEDED SharedLibrary ({{.*}}2.so) // CHECK-NEXT: 0x0000000000000015 DEBUG 0x0 // CHECK-NEXT: 0x0000000000000000 NULL 0x0 // CHECK-NEXT: ] diff --git a/test/ELF/dynamic.s b/test/ELF/dynamic.s new file mode 100644 index 000000000000..2efd2990c52c --- /dev/null +++ b/test/ELF/dynamic.s @@ -0,0 +1,44 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t.o + +## Check that _DYNAMIC symbol is created when creating dynamic output, +## and has hidden visibility and address equal to .dynamic section. +# RUN: ld.lld -shared %t.o -o %t.so +# RUN: llvm-readobj -sections -symbols %t.so | FileCheck %s +# CHECK: Section { +# CHECK: Index: 5 +# CHECK: Name: .dynamic +# CHECK-NEXT: Type: SHT_DYNAMIC +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: SHF_WRITE +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x[[ADDR:.*]] +# CHECK-NEXT: Offset: 0x1000 +# CHECK-NEXT: Size: +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: } +# CHECK: Symbols [ +# CHECK: Symbol { +# CHECK: Name: _DYNAMIC +# CHECK-NEXT: Value: 0x[[ADDR]] +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Local +# CHECK-NEXT: Type: None +# CHECK-NEXT: Other [ (0x2) +# CHECK-NEXT: STV_HIDDEN +# CHECK-NEXT: ] +# CHECK-NEXT: Section: .dynamic +# CHECK-NEXT: } + +# RUN: ld.lld %t.o -o %t.o +# RUN: llvm-readobj -sections -symbols %t.o | FileCheck -check-prefix=NODYN %s +# NODYN: Symbols [ +# NODYN-NOT: Name: _DYNAMIC +# NODYN: ] + +.globl _start +_start: diff --git a/test/ELF/dynsym-pie.s b/test/ELF/dynsym-pie.s new file mode 100644 index 000000000000..9d3a9ffe304f --- /dev/null +++ b/test/ELF/dynsym-pie.s @@ -0,0 +1,36 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t +# RUN: ld.lld -pie %t -o %t.out +# RUN: llvm-readobj -t -dyn-symbols %t.out | FileCheck %s + +# CHECK: DynamicSymbols [ +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: @ +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Local +# CHECK-NEXT: Type: None +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Undefined +# CHECK-NEXT: } +# CHECK-NEXT: ] + +.text +.globl _start +_start: + +.global default +default: + +.global protected +protected: + +.global hidden +hidden: + +.global internal +internal: + +.global protected_with_hidden +.protected +protected_with_hidden: diff --git a/test/ELF/edata-etext.s b/test/ELF/edata-etext.s new file mode 100644 index 000000000000..e0538d690d7c --- /dev/null +++ b/test/ELF/edata-etext.s @@ -0,0 +1,117 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: ld.lld %t.o -o %t +# RUN: llvm-readobj -sections -symbols %t | FileCheck %s + +## This checks that: +## 1) Address of _etext is the first location after the last read-only loadable segment. +## 2) Address of _edata points to the end of the last non SHT_NOBITS section. +## That is how gold/bfd do. At the same time specs says: "If the address of _edata is +## greater than the address of _etext, the address of _end is same as the address +## of _edata." (https://docs.oracle.com/cd/E53394_01/html/E54766/u-etext-3c.html). +## 3) Address of _end is different from _edata because of 2. +# CHECK: Section { +# CHECK: Index: 1 +# CHECK: Name: .text +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: SHF_EXECINSTR +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x11000 +# CHECK-NEXT: Offset: 0x1000 +# CHECK-NEXT: Size: 1 +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: 0 +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: 2 +# CHECK-NEXT: Name: .data +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: SHF_WRITE +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x12000 +# CHECK-NEXT: Offset: 0x2000 +# CHECK-NEXT: Size: 2 +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: 3 +# CHECK-NEXT: Name: .bss +# CHECK-NEXT: Type: SHT_NOBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: SHF_WRITE +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x12004 +# CHECK-NEXT: Offset: 0x2002 +# CHECK-NEXT: Size: 6 +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: } +# CHECK: Symbols [ +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Local +# CHECK-NEXT: Type: None +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Undefined +# CHECK-NEXT: } +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: _start +# CHECK-NEXT: Value: 0x11000 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Global +# CHECK-NEXT: Type: None +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: .text +# CHECK-NEXT: } +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: _edata +# CHECK-NEXT: Value: 0x12002 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Global +# CHECK-NEXT: Type: None +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Absolute +# CHECK-NEXT: } +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: _end +# CHECK-NEXT: Value: 0x1200A +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Global +# CHECK-NEXT: Type: None +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Absolute +# CHECK-NEXT: } +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: _etext +# CHECK-NEXT: Value: 0x11001 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Global +# CHECK-NEXT: Type: None +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Absolute +# CHECK-NEXT: } +# CHECK-NEXT: ] + +.global _start,_end,_etext,_edata +.text +_start: + nop +.data + .word 1 +.bss + .align 4 + .space 6 diff --git a/test/ELF/eh-frame-dyn-rel.s b/test/ELF/eh-frame-dyn-rel.s new file mode 100644 index 000000000000..62d56951b2cf --- /dev/null +++ b/test/ELF/eh-frame-dyn-rel.s @@ -0,0 +1,10 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: not ld.lld %t.o %t.o -o %t -shared 2>&1 | FileCheck %s + + .section bar,"axG",@progbits,foo,comdat + .cfi_startproc + .cfi_personality 0x8c, foo + .cfi_endproc + +// CHECK: can't create dynamic relocation R_X86_64_64 against readonly segment diff --git a/test/ELF/eh-frame-gc.s b/test/ELF/eh-frame-gc.s new file mode 100644 index 000000000000..b2e21f497f41 --- /dev/null +++ b/test/ELF/eh-frame-gc.s @@ -0,0 +1,20 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o +# RUN: ld.lld -shared --gc-sections %t.o -o %t +# RUN: llvm-readobj -s %t | FileCheck %s + +## Check that section containing personality is +## not garbage collected. +# CHECK: Sections [ +# CHECK: Name: .test_personality_section + +.text +.globl foo +.type foo,@function +foo: + .cfi_startproc + .cfi_personality 155, DW.ref.__gxx_personality_v0 + .cfi_endproc + +.section .test_personality_section +DW.ref.__gxx_personality_v0: diff --git a/test/ELF/eh-frame-hdr-abs-fde.s b/test/ELF/eh-frame-hdr-abs-fde.s new file mode 100644 index 000000000000..37705d6ad818 --- /dev/null +++ b/test/ELF/eh-frame-hdr-abs-fde.s @@ -0,0 +1,33 @@ +# Check reading PC values of FDEs and writing lookup table in the .eh_frame_hdr +# if CIE augmentation string has 'L' token and PC values are encoded using +# absolute (not relative) format. + +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o +# RUN: ld.lld --eh-frame-hdr %t.o -o %t +# RUN: llvm-objdump -s -dwarf=frames %t | FileCheck %s + +# REQUIRES: mips + +# CHECK: Contents of section .eh_frame_hdr: +# CHECK-NEXT: 10178 011b033b ffffffcc 00000001 0000fe88 +# ^-- 0x20000 - 0x10178 +# .text - .eh_frame_hdr +# CHECK-NEXT: 10188 ffffffe8 +# CHECK-NEXT: Contents of section .text: +# CHECK-NEXT: 20000 00000000 + +# CHECK: Augmentation: "zLR" +# CHECK: Augmentation data: 00 0B +# ^-- DW_EH_PE_udata4 | DW_EH_PE_signed + + .text + .globl __start +__start: + .cfi_startproc + .cfi_lsda 0, _ex + nop + .cfi_endproc + + .data +_ex: + .word 0 diff --git a/test/ELF/eh-frame-hdr-augmentation.s b/test/ELF/eh-frame-hdr-augmentation.s new file mode 100644 index 000000000000..91e6a9cc1ccb --- /dev/null +++ b/test/ELF/eh-frame-hdr-augmentation.s @@ -0,0 +1,38 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: ld.lld --eh-frame-hdr %t.o -o %t -shared +// RUN: llvm-objdump --dwarf=frames %t | FileCheck %s + +// CHECK: .eh_frame contents: + +// CHECK: 00000000 0000001c ffffffff CIE +// CHECK-NEXT: Version: 1 +// CHECK-NEXT: Augmentation: "zPLR" +// CHECK-NEXT: Code alignment factor: 1 +// CHECK-NEXT: Data alignment factor: -8 +// CHECK-NEXT: Return address column: 16 +// CHECK-NEXT: Augmentation data: + +// CHECK: DW_CFA_def_cfa: reg7 +8 +// CHECK-NEXT: DW_CFA_offset: reg16 -8 +// CHECK-NEXT: DW_CFA_nop: +// CHECK-NEXT: DW_CFA_nop: + +// CHECK: 00000020 00000014 00000024 FDE cie=00000024 pc=00000dd8...00000dd8 +// CHECK-NEXT: DW_CFA_nop: +// CHECK-NEXT: DW_CFA_nop: +// CHECK-NEXT: DW_CFA_nop: + + .cfi_startproc + .cfi_personality 0x9b, g + .cfi_lsda 0x1b, h + .cfi_endproc + + .global g + .hidden g +g: + + .global h + .hidden h +h: + diff --git a/test/ELF/eh-frame-hdr-icf.s b/test/ELF/eh-frame-hdr-icf.s new file mode 100644 index 000000000000..2e7b335fb46d --- /dev/null +++ b/test/ELF/eh-frame-hdr-icf.s @@ -0,0 +1,27 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: ld.lld %t -o %t2 --icf=all --eh-frame-hdr +# RUN: llvm-objdump -s %t2 | FileCheck %s + +# CHECK: Contents of section .eh_frame_hdr: +# CHECK-NEXT: 101a0 011b033b b4ffffff 01000000 600e0000 +# ^ FDE count +# CHECK-NEXT: 101b0 d0ffffff 00000000 00000000 +# ^ FDE for f2 + +.globl _start, f1, f2 +_start: + ret + +.section .text.f1, "ax" +f1: + .cfi_startproc + ret + .cfi_endproc + +.section .text.f2, "ax" +f2: + .cfi_startproc + ret + .cfi_endproc diff --git a/test/ELF/eh-frame-hdr-no-out.s b/test/ELF/eh-frame-hdr-no-out.s new file mode 100644 index 000000000000..edbafad07247 --- /dev/null +++ b/test/ELF/eh-frame-hdr-no-out.s @@ -0,0 +1,6 @@ +// REQUIRES: x86 +// RUN: not ld.lld --eh-frame-hdr %p/Inputs/invalid-cie-version2.elf -o %t >& %t.log +// RUN: FileCheck %s < %t.log + +// invalid-cie-version2.elf contains unsupported version of CIE = 2. +// CHECK: FDE version 1 or 3 expected, but got 2 diff --git a/test/ELF/eh-frame-hdr-no-out2.s b/test/ELF/eh-frame-hdr-no-out2.s new file mode 100644 index 000000000000..0eeb0ea5548d --- /dev/null +++ b/test/ELF/eh-frame-hdr-no-out2.s @@ -0,0 +1,19 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: ld.lld --eh-frame-hdr %t.o -o %t +// RUN: llvm-readobj -s -program-headers %t | FileCheck %s --check-prefix=NOHDR + +.section foo,"ax",@progbits + nop + +.text +.globl _start +_start: + +// There is no .eh_frame section, +// therefore .eh_frame_hdr also not created. +// NOHDR: Sections [ +// NOHDR-NOT: Name: .eh_frame +// NOHDR-NOT: Name: .eh_frame_hdr +// NOHDR: ProgramHeaders [ +// NOHDR-NOT: PT_GNU_EH_FRAME diff --git a/test/ELF/eh-frame-hdr.s b/test/ELF/eh-frame-hdr.s new file mode 100644 index 000000000000..16fb49ac8e9f --- /dev/null +++ b/test/ELF/eh-frame-hdr.s @@ -0,0 +1,127 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: ld.lld %t.o -o %t +// RUN: llvm-readobj -file-headers -s -section-data -program-headers -symbols %t | FileCheck %s --check-prefix=NOHDR +// RUN: ld.lld --eh-frame-hdr %t.o -o %t +// RUN: llvm-readobj -file-headers -s -section-data -program-headers -symbols %t | FileCheck %s --check-prefix=HDR +// RUN: llvm-objdump -d %t | FileCheck %s --check-prefix=HDRDISASM + +.section foo,"ax",@progbits +.cfi_startproc + nop +.cfi_endproc + +.section bar,"ax",@progbits +.cfi_startproc + nop +.cfi_endproc + +.section dah,"ax",@progbits +.cfi_startproc + nop +.cfi_endproc + +.text +.globl _start +_start: + +// NOHDR: Sections [ +// NOHDR-NOT: Name: .eh_frame_hdr +// NOHDR: ProgramHeaders [ +// NOHDR-NOT: PT_GNU_EH_FRAME + +//HDRDISASM: Disassembly of section foo: +//HDRDISASM-NEXT: foo: +//HDRDISASM-NEXT: 11000: 90 nop +//HDRDISASM-NEXT: Disassembly of section bar: +//HDRDISASM-NEXT: bar: +//HDRDISASM-NEXT: 11001: 90 nop +//HDRDISASM-NEXT: Disassembly of section dah: +//HDRDISASM-NEXT: dah: +//HDRDISASM-NEXT: 11002: 90 nop + +// HDR: Sections [ +// HDR: Section { +// HDR: Index: 1 +// HDR-NEXT: Name: .eh_frame +// HDR-NEXT: Type: SHT_PROGBITS +// HDR-NEXT: Flags [ +// HDR-NEXT: SHF_ALLOC +// HDR-NEXT: ] +// HDR-NEXT: Address: 0x10158 +// HDR-NEXT: Offset: 0x158 +// HDR-NEXT: Size: 96 +// HDR-NEXT: Link: 0 +// HDR-NEXT: Info: 0 +// HDR-NEXT: AddressAlignment: 8 +// HDR-NEXT: EntrySize: 0 +// HDR-NEXT: SectionData ( +// HDR-NEXT: 0000: 14000000 00000000 017A5200 01781001 | +// HDR-NEXT: 0010: 1B0C0708 90010000 14000000 1C000000 | +// HDR-NEXT: 0020: 880E0000 01000000 00000000 00000000 | +// HDR-NEXT: 0030: 14000000 34000000 710E0000 01000000 | +// HDR-NEXT: 0040: 00000000 00000000 14000000 4C000000 | +// HDR-NEXT: 0050: 5A0E0000 01000000 00000000 00000000 | +// CIE: 14000000 00000000 017A5200 01781001 1B0C0708 90010000 +// FDE(1): 14000000 1C000000 880E0000 01000000 00000000 00000000 +// address of data (starts with 0x880E0000) = 0x10158 + 0x0020 = 0x10178 +// The starting address to which this FDE applies = 0xE88 + 0x10178 = 0x11000 +// The number of bytes after the start address to which this FDE applies = 0x01000000 = 1 +// FDE(2): 14000000 34000000 710E0000 01000000 00000000 00000000 +// address of data (starts with 0x710E0000) = 0x10158 + 0x0038 = 0x10190 +// The starting address to which this FDE applies = 0xE71 + 0x10190 = 0x11001 +// The number of bytes after the start address to which this FDE applies = 0x01000000 = 1 +// FDE(3): 14000000 4C000000 5A0E0000 01000000 00000000 00000000 +// address of data (starts with 0x5A0E0000) = 0x10158 + 0x0050 = 0x101A8 +// The starting address to which this FDE applies = 0xE5A + 0x101A8 = 0x11002 +// The number of bytes after the start address to which this FDE applies = 0x01000000 = 1 +// HDR-NEXT: ) +// HDR-NEXT: } +// HDR-NEXT: Section { +// HDR-NEXT: Index: 2 +// HDR-NEXT: Name: .eh_frame_hdr +// HDR-NEXT: Type: SHT_PROGBITS +// HDR-NEXT: Flags [ +// HDR-NEXT: SHF_ALLOC +// HDR-NEXT: ] +// HDR-NEXT: Address: 0x101B8 +// HDR-NEXT: Offset: 0x1B8 +// HDR-NEXT: Size: 36 +// HDR-NEXT: Link: 0 +// HDR-NEXT: Info: 0 +// HDR-NEXT: AddressAlignment: 1 +// HDR-NEXT: EntrySize: 0 +// HDR-NEXT: SectionData ( +// HDR-NEXT: 0000: 011B033B 9CFFFFFF 03000000 480E0000 | +// HDR-NEXT: 0010: B8FFFFFF 490E0000 D0FFFFFF 4A0E0000 | +// HDR-NEXT: 0020: E8FFFFFF | +// Header (always 4 bytes): 0x011B033B +// 9CFFFFFF = .eh_frame(0x10158) - .eh_frame_hdr(0x101B8) - 4 +// 03000000 = 3 = the number of FDE pointers in the table. +// Entry(1): 480E0000 B8FFFFFF +// 480E0000 = 0x11000 - .eh_frame_hdr(0x101B8) = 0xE48 +// B8FFFFFF = address of FDE(1) - .eh_frame_hdr(0x101B8) = +// = .eh_frame(0x10158) + 24 - 0x101B8 = 0xFFFFFFB8 +// Entry(2): 490E0000 D0FFFFFF +// 490E0000 = 0x11001 - .eh_frame_hdr(0x101B8) = 0xE49 +// D0FFFFFF = address of FDE(2) - .eh_frame_hdr(0x101B8) = +// = .eh_frame(0x10158) + 24 + 24 - 0x101B8 = 0xFFFFFFD0 +// Entry(3): 4A0E0000 E8FFFFFF +// 4A0E0000 = 0x11002 - .eh_frame_hdr(0x101B8) = 0xE4A +// E8FFFFFF = address of FDE(2) - .eh_frame_hdr(0x101B8) = +// = .eh_frame(0x10158) + 24 + 24 - 0x101B8 = 0xFFFFFFE8 +// HDR-NEXT: ) +// HDR-NEXT: } +// HDR: ProgramHeaders [ +// HDR: ProgramHeader { +// HDR: Type: PT_GNU_EH_FRAME +// HDR-NEXT: Offset: 0x1B8 +// HDR-NEXT: VirtualAddress: 0x101B8 +// HDR-NEXT: PhysicalAddress: 0x101B8 +// HDR-NEXT: FileSize: 36 +// HDR-NEXT: MemSize: 36 +// HDR-NEXT: Flags [ +// HDR-NEXT: PF_R +// HDR-NEXT: ] +// HDR-NEXT: Alignment: 1 +// HDR-NEXT: } diff --git a/test/ELF/eh-frame-marker.s b/test/ELF/eh-frame-marker.s new file mode 100644 index 000000000000..a5de2a7c3d40 --- /dev/null +++ b/test/ELF/eh-frame-marker.s @@ -0,0 +1,6 @@ +// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux +// RUN: ld.lld --eh-frame-hdr %t.o -o %t.so -shared +// We used to crash on this. + .section .eh_frame +foo: + .long 0 diff --git a/test/ELF/eh-frame-merge.s b/test/ELF/eh-frame-merge.s index 2b0e4a52822d..2610d4d4d2de 100644 --- a/test/ELF/eh-frame-merge.s +++ b/test/ELF/eh-frame-merge.s @@ -21,7 +21,7 @@ // * There is only one copy of the second FDE // CHECK: Name: .eh_frame -// CHECK-NEXT: Type: SHT_X86_64_UNWIND +// CHECK-NEXT: Type: SHT_PROGBITS // CHECK-NEXT: Flags [ // CHECK-NEXT: SHF_ALLOC // CHECK-NEXT: ] diff --git a/test/ELF/eh-frame-multilpe-cie.s b/test/ELF/eh-frame-multilpe-cie.s new file mode 100644 index 000000000000..12781ff5b6e9 --- /dev/null +++ b/test/ELF/eh-frame-multilpe-cie.s @@ -0,0 +1,12 @@ +// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux +// RUN: ld.lld --eh-frame-hdr %t.o -o %t.so -shared +// We would fail to parse multiple cies in the same file. + + .cfi_startproc + .cfi_personality 0x9b, foo + .cfi_endproc + + .cfi_startproc + .cfi_endproc + +foo: diff --git a/test/ELF/eh-frame-type.test b/test/ELF/eh-frame-type.test index f59ab116d7dd..756299739e16 100644 --- a/test/ELF/eh-frame-type.test +++ b/test/ELF/eh-frame-type.test @@ -1,10 +1,11 @@ -# RUN: yaml2obj -format elf %s -o %t.o +# RUN: yaml2obj %s -o %t.o # RUN: ld.lld %t.o -o %t -shared # RUN: llvm-readobj -s %t | FileCheck %s # CHECK: Name: .eh_frame -# CHECK-NEXT: Type: SHT_X86_64_UNWIND +# CHECK-NEXT: Type: SHT_PROGBITS +!ELF FileHeader: Class: ELFCLASS64 Data: ELFDATA2LSB diff --git a/test/ELF/ehframe-relocation.s b/test/ELF/ehframe-relocation.s index f952ebc60865..8d5e14919e92 100644 --- a/test/ELF/ehframe-relocation.s +++ b/test/ELF/ehframe-relocation.s @@ -1,17 +1,19 @@ // REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o -// RUN: ld.lld %t.o -o %t +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/ehframe-relocation.s -o %t2.o +// RUN: ld.lld %t.o %t2.o -o %t // RUN: llvm-readobj -s %t | FileCheck %s // RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s // CHECK: Name: .eh_frame -// CHECK-NEXT: Type: SHT_X86_64_UNWIND +// CHECK-NEXT: Type: SHT_PROGBITS // CHECK-NEXT: Flags [ // CHECK-NEXT: SHF_ALLOC // CHECK-NEXT: ] // CHECK-NEXT: Address: 0x10120 // CHECK-NEXT: Offset: -// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Size: 48 +// CHECK-NOT: .eh_frame // 0x10120 = 65824 // 0x10120 + 5 = 65829 diff --git a/test/ELF/empty-ver.s b/test/ELF/empty-ver.s new file mode 100644 index 000000000000..f200d2876e09 --- /dev/null +++ b/test/ELF/empty-ver.s @@ -0,0 +1,25 @@ +// REQUIRES: x86 +// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux +// RUN: ld.lld %t.o -o %t.so -shared -version-script %p/Inputs/empty-ver.ver +// RUN: llvm-readobj -version-info %t.so | FileCheck %s + +// CHECK: Version symbols { +// CHECK-NEXT: Section Name: +// CHECK-NEXT: Address: +// CHECK-NEXT: Offset: +// CHECK-NEXT: Link: +// CHECK-NEXT: Symbols [ +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Version: 0 +// CHECK-NEXT: Name: @ +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Version: 2 +// CHECK-NEXT: Name: foo@ver +// CHECK-NEXT: } +// CHECK-NEXT: ] +// CHECK-NEXT: } + + +.global foo@ver +foo@ver: diff --git a/test/ELF/emulation.s b/test/ELF/emulation.s index a8a8f398c42c..7cc764fc6c18 100644 --- a/test/ELF/emulation.s +++ b/test/ELF/emulation.s @@ -29,6 +29,37 @@ # X86-64-NEXT: StringTableSectionIndex: # X86-64-NEXT: } +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux-gnux32 %s -o %tx32 +# RUN: ld.lld -m elf32_x86_64 %tx32 -o %t2x32 +# RUN: llvm-readobj -file-headers %t2x32 | FileCheck --check-prefix=X32 %s +# RUN: ld.lld %tx32 -o %t3x32 +# RUN: llvm-readobj -file-headers %t3x32 | FileCheck --check-prefix=X32 %s +# X32: ElfHeader { +# X32-NEXT: Ident { +# X32-NEXT: Magic: (7F 45 4C 46) +# X32-NEXT: Class: 32-bit (0x1) +# X32-NEXT: DataEncoding: LittleEndian (0x1) +# X32-NEXT: FileVersion: 1 +# X32-NEXT: OS/ABI: SystemV (0x0) +# X32-NEXT: ABIVersion: 0 +# X32-NEXT: Unused: (00 00 00 00 00 00 00) +# X32-NEXT: } +# X32-NEXT: Type: Executable (0x2) +# X32-NEXT: Machine: EM_X86_64 (0x3E) +# X32-NEXT: Version: 1 +# X32-NEXT: Entry: +# X32-NEXT: ProgramHeaderOffset: 0x34 +# X32-NEXT: SectionHeaderOffset: +# X32-NEXT: Flags [ (0x0) +# X32-NEXT: ] +# X32-NEXT: HeaderSize: 52 +# X32-NEXT: ProgramHeaderEntrySize: 32 +# X32-NEXT: ProgramHeaderCount: +# X32-NEXT: SectionHeaderEntrySize: 40 +# X32-NEXT: SectionHeaderCount: +# X32-NEXT: StringTableSectionIndex: +# X32-NEXT: } + # RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %s -o %tx86 # RUN: ld.lld -m elf_i386 %tx86 -o %t2x86 # RUN: llvm-readobj -file-headers %t2x86 | FileCheck --check-prefix=X86 %s @@ -60,6 +91,37 @@ # X86-NEXT: StringTableSectionIndex: # X86-NEXT: } +# RUN: llvm-mc -filetype=obj -triple=i686-unknown-freebsd %s -o %tx86fbsd +# RUN: ld.lld -m elf_i386_fbsd %tx86fbsd -o %t2x86_fbsd +# RUN: llvm-readobj -file-headers %t2x86_fbsd | FileCheck --check-prefix=X86FBSD %s +# RUN: ld.lld %tx86fbsd -o %t3x86fbsd +# RUN: llvm-readobj -file-headers %t3x86fbsd | FileCheck --check-prefix=X86FBSD %s +# X86FBSD: ElfHeader { +# X86FBSD-NEXT: Ident { +# X86FBSD-NEXT: Magic: (7F 45 4C 46) +# X86FBSD-NEXT: Class: 32-bit (0x1) +# X86FBSD-NEXT: DataEncoding: LittleEndian (0x1) +# X86FBSD-NEXT: FileVersion: 1 +# X86FBSD-NEXT: OS/ABI: FreeBSD (0x9) +# X86FBSD-NEXT: ABIVersion: 0 +# X86FBSD-NEXT: Unused: (00 00 00 00 00 00 00) +# X86FBSD-NEXT: } +# X86FBSD-NEXT: Type: Executable (0x2) +# X86FBSD-NEXT: Machine: EM_386 (0x3) +# X86FBSD-NEXT: Version: 1 +# X86FBSD-NEXT: Entry: +# X86FBSD-NEXT: ProgramHeaderOffset: 0x34 +# X86FBSD-NEXT: SectionHeaderOffset: +# X86FBSD-NEXT: Flags [ (0x0) +# X86FBSD-NEXT: ] +# X86FBSD-NEXT: HeaderSize: 52 +# X86FBSD-NEXT: ProgramHeaderEntrySize: 32 +# X86FBSD-NEXT: ProgramHeaderCount: +# X86FBSD-NEXT: SectionHeaderEntrySize: 40 +# X86FBSD-NEXT: SectionHeaderCount: +# X86FBSD-NEXT: StringTableSectionIndex: +# X86FBSD-NEXT: } + # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %tppc64 # RUN: ld.lld -m elf64ppc %tppc64 -o %t2ppc64 # RUN: llvm-readobj -file-headers %t2ppc64 | FileCheck --check-prefix=PPC64 %s @@ -147,6 +209,60 @@ # MIPSEL-NEXT: EF_MIPS_CPIC # MIPSEL-NEXT: ] +# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %tmips64 +# RUN: ld.lld -m elf64btsmip -e _start %tmips64 -o %t2mips64 +# RUN: llvm-readobj -file-headers %t2mips64 | FileCheck --check-prefix=MIPS64 %s +# RUN: ld.lld %tmips64 -e _start -o %t3mips64 +# RUN: llvm-readobj -file-headers %t3mips64 | FileCheck --check-prefix=MIPS64 %s +# MIPS64: ElfHeader { +# MIPS64-NEXT: Ident { +# MIPS64-NEXT: Magic: (7F 45 4C 46) +# MIPS64-NEXT: Class: 64-bit (0x2) +# MIPS64-NEXT: DataEncoding: BigEndian (0x2) +# MIPS64-NEXT: FileVersion: 1 +# MIPS64-NEXT: OS/ABI: SystemV (0x0) +# MIPS64-NEXT: ABIVersion: 0 +# MIPS64-NEXT: Unused: (00 00 00 00 00 00 00) +# MIPS64-NEXT: } +# MIPS64-NEXT: Type: Executable (0x2) +# MIPS64-NEXT: Machine: EM_MIPS (0x8) +# MIPS64-NEXT: Version: 1 +# MIPS64-NEXT: Entry: +# MIPS64-NEXT: ProgramHeaderOffset: 0x40 +# MIPS64-NEXT: SectionHeaderOffset: +# MIPS64-NEXT: Flags [ +# MIPS64-NEXT: EF_MIPS_ARCH_64R2 +# MIPS64-NEXT: EF_MIPS_CPIC +# MIPS64-NEXT: EF_MIPS_PIC +# MIPS64-NEXT: ] + +# RUN: llvm-mc -filetype=obj -triple=mips64el-unknown-linux %s -o %tmips64el +# RUN: ld.lld -m elf64ltsmip -e _start %tmips64el -o %t2mips64el +# RUN: llvm-readobj -file-headers %t2mips64el | FileCheck --check-prefix=MIPS64EL %s +# RUN: ld.lld %tmips64el -e _start -o %t3mips64el +# RUN: llvm-readobj -file-headers %t3mips64el | FileCheck --check-prefix=MIPS64EL %s +# MIPS64EL: ElfHeader { +# MIPS64EL-NEXT: Ident { +# MIPS64EL-NEXT: Magic: (7F 45 4C 46) +# MIPS64EL-NEXT: Class: 64-bit (0x2) +# MIPS64EL-NEXT: DataEncoding: LittleEndian (0x1) +# MIPS64EL-NEXT: FileVersion: 1 +# MIPS64EL-NEXT: OS/ABI: SystemV (0x0) +# MIPS64EL-NEXT: ABIVersion: 0 +# MIPS64EL-NEXT: Unused: (00 00 00 00 00 00 00) +# MIPS64EL-NEXT: } +# MIPS64EL-NEXT: Type: Executable (0x2) +# MIPS64EL-NEXT: Machine: EM_MIPS (0x8) +# MIPS64EL-NEXT: Version: 1 +# MIPS64EL-NEXT: Entry: +# MIPS64EL-NEXT: ProgramHeaderOffset: 0x40 +# MIPS64EL-NEXT: SectionHeaderOffset: +# MIPS64EL-NEXT: Flags [ +# MIPS64EL-NEXT: EF_MIPS_ARCH_64R2 +# MIPS64EL-NEXT: EF_MIPS_CPIC +# MIPS64EL-NEXT: EF_MIPS_PIC +# MIPS64EL-NEXT: ] + # RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %s -o %taarch64 # RUN: ld.lld -m aarch64linux %taarch64 -o %t2aarch64 # RUN: llvm-readobj -file-headers %t2aarch64 | FileCheck --check-prefix=AARCH64 %s @@ -173,5 +289,5 @@ # REQUIRES: x86,ppc,mips,aarch64 -.globl _start; +.globl _start _start: diff --git a/test/ELF/end.s b/test/ELF/end.s index 390e4445e2d8..689157f82070 100644 --- a/test/ELF/end.s +++ b/test/ELF/end.s @@ -36,13 +36,13 @@ // NOBSS-NEXT: SHF_ALLOC // NOBSS-NEXT: SHF_WRITE // NOBSS-NEXT: ] -// NOBSS-NEXT: Address: 0x12000 +// NOBSS-NEXT: Address: 0x159 // NOBSS-NEXT: Offset: // NOBSS-NEXT: Size: 2 // NOBSS: ] // NOBSS: Symbols [ // NOBSS: Name: _end -// NOBSS-NEXT: Value: 0x12002 +// NOBSS-NEXT: Value: 0x15B // NOBSS: ] // If the layout of the sections is changed, "_end" should point to the end of allocated address space. @@ -60,13 +60,13 @@ // TEXTATEND-NEXT: SHF_ALLOC // TEXTATEND-NEXT: SHF_EXECINSTR // TEXTATEND-NEXT: ] -// TEXTATEND-NEXT: Address: 0x12000 +// TEXTATEND-NEXT: Address: 0x160 // TEXTATEND-NEXT: Offset: // TEXTATEND-NEXT: Size: 1 // TEXTATEND: ] // TEXTATEND: Symbols [ // TEXTATEND: Name: _end -// TEXTATEND-NEXT: Value: 0x12001 +// TEXTATEND-NEXT: Value: 0x161 // TEXTATEND: ] .global _start,_end diff --git a/test/ELF/entry.s b/test/ELF/entry.s index c8758ece69eb..6175c7623a34 100644 --- a/test/ELF/entry.s +++ b/test/ELF/entry.s @@ -4,9 +4,9 @@ # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=SYM %s # RUN: ld.lld %t1 -shared -o %t2 -e entry # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=DSO %s -# RUN: ld.lld %t1 -o %t2 -e 4096 +# RUN: ld.lld %t1 -o %t2 --entry=4096 # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=DEC %s -# RUN: ld.lld %t1 -o %t2 -e 0xcafe +# RUN: ld.lld %t1 -o %t2 --entry 0xcafe # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=HEX %s # RUN: ld.lld %t1 -o %t2 -e 0777 # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=OCT %s diff --git a/test/ELF/fatal-warnings.s b/test/ELF/fatal-warnings.s new file mode 100644 index 000000000000..0bc2a2b44476 --- /dev/null +++ b/test/ELF/fatal-warnings.s @@ -0,0 +1,16 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/warn-common.s -o %t2.o + +# RUN: ld.lld --warn-common %t1.o %t2.o -o %t1.out 2>&1 | \ +# RUN: FileCheck -check-prefix=ERR %s +# ERR: multiple common of + +# RUN: not ld.lld --warn-common --fatal-warnings %t1.o %t2.o -o %t2.out 2>&1 | \ +# RUN: FileCheck -check-prefix=ERR %s + +.globl _start +_start: + +.type arr,@object +.comm arr,4,4 diff --git a/test/ELF/file-sym.s b/test/ELF/file-sym.s new file mode 100644 index 000000000000..eddb461490c6 --- /dev/null +++ b/test/ELF/file-sym.s @@ -0,0 +1,12 @@ +# Check that we do not keep STT_FILE symbols in the symbol table + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: ld.lld %t.o -shared -o %t.so +# RUN: llvm-readobj -symbols %t.so | FileCheck %s + +# REQUIRES: x86 + +# CHECK-NOT: xxx + +.file "xxx" +.file "" diff --git a/test/ELF/gc-merge-local-sym.s b/test/ELF/gc-merge-local-sym.s new file mode 100644 index 000000000000..b02a3a4e4762 --- /dev/null +++ b/test/ELF/gc-merge-local-sym.s @@ -0,0 +1,34 @@ +// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux +// RUN: ld.lld %t.o -o %t.so -shared -O3 --gc-sections +// RUN: llvm-readobj -s -section-data -t %t.so | FileCheck %s + +// CHECK: Name: .rodata +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_MERGE +// CHECK-NEXT: SHF_STRINGS +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x1C8 +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: 4 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 1 +// CHECK-NEXT: EntrySize: 1 +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 61626300 |abc.| +// CHECK-NEXT: ) + +// CHECK: Symbols [ +// CHECK: Symbol { +// CHECK-NOT: Name: bar + + .global foo +foo: + leaq .L.str(%rip), %rsi + .section .rodata.str1.1,"aMS",@progbits,1 +.L.str: + .asciz "abc" +bar: + .asciz "def" diff --git a/test/ELF/gc-sections-eh.s b/test/ELF/gc-sections-eh.s index 042b68ebdfe2..88c3dd0d9ca4 100644 --- a/test/ELF/gc-sections-eh.s +++ b/test/ELF/gc-sections-eh.s @@ -1,10 +1,23 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t + # RUN: ld.lld %t -o %t2 --gc-sections # RUN: llvm-readobj -t %t2 | FileCheck %s +# RUN: llvm-objdump --dwarf=frames %t2 | FileCheck --check-prefix=EH %s + +# RUN: ld.lld %t -o %t3 +# RUN: llvm-readobj -t %t3 | FileCheck --check-prefix=NOGC %s +# RUN: llvm-objdump --dwarf=frames %t3 | FileCheck --check-prefix=EHNOGC %s # CHECK-NOT: foo +# NOGC: foo + +# EH: FDE cie={{.*}} pc= +# EH-NOT: FDE + +# EHNOGC: FDE cie={{.*}} pc= +# EHNOGC: FDE cie={{.*}} pc= .section .text,"ax",@progbits,unique,0 .globl foo diff --git a/test/ELF/gc-sections-local-sym.s b/test/ELF/gc-sections-local-sym.s new file mode 100644 index 000000000000..89121e289cc2 --- /dev/null +++ b/test/ELF/gc-sections-local-sym.s @@ -0,0 +1,57 @@ +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +// RUN: ld.lld %t -o %t2 -shared --gc-sections +// RUN: llvm-readobj -t -s -section-data %t2 | FileCheck %s +// REQUIRES: x86 + +.global foo +foo: + +.section .bar,"a" +zed: + +// CHECK: Name: .strtab +// CHECK-NEXT: Type: SHT_STRTAB +// CHECK-NEXT: Flags [ +// CHECK-NEXT: ] +// CHECK-NEXT: Address: +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: +// CHECK-NEXT: Link: +// CHECK-NEXT: Info: +// CHECK-NEXT: AddressAlignment: +// CHECK-NEXT: EntrySize: +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 00666F6F 005F4459 4E414D49 4300 |.foo._DYNAMIC.| +// CHECK-NEXT: ) + +// CHECK: Symbols [ +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: (0) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: Undefined +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: _DYNAMIC +// CHECK-NEXT: Value: 0x1000 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other [ (0x2) +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] +// CHECK-NEXT: Section: .dynamic +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: foo +// CHECK-NEXT: Value: +// CHECK-NEXT: Size: +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other: +// CHECK-NEXT: Section: .text +// CHECK-NEXT: } +// CHECK-NEXT: ] diff --git a/test/ELF/gc-sections-lsda.s b/test/ELF/gc-sections-lsda.s new file mode 100644 index 000000000000..b5bed8f0c816 --- /dev/null +++ b/test/ELF/gc-sections-lsda.s @@ -0,0 +1,21 @@ +// REQUIRES: x86 + +// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux +// RUN: ld.lld -shared --gc-sections %t.o -o %t + +// Test that we handle .eh_frame keeping sections alive. We could be more +// precise and gc the entire contents of this file, but test that at least +// we are consistent: if we keep .abc, we have to keep .foo + +// RUN: llvm-readobj -s %t | FileCheck %s +// CHECK: Name: .abc +// CHECK: Name: .foo (38) + + .cfi_startproc + .cfi_lsda 0x1b,zed + .cfi_endproc + .section .abc,"a" +zed: + .long bar-. + .section .foo,"ax" +bar: diff --git a/test/ELF/gc-sections-merge-addend.s b/test/ELF/gc-sections-merge-addend.s new file mode 100644 index 000000000000..8595f5802be5 --- /dev/null +++ b/test/ELF/gc-sections-merge-addend.s @@ -0,0 +1,39 @@ +// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux +// RUN: ld.lld %t.o -o %t.so -shared --gc-sections +// RUN: llvm-readobj -s -section-data %t.so | FileCheck %s + + +// CHECK: Name: .rodata +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_MERGE +// CHECK-NEXT: SHF_STRINGS +// CHECK-NEXT: ] +// CHECK-NEXT: Address: +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: 4 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 1 +// CHECK-NEXT: EntrySize: 1 +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 62617200 |bar.| +// CHECK-NEXT: ) + + .section .data.f,"aw",@progbits + .globl f +f: + .quad .rodata.str1.1 + 4 + + .section .data.g,"aw",@progbits + .hidden g + .globl g +g: + .quad .rodata.str1.1 + + .section .rodata.str1.1,"aMS",@progbits,1 +.L.str: + .asciz "foo" +.L.str.1: + .asciz "bar" diff --git a/test/ELF/gc-sections-merge-implicit-addend.s b/test/ELF/gc-sections-merge-implicit-addend.s new file mode 100644 index 000000000000..8a7c804a830a --- /dev/null +++ b/test/ELF/gc-sections-merge-implicit-addend.s @@ -0,0 +1,39 @@ +// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=i386-pc-linux +// RUN: ld.lld %t.o -o %t.so -shared --gc-sections +// RUN: llvm-readobj -s -section-data %t.so | FileCheck %s + + +// CHECK: Name: .rodata +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_MERGE +// CHECK-NEXT: SHF_STRINGS +// CHECK-NEXT: ] +// CHECK-NEXT: Address: +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: 4 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 1 +// CHECK-NEXT: EntrySize: 1 +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 62617200 |bar.| +// CHECK-NEXT: ) + + .section .data.f,"aw",@progbits + .globl f +f: + .long .rodata.str1.1 + 4 + + .section .data.g,"aw",@progbits + .hidden g + .globl g +g: + .long .rodata.str1.1 + + .section .rodata.str1.1,"aMS",@progbits,1 +.L.str: + .asciz "foo" +.L.str.1: + .asciz "bar" diff --git a/test/ELF/gc-sections-merge.s b/test/ELF/gc-sections-merge.s new file mode 100644 index 000000000000..ef2688659871 --- /dev/null +++ b/test/ELF/gc-sections-merge.s @@ -0,0 +1,61 @@ +// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux +// RUN: ld.lld %t.o -o %t.so -shared +// RUN: ld.lld %t.o -o %t.gc.so -shared --gc-sections +// RUN: llvm-readobj -s -section-data %t.so | FileCheck %s +// RUN: llvm-readobj -s -section-data %t.gc.so | FileCheck --check-prefix=GC %s + + +// CHECK: Name: .rodata +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_MERGE +// CHECK-NEXT: SHF_STRINGS +// CHECK-NEXT: ] +// CHECK-NEXT: Address: +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: 8 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 1 +// CHECK-NEXT: EntrySize: 1 +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 666F6F00 62617200 |foo.bar.| +// CHECK-NEXT: ) + +// GC: Name: .rodata +// GC-NEXT: Type: SHT_PROGBITS +// GC-NEXT: Flags [ +// GC-NEXT: SHF_ALLOC +// GC-NEXT: SHF_MERGE +// GC-NEXT: SHF_STRINGS +// GC-NEXT: ] +// GC-NEXT: Address: +// GC-NEXT: Offset: +// GC-NEXT: Size: 4 +// GC-NEXT: Link: 0 +// GC-NEXT: Info: 0 +// GC-NEXT: AddressAlignment: 1 +// GC-NEXT: EntrySize: 1 +// GC-NEXT: SectionData ( +// GC-NEXT: 0000: 666F6F00 |foo.| +// GC-NEXT: ) + + .section .text.f,"ax",@progbits + .globl f +f: + leaq .L.str(%rip), %rax + retq + + .section .text.g,"ax",@progbits + .hidden g + .globl g +g: + leaq .L.str.1(%rip), %rax + retq + + .section .rodata.str1.1,"aMS",@progbits,1 +.L.str: + .asciz "foo" +.L.str.1: + .asciz "bar" diff --git a/test/ELF/gc-sections-protected.s b/test/ELF/gc-sections-protected.s new file mode 100644 index 000000000000..9f1efed5938a --- /dev/null +++ b/test/ELF/gc-sections-protected.s @@ -0,0 +1,18 @@ +// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux +// RUN: ld.lld %t.o -o %t.so -shared --gc-sections +// RUN: llvm-readobj -s %t.so | FileCheck %s + +// CHECK: Name: .text +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_EXECINSTR +// CHECK-NEXT: ] +// CHECK-NEXT: Address: +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: 1 + +.protected g +.globl g +g: +retq diff --git a/test/ELF/gc-sections-shared.s b/test/ELF/gc-sections-shared.s new file mode 100644 index 000000000000..d52eae2177b2 --- /dev/null +++ b/test/ELF/gc-sections-shared.s @@ -0,0 +1,34 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o +# RUN: ld.lld -shared %t2.o -o %t2.so +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: ld.lld --gc-sections --export-dynamic-symbol foo -o %t %t.o --as-needed %t2.so +# RUN: llvm-readobj --dynamic-table --dyn-symbols %t | FileCheck %s + +# This test the property that we have a needed line for every undefined. +# It would also be OK to drop bar2 and the need for the .so + + +# CHECK: Name: bar +# CHECK: Name: bar2 +# CHECK: Name: foo +# CHECK: NEEDED SharedLibrary ({{.*}}.so) + + +.section .text.foo, "ax" +.globl foo +foo: +call bar + +.section .text.bar, "ax" +.globl bar +bar: +ret + +.section .text._start, "ax" +.globl _start +_start: +ret + +.section .text.unused, "ax" +call bar2 diff --git a/test/ELF/gc-sections-weak.s b/test/ELF/gc-sections-weak.s new file mode 100644 index 000000000000..625b613843ba --- /dev/null +++ b/test/ELF/gc-sections-weak.s @@ -0,0 +1,24 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/gc-sections-weak.s -o %t2.o +// RUN: ld.lld %t.o %t2.o -o %t.so -shared --gc-sections +// RUN: llvm-readobj -s %t.so | FileCheck %s + +.global foo +foo: +nop + +.data +.global bar1 +bar1: +.quad foo + +// CHECK: Name: .text +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_EXECINSTR +// CHECK-NEXT: ] +// CHECK-NEXT: Address: +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: 1 diff --git a/test/ELF/global_offset_table_shared.s b/test/ELF/global_offset_table_shared.s new file mode 100644 index 000000000000..7935925ae2b3 --- /dev/null +++ b/test/ELF/global_offset_table_shared.s @@ -0,0 +1,9 @@ +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t +// RUN: ld.lld -shared %t -o %t2 +// RUN: llvm-readobj -t %t2 | FileCheck %s +.long _GLOBAL_OFFSET_TABLE_ + +// CHECK: Name: _GLOBAL_OFFSET_TABLE_ +// CHECK-NEXT: Value: +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local diff --git a/test/ELF/gnu-ifunc-gotpcrel.s b/test/ELF/gnu-ifunc-gotpcrel.s new file mode 100644 index 000000000000..08aa0af37a1b --- /dev/null +++ b/test/ELF/gnu-ifunc-gotpcrel.s @@ -0,0 +1,14 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/gnu-ifunc-gotpcrel.s -o %t2.o +# RUN: ld.lld -shared %t2.o -o %t2.so +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: ld.lld %t.o %t2.so -o %t +# RUN: llvm-readobj -dyn-relocations %t | FileCheck %s + +# CHECK: Dynamic Relocations { +# CHECK-NEXT: 0x120B0 R_X86_64_GLOB_DAT foo 0x0 +# CHECK-NEXT: } + +.globl _start +_start: +mov foo@gotpcrel(%rip), %rax diff --git a/test/ELF/gnu-ifunc-i386.s b/test/ELF/gnu-ifunc-i386.s index 6dcdf256d70c..bc2d0f9610b3 100644 --- a/test/ELF/gnu-ifunc-i386.s +++ b/test/ELF/gnu-ifunc-i386.s @@ -1,7 +1,7 @@ // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o // RUN: ld.lld -static %t.o -o %tout // RUN: llvm-objdump -d %tout | FileCheck %s --check-prefix=DISASM -// RUN: llvm-readobj -r -symbols -sections %tout | FileCheck %s --check-prefix=CHECK +// RUN: llvm-readobj -r -symbols -sections %tout | FileCheck %s // REQUIRES: x86 // CHECK: Sections [ @@ -43,8 +43,10 @@ // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 0 -// CHECK-NEXT: Section: Absolute +// CHECK-NEXT: Other [ +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] +// CHECK-NEXT: Section: .rel.plt // CHECK-NEXT: } // CHECK-NEXT: Symbol { // CHECK-NEXT: Name: __rel_iplt_start @@ -52,8 +54,10 @@ // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 0 -// CHECK-NEXT: Section: Absolute +// CHECK-NEXT: Other [ +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] +// CHECK-NEXT: Section: .rel.plt // CHECK-NEXT: } // CHECK-NEXT: Symbol { // CHECK-NEXT: Name: _start @@ -112,13 +116,11 @@ .text .type foo STT_GNU_IFUNC .globl foo -.type foo, @function foo: ret .type bar STT_GNU_IFUNC .globl bar -.type bar, @function bar: ret diff --git a/test/ELF/gnu-ifunc-nosym-i386.s b/test/ELF/gnu-ifunc-nosym-i386.s index 1101b6d763d5..d22cedbfe6de 100644 --- a/test/ELF/gnu-ifunc-nosym-i386.s +++ b/test/ELF/gnu-ifunc-nosym-i386.s @@ -6,20 +6,18 @@ // Check that no __rel_iplt_end/__rel_iplt_start // appear in symtab if there is no references to them. // CHECK: Symbols [ -// CHECK-NEXT-NOT: __rel_iplt_end -// CHECK-NEXT-NOT: __rel_iplt_start +// CHECK-NOT: __rel_iplt_end +// CHECK-NOT: __rel_iplt_start // CHECK: ] .text .type foo STT_GNU_IFUNC .globl foo -.type foo, @function foo: ret .type bar STT_GNU_IFUNC .globl bar -.type bar, @function bar: ret diff --git a/test/ELF/gnu-ifunc-nosym.s b/test/ELF/gnu-ifunc-nosym.s index c97fd749c02b..08e498e97c19 100644 --- a/test/ELF/gnu-ifunc-nosym.s +++ b/test/ELF/gnu-ifunc-nosym.s @@ -6,20 +6,18 @@ // Check that no __rela_iplt_end/__rela_iplt_start // appear in symtab if there is no references to them. // CHECK: Symbols [ -// CHECK-NEXT-NOT: __rela_iplt_end -// CHECK-NEXT-NOT: __rela_iplt_start +// CHECK-NOT: __rela_iplt_end +// CHECK-NOT: __rela_iplt_start // CHECK: ] .text .type foo STT_GNU_IFUNC .globl foo -.type foo, @function foo: ret .type bar STT_GNU_IFUNC .globl bar -.type bar, @function bar: ret diff --git a/test/ELF/gnu-ifunc-relative.s b/test/ELF/gnu-ifunc-relative.s new file mode 100644 index 000000000000..dc35102c5787 --- /dev/null +++ b/test/ELF/gnu-ifunc-relative.s @@ -0,0 +1,23 @@ +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: ld.lld -static %t.o -o %tout +// RUN: llvm-readobj -r -t %tout | FileCheck %s +// REQUIRES: x86 + +.type foo STT_GNU_IFUNC +.globl foo +foo: + ret + +.globl _start +_start: + call foo + +// CHECK: Section ({{.*}}) .rela.plt { +// CHECK-NEXT: R_X86_64_IRELATIVE - 0x[[ADDR:.*]] +// CHECK-NEXT: } + +// CHECK: Name: foo +// CHECK-NEXT: Value: 0x[[ADDR]] +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: GNU_IFunc diff --git a/test/ELF/gnu-ifunc.s b/test/ELF/gnu-ifunc.s index b04f2758e22c..5336c89a563b 100644 --- a/test/ELF/gnu-ifunc.s +++ b/test/ELF/gnu-ifunc.s @@ -1,7 +1,7 @@ // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: ld.lld -static %t.o -o %tout // RUN: llvm-objdump -d %tout | FileCheck %s --check-prefix=DISASM -// RUN: llvm-readobj -r -symbols -sections %tout | FileCheck %s --check-prefix=CHECK +// RUN: llvm-readobj -r -symbols -sections %tout | FileCheck %s // REQUIRES: x86 // CHECK: Sections [ @@ -42,8 +42,10 @@ // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 0 -// CHECK-NEXT: Section: Absolute +// CHECK-NEXT: Other [ +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] +// CHECK-NEXT: Section: .rela.plt // CHECK-NEXT: } // CHECK-NEXT: Symbol { // CHECK-NEXT: Name: __rela_iplt_start @@ -51,8 +53,10 @@ // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 0 -// CHECK-NEXT: Section: Absolute +// CHECK-NEXT: Other [ +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] +// CHECK-NEXT: Section: .rela.plt // CHECK-NEXT: } // CHECK-NEXT: Symbol { // CHECK-NEXT: Name: _start @@ -93,6 +97,7 @@ // DISASM-NEXT: 11007: e8 34 00 00 00 callq 52 // DISASM-NEXT: 1100c: ba 58 01 01 00 movl $65880, %edx // DISASM-NEXT: 11011: ba 88 01 01 00 movl $65928, %edx +// DISASM-NEXT: 11016: ba 89 01 01 00 movl $65929, %edx // DISASM-NEXT: Disassembly of section .plt: // DISASM-NEXT: .plt: // DISASM-NEXT: 11020: ff 35 e2 0f 00 00 pushq 4066(%rip) @@ -108,13 +113,11 @@ .text .type foo STT_GNU_IFUNC .globl foo -.type foo, @function foo: ret .type bar STT_GNU_IFUNC .globl bar -.type bar, @function bar: ret @@ -124,3 +127,4 @@ _start: call bar movl $__rela_iplt_start,%edx movl $__rela_iplt_end,%edx + movl $__rela_iplt_end + 1,%edx diff --git a/test/ELF/gnu-unique.s b/test/ELF/gnu-unique.s index f7206cf8c97f..afc0da27063d 100644 --- a/test/ELF/gnu-unique.s +++ b/test/ELF/gnu-unique.s @@ -1,7 +1,11 @@ +// REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t +// // RUN: ld.lld %t -shared -o %tout.so -// RUN: llvm-readobj -dyn-symbols %tout.so | FileCheck %s -// REQUIRES: x86 +// RUN: llvm-readobj -dyn-symbols %tout.so | FileCheck -check-prefix=GNU %s +// +// RUN: ld.lld %t -shared -o %tout.so --no-gnu-unique +// RUN: llvm-readobj -dyn-symbols %tout.so | FileCheck -check-prefix=NO %s // Check that STB_GNU_UNIQUE is treated as a global and ends up in the dynamic // symbol table as STB_GNU_UNIQUE. @@ -14,11 +18,20 @@ _start: .type symb, @gnu_unique_object symb: -# CHECK: Name: symb@ -# CHECK-NEXT: Value: -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Unique -# CHECK-NEXT: Type: Object -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: .data -# CHECK-NEXT: } +# GNU: Name: symb@ +# GNU-NEXT: Value: +# GNU-NEXT: Size: 0 +# GNU-NEXT: Binding: Unique +# GNU-NEXT: Type: Object +# GNU-NEXT: Other: 0 +# GNU-NEXT: Section: .data +# GNU-NEXT: } + +# NO: Name: symb@ +# NO-NEXT: Value: +# NO-NEXT: Size: 0 +# NO-NEXT: Binding: Global +# NO-NEXT: Type: Object +# NO-NEXT: Other: 0 +# NO-NEXT: Section: .data +# NO-NEXT: } diff --git a/test/ELF/got-plt-header.s b/test/ELF/got-plt-header.s new file mode 100644 index 000000000000..691516d1a348 --- /dev/null +++ b/test/ELF/got-plt-header.s @@ -0,0 +1,30 @@ +// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux +// RUN: ld.lld %t.o -o %t.so -shared +// RUN: llvm-readobj -s -section-data %t.so | FileCheck %s + + call foo@plt + +// Check that the first .got.plt entry has the address of the dynamic table. + +// CHECK: Type: SHT_DYNAMIC +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x2000 + +// CHECK: Name: .got.plt +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x3000 +// CHECK-NEXT: Offset: 0x3000 +// CHECK-NEXT: Size: 32 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 8 +// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 00200000 00000000 00000000 00000000 diff --git a/test/ELF/gotpc-relax-nopic.s b/test/ELF/gotpc-relax-nopic.s new file mode 100644 index 000000000000..278173557837 --- /dev/null +++ b/test/ELF/gotpc-relax-nopic.s @@ -0,0 +1,81 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -relax-relocations -triple=x86_64-unknown-linux %s -o %t.o +# RUN: ld.lld %t.o -o %t1 +# RUN: llvm-readobj -symbols -r %t1 | FileCheck --check-prefix=SYMRELOC %s +# RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASM %s + +## There is no relocations. +# SYMRELOC: Relocations [ +# SYMRELOC-NEXT: ] +# SYMRELOC: Symbols [ +# SYMRELOC: Symbol { +# SYMRELOC: Name: bar +# SYMRELOC-NEXT: Value: 0x12000 + +## 73728 = 0x12000 (bar) +# DISASM: Disassembly of section .text: +# DISASM-NEXT: _start: +# DISASM-NEXT: 11000: 48 81 d0 00 20 01 00 adcq $73728, %rax +# DISASM-NEXT: 11007: 48 81 c3 00 20 01 00 addq $73728, %rbx +# DISASM-NEXT: 1100e: 48 81 e1 00 20 01 00 andq $73728, %rcx +# DISASM-NEXT: 11015: 48 81 fa 00 20 01 00 cmpq $73728, %rdx +# DISASM-NEXT: 1101c: 48 81 cf 00 20 01 00 orq $73728, %rdi +# DISASM-NEXT: 11023: 48 81 de 00 20 01 00 sbbq $73728, %rsi +# DISASM-NEXT: 1102a: 48 81 ed 00 20 01 00 subq $73728, %rbp +# DISASM-NEXT: 11031: 49 81 f0 00 20 01 00 xorq $73728, %r8 +# DISASM-NEXT: 11038: 49 f7 c7 00 20 01 00 testq $73728, %r15 + +# RUN: ld.lld -shared %t.o -o %t2 +# RUN: llvm-readobj -s %t2 | FileCheck --check-prefix=SEC-PIC %s +# RUN: llvm-objdump -d %t2 | FileCheck --check-prefix=DISASM-PIC %s +# SEC-PIC: Section { +# SEC-PIC: Index: +# SEC-PIC: Name: .got +# SEC-PIC-NEXT: Type: SHT_PROGBITS +# SEC-PIC-NEXT: Flags [ +# SEC-PIC-NEXT: SHF_ALLOC +# SEC-PIC-NEXT: SHF_WRITE +# SEC-PIC-NEXT: ] +# SEC-PIC-NEXT: Address: 0x2090 +# SEC-PIC-NEXT: Offset: 0x2090 +# SEC-PIC-NEXT: Size: 8 +# SEC-PIC-NEXT: Link: +# SEC-PIC-NEXT: Info: +# SEC-PIC-NEXT: AddressAlignment: +# SEC-PIC-NEXT: EntrySize: +# SEC-PIC-NEXT: } + +## Check that there was no relaxation performed. All values refer to got entry. +## Ex: 0x1000 + 4233 + 7 = 0x2090 +## 0x102a + 4191 + 7 = 0x2090 +# DISASM-PIC: Disassembly of section .text: +# DISASM-PIC-NEXT: _start: +# DISASM-PIC-NEXT: 1000: 48 13 05 89 10 00 00 adcq 4233(%rip), %rax +# DISASM-PIC-NEXT: 1007: 48 03 1d 82 10 00 00 addq 4226(%rip), %rbx +# DISASM-PIC-NEXT: 100e: 48 23 0d 7b 10 00 00 andq 4219(%rip), %rcx +# DISASM-PIC-NEXT: 1015: 48 3b 15 74 10 00 00 cmpq 4212(%rip), %rdx +# DISASM-PIC-NEXT: 101c: 48 0b 3d 6d 10 00 00 orq 4205(%rip), %rdi +# DISASM-PIC-NEXT: 1023: 48 1b 35 66 10 00 00 sbbq 4198(%rip), %rsi +# DISASM-PIC-NEXT: 102a: 48 2b 2d 5f 10 00 00 subq 4191(%rip), %rbp +# DISASM-PIC-NEXT: 1031: 4c 33 05 58 10 00 00 xorq 4184(%rip), %r8 +# DISASM-PIC-NEXT: 1038: 4c 85 3d 51 10 00 00 testq 4177(%rip), %r15 + +.data +.type bar, @object +bar: + .byte 1 + .size bar, .-bar + +.text +.globl _start +.type _start, @function +_start: + adcq bar@GOTPCREL(%rip), %rax + addq bar@GOTPCREL(%rip), %rbx + andq bar@GOTPCREL(%rip), %rcx + cmpq bar@GOTPCREL(%rip), %rdx + orq bar@GOTPCREL(%rip), %rdi + sbbq bar@GOTPCREL(%rip), %rsi + subq bar@GOTPCREL(%rip), %rbp + xorq bar@GOTPCREL(%rip), %r8 + testq %r15, bar@GOTPCREL(%rip) diff --git a/test/ELF/gotpc-relax-und-dso.s b/test/ELF/gotpc-relax-und-dso.s new file mode 100644 index 000000000000..ed6c4bc9bb15 --- /dev/null +++ b/test/ELF/gotpc-relax-und-dso.s @@ -0,0 +1,72 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -relax-relocations -triple=x86_64-unknown-linux %s -o %t.o +# RUN: llvm-mc -filetype=obj -relax-relocations -triple=x86_64-pc-linux %S/Inputs/gotpc-relax-und-dso.s -o %tdso.o +# RUN: ld.lld -shared %tdso.o -o %t.so +# RUN: ld.lld -shared %t.o %t.so -o %tout +# RUN: llvm-readobj -r -s %tout | FileCheck --check-prefix=RELOC %s +# RUN: llvm-objdump -d %tout | FileCheck --check-prefix=DISASM %s + +# RELOC: Relocations [ +# RELOC-NEXT: Section ({{.*}}) .rela.dyn { +# RELOC-NEXT: R_X86_64_GLOB_DAT dsofoo 0x0 +# RELOC-NEXT: R_X86_64_GLOB_DAT foo 0x0 +# RELOC-NEXT: R_X86_64_GLOB_DAT und 0x0 +# RELOC-NEXT: } +# RELOC-NEXT: ] + +# 0x101e + 7 - 36 = 0x1001 +# 0x1025 + 7 - 43 = 0x1001 +# DISASM: Disassembly of section .text: +# DISASM-NEXT: foo: +# DISASM-NEXT: nop +# DISASM: hid: +# DISASM-NEXT: nop +# DISASM: _start: +# DISASM-NEXT: movq 4247(%rip), %rax +# DISASM-NEXT: movq 4240(%rip), %rax +# DISASM-NEXT: movq 4241(%rip), %rax +# DISASM-NEXT: movq 4234(%rip), %rax +# DISASM-NEXT: leaq -36(%rip), %rax +# DISASM-NEXT: leaq -43(%rip), %rax +# DISASM-NEXT: movq 4221(%rip), %rax +# DISASM-NEXT: movq 4214(%rip), %rax +# DISASM-NEXT: movq 4191(%rip), %rax +# DISASM-NEXT: movq 4184(%rip), %rax +# DISASM-NEXT: movq 4185(%rip), %rax +# DISASM-NEXT: movq 4178(%rip), %rax +# DISASM-NEXT: leaq -92(%rip), %rax +# DISASM-NEXT: leaq -99(%rip), %rax +# DISASM-NEXT: movq 4165(%rip), %rax +# DISASM-NEXT: movq 4158(%rip), %rax + +.text +.globl foo +.type foo, @function +foo: + nop + +.globl hid +.hidden hid +.type hid, @function +hid: + nop + +.globl _start +.type _start, @function +_start: + movq und@GOTPCREL(%rip), %rax + movq und@GOTPCREL(%rip), %rax + movq dsofoo@GOTPCREL(%rip), %rax + movq dsofoo@GOTPCREL(%rip), %rax + movq hid@GOTPCREL(%rip), %rax + movq hid@GOTPCREL(%rip), %rax + movq foo@GOTPCREL(%rip), %rax + movq foo@GOTPCREL(%rip), %rax + movq und@GOTPCREL(%rip), %rax + movq und@GOTPCREL(%rip), %rax + movq dsofoo@GOTPCREL(%rip), %rax + movq dsofoo@GOTPCREL(%rip), %rax + movq hid@GOTPCREL(%rip), %rax + movq hid@GOTPCREL(%rip), %rax + movq foo@GOTPCREL(%rip), %rax + movq foo@GOTPCREL(%rip), %rax diff --git a/test/ELF/gotpc-relax.s b/test/ELF/gotpc-relax.s new file mode 100644 index 000000000000..422e10439d00 --- /dev/null +++ b/test/ELF/gotpc-relax.s @@ -0,0 +1,98 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -relax-relocations -triple=x86_64-unknown-linux %s -o %t.o +# RUN: ld.lld %t.o -o %t1 +# RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=RELOC %s +# RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASM %s + +## There is no relocations. +# RELOC: Relocations [ +# RELOC: ] + +# 0x11003 + 7 - 10 = 0x11000 +# 0x1100a + 7 - 17 = 0x11000 +# 0x11011 + 7 - 23 = 0x11001 +# 0x11018 + 7 - 30 = 0x11001 +# DISASM: Disassembly of section .text: +# DISASM-NEXT: foo: +# DISASM-NEXT: 11000: 90 nop +# DISASM: hid: +# DISASM-NEXT: 11001: 90 nop +# DISASM: ifunc: +# DISASM-NEXT: 11002: c3 retq +# DISASM: _start: +# DISASM-NEXT: leaq -10(%rip), %rax +# DISASM-NEXT: leaq -17(%rip), %rax +# DISASM-NEXT: leaq -23(%rip), %rax +# DISASM-NEXT: leaq -30(%rip), %rax +# DISASM-NEXT: movq 4058(%rip), %rax +# DISASM-NEXT: movq 4051(%rip), %rax +# DISASM-NEXT: leaq -52(%rip), %rax +# DISASM-NEXT: leaq -59(%rip), %rax +# DISASM-NEXT: leaq -65(%rip), %rax +# DISASM-NEXT: leaq -72(%rip), %rax +# DISASM-NEXT: movq 4016(%rip), %rax +# DISASM-NEXT: movq 4009(%rip), %rax +# DISASM-NEXT: callq -93 +# DISASM-NEXT: callq -99 +# DISASM-NEXT: callq -104 +# DISASM-NEXT: callq -110 +# DISASM-NEXT: callq *3979(%rip) +# DISASM-NEXT: callq *3973(%rip) +# DISASM-NEXT: jmp -128 +# DISASM-NEXT: nop +# DISASM-NEXT: jmp -134 +# DISASM-NEXT: nop +# DISASM-NEXT: jmp -139 +# DISASM-NEXT: nop +# DISASM-NEXT: jmp -145 +# DISASM-NEXT: nop +# DISASM-NEXT: jmpq *3943(%rip) +# DISASM-NEXT: jmpq *3937(%rip) + +.text +.globl foo +.type foo, @function +foo: + nop + +.globl hid +.hidden hid +.type hid, @function +hid: + nop + +.text +.type ifunc STT_GNU_IFUNC +.globl ifunc +.type ifunc, @function +ifunc: + ret + +.globl _start +.type _start, @function +_start: + movq foo@GOTPCREL(%rip), %rax + movq foo@GOTPCREL(%rip), %rax + movq hid@GOTPCREL(%rip), %rax + movq hid@GOTPCREL(%rip), %rax + movq ifunc@GOTPCREL(%rip), %rax + movq ifunc@GOTPCREL(%rip), %rax + movq foo@GOTPCREL(%rip), %rax + movq foo@GOTPCREL(%rip), %rax + movq hid@GOTPCREL(%rip), %rax + movq hid@GOTPCREL(%rip), %rax + movq ifunc@GOTPCREL(%rip), %rax + movq ifunc@GOTPCREL(%rip), %rax + + call *foo@GOTPCREL(%rip) + call *foo@GOTPCREL(%rip) + call *hid@GOTPCREL(%rip) + call *hid@GOTPCREL(%rip) + call *ifunc@GOTPCREL(%rip) + call *ifunc@GOTPCREL(%rip) + jmp *foo@GOTPCREL(%rip) + jmp *foo@GOTPCREL(%rip) + jmp *hid@GOTPCREL(%rip) + jmp *hid@GOTPCREL(%rip) + jmp *ifunc@GOTPCREL(%rip) + jmp *ifunc@GOTPCREL(%rip) diff --git a/test/ELF/gotpcrelx.s b/test/ELF/gotpcrelx.s new file mode 100644 index 000000000000..95dbf663ffe8 --- /dev/null +++ b/test/ELF/gotpcrelx.s @@ -0,0 +1,30 @@ +// RUN: llvm-mc -filetype=obj -relax-relocations -triple x86_64-pc-linux-gnu \ +// RUN: %s -o %t.o +// RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=RELS %s +// RUN: ld.lld %t.o -o %t.so -shared +// RUN: llvm-readobj -s -r %t.so | FileCheck %s + +movq foo@GOTPCREL(%rip), %rax +movq bar@GOTPCREL(%rip), %rax + +// RELS: Relocations [ +// RELS-NEXT: Section ({{.*}}) .rela.text { +// RELS-NEXT: R_X86_64_REX_GOTPCRELX foo 0xFFFFFFFFFFFFFFFC +// RELS-NEXT: R_X86_64_REX_GOTPCRELX bar 0xFFFFFFFFFFFFFFFC +// RELS-NEXT: } +// RELS-NEXT: ] + +// CHECK: Name: .got +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x2090 + +// CHECK: Relocations [ +// CHECK-NEXT: Section ({{.*}}) .rela.dyn { +// CHECK-NEXT: 0x2098 R_X86_64_GLOB_DAT bar 0x0 +// CHECK-NEXT: 0x2090 R_X86_64_GLOB_DAT foo 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: ] diff --git a/test/ELF/i386-got-and-copy.s b/test/ELF/i386-got-and-copy.s new file mode 100644 index 000000000000..f5b0b8ec5bb8 --- /dev/null +++ b/test/ELF/i386-got-and-copy.s @@ -0,0 +1,25 @@ +# REQUIRES: x86 + +# If there are two relocations such that the first one requires +# dynamic COPY relocation, the second one requires GOT entry +# creation, linker should create both - dynamic relocation +# and GOT entry. + +# RUN: llvm-mc -filetype=obj -triple=i386-pc-linux \ +# RUN: %S/Inputs/copy-in-shared.s -o %t.so.o +# RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %s -o %t.o +# RUN: ld.lld %t.so.o -shared -o %t.so +# RUN: ld.lld %t.o %t.so -o %t.exe +# RUN: llvm-readobj -r %t.exe | FileCheck %s + +# CHECK: Relocations [ +# CHECK-NEXT: Section (4) .rel.dyn { +# CHECK-NEXT: 0x{{[0-9A-F]+}} R_386_COPY foo +# CHECK-NEXT: } +# CHECK-NEXT: ] + + .text + .global _start +_start: + movl $foo, (%esp) # R_386_32 - requires R_386_COPY relocation + movl foo@GOT, %eax # R_386_GOT32 - requires GOT entry diff --git a/test/ELF/i386-gotpc.s b/test/ELF/i386-gotpc.s new file mode 100644 index 000000000000..14c2fcbec064 --- /dev/null +++ b/test/ELF/i386-gotpc.s @@ -0,0 +1,20 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o +// RUN: ld.lld %t.o -o %t.so -shared +// RUN: llvm-readobj -s %t.so | FileCheck %s +// RUN: llvm-objdump -d %t.so | FileCheck --check-prefix=DISASM %s + +movl $_GLOBAL_OFFSET_TABLE_, %eax + +// CHECK: Name: .got (38) +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x2030 + +// DISASM: Disassembly of section .text: +// DISASM-NEXT: .text: +// DISASM-NEXT: 1000: {{.*}} movl $4144, %eax +// 0x2030 - 0x1000 = 4144 diff --git a/test/ELF/i386-merge.s b/test/ELF/i386-merge.s new file mode 100644 index 000000000000..5d48d4d07f08 --- /dev/null +++ b/test/ELF/i386-merge.s @@ -0,0 +1,50 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %s -o %t.o +// RUN: ld.lld %t.o -o %t -shared +// RUN: llvm-readobj -s -section-data %t | FileCheck %s + +// CHECK: Name: .mysec +// CHECK-NEXT: Type: +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_MERGE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x114 +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: +// CHECK-NEXT: Link: +// CHECK-NEXT: Info: +// CHECK-NEXT: AddressAlignment: +// CHECK-NEXT: EntrySize: +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 42000000 | +// CHECK-NEXT: ) + + +// CHECK: Name: .data +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x2000 +// CHECK-NEXT: Offset: 0x2000 +// CHECK-NEXT: Size: 4 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 1 +// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 14010000 | +// CHECK-NEXT: ) + +// The content of .data should be the address of .mysec. 14010000 is 0x114 in +// little endian. + + .data + .long .mysec+4 + + .section .mysec,"aM",@progbits,4 + .align 4 + .long 0x42 + .long 0x42 diff --git a/test/ELF/i386-relative.s b/test/ELF/i386-relative.s new file mode 100644 index 000000000000..d814b5b6786a --- /dev/null +++ b/test/ELF/i386-relative.s @@ -0,0 +1,14 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %s -o %t.o +// RUN: ld.lld -shared %t.o -o %t.so +// RUN: llvm-readobj -r %t.so | FileCheck %s + +// CHECK: Relocations [ +// CHECK-NEXT: Section ({{.*}}) .rel.dyn { +// CHECK-NEXT: R_386_RELATIVE - 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: ] + + .data +foo: + .long foo diff --git a/test/ELF/i386-relax-reloc.s b/test/ELF/i386-relax-reloc.s new file mode 100644 index 000000000000..a7fdc404ceca --- /dev/null +++ b/test/ELF/i386-relax-reloc.s @@ -0,0 +1,12 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o -relax-relocations +// RUN: ld.lld -shared %t.o -o %t.so +// RUN: llvm-objdump -d %t.so | FileCheck %s + +foo: + movl bar@GOT(%ebx), %eax + movl bar+8@GOT(%ebx), %eax + +// CHECK: foo: +// CHECK-NEXT: movl -4(%ebx), %eax +// CHECK-NEXT: movl 4(%ebx), %eax diff --git a/test/ELF/i386-tls-ie-shared.s b/test/ELF/i386-tls-ie-shared.s new file mode 100644 index 000000000000..a2c25e2d2f81 --- /dev/null +++ b/test/ELF/i386-tls-ie-shared.s @@ -0,0 +1,110 @@ +// RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o +// RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %p/Inputs/tls-opt-iele-i686-nopic.s -o %tso.o +// RUN: ld.lld -shared %tso.o -o %tso +// RUN: ld.lld -shared %t.o %tso -o %t1 +// RUN: llvm-readobj -s -r %t1 | FileCheck --check-prefix=GOTRELSHARED %s +// RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASMSHARED %s + +// GOTRELSHARED: Section { +// GOTRELSHARED: Index: 8 +// GOTRELSHARED: Name: .got +// GOTRELSHARED-NEXT: Type: SHT_PROGBITS +// GOTRELSHARED-NEXT: Flags [ +// GOTRELSHARED-NEXT: SHF_ALLOC +// GOTRELSHARED-NEXT: SHF_WRITE +// GOTRELSHARED-NEXT: ] +// GOTRELSHARED-NEXT: Address: 0x1050 +// GOTRELSHARED-NEXT: Offset: 0x1050 +// GOTRELSHARED-NEXT: Size: 16 +// GOTRELSHARED-NEXT: Link: 0 +// GOTRELSHARED-NEXT: Info: 0 +// GOTRELSHARED-NEXT: AddressAlignment: 4 +// GOTRELSHARED-NEXT: EntrySize: 0 +// GOTRELSHARED-NEXT: } +// GOTRELSHARED: Relocations [ +// GOTRELSHARED-NEXT: Section ({{.*}}) .rel.dyn { +// GOTRELSHARED-NEXT: 0x2002 R_386_RELATIVE - 0x0 +// GOTRELSHARED-NEXT: 0x200A R_386_RELATIVE - 0x0 +// GOTRELSHARED-NEXT: 0x2013 R_386_RELATIVE - 0x0 +// GOTRELSHARED-NEXT: 0x201C R_386_RELATIVE - 0x0 +// GOTRELSHARED-NEXT: 0x2024 R_386_RELATIVE - 0x0 +// GOTRELSHARED-NEXT: 0x202D R_386_RELATIVE - 0x0 +// GOTRELSHARED-NEXT: 0x2036 R_386_RELATIVE - 0x0 +// GOTRELSHARED-NEXT: 0x203F R_386_RELATIVE - 0x0 +// GOTRELSHARED-NEXT: 0x1050 R_386_TLS_TPOFF tlslocal0 0x0 +// GOTRELSHARED-NEXT: 0x1054 R_386_TLS_TPOFF tlslocal1 0x0 +// GOTRELSHARED-NEXT: 0x1058 R_386_TLS_TPOFF tlsshared0 0x0 +// GOTRELSHARED-NEXT: 0x105C R_386_TLS_TPOFF tlsshared1 0x0 +// GOTRELSHARED-NEXT: } +// GOTRELSHARED-NEXT: ] + +// DISASMSHARED: Disassembly of section test: +// DISASMSHARED-NEXT: _start: +// (.got)[0] = 0x2050 = 8272 +// (.got)[1] = 0x2054 = 8276 +// (.got)[2] = 0x2058 = 8280 +// (.got)[3] = 0x205C = 8284 +// DISASMSHARED-NEXT: 2000: 8b 0d 50 10 00 00 movl 4176, %ecx +// DISASMSHARED-NEXT: 2006: 65 8b 01 movl %gs:(%ecx), %eax +// DISASMSHARED-NEXT: 2009: a1 50 10 00 00 movl 4176, %eax +// DISASMSHARED-NEXT: 200e: 65 8b 00 movl %gs:(%eax), %eax +// DISASMSHARED-NEXT: 2011: 03 0d 50 10 00 00 addl 4176, %ecx +// DISASMSHARED-NEXT: 2017: 65 8b 01 movl %gs:(%ecx), %eax +// DISASMSHARED-NEXT: 201a: 8b 0d 54 10 00 00 movl 4180, %ecx +// DISASMSHARED-NEXT: 2020: 65 8b 01 movl %gs:(%ecx), %eax +// DISASMSHARED-NEXT: 2023: a1 54 10 00 00 movl 4180, %eax +// DISASMSHARED-NEXT: 2028: 65 8b 00 movl %gs:(%eax), %eax +// DISASMSHARED-NEXT: 202b: 03 0d 54 10 00 00 addl 4180, %ecx +// DISASMSHARED-NEXT: 2031: 65 8b 01 movl %gs:(%ecx), %eax +// DISASMSHARED-NEXT: 2034: 8b 0d 58 10 00 00 movl 4184, %ecx +// DISASMSHARED-NEXT: 203a: 65 8b 01 movl %gs:(%ecx), %eax +// DISASMSHARED-NEXT: 203d: 03 0d 5c 10 00 00 addl 4188, %ecx +// DISASMSHARED-NEXT: 2043: 65 8b 01 movl %gs:(%ecx), %eax + +.type tlslocal0,@object +.section .tbss,"awT",@nobits +.globl tlslocal0 +.align 4 +tlslocal0: + .long 0 + .size tlslocal0, 4 + +.type tlslocal1,@object +.section .tbss,"awT",@nobits +.globl tlslocal1 +.align 4 +tlslocal1: + .long 0 + .size tlslocal1, 4 + +.section .text +.globl ___tls_get_addr +.type ___tls_get_addr,@function +___tls_get_addr: + +.section test, "axw" +.globl _start +_start: +movl tlslocal0@indntpoff,%ecx +movl %gs:(%ecx),%eax + +movl tlslocal0@indntpoff,%eax +movl %gs:(%eax),%eax + +addl tlslocal0@indntpoff,%ecx +movl %gs:(%ecx),%eax + +movl tlslocal1@indntpoff,%ecx +movl %gs:(%ecx),%eax + +movl tlslocal1@indntpoff,%eax +movl %gs:(%eax),%eax + +addl tlslocal1@indntpoff,%ecx +movl %gs:(%ecx),%eax + +movl tlsshared0@indntpoff,%ecx +movl %gs:(%ecx),%eax + +addl tlsshared1@indntpoff,%ecx +movl %gs:(%ecx),%eax diff --git a/test/ELF/icf1.s b/test/ELF/icf1.s new file mode 100644 index 000000000000..bb060078476e --- /dev/null +++ b/test/ELF/icf1.s @@ -0,0 +1,23 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: ld.lld %t -o %t2 --icf=all --verbose | FileCheck %s + +# CHECK: selected .text.f1 +# CHECK: removed .text.f2 + +.globl _start, f1, f2 +_start: + ret + +.section .text.f1, "ax" +f1: + mov $60, %rax + mov $42, %rdi + syscall + +.section .text.f2, "ax" +f2: + mov $60, %rax + mov $42, %rdi + syscall diff --git a/test/ELF/icf2.s b/test/ELF/icf2.s new file mode 100644 index 000000000000..be595112b7e7 --- /dev/null +++ b/test/ELF/icf2.s @@ -0,0 +1,17 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/icf2.s -o %t2 +# RUN: ld.lld %t1 %t2 -o %t --icf=all --verbose | FileCheck %s + +# CHECK: selected .text.f1 +# CHECK: removed .text.f2 + +.globl _start, f1, f2 +_start: + ret + +.section .text.f1, "ax" +f1: + mov $60, %rdi + call f2 diff --git a/test/ELF/icf3.s b/test/ELF/icf3.s new file mode 100644 index 000000000000..9f39ff6c7477 --- /dev/null +++ b/test/ELF/icf3.s @@ -0,0 +1,19 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/icf2.s -o %t2 +# RUN: ld.lld %t1 %t2 -o %t --icf=all --verbose | FileCheck %s + +# CHECK-NOT: Selected .text.f1 +# CHECK-NOT: Selected .text.f2 + +.globl _start, f1, f2 +_start: + ret + +# This section is not mergeable because the content is different from f2. +.section .text.f1, "ax" +f1: + mov $60, %rdi + call f2 + mov $0, %rax diff --git a/test/ELF/icf4.s b/test/ELF/icf4.s new file mode 100644 index 000000000000..ad16d48775d6 --- /dev/null +++ b/test/ELF/icf4.s @@ -0,0 +1,19 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: ld.lld %t -o %t --icf=all --verbose | FileCheck %s + +# CHECK-NOT: Selected .text.f1 +# CHECK-NOT: Selected .text.f2 + +.globl _start, f1, f2 +_start: + ret + +.section .text.f1, "ax" +f1: + mov $1, %rax + +.section .text.f2, "ax" +f2: + mov $0, %rax diff --git a/test/ELF/icf5.s b/test/ELF/icf5.s new file mode 100644 index 000000000000..cf466585c581 --- /dev/null +++ b/test/ELF/icf5.s @@ -0,0 +1,19 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: ld.lld %t -o %t --icf=all --verbose | FileCheck %s + +# CHECK-NOT: Selected .text.f1 +# CHECK-NOT: Selected .text.f2 + +.globl _start, f1, f2 +_start: + ret + +.section .text.f1, "ax" +f1: + mov $0, %rax + +.section .text.f2, "awx" +f2: + mov $0, %rax diff --git a/test/ELF/icf6.s b/test/ELF/icf6.s new file mode 100644 index 000000000000..ecb62fee2a0c --- /dev/null +++ b/test/ELF/icf6.s @@ -0,0 +1,23 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: ld.lld %t -o %t2 --icf=all --verbose | FileCheck %s + +# CHECK-NOT: Selected .text.f1 +# CHECK-NOT: Selected .text.f2 + +.globl _start, f1, f2 +_start: + ret + +.section .init, "ax" +f1: + mov $60, %rax + mov $42, %rdi + syscall + +.section .fini, "ax" +f2: + mov $60, %rax + mov $42, %rdi + syscall diff --git a/test/ELF/icf7.s b/test/ELF/icf7.s new file mode 100644 index 000000000000..f1fca5b2f2d5 --- /dev/null +++ b/test/ELF/icf7.s @@ -0,0 +1,29 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: ld.lld %t -o %t2 --icf=all --verbose | FileCheck %s +# RUN: llvm-objdump -t %t2 | FileCheck -check-prefix=ALIGN %s + +# CHECK: selected .text.f1 +# CHECK: removed .text.f2 + +# ALIGN: 0000000000011000 .text 00000000 _start +# ALIGN: 0000000000011100 .text 00000000 f1 + +.globl _start, f1, f2 +_start: + ret + +.section .text.f1, "ax" + .align 1 +f1: + mov $60, %rax + mov $42, %rdi + syscall + +.section .text.f2, "ax" + .align 256 +f2: + mov $60, %rax + mov $42, %rdi + syscall diff --git a/test/ELF/image-base.s b/test/ELF/image-base.s new file mode 100644 index 000000000000..0be5059dcad8 --- /dev/null +++ b/test/ELF/image-base.s @@ -0,0 +1,60 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: ld.lld -image-base=0x1000000 %t -o %t1 +# RUN: llvm-readobj -program-headers %t1 | FileCheck %s + +.global _start +_start: + nop + +# CHECK: ProgramHeaders [ +# CHECK-NEXT: ProgramHeader { +# CHECK-NEXT: Type: PT_PHDR (0x6) +# CHECK-NEXT: Offset: 0x40 +# CHECK-NEXT: VirtualAddress: 0x1000040 +# CHECK-NEXT: PhysicalAddress: 0x1000040 +# CHECK-NEXT: FileSize: 224 +# CHECK-NEXT: MemSize: 224 +# CHECK-NEXT: Flags [ (0x4) +# CHECK-NEXT: PF_R (0x4) +# CHECK-NEXT: ] +# CHECK-NEXT: Alignment: 8 +# CHECK-NEXT: } +# CHECK-NEXT: ProgramHeader { +# CHECK-NEXT: Type: PT_LOAD (0x1) +# CHECK-NEXT: Offset: 0x0 +# CHECK-NEXT: VirtualAddress: 0x1000000 +# CHECK-NEXT: PhysicalAddress: 0x1000000 +# CHECK-NEXT: FileSize: 288 +# CHECK-NEXT: MemSize: 288 +# CHECK-NEXT: Flags [ (0x4) +# CHECK-NEXT: PF_R (0x4) +# CHECK-NEXT: ] +# CHECK-NEXT: Alignment: 4096 +# CHECK-NEXT: } +# CHECK-NEXT: ProgramHeader { +# CHECK-NEXT: Type: PT_LOAD (0x1) +# CHECK-NEXT: Offset: 0x1000 +# CHECK-NEXT: VirtualAddress: 0x1001000 +# CHECK-NEXT: PhysicalAddress: 0x1001000 +# CHECK-NEXT: FileSize: 1 +# CHECK-NEXT: MemSize: 1 +# CHECK-NEXT: Flags [ (0x5) +# CHECK-NEXT: PF_R (0x4) +# CHECK-NEXT: PF_X (0x1) +# CHECK-NEXT: ] +# CHECK-NEXT: Alignment: 4096 +# CHECK-NEXT: } +# CHECK-NEXT: ProgramHeader { +# CHECK-NEXT: Type: PT_GNU_STACK (0x6474E551) +# CHECK-NEXT: Offset: 0x0 +# CHECK-NEXT: VirtualAddress: 0x0 +# CHECK-NEXT: PhysicalAddress: 0x0 +# CHECK-NEXT: FileSize: 0 +# CHECK-NEXT: MemSize: 0 +# CHECK-NEXT: Flags [ (0x6) +# CHECK-NEXT: PF_R (0x4) +# CHECK-NEXT: PF_W (0x2) +# CHECK-NEXT: ] +# CHECK-NEXT: Alignment: 0 +# CHECK-NEXT: } diff --git a/test/ELF/incompatible.s b/test/ELF/incompatible.s index 1696d83de7ac..82055b7a104a 100644 --- a/test/ELF/incompatible.s +++ b/test/ELF/incompatible.s @@ -53,6 +53,7 @@ // ARCHIVE: a.o is incompatible with {{.*}}b.o .global _start _start: +.data .long foo // REQUIRES: x86,aarch64 diff --git a/test/ELF/init-fini.s b/test/ELF/init-fini.s index d2b24088d1e1..400679066636 100644 --- a/test/ELF/init-fini.s +++ b/test/ELF/init-fini.s @@ -35,7 +35,7 @@ // NOENTRY-NOT: FINI // NOENTRY: ] -.global _start,_init,_fini,_foo,_bar,_undef; +.global _start,_init,_fini,_foo,_bar,_undef _start: _init = 0x11010 _fini = 0x11020 diff --git a/test/ELF/init_fini_priority.s b/test/ELF/init_fini_priority.s new file mode 100644 index 000000000000..84e5dc35e9d2 --- /dev/null +++ b/test/ELF/init_fini_priority.s @@ -0,0 +1,37 @@ +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +// RUN: ld.lld %t -o %t.exe +// RUN: llvm-objdump -s %t.exe | FileCheck %s +// REQUIRES: x86 + +.globl _start +_start: + nop + +.section .init_array, "aw", @init_array + .align 8 + .byte 1 +.section .init_array.100, "aw", @init_array + .long 2 +.section .init_array.5, "aw", @init_array + .byte 3 +.section .init_array, "aw", @init_array + .byte 4 +.section .init_array, "aw", @init_array + .byte 5 + +.section .fini_array, "aw", @fini_array + .align 8 + .byte 0x11 +.section .fini_array.100, "aw", @fini_array + .long 0x12 +.section .fini_array.5, "aw", @fini_array + .byte 0x13 +.section .fini_array, "aw", @fini_array + .byte 0x14 +.section .fini_array, "aw", @fini_array + .byte 0x15 + +// CHECK: Contents of section .init_array: +// CHECK-NEXT: 03020000 00000000 010405 +// CHECK: Contents of section .fini_array: +// CHECK-NEXT: 13120000 00000000 111415 diff --git a/test/ELF/invalid-cie-length.s b/test/ELF/invalid-cie-length.s index 36d1e03fb567..e9ad3ca8ba82 100644 --- a/test/ELF/invalid-cie-length.s +++ b/test/ELF/invalid-cie-length.s @@ -6,4 +6,4 @@ .section .eh_frame .byte 0 -// CHECK: Truncated CIE/FDE length +// CHECK: CIE/FDE too small diff --git a/test/ELF/invalid-cie-length3.s b/test/ELF/invalid-cie-length3.s index 8f3ab1cf29d0..665fc80a24b4 100644 --- a/test/ELF/invalid-cie-length3.s +++ b/test/ELF/invalid-cie-length3.s @@ -6,4 +6,4 @@ .section .eh_frame .long 0xFFFFFFFC -// CHECK: CIE/FIE size is too large +// CHECK: CIE/FIE ends past the end of the section diff --git a/test/ELF/invalid-cie-length4.s b/test/ELF/invalid-cie-length4.s index 4a51ca1f812d..daa20d196811 100644 --- a/test/ELF/invalid-cie-length4.s +++ b/test/ELF/invalid-cie-length4.s @@ -7,4 +7,4 @@ .long 0xFFFFFFFF .byte 0 -// CHECK: Truncated CIE/FDE length +// CHECK: CIE/FDE too large diff --git a/test/ELF/invalid-cie-length5.s b/test/ELF/invalid-cie-length5.s index 14054a2dee84..bfa35edf7db5 100644 --- a/test/ELF/invalid-cie-length5.s +++ b/test/ELF/invalid-cie-length5.s @@ -7,4 +7,4 @@ .long 0xFFFFFFFF .quad 0xFFFFFFFFFFFFFFF4 -// CHECK: CIE/FIE size is too large +// CHECK: CIE/FDE too large diff --git a/test/ELF/invalid-cie-reference.s b/test/ELF/invalid-cie-reference.s index 1b099d19b7e1..fba2467e216a 100644 --- a/test/ELF/invalid-cie-reference.s +++ b/test/ELF/invalid-cie-reference.s @@ -29,4 +29,4 @@ .long 0x0 .long 0x0 -// CHECK: Invalid CIE reference +// CHECK: invalid CIE reference diff --git a/test/ELF/invalid-dynamic-list.test b/test/ELF/invalid-dynamic-list.test new file mode 100644 index 000000000000..0e7c820f563e --- /dev/null +++ b/test/ELF/invalid-dynamic-list.test @@ -0,0 +1,37 @@ +## Different "echo" commands on Windows interpret quoted strings and +## wildcards in similar but different way (On Windows, ARGV tokenization +## and wildcard expansion are not done by the shell but by each command.) +## Because of that reason, this test fails on some Windows environment. +## We can't write quoted strings that are interpreted the same way +## by all echo commands. So, we don't want to run this on Windows. + +# REQUIRES: shell + +# RUN: mkdir -p %t.dir + +# RUN: echo foobar > %t1 +# RUN: not ld.lld --dynamic-list %t1 2>&1 | FileCheck -check-prefix=ERR1 %s +# ERR1: line 1: { expected, but got foobar + +# RUN: echo "{ foobar;" > %t1 +# RUN: not ld.lld --dynamic-list %t1 2>&1 | FileCheck -check-prefix=ERR2 %s +# ERR2: line 1: unexpected EOF + +## Missing ';' before '}' +# RUN: echo "{ foobar }" > %t1 +# RUN: not ld.lld --dynamic-list %t1 2>&1 | FileCheck -check-prefix=ERR3 %s +# ERR3: line 1: ; expected, but got } + +## Missing final ';' +# RUN: echo "{ foobar; }" > %t1 +# RUN: not ld.lld --dynamic-list %t1 2>&1 | FileCheck -check-prefix=ERR4 %s +# ERR4: line 1: unexpected EOF + +## Missing \" in foobar definition +# RUN echo "{ \"foobar; };" > %t1 +# RUN: not ld.lld --dynamic-list %t1 2>&1 | FileCheck -check-prefix=ERR5 %s +# ERR5: line 1: unexpected EOF + +# RUN: echo "{ extern \"BOGUS\" { test }; };" > %t1 +# RUN: not ld.lld --dynamic-list %t1 2>&1 | FileCheck -check-prefix=ERR6 %s +# ERR6: line 1: ; expected, but got BOGUS diff --git a/test/ELF/invalid-elf.test b/test/ELF/invalid-elf.test index 05e95cab0d27..c3a97d37ffa9 100644 --- a/test/ELF/invalid-elf.test +++ b/test/ELF/invalid-elf.test @@ -2,26 +2,27 @@ # RUN: not ld.lld %t %p/Inputs/invalid-data-encoding.a -o %t2 2>&1 | \ # RUN: FileCheck --check-prefix=INVALID-DATA-ENC %s -# INVALID-DATA-ENC: Invalid data encoding: test.o +# INVALID-DATA-ENC: invalid data encoding: test.o # RUN: not ld.lld %t %p/Inputs/invalid-file-class.a -o %t2 2>&1 | \ # RUN: FileCheck --check-prefix=INVALID-FILE-CLASS %s -# INVALID-FILE-CLASS: Invalid file class: test.o +# INVALID-FILE-CLASS: invalid file class: test.o # RUN: not ld.lld %p/Inputs/invalid-symtab-sh_info.elf -o %t2 2>&1 | \ # RUN: FileCheck --check-prefix=INVALID-SYMTAB-SHINFO %s -# INVALID-SYMTAB-SHINFO: Invalid sh_info in symbol table +# INVALID-SYMTAB-SHINFO: invalid sh_info in symbol table # RUN: not ld.lld %p/Inputs/invalid-binding.elf -o %t2 2>&1 | \ # RUN: FileCheck --check-prefix=INVALID-BINDING %s # INVALID-BINDING: unexpected binding # RUN: not ld.lld %p/Inputs/invalid-section-index.elf -o %t2 2>&1 | \ -# RUN: FileCheck --check-prefix=INVALID-SECTION-INDEX %s -# INVALID-SECTION-INDEX: Invalid section index +# RUN: FileCheck --check-prefix=INVALID-SECTION-INDEX-LLD %s +# INVALID-SECTION-INDEX-LLD: invalid section index # RUN: not ld.lld %p/Inputs/invalid-shstrndx.so -o %t2 2>&1 | \ # RUN: FileCheck --check-prefix=INVALID-SECTION-INDEX %s +# INVALID-SECTION-INDEX: Invalid section index # RUN: not ld.lld %p/Inputs/invalid-shentsize-zero.elf -o %t2 2>&1 | \ # RUN: FileCheck --check-prefix=INVALID-SHENTSIZE-ZERO %s @@ -29,6 +30,6 @@ # RUN: not ld.lld %p/Inputs/invalid-multiple-eh-relocs.elf -o %t2 2>&1 | \ # RUN: FileCheck --check-prefix=INVALID-EH-RELOCS %s -# INVALID-EH-RELOCS: Multiple relocation sections to .eh_frame are not supported +# INVALID-EH-RELOCS: multiple relocation sections to .eh_frame are not supported .long foo diff --git a/test/ELF/invalid-linkerscript.test b/test/ELF/invalid-linkerscript.test new file mode 100644 index 000000000000..e0881662b962 --- /dev/null +++ b/test/ELF/invalid-linkerscript.test @@ -0,0 +1,54 @@ +## Different "echo" commands on Windows interpret quoted strings and +## wildcards in similar but different way (On Windows, ARGV tokenization +## and wildcard expansion are not done by the shell but by each command.) +## Because of that reason, this test fails on some Windows environment. +## We can't write quoted strings that are interpreted the same way +## by all echo commands. So, we don't want to run this on Windows. + +# REQUIRES: shell + +# RUN: mkdir -p %t.dir + +## Note that we are using "cannot open no-such-file: " as a marker that the +## linker keep going when it found an error. That specific error message is not +## related to the linker script tests. + +# RUN: echo foobar > %t1 +# RUN: not ld.lld %t1 no-such-file 2>&1 | FileCheck -check-prefix=ERR1 %s +# ERR1: unknown directive: foobar +# ERR1: cannot open no-such-file: + +# RUN: echo "foo \"bar" > %t2 +# RUN: not ld.lld %t2 no-such-file 2>&1 | FileCheck -check-prefix=ERR2 %s +# ERR2: unclosed quote +# ERR2: cannot open no-such-file: + +# RUN: echo "/*" > %t3 +# RUN: not ld.lld %t3 no-such-file 2>&1 | FileCheck -check-prefix=ERR3 %s +# ERR3: unclosed comment +# ERR3: cannot open no-such-file: + +# RUN: echo "EXTERN (" > %t4 +# RUN: not ld.lld %t4 no-such-file 2>&1 | FileCheck -check-prefix=ERR4 %s +# ERR4: unexpected EOF +# ERR4: cannot open no-such-file: + +# RUN: echo "EXTERN (" > %t5 +# RUN: not ld.lld %t5 no-such-file 2>&1 | FileCheck -check-prefix=ERR5 %s +# ERR5: unexpected EOF +# ERR5: cannot open no-such-file: + +# RUN: echo "EXTERN xyz" > %t6 +# RUN: not ld.lld %t6 no-such-file 2>&1 | FileCheck -check-prefix=ERR6 %s +# ERR6: ( expected, but got xyz +# ERR6: cannot open no-such-file: + +# RUN: echo "INCLUDE /no/such/file" > %t7 +# RUN: not ld.lld %t7 no-such-file 2>&1 | FileCheck -check-prefix=ERR7 %s +# ERR7: cannot open /no/such/file +# ERR7: cannot open no-such-file: + +# RUN: echo "OUTPUT_FORMAT(x y z)" > %t8 +# RUN: not ld.lld %t8 no-such-file 2>&1 | FileCheck -check-prefix=ERR8 %s +# ERR8: unexpected token: y +# ERR8: cannot open no-such-file: diff --git a/test/ELF/invalid-relocations.test b/test/ELF/invalid-relocations.test index 2b4a6c4a4210..cfeb44b03c67 100644 --- a/test/ELF/invalid-relocations.test +++ b/test/ELF/invalid-relocations.test @@ -1,6 +1,7 @@ -# RUN: yaml2obj -format elf %s -o %t +# RUN: yaml2obj %s -o %t # RUN: not ld.lld %t -o %tout 2>&1 | FileCheck %s +!ELF FileHeader: Class: ELFCLASS64 Data: ELFDATA2LSB @@ -19,4 +20,4 @@ Symbols: Global: - Name: lulz -# CHECK: Invalid relocated section index +# CHECK: invalid relocated section index diff --git a/test/ELF/libsearch.s b/test/ELF/libsearch.s index c965b9ba91fc..782d755f7341 100644 --- a/test/ELF/libsearch.s +++ b/test/ELF/libsearch.s @@ -23,7 +23,7 @@ // Should fail if cannot find specified library (without -L switch) // RUN: not ld.lld -o %t3 %t.o -lls 2>&1 \ // RUN: | FileCheck --check-prefix=NOLIB %s -// NOLIB: Unable to find library -lls +// NOLIB: unable to find library -lls // Should use explicitly specified static library // Also ensure that we accept -L @@ -44,6 +44,12 @@ // RUN: ld.lld -o %t3 %t.o -L%t.dir -lls // RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=DYNAMIC %s +// Check for library search order +// RUN: mkdir -p %t.dir2 +// RUN: cp %t.dir/libls.a %t.dir2 +// RUN: ld.lld -o %t3 %t.o -L%t.dir2 -L%t.dir -lls +// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=STATIC %s + // -L can be placed after -l // RUN: ld.lld -o %t3 %t.o -lls -L%t.dir @@ -55,7 +61,7 @@ // RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=STATIC %s // RUN: not ld.lld -o %t3 %t.o -L%t.dir -Bstatic -lls2 2>&1 \ // RUN: | FileCheck --check-prefix=NOLIB2 %s -// NOLIB2: Unable to find library -lls2 +// NOLIB2: unable to find library -lls2 // -Bdynamic should restore default behaviour // RUN: ld.lld -o %t3 %t.o -L%t.dir -Bstatic -Bdynamic -lls @@ -79,5 +85,5 @@ // RUN: ld.lld -o %t3 %t.o -L%t.dir -Bstatic -call_shared -lls // RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=DYNAMIC %s -.globl _start,_bar; +.globl _start,_bar _start: diff --git a/test/ELF/linkerscript-align.s b/test/ELF/linkerscript-align.s new file mode 100644 index 000000000000..5f6e6f770766 --- /dev/null +++ b/test/ELF/linkerscript-align.s @@ -0,0 +1,41 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t + +# RUN: echo "SECTIONS { \ +# RUN: . = 0x10000; \ +# RUN: .aaa : \ +# RUN: { \ +# RUN: *(.aaa) \ +# RUN: } \ +# RUN: . = ALIGN(4096); \ +# RUN: .bbb : \ +# RUN: { \ +# RUN: *(.bbb) \ +# RUN: } \ +# RUN: . = ALIGN(4096 * 4); \ +# RUN: .ccc : \ +# RUN: { \ +# RUN: *(.ccc) \ +# RUN: } \ +# RUN: }" > %t.script +# RUN: ld.lld -o %t1 --script %t.script %t +# RUN: llvm-objdump -section-headers %t1 | FileCheck %s +# CHECK: Sections: +# CHECK-NEXT: Idx Name Size Address Type +# CHECK-NEXT: 0 00000000 0000000000000000 +# CHECK-NEXT: 1 .aaa 00000008 0000000000010000 DATA +# CHECK-NEXT: 2 .bbb 00000008 0000000000011000 DATA +# CHECK-NEXT: 3 .ccc 00000008 0000000000014000 DATA + +.global _start +_start: + nop + +.section .aaa, "a" +.quad 0 + +.section .bbb, "a" +.quad 0 + +.section .ccc, "a" +.quad 0 diff --git a/test/ELF/linkerscript-diagnostic.s b/test/ELF/linkerscript-diagnostic.s new file mode 100644 index 000000000000..f42cbe82cf38 --- /dev/null +++ b/test/ELF/linkerscript-diagnostic.s @@ -0,0 +1,66 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t + +## Take some valid script with multiline comments +## and check it actually works: +# RUN: echo "SECTIONS {" > %t.script +# RUN: echo ".text : { *(.text) }" >> %t.script +# RUN: echo ".keep : { *(.keep) } /*" >> %t.script +# RUN: echo "comment line 1" >> %t.script +# RUN: echo "comment line 2 */" >> %t.script +# RUN: echo ".temp : { *(.temp) } }" >> %t.script +# RUN: ld.lld -shared %t -o %t1 --script %t.script + +## Change ":" to "+" at line 2, check that error +## message starts from correct line number: +# RUN: echo "SECTIONS {" > %t.script +# RUN: echo ".text + { *(.text) }" >> %t.script +# RUN: echo ".keep : { *(.keep) } /*" >> %t.script +# RUN: echo "comment line 1" >> %t.script +# RUN: echo "comment line 2 */" >> %t.script +# RUN: echo ".temp : { *(.temp) } }" >> %t.script +# RUN: not ld.lld -shared %t -o %t1 --script %t.script 2>&1 | FileCheck -check-prefix=ERR1 %s +# ERR1: line 2: + +## Change ":" to "+" at line 3 now, check correct error line number: +# RUN: echo "SECTIONS {" > %t.script +# RUN: echo ".text : { *(.text) }" >> %t.script +# RUN: echo ".keep + { *(.keep) } /*" >> %t.script +# RUN: echo "comment line 1" >> %t.script +# RUN: echo "comment line 2 */" >> %t.script +# RUN: echo ".temp : { *(.temp) } }" >> %t.script +# RUN: not ld.lld -shared %t -o %t1 --script %t.script 2>&1 | FileCheck -check-prefix=ERR2 %s +# ERR2: line 3: + +## Change ":" to "+" at line 6, after multiline comment, +## check correct error line number: +# RUN: echo "SECTIONS {" > %t.script +# RUN: echo ".text : { *(.text) }" >> %t.script +# RUN: echo ".keep : { *(.keep) } /*" >> %t.script +# RUN: echo "comment line 1" >> %t.script +# RUN: echo "comment line 2 */" >> %t.script +# RUN: echo ".temp + { *(.temp) } }" >> %t.script +# RUN: not ld.lld -shared %t -o %t1 --script %t.script 2>&1 | FileCheck -check-prefix=ERR5 %s +# ERR5: line 6: + +## Check that text of lines and pointer to 'bad' token are working ok. +# RUN: echo "UNKNOWN_TAG {" > %t.script +# RUN: echo ".text : { *(.text) }" >> %t.script +# RUN: echo ".keep : { *(.keep) }" >> %t.script +# RUN: echo ".temp : { *(.temp) } }" >> %t.script +# RUN: not ld.lld -shared %t -o %t1 --script %t.script > %t.log 2>&1 +# RUN: FileCheck -check-prefix=ERR6 %s < %t.log +# ERR6: line 1: +# ERR6-NEXT: UNKNOWN_TAG { +# RUN: grep '^^' %t.log + +## One more check that text of lines and pointer to 'bad' token are working ok. +# RUN: echo "SECTIONS {" > %t.script +# RUN: echo ".text : { *(.text) }" >> %t.script +# RUN: echo ".keep : { *(.keep) }" >> %t.script +# RUN: echo "boom .temp : { *(.temp) } }" >> %t.script +# RUN: not ld.lld -shared %t -o %t1 --script %t.script > %t.log 2>&1 +# RUN: FileCheck -check-prefix=ERR7 %s < %t.log +# ERR7: line 4: : expected, but got .temp +# ERR7-NEXT: boom .temp : { *(.temp) } } +# RUN: grep '^ ^' %t.log diff --git a/test/ELF/linkerscript-locationcounter.s b/test/ELF/linkerscript-locationcounter.s new file mode 100644 index 000000000000..c6e8e7ef8ea8 --- /dev/null +++ b/test/ELF/linkerscript-locationcounter.s @@ -0,0 +1,340 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: echo "SECTIONS { \ +# RUN: . = 0xFFF0; \ +# RUN: . = . + 0x10; \ +# RUN: .plus : { *(.plus) } \ +# RUN: . = 0x11010 - 0x10; \ +# RUN: .minus : { *(.minus) } \ +# RUN: . = 0x24000 / 0x2; \ +# RUN: .div : { *(.div) } \ +# RUN: . = 0x11000 + 0x1000 * 0x2; \ +# RUN: .mul : { *(.mul) } \ +# RUN: . = 0x10000 + (0x1000 + 0x1000) * 0x2; \ +# RUN: .bracket : { *(.bracket) } \ +# RUN: . = 0x17000 & 0x15000; \ +# RUN: .and : { *(.and) } \ +# RUN: . = 0x1 ? 0x16000 : 0x999999; \ +# RUN: .ternary1 : { *(.ternary1) } \ +# RUN: . = 0x0 ? 0x999999 : 0x17000; \ +# RUN: .ternary2 : { *(.ternary2) } \ +# RUN: . = 0x0 < 0x1 ? 0x18000 : 0x999999; \ +# RUN: .less : { *(.less) } \ +# RUN: . = 0x1 <= 0x1 ? 0x19000 : 0x999999; \ +# RUN: .lesseq : { *(.lesseq) } \ +# RUN: . = 0x1 > 0x0 ? 0x20000 : 0x999999; \ +# RUN: .great : { *(.great) } \ +# RUN: . = 0x1 >= 0x1 ? 0x21000 : 0x999999; \ +# RUN: .greateq : { *(.greateq) } \ +# RUN: . = 0x1 == 0x1 ? 0x22000 : 0x999999; \ +# RUN: .eq : { *(.eq) } \ +# RUN: . = 0x2 != 0x1 ? 0x23000 : 0x999999; \ +# RUN: .neq : { *(.neq) } \ +# RUN: }" > %t.script +# RUN: ld.lld %t --script %t.script -o %t2 +# RUN: llvm-readobj -s %t2 | FileCheck %s + +# CHECK: Section { +# CHECK: Index: 1 +# CHECK: Name: .plus +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x10000 +# CHECK-NEXT: Offset: +# CHECK-NEXT: Size: +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: 2 +# CHECK-NEXT: Name: .minus +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x11000 +# CHECK-NEXT: Offset: +# CHECK-NEXT: Size: +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: 3 +# CHECK-NEXT: Name: .div +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x12000 +# CHECK-NEXT: Offset: +# CHECK-NEXT: Size: +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: 4 +# CHECK-NEXT: Name: .mul +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x13000 +# CHECK-NEXT: Offset: +# CHECK-NEXT: Size: +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: 5 +# CHECK-NEXT: Name: .bracket +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x14000 +# CHECK-NEXT: Offset: +# CHECK-NEXT: Size: +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: +# CHECK-NEXT: Name: .and +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x15000 +# CHECK-NEXT: Offset: +# CHECK-NEXT: Size: +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: +# CHECK-NEXT: Name: .ternary1 +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x16000 +# CHECK-NEXT: Offset: +# CHECK-NEXT: Size: +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: +# CHECK-NEXT: Name: .ternary2 +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x17000 +# CHECK-NEXT: Offset: +# CHECK-NEXT: Size: +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: +# CHECK-NEXT: Name: .less +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x18000 +# CHECK-NEXT: Offset: +# CHECK-NEXT: Size: +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: +# CHECK-NEXT: Name: .lesseq +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x19000 +# CHECK-NEXT: Offset: +# CHECK-NEXT: Size: +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: +# CHECK-NEXT: Name: .great +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x20000 +# CHECK-NEXT: Offset: +# CHECK-NEXT: Size: +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: +# CHECK-NEXT: Name: .greateq +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x21000 +# CHECK-NEXT: Offset: +# CHECK-NEXT: Size: +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: +# CHECK-NEXT: Name: .eq +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x22000 +# CHECK-NEXT: Offset: +# CHECK-NEXT: Size: +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: +# CHECK-NEXT: Name: .neq +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x23000 +# CHECK-NEXT: Offset: +# CHECK-NEXT: Size: +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: } + +## Mailformed number error. +# RUN: echo "SECTIONS { \ +# RUN: . = 0x12Q41; \ +# RUN: }" > %t.script +# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \ +# RUN: FileCheck --check-prefix=NUMERR %s +# NUMERR: malformed number: 0x12Q41 + +## Missing closing bracket. +# RUN: echo "SECTIONS { \ +# RUN: . = 0x10000 + (0x1000 + 0x1000 * 0x2; \ +# RUN: }" > %t.script +# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \ +# RUN: FileCheck --check-prefix=BRACKETERR %s +# BRACKETERR: unexpected EOF + +## Missing opening bracket. +# RUN: echo "SECTIONS { \ +# RUN: . = 0x10000 + 0x1000 + 0x1000) * 0x2; \ +# RUN: }" > %t.script +# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \ +# RUN: FileCheck --check-prefix=BRACKETERR2 %s +# BRACKETERR2: stray token: ) + +## Empty expression. +# RUN: echo "SECTIONS { \ +# RUN: . = ; \ +# RUN: }" > %t.script +# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \ +# RUN: FileCheck --check-prefix=ERREXPR %s +# ERREXPR: error in location counter expression + +## Div by zero error. +# RUN: echo "SECTIONS { \ +# RUN: . = 0x10000 / 0x0; \ +# RUN: }" > %t.script +# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \ +# RUN: FileCheck --check-prefix=DIVZERO %s +# DIVZERO: division by zero + +## Broken ternary operator expression. +# RUN: echo "SECTIONS { \ +# RUN: . = 0x1 ? 0x2; \ +# RUN: }" > %t.script +# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \ +# RUN: FileCheck --check-prefix=TERNERR %s +# TERNERR: unexpected EOF + +.globl _start +_start: +nop + +.section .plus, "a" +.quad 0 + +.section .minus, "a" +.quad 0 + +.section .div, "a" +.quad 0 + +.section .mul, "a" +.quad 0 + +.section .bracket, "a" +.quad 0 + +.section .and, "a" +.quad 0 + +.section .ternary1, "a" +.quad 0 + +.section .ternary2, "a" +.quad 0 + +.section .less, "a" +.quad 0 + +.section .lesseq, "a" +.quad 0 + +.section .great, "a" +.quad 0 + +.section .greateq, "a" +.quad 0 + +.section .eq, "a" +.quad 0 + +.section .neq, "a" +.quad 0 diff --git a/test/ELF/linkerscript-orphans.s b/test/ELF/linkerscript-orphans.s new file mode 100644 index 000000000000..fa7d30bf7f7c --- /dev/null +++ b/test/ELF/linkerscript-orphans.s @@ -0,0 +1,31 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t + +# RUN: echo "SECTIONS { .writable : { *(.writable) } }" > %t.script +# RUN: ld.lld -o %t.out --script %t.script %t +# RUN: llvm-objdump -section-headers %t.out | \ +# RUN: FileCheck -check-prefix=TEXTORPHAN %s + +# RUN: echo "SECTIONS { .text : { *(.text) } }" > %t.script +# RUN: ld.lld -o %t.out --script %t.script %t +# RUN: llvm-objdump -section-headers %t.out | \ +# RUN: FileCheck -check-prefix=WRITABLEORPHAN %s + +# TEXTORPHAN: Sections: +# TEXTORPHAN-NEXT: Idx Name +# TEXTORPHAN-NEXT: 0 +# TEXTORPHAN-NEXT: 1 .writable +# TEXTORPHAN-NEXT: 2 .text + +# WRITABLEORPHAN: Sections: +# WRITABLEORPHAN-NEXT: Idx Name +# WRITABLEORPHAN-NEXT: 0 +# WRITABLEORPHAN-NEXT: 1 .text +# WRITABLEORPHAN-NEXT: 2 .writable + +.global _start +_start: + nop + +.section .writable,"aw" + .zero 4 diff --git a/test/ELF/linkerscript-phdr-check.s b/test/ELF/linkerscript-phdr-check.s new file mode 100644 index 000000000000..c7229ed3312c --- /dev/null +++ b/test/ELF/linkerscript-phdr-check.s @@ -0,0 +1,15 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t + +# RUN: echo "SECTIONS { . = 0x10000000; .text : {*(.text.*)} }" > %t.script +# RUN: ld.lld -o %t1 --script %t.script %t +# RUN: llvm-readobj -program-headers %t1 | FileCheck %s +# CHECK: ProgramHeaders [ +# CHECK-NEXT: ProgramHeader { +# CHECK-NEXT: Type: PT_PHDR (0x6) +# CHECK-NEXT: Offset: 0x40 +# CHECK-NEXT: VirtualAddress: 0xFFFF040 + +.global _start +_start: + nop diff --git a/test/ELF/linkerscript-repsection-va.s b/test/ELF/linkerscript-repsection-va.s new file mode 100644 index 000000000000..4feeaa0e1c38 --- /dev/null +++ b/test/ELF/linkerscript-repsection-va.s @@ -0,0 +1,24 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t + +# RUN: echo "SECTIONS {.foo : {*(.foo.*)} }" > %t.script +# RUN: ld.lld -o %t1 --script %t.script %t +# RUN: llvm-objdump -section-headers %t1 | FileCheck %s +# CHECK: Sections: +# CHECK-NEXT: Idx Name Size Address Type +# CHECK-NEXT: 0 00000000 0000000000000000 +# CHECK-NEXT: 1 .foo 00000004 0000000000000158 DATA +# CHECK-NEXT: 2 .foo 00000004 000000000000015c DATA +# CHECK-NEXT: 3 .text 00000001 0000000000000160 TEXT DATA + +.global _start +_start: + nop + +.section .foo.1,"a" +foo1: + .long 0 + +.section .foo.2,"aw" +foo2: + .long 0 diff --git a/test/ELF/linkerscript-sections-keep.s b/test/ELF/linkerscript-sections-keep.s new file mode 100644 index 000000000000..fae6383ca499 --- /dev/null +++ b/test/ELF/linkerscript-sections-keep.s @@ -0,0 +1,80 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t + +## First check that section "keep" is garbage collected without using KEEP +# RUN: echo "SECTIONS { \ +# RUN: .text : { *(.text) } \ +# RUN: .keep : { *(.keep) } \ +# RUN: .temp : { *(.temp) }}" > %t.script +# RUN: ld.lld --gc-sections -o %t1 --script %t.script %t +# RUN: llvm-objdump -section-headers %t1 | \ +# RUN: FileCheck -check-prefix=SECGC %s +# SECGC: Sections: +# SECGC-NEXT: Idx Name Size Address Type +# SECGC-NEXT: 0 00000000 0000000000000000 +# SECGC-NEXT: 1 .text 00000007 0000000000000158 TEXT DATA +# SECGC-NEXT: 2 .temp 00000004 000000000000015f DATA + +## Now apply KEEP command to preserve the section. +# RUN: echo "SECTIONS { \ +# RUN: .text : { *(.text) } \ +# RUN: .keep : { KEEP(*(.keep)) } \ +# RUN: .temp : { *(.temp) }}" > %t.script +# RUN: ld.lld --gc-sections -o %t1 --script %t.script %t +# RUN: llvm-objdump -section-headers %t1 | \ +# RUN: FileCheck -check-prefix=SECNOGC %s +# SECNOGC: Sections: +# SECNOGC-NEXT: Idx Name Size Address Type +# SECNOGC-NEXT: 0 00000000 0000000000000000 +# SECNOGC-NEXT: 1 .text 00000007 0000000000000158 TEXT DATA +# SECNOGC-NEXT: 2 .keep 00000004 000000000000015f DATA +# SECNOGC-NEXT: 3 .temp 00000004 0000000000000163 DATA + +## A section name matches two entries in the SECTIONS directive. The +## first one doesn't have KEEP, the second one does. If section that have +## KEEP is the first in order then section is NOT collected. +# RUN: echo "SECTIONS { \ +# RUN: .keep : { KEEP(*(.keep)) } \ +# RUN: .nokeep : { *(.keep) }}" > %t.script +# RUN: ld.lld --gc-sections -o %t1 --script %t.script %t +# RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix=MIXED1 %s +# MIXED1: Sections: +# MIXED1-NEXT: Idx Name Size Address Type +# MIXED1-NEXT: 0 00000000 0000000000000000 +# MIXED1-NEXT: 1 .keep 00000004 0000000000000120 DATA +# MIXED1-NEXT: 2 .temp 00000004 0000000000000124 DATA +# MIXED1-NEXT: 3 .text 00000007 0000000000000128 TEXT DATA +# MIXED1-NEXT: 4 .symtab 00000060 0000000000000000 +# MIXED1-NEXT: 5 .shstrtab 0000002d 0000000000000000 +# MIXED1-NEXT: 6 .strtab 00000012 0000000000000000 + +## The same, but now section without KEEP is at first place. +## gold and bfd linkers disagree here. gold collects .keep while +## bfd keeps it. Our current behavior is compatible with bfd although +## we can choose either way. +# RUN: echo "SECTIONS { \ +# RUN: .nokeep : { *(.keep) } \ +# RUN: .keep : { KEEP(*(.keep)) }}" > %t.script +# RUN: ld.lld --gc-sections -o %t1 --script %t.script %t +# RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix=MIXED2 %s +# MIXED2: Sections: +# MIXED2-NEXT: Idx Name Size Address Type +# MIXED2-NEXT: 0 00000000 0000000000000000 +# MIXED2-NEXT: 1 .nokeep 00000004 0000000000000120 DATA +# MIXED2-NEXT: 2 .temp 00000004 0000000000000124 DATA +# MIXED2-NEXT: 3 .text 00000007 0000000000000128 TEXT DATA +# MIXED2-NEXT: 4 .symtab 00000060 0000000000000000 +# MIXED2-NEXT: 5 .shstrtab 0000002f 0000000000000000 +# MIXED2-NEXT: 6 .strtab 00000012 0000000000000000 + +.global _start +_start: + mov temp, %eax + +.section .keep, "a" +keep: + .long 1 + +.section .temp, "a" +temp: + .long 2 diff --git a/test/ELF/linkerscript-sections-padding.s b/test/ELF/linkerscript-sections-padding.s new file mode 100644 index 000000000000..545739efe5a8 --- /dev/null +++ b/test/ELF/linkerscript-sections-padding.s @@ -0,0 +1,44 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t + +## Check that padding value works: +# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x112233445566778899 }" > %t.script +# RUN: ld.lld -o %t.out --script %t.script %t +# RUN: hexdump -C %t.out | FileCheck -check-prefix=YES %s +# YES: 00000120 66 22 33 44 55 66 77 88 99 11 22 33 44 55 66 77 + +## Confirming that address was correct: +# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x998877665544332211 }" > %t.script +# RUN: ld.lld -o %t.out --script %t.script %t +# RUN: hexdump -C %t.out | FileCheck -check-prefix=YES2 %s +# YES2: 00000120 66 88 77 66 55 44 33 22 11 99 88 77 66 55 44 + +## Default padding value is 0x00: +# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } }" > %t.script +# RUN: ld.lld -o %t.out --script %t.script %t +# RUN: hexdump -C %t.out | FileCheck -check-prefix=NO %s +# NO: 00000120 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + +## Filler should be a hex value (1): +# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =99 }" > %t.script +# RUN: not ld.lld -o %t.out --script %t.script %t 2>&1 \ +# RUN: | FileCheck --check-prefix=ERR %s +# ERR: filler should be a hexadecimal value + +## Filler should be a hex value (2): +# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x99XX }" > %t.script +# RUN: not ld.lld -o %t.out --script %t.script %t 2>&1 \ +# RUN: | FileCheck --check-prefix=ERR2 %s +# ERR2: not a hexadecimal value: XX + +.section .mysec.1,"a" +.align 16 +.byte 0x66 + +.section .mysec.2,"a" +.align 16 +.byte 0x66 + +.globl _start +_start: + nop diff --git a/test/ELF/linkerscript-sections.s b/test/ELF/linkerscript-sections.s index 165ec335ec13..b68dac765a77 100644 --- a/test/ELF/linkerscript-sections.s +++ b/test/ELF/linkerscript-sections.s @@ -22,7 +22,7 @@ # SEC-DEFAULT: 4 .bss 00000002 {{[0-9a-f]*}} BSS # SEC-DEFAULT: 5 .shstrtab 00000002 {{[0-9a-f]*}} # SEC-DEFAULT: 6 .symtab 00000030 {{[0-9a-f]*}} -# SEC-DEFAULT: 7 .shstrtab 0000003c {{[0-9a-f]*}} +# SEC-DEFAULT: 7 .shstrtab 00000032 {{[0-9a-f]*}} # SEC-DEFAULT: 8 .strtab 00000008 {{[0-9a-f]*}} # Sections are put in order specified in linker script. @@ -42,7 +42,7 @@ # SEC-ORDER: 1 .bss 00000002 {{[0-9a-f]*}} BSS # SEC-ORDER: 2 other 00000003 {{[0-9a-f]*}} DATA # SEC-ORDER: 3 .shstrtab 00000002 {{[0-9a-f]*}} -# SEC-ORDER: 4 .shstrtab 0000003c {{[0-9a-f]*}} +# SEC-ORDER: 4 .shstrtab 00000032 {{[0-9a-f]*}} # SEC-ORDER: 5 .symtab 00000030 {{[0-9a-f]*}} # SEC-ORDER: 6 .strtab 00000008 {{[0-9a-f]*}} # SEC-ORDER: 7 .data 00000020 {{[0-9a-f]*}} DATA @@ -63,7 +63,7 @@ # SEC-SWAP-NAMES: 4 .bss 00000002 {{[0-9a-f]*}} BSS # SEC-SWAP-NAMES: 5 .shstrtab 00000002 {{[0-9a-f]*}} # SEC-SWAP-NAMES: 6 .symtab 00000030 {{[0-9a-f]*}} -# SEC-SWAP-NAMES: 7 .shstrtab 0000003c {{[0-9a-f]*}} +# SEC-SWAP-NAMES: 7 .shstrtab 00000032 {{[0-9a-f]*}} # SEC-SWAP-NAMES: 8 .strtab 00000008 {{[0-9a-f]*}} # .shstrtab from the input object file is discarded. @@ -100,10 +100,10 @@ # SEC-MULTI: 3 .bss 00000002 {{[0-9a-f]*}} BSS # SEC-MULTI: 4 .shstrtab 00000002 {{[0-9a-f]*}} # SEC-MULTI: 5 .symtab 00000030 {{[0-9a-f]*}} -# SEC-MULTI: 6 .shstrtab 00000036 {{[0-9a-f]*}} +# SEC-MULTI: 6 .shstrtab 0000002c {{[0-9a-f]*}} # SEC-MULTI: 7 .strtab 00000008 {{[0-9a-f]*}} -.globl _start; +.globl _start _start: mov $60, %rax mov $42, %rdi diff --git a/test/ELF/linkerscript-symbol-conflict.s b/test/ELF/linkerscript-symbol-conflict.s new file mode 100644 index 000000000000..30186ed5cb87 --- /dev/null +++ b/test/ELF/linkerscript-symbol-conflict.s @@ -0,0 +1,11 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t + +# RUN: echo "SECTIONS {.text : {*(.text.*)} end = .;}" > %t.script +# RUN: ld.lld -o %t1 --script %t.script %t +# RUN: llvm-objdump -t %t1 | FileCheck %s +# CHECK: 0000000000000121 *ABS* 00000000 end + +.global _start +_start: + nop diff --git a/test/ELF/linkerscript-symbols.s b/test/ELF/linkerscript-symbols.s new file mode 100644 index 000000000000..1fcd4e8a8481 --- /dev/null +++ b/test/ELF/linkerscript-symbols.s @@ -0,0 +1,11 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t + +# RUN: echo "SECTIONS {.text : {*(.text.*)} text_end = .;}" > %t.script +# RUN: ld.lld -o %t1 --script %t.script %t +# RUN: llvm-objdump -t %t1 | FileCheck %s +# CHECK: 0000000000000121 *ABS* 00000000 text_end + +.global _start +_start: + nop diff --git a/test/ELF/linkerscript-va.s b/test/ELF/linkerscript-va.s new file mode 100644 index 000000000000..25d0bd2268c0 --- /dev/null +++ b/test/ELF/linkerscript-va.s @@ -0,0 +1,24 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t + +# RUN: echo "SECTIONS {}" > %t.script +# RUN: ld.lld -o %t1 --script %t.script %t +# RUN: llvm-objdump -section-headers %t1 | FileCheck %s +# CHECK: Sections: +# CHECK-NEXT: Idx Name Size Address Type +# CHECK-NEXT: 0 00000000 0000000000000000 +# CHECK-NEXT: 1 .foo 00000004 0000000000000120 DATA +# CHECK-NEXT: 2 .boo 00000004 0000000000000124 DATA +# CHECK-NEXT: 3 .text 00000001 0000000000000128 TEXT DATA + +.global _start +_start: + nop + +.section .foo, "a" +foo: + .long 0 + +.section .boo, "a" +boo: + .long 0 diff --git a/test/ELF/linkerscript.s b/test/ELF/linkerscript.s index bff285b97612..4ee7416a4b84 100644 --- a/test/ELF/linkerscript.s +++ b/test/ELF/linkerscript.s @@ -1,3 +1,9 @@ +# There is some bad quoting interaction between lit's internal shell, which is +# implemented in Python, and the Cygwin implementations of the Unix utilities. +# Avoid running these tests on Windows for now by requiring a real shell. + +# REQUIRES: shell + # REQUIRES: x86 # RUN: mkdir -p %t.dir # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t @@ -10,43 +16,43 @@ # RUN: ld.lld %t -o %t2 %t.script # RUN: llvm-readobj %t2 > /dev/null -# RUN: echo "GROUP(" %t ")" > %t.script +# RUN: echo "GROUP(\"%t\")" > %t.script # RUN: ld.lld -o %t2 %t.script # RUN: llvm-readobj %t2 > /dev/null -# RUN: echo "INPUT(" %t ")" > %t.script +# RUN: echo "INPUT(\"%t\")" > %t.script # RUN: ld.lld -o %t2 %t.script # RUN: llvm-readobj %t2 > /dev/null -# RUN: echo "GROUP(" %t libxyz.a ")" > %t.script +# RUN: echo "GROUP(\"%t\" libxyz.a )" > %t.script # RUN: not ld.lld -o %t2 %t.script # RUN: ld.lld -o %t2 %t.script -L%t.dir # RUN: llvm-readobj %t2 > /dev/null -# RUN: echo "GROUP(" %t =libxyz.a ")" > %t.script +# RUN: echo "GROUP(\"%t\" =libxyz.a )" > %t.script # RUN: not ld.lld -o %t2 %t.script # RUN: ld.lld -o %t2 %t.script --sysroot=%t.dir # RUN: llvm-readobj %t2 > /dev/null -# RUN: echo "GROUP(" %t -lxyz ")" > %t.script +# RUN: echo "GROUP(\"%t\" -lxyz )" > %t.script # RUN: not ld.lld -o %t2 %t.script # RUN: ld.lld -o %t2 %t.script -L%t.dir # RUN: llvm-readobj %t2 > /dev/null -# RUN: echo "GROUP(" %t libxyz.a ")" > %t.script +# RUN: echo "GROUP(\"%t\" libxyz.a )" > %t.script # RUN: not ld.lld -o %t2 %t.script # RUN: ld.lld -o %t2 %t.script -L%t.dir # RUN: llvm-readobj %t2 > /dev/null -# RUN: echo "GROUP(" %t /libxyz.a ")" > %t.script -# RUN: echo "GROUP(" %t /libxyz.a ")" > %t.dir/xyz.script +# RUN: echo "GROUP(\"%t\" /libxyz.a )" > %t.script +# RUN: echo "GROUP(\"%t\" /libxyz.a )" > %t.dir/xyz.script # RUN: not ld.lld -o %t2 %t.script # RUN: not ld.lld -o %t2 %t.script --sysroot=%t.dir # RUN: ld.lld -o %t2 %t.dir/xyz.script --sysroot=%t.dir # RUN: llvm-readobj %t2 > /dev/null -# RUN: echo "GROUP(" %t.script2 ")" > %t.script1 -# RUN: echo "GROUP(" %t ")" > %t.script2 +# RUN: echo "GROUP(\"%t.script2\")" > %t.script1 +# RUN: echo "GROUP(\"%t\")" > %t.script2 # RUN: ld.lld -o %t2 %t.script1 # RUN: llvm-readobj %t2 > /dev/null @@ -70,16 +76,16 @@ # ENTRY-OVERLOAD: Name: _start # ENTRY-OVERLOAD-NEXT: Value: [[ENTRY]] -# RUN: echo "OUTPUT_FORMAT(\"elf64-x86-64\") /*/*/ GROUP(" %t ")" > %t.script +# RUN: echo "OUTPUT_FORMAT(elf64-x86-64) /*/*/ GROUP(\"%t\" )" > %t.script # RUN: ld.lld -o %t2 %t.script # RUN: llvm-readobj %t2 > /dev/null -# RUN: echo "GROUP(AS_NEEDED(" %t "))" > %t.script +# RUN: echo "GROUP(AS_NEEDED(\"%t\"))" > %t.script # RUN: ld.lld -o %t2 %t.script # RUN: llvm-readobj %t2 > /dev/null # RUN: rm -f %t.out -# RUN: echo "OUTPUT(" %t.out ")" > %t.script +# RUN: echo "OUTPUT(\"%t.out\")" > %t.script # RUN: ld.lld %t.script %t # RUN: llvm-readobj %t.out > /dev/null @@ -95,8 +101,8 @@ # RUN: ld.lld %t.script %t # RUN: llvm-readobj %t.out > /dev/null -# RUN: echo "INCLUDE " %t.script2 "OUTPUT(" %t.out ")" > %t.script1 -# RUN: echo "GROUP(" %t ")" > %t.script2 +# RUN: echo "INCLUDE \"%t.script2\" OUTPUT(\"%t.out\")" > %t.script1 +# RUN: echo "GROUP(\"%t\")" > %t.script2 # RUN: ld.lld %t.script1 # RUN: llvm-readobj %t2 > /dev/null @@ -106,7 +112,7 @@ # ERR1: unknown directive: FOO -.globl _start, _label; +.globl _start, _label _start: mov $60, %rax mov $42, %rdi diff --git a/test/ELF/linkerscript2.s b/test/ELF/linkerscript2.s index f83198f759fd..6ecd9e7ea975 100644 --- a/test/ELF/linkerscript2.s +++ b/test/ELF/linkerscript2.s @@ -1,10 +1,16 @@ +# There is some bad quoting interaction between lit's internal shell, which is +# implemented in Python, and the Cygwin implementations of the Unix utilities. +# Avoid running these tests on Windows for now by requiring a real shell. + +# REQUIRES: shell + # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd \ # RUN: %p/Inputs/libsearch-dyn.s -o %tdyn.o # RUN: mkdir -p %t.dir # RUN: ld.lld -shared %tdyn.o -o %t.dir/libls.so -# RUN: echo "SEARCH_DIR(" %t.dir ")" > %t.script +# RUN: echo "SEARCH_DIR(\"%t.dir\")" > %t.script # RUN: ld.lld -o %t2 --script %t.script -lls %t .globl _start,_bar diff --git a/test/ELF/lit.local.cfg b/test/ELF/lit.local.cfg index 0011e796e5f4..b93a36d2b50b 100644 --- a/test/ELF/lit.local.cfg +++ b/test/ELF/lit.local.cfg @@ -1,2 +1,2 @@ -config.suffixes = ['.test', '.s'] +config.suffixes = ['.test', '.s', '.ll'] diff --git a/test/ELF/llvm33-rela-outside-group.s b/test/ELF/llvm33-rela-outside-group.s new file mode 100644 index 000000000000..8e7e7c4e6a4d --- /dev/null +++ b/test/ELF/llvm33-rela-outside-group.s @@ -0,0 +1,11 @@ +// Input file generated with: +// llvm33/llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %S/Inputs/llvm33-rela-outside-group.o +// +// RUN: ld.lld -shared %S/Inputs/llvm33-rela-outside-group.o %S/Inputs/llvm33-rela-outside-group.o + + .global bar + .weak _Z3fooIiEvv + + .section .text._Z3fooIiEvv,"axG",@progbits,_Z3fooIiEvv,comdat +_Z3fooIiEvv: + callq bar@PLT diff --git a/test/ELF/local-dynamic.s b/test/ELF/local-dynamic.s index 162c58cb57ed..436516a91190 100644 --- a/test/ELF/local-dynamic.s +++ b/test/ELF/local-dynamic.s @@ -42,6 +42,17 @@ // CHECK-NEXT: Section: .text // CHECK-NEXT: } // CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: _DYNAMIC +// CHECK-NEXT: Value: 0x1000 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other [ (0x2) +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] +// CHECK-NEXT: Section: .dynamic +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { // CHECK-NEXT: Name: _start // CHECK-NEXT: Value: 0x1000 // CHECK-NEXT: Size: 0 diff --git a/test/ELF/local-got-pie.s b/test/ELF/local-got-pie.s new file mode 100644 index 000000000000..e846bd454445 --- /dev/null +++ b/test/ELF/local-got-pie.s @@ -0,0 +1,36 @@ +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +// RUN: ld.lld %t.o -o %t -pie +// RUN: llvm-readobj -s -r %t | FileCheck %s +// RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s + +.globl _start +_start: + call foo@gotpcrel + + .hidden foo + .global foo +foo: + nop + +// 0x20A0 - 1001 - 5 = 4250 +// DISASM: Disassembly of section .text: +// DISASM-NEXT: _start: +// DISASM-NEXT: 1000: {{.*}} callq 4251 +// DISASM: foo: +// DISASM-NEXT: 1005: {{.*}} nop + +// CHECK: Name: .got +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x20A0 +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: 8 + +// CHECK: Relocations [ +// CHECK-NEXT: Section ({{.*}}) .rela.dyn { +// CHECK-NEXT: 0x20A0 R_X86_64_RELATIVE - 0x1005 +// CHECK-NEXT: } +// CHECK-NEXT: ] diff --git a/test/ELF/local-undefined-symbol.s b/test/ELF/local-undefined-symbol.s new file mode 100644 index 000000000000..34ef847180ae --- /dev/null +++ b/test/ELF/local-undefined-symbol.s @@ -0,0 +1,13 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: ld.lld %t -o %t1 +# RUN: llvm-readobj -t %t1 | FileCheck %s + +# CHECK: Symbols [ +# CHECK-NOT: Name: foo + +.global _start +_start: + jmp foo + +.local foo diff --git a/test/ELF/lto/Inputs/archive-2.ll b/test/ELF/lto/Inputs/archive-2.ll new file mode 100644 index 000000000000..8236cfe5cd84 --- /dev/null +++ b/test/ELF/lto/Inputs/archive-2.ll @@ -0,0 +1,6 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @_start() { + ret void +} diff --git a/test/ELF/lto/Inputs/archive-3.ll b/test/ELF/lto/Inputs/archive-3.ll new file mode 100644 index 000000000000..ad8fb1e33ef2 --- /dev/null +++ b/test/ELF/lto/Inputs/archive-3.ll @@ -0,0 +1,5 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" +define void @foo() { + ret void +} diff --git a/test/ELF/lto/Inputs/archive.ll b/test/ELF/lto/Inputs/archive.ll new file mode 100644 index 000000000000..71c1e4f35600 --- /dev/null +++ b/test/ELF/lto/Inputs/archive.ll @@ -0,0 +1,6 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @f() { + ret void +} diff --git a/test/ELF/lto/Inputs/available-externally.ll b/test/ELF/lto/Inputs/available-externally.ll new file mode 100644 index 000000000000..b8583eab829d --- /dev/null +++ b/test/ELF/lto/Inputs/available-externally.ll @@ -0,0 +1,6 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @zed() { + ret void +} diff --git a/test/ELF/lto/Inputs/comdat.s b/test/ELF/lto/Inputs/comdat.s new file mode 100644 index 000000000000..6f6e5ae1d9df --- /dev/null +++ b/test/ELF/lto/Inputs/comdat.s @@ -0,0 +1,5 @@ + .section .text.f,"axG",@progbits,c,comdat + .globl foo + +foo: + retq diff --git a/test/ELF/lto/Inputs/common.s b/test/ELF/lto/Inputs/common.s new file mode 100644 index 000000000000..e2cd9e6d50c3 --- /dev/null +++ b/test/ELF/lto/Inputs/common.s @@ -0,0 +1 @@ + .comm a,8,4 diff --git a/test/ELF/lto/Inputs/drop-debug-info.bc b/test/ELF/lto/Inputs/drop-debug-info.bc new file mode 100644 index 000000000000..f9c471f8e0d1 Binary files /dev/null and b/test/ELF/lto/Inputs/drop-debug-info.bc differ diff --git a/test/ELF/lto/Inputs/drop-linkage.ll b/test/ELF/lto/Inputs/drop-linkage.ll new file mode 100644 index 000000000000..0e3dc7a41421 --- /dev/null +++ b/test/ELF/lto/Inputs/drop-linkage.ll @@ -0,0 +1,12 @@ +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +$foo = comdat any +define linkonce void @foo() comdat { + ret void +} + +define void @bar() { + call void @foo() + ret void +} diff --git a/test/ELF/lto/Inputs/dynsym.s b/test/ELF/lto/Inputs/dynsym.s new file mode 100644 index 000000000000..a69f870a1b60 --- /dev/null +++ b/test/ELF/lto/Inputs/dynsym.s @@ -0,0 +1,3 @@ +.globl foo +foo: +ret diff --git a/test/ELF/lto/Inputs/internalize-exportdyn.ll b/test/ELF/lto/Inputs/internalize-exportdyn.ll new file mode 100644 index 000000000000..21ac3580762c --- /dev/null +++ b/test/ELF/lto/Inputs/internalize-exportdyn.ll @@ -0,0 +1,6 @@ +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +define weak_odr void @bah() { + ret void +} diff --git a/test/ELF/lto/Inputs/internalize-undef.ll b/test/ELF/lto/Inputs/internalize-undef.ll new file mode 100644 index 000000000000..71c1e4f35600 --- /dev/null +++ b/test/ELF/lto/Inputs/internalize-undef.ll @@ -0,0 +1,6 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @f() { + ret void +} diff --git a/test/ELF/lto/Inputs/irmover-error.ll b/test/ELF/lto/Inputs/irmover-error.ll new file mode 100644 index 000000000000..86ed259b2a00 --- /dev/null +++ b/test/ELF/lto/Inputs/irmover-error.ll @@ -0,0 +1,6 @@ +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +!0 = !{ i32 1, !"foo", i32 2 } + +!llvm.module.flags = !{ !0 } diff --git a/test/ELF/lto/Inputs/linkonce-odr.ll b/test/ELF/lto/Inputs/linkonce-odr.ll new file mode 100644 index 000000000000..0b3828846eb5 --- /dev/null +++ b/test/ELF/lto/Inputs/linkonce-odr.ll @@ -0,0 +1,6 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define linkonce_odr void @f() { + ret void +} diff --git a/test/ELF/lto/Inputs/linkonce.ll b/test/ELF/lto/Inputs/linkonce.ll new file mode 100644 index 000000000000..a6738b3ad71e --- /dev/null +++ b/test/ELF/lto/Inputs/linkonce.ll @@ -0,0 +1,6 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define linkonce void @f() { + ret void +} diff --git a/test/ELF/lto/Inputs/resolution.s b/test/ELF/lto/Inputs/resolution.s new file mode 100644 index 000000000000..60b7870efbf4 --- /dev/null +++ b/test/ELF/lto/Inputs/resolution.s @@ -0,0 +1,4 @@ + .data + .global a +a: + .long 9 diff --git a/test/ELF/lto/Inputs/save-temps.ll b/test/ELF/lto/Inputs/save-temps.ll new file mode 100644 index 000000000000..d6e6eb661f33 --- /dev/null +++ b/test/ELF/lto/Inputs/save-temps.ll @@ -0,0 +1,6 @@ +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +define void @bar() { + ret void +} diff --git a/test/ELF/lto/Inputs/shared.s b/test/ELF/lto/Inputs/shared.s new file mode 100644 index 000000000000..ab79ed131c3f --- /dev/null +++ b/test/ELF/lto/Inputs/shared.s @@ -0,0 +1,7 @@ +.globl printf +.type printf, @function +printf: + +.globl puts +.type puts, @function +puts: diff --git a/test/ELF/lto/Inputs/start-lib1.ll b/test/ELF/lto/Inputs/start-lib1.ll new file mode 100644 index 000000000000..9f42e6afff0f --- /dev/null +++ b/test/ELF/lto/Inputs/start-lib1.ll @@ -0,0 +1,8 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +declare void @bar() + +define void @foo() { + ret void +} diff --git a/test/ELF/lto/Inputs/start-lib2.ll b/test/ELF/lto/Inputs/start-lib2.ll new file mode 100644 index 000000000000..68b3c8362808 --- /dev/null +++ b/test/ELF/lto/Inputs/start-lib2.ll @@ -0,0 +1,6 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @bar() { + ret void +} diff --git a/test/ELF/lto/Inputs/tls-mixed.s b/test/ELF/lto/Inputs/tls-mixed.s new file mode 100644 index 000000000000..b31ae3dd54d1 --- /dev/null +++ b/test/ELF/lto/Inputs/tls-mixed.s @@ -0,0 +1,4 @@ +.globl foo +.section .tbss,"awT",@nobits +foo: +.long 0 diff --git a/test/ELF/lto/Inputs/type-merge.ll b/test/ELF/lto/Inputs/type-merge.ll new file mode 100644 index 000000000000..c31642105f3a --- /dev/null +++ b/test/ELF/lto/Inputs/type-merge.ll @@ -0,0 +1,8 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @zed() { + call void @bar() + ret void +} +declare void @bar() diff --git a/test/ELF/lto/Inputs/type-merge2.ll b/test/ELF/lto/Inputs/type-merge2.ll new file mode 100644 index 000000000000..79fd1f886306 --- /dev/null +++ b/test/ELF/lto/Inputs/type-merge2.ll @@ -0,0 +1,8 @@ +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +%zed = type { i16 } +define void @bar(%zed* %this) { + store %zed* %this, %zed** null + ret void +} diff --git a/test/ELF/lto/Inputs/undef-mixed.s b/test/ELF/lto/Inputs/undef-mixed.s new file mode 100644 index 000000000000..2e4b7e114bb5 --- /dev/null +++ b/test/ELF/lto/Inputs/undef-mixed.s @@ -0,0 +1,3 @@ + .globl bar +bar: + retq diff --git a/test/ELF/lto/Inputs/unnamed-addr-lib.s b/test/ELF/lto/Inputs/unnamed-addr-lib.s new file mode 100644 index 000000000000..e6ebce024f05 --- /dev/null +++ b/test/ELF/lto/Inputs/unnamed-addr-lib.s @@ -0,0 +1,6 @@ + .protected foo + .global foo +foo: + + .global bar +bar: diff --git a/test/ELF/lto/Inputs/visibility.s b/test/ELF/lto/Inputs/visibility.s new file mode 100644 index 000000000000..db1379cc441f --- /dev/null +++ b/test/ELF/lto/Inputs/visibility.s @@ -0,0 +1,8 @@ + .global g +g: + ret + + .data + .global a +a: + .long 41 diff --git a/test/ELF/lto/archive-2.ll b/test/ELF/lto/archive-2.ll new file mode 100644 index 000000000000..6712d60c11e3 --- /dev/null +++ b/test/ELF/lto/archive-2.ll @@ -0,0 +1,28 @@ +; REQUIRES: x86 +; RUN: llvm-as %S/Inputs/archive-2.ll -o %t1.o +; RUN: rm -f %t.a +; RUN: llvm-ar rcs %t.a %t1.o +; RUN: llvm-as %s -o %t2.o +; RUN: ld.lld -m elf_x86_64 %t2.o %t.a -o %t3 +; RUN: llvm-readobj -t %t3 | FileCheck %s +; RUN: ld.lld -m elf_x86_64 %t2.o --whole-archive %t.a -o %t3 -shared +; RUN: llvm-readobj -t %t3 | FileCheck %s + +; CHECK: Name: _start ( +; CHECK-NEXT: Value: +; CHECK-NEXT: Size: +; CHECK-NEXT: Binding: Global +; CHECK-NEXT: Type: Function +; CHECK-NEXT: Other: 0 +; CHECK-NEXT: Section: .text + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @g() { + call void @_start() + ret void +} + +declare void @_start() + diff --git a/test/ELF/lto/archive-3.ll b/test/ELF/lto/archive-3.ll new file mode 100644 index 000000000000..350c8929c9df --- /dev/null +++ b/test/ELF/lto/archive-3.ll @@ -0,0 +1,19 @@ +; REQUIRES: x86 +; RUN: llvm-as %S/Inputs/archive-3.ll -o %t1.o +; RUN: llvm-as %s -o %t2.o + +; RUN: ld.lld -m elf_x86_64 %t1.o %t2.o -o %t3 -save-temps +; RUN: llvm-dis %t3.lto.bc -o - | FileCheck %s + +; RUN: rm -f %t.a +; RUN: llvm-ar rcs %t.a %t1.o +; RUN: ld.lld -m elf_x86_64 %t.a %t1.o %t2.o -o %t3 -save-temps +; RUN: llvm-dis %t3.lto.bc -o - | FileCheck %s + +; CHECK: define internal void @foo() { + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" +define void @_start() { + ret void +} diff --git a/test/ELF/lto/archive.ll b/test/ELF/lto/archive.ll new file mode 100644 index 000000000000..b3f69fb9920f --- /dev/null +++ b/test/ELF/lto/archive.ll @@ -0,0 +1,37 @@ +; REQUIRES: x86 +; RUN: llvm-as %S/Inputs/archive.ll -o %t1.o +; RUN: rm -f %t.a +; RUN: llvm-ar rcs %t.a %t1.o +; RUN: llvm-as %s -o %t2.o +; RUN: ld.lld -m elf_x86_64 %t2.o %t.a -o %t3 -shared +; RUN: llvm-readobj -t %t3 | FileCheck %s +; RUN: ld.lld -m elf_x86_64 %t2.o --whole-archive %t.a -o %t3 -shared +; RUN: llvm-readobj -t %t3 | FileCheck %s + + +; CHECK: Name: g ( +; CHECK-NEXT: Value: +; CHECK-NEXT: Size: +; CHECK-NEXT: Binding: Global +; CHECK-NEXT: Type: Function +; CHECK-NEXT: Other: 0 +; CHECK-NEXT: Section: .text + +; CHECK: Name: f ( +; CHECK-NEXT: Value: +; CHECK-NEXT: Size: +; CHECK-NEXT: Binding: Global +; CHECK-NEXT: Type: Function +; CHECK-NEXT: Other: 0 +; CHECK-NEXT: Section: .text + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @g() { + call void @f() + ret void +} + +declare void @f() + diff --git a/test/ELF/lto/asmundef.ll b/test/ELF/lto/asmundef.ll new file mode 100644 index 000000000000..d76e418fce81 --- /dev/null +++ b/test/ELF/lto/asmundef.ll @@ -0,0 +1,25 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld -m elf_x86_64 %t.o -o %t -save-temps +; RUN: llvm-dis %t.lto.bc -o - | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +module asm ".weak patatino" +module asm ".equ patatino, foo" + +declare void @patatino() + +define void @foo() { + ret void +} + +define void @_start() { + call void @patatino() + ret void +} + +; CHECK: @llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void ()* @foo to i8*)], section "llvm.metadata" +; CHECK: define internal void @foo + diff --git a/test/ELF/lto/available-externally.ll b/test/ELF/lto/available-externally.ll new file mode 100644 index 000000000000..74aa86002c9e --- /dev/null +++ b/test/ELF/lto/available-externally.ll @@ -0,0 +1,22 @@ +; RUN: llvm-as %s -o %t1.o +; RUN: llvm-as %p/Inputs/available-externally.ll -o %t2.o +; RUN: ld.lld %t1.o %t2.o -m elf_x86_64 -o %t.so -shared -save-temps +; RUN: llvm-dis < %t.so.lto.bc | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @foo() { + call void @bar() + call void @zed() + ret void +} +define available_externally void @bar() { + ret void +} +define available_externally void @zed() { + ret void +} + +; CHECK: define available_externally void @bar() { +; CHECK: define void @zed() { diff --git a/test/ELF/lto/combined-lto-object-name.ll b/test/ELF/lto/combined-lto-object-name.ll new file mode 100644 index 000000000000..f5b7e3ae40e6 --- /dev/null +++ b/test/ELF/lto/combined-lto-object-name.ll @@ -0,0 +1,14 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: not ld.lld -m elf_x86_64 %t.o -o %t2 2>&1 | FileCheck %s + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +declare void @foo() +define void @_start() { + call void @foo() + ret void +} + +; CHECK: undefined symbol: foo in {{.*}}combined-lto-object-name.ll.tmp.o diff --git a/test/ELF/lto/comdat.ll b/test/ELF/lto/comdat.ll new file mode 100644 index 000000000000..e1384d0abd23 --- /dev/null +++ b/test/ELF/lto/comdat.ll @@ -0,0 +1,21 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld -m elf_x86_64 %t.o %t.o -o %t.so -shared +; RUN: llvm-readobj -t %t.so | FileCheck %s + +; CHECK: Name: foo +; CHECK-NEXT: Value: +; CHECK-NEXT: Size: 1 +; CHECK-NEXT: Binding: Global +; CHECK-NEXT: Type: Function +; CHECK-NEXT: Other: 0 +; CHECK-NEXT: Section: .text + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +$foo = comdat any +define void @foo() comdat { + ret void +} + diff --git a/test/ELF/lto/comdat2.ll b/test/ELF/lto/comdat2.ll new file mode 100644 index 000000000000..1509585f1553 --- /dev/null +++ b/test/ELF/lto/comdat2.ll @@ -0,0 +1,40 @@ +; RUN: llvm-as %s -o %t.o +; RUN: llvm-mc -triple=x86_64-pc-linux %p/Inputs/comdat.s -o %t2.o -filetype=obj +; RUN: ld.lld -m elf_x86_64 %t.o %t2.o -o %t.so -shared +; RUN: llvm-readobj -t %t.so | FileCheck %s +; RUN: ld.lld -m elf_x86_64 %t2.o %t.o -o %t2.so -shared +; RUN: llvm-readobj -t %t2.so | FileCheck %s --check-prefix=OTHER + + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +$c = comdat any + +define protected void @foo() comdat($c) { + ret void +} + +; CHECK: Symbol { +; CHECK: Name: foo +; CHECK-NEXT: Value: 0x1000 +; CHECK-NEXT: Size: 1 +; CHECK-NEXT: Binding: Global +; CHECK-NEXT: Type: Function +; CHECK-NEXT: Other [ +; CHECK-NEXT: STV_PROTECTED +; CHECK-NEXT: ] +; CHECK-NEXT: Section: .text +; CHECK-NEXT: } + +; OTHER: Symbol { +; OTHER: Name: foo +; OTHER-NEXT: Value: 0x1000 +; OTHER-NEXT: Size: 0 +; OTHER-NEXT: Binding: Global +; OTHER-NEXT: Type: None +; OTHER-NEXT: Other [ +; OTHER-NEXT: STV_PROTECTED +; OTHER-NEXT: ] +; OTHER-NEXT: Section: .text +; OTHER-NEXT: } diff --git a/test/ELF/lto/common.ll b/test/ELF/lto/common.ll new file mode 100644 index 000000000000..b02002431320 --- /dev/null +++ b/test/ELF/lto/common.ll @@ -0,0 +1,31 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t1.o +; RUN: llvm-mc -triple=x86_64-pc-linux %p/Inputs/common.s -o %t2.o -filetype=obj +; RUN: ld.lld %t1.o %t2.o -o %t.so -shared +; RUN: llvm-readobj -s -t %t.so | FileCheck %s + +; CHECK: Name: .bss +; CHECK-NEXT: Type: SHT_NOBITS +; CHECK-NEXT: Flags [ +; CHECK-NEXT: SHF_ALLOC +; CHECK-NEXT: SHF_WRITE +; CHECK-NEXT: ] +; CHECK-NEXT: Address: +; CHECK-NEXT: Offset: +; CHECK-NEXT: Size: 8 +; CHECK-NEXT: Link: 0 +; CHECK-NEXT: Info: 0 +; CHECK-NEXT: AddressAlignment: 8 + +; CHECK: Name: a +; CHECK-NEXT: Value: +; CHECK-NEXT: Size: 8 +; CHECK-NEXT: Binding: Global +; CHECK-NEXT: Type: Object +; CHECK-NEXT: Other: 0 +; CHECK-NEXT: Section: .bss + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@a = common global i32 0, align 8 diff --git a/test/ELF/lto/common2.ll b/test/ELF/lto/common2.ll new file mode 100644 index 000000000000..59a2676e4fc9 --- /dev/null +++ b/test/ELF/lto/common2.ll @@ -0,0 +1,24 @@ +; RUN: llvm-as %s -o %t1.o +; RUN: ld.lld -m elf_x86_64 %t1.o -o %t -shared -save-temps +; RUN: llvm-dis < %t.lto.bc | FileCheck %s +; RUN: llvm-readobj -t %t | FileCheck %s --check-prefix=SHARED + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@a = common global i8 0, align 8 + +; Shared library case, we ensure that the bitcode generated file +; has not the a symbol but is appears in the final shared library +; produced. +; CHECK-NOT: @a = common global i8 0, align 8 + +; SHARED: Symbol { +; SHARED: Name: a +; SHARED-NEXT: Value: 0x2000 +; SHARED-NEXT: Size: 1 +; SHARED-NEXT: Binding: Global +; SHARED-NEXT: Type: Object +; SHARED-NEXT: Other: 0 +; SHARED-NEXT: Section: .bss +; SHARED-NEXT: } diff --git a/test/ELF/lto/ctors.ll b/test/ELF/lto/ctors.ll new file mode 100644 index 000000000000..7fce645f28f6 --- /dev/null +++ b/test/ELF/lto/ctors.ll @@ -0,0 +1,18 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -shared +; RUN: llvm-readobj -sections %t.so | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @ctor, i8* null }] +define void @ctor() { + call void asm "nop", ""() + ret void +} + +; The llvm.global_ctors should end up producing constructors. +; On x86-64 (linux) we should always emit .init_array and never .ctors. +; CHECK: Name: .init_array +; CHECK-NOT: Name: .ctors diff --git a/test/ELF/lto/discard-value-names.ll b/test/ELF/lto/discard-value-names.ll new file mode 100644 index 000000000000..c6cd94fd2e18 --- /dev/null +++ b/test/ELF/lto/discard-value-names.ll @@ -0,0 +1,23 @@ +; RUN: llvm-as %s -o %t.o + +; RUN: ld.lld -m elf_x86_64 -shared -save-temps %t.o -o %t2.o +; RUN: llvm-dis < %t2.o.lto.bc | FileCheck %s + +; CHECK: @GlobalValueName +; CHECK: @foo(i32 %in) +; CHECK: somelabel: +; CHECK: %GV = load i32, i32* @GlobalValueName +; CHECK: %add = add i32 %in, %GV +; CHECK: ret i32 %add + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@GlobalValueName = global i32 0 + +define i32 @foo(i32 %in) { +somelabel: + %GV = load i32, i32* @GlobalValueName + %add = add i32 %in, %GV + ret i32 %add +} diff --git a/test/ELF/lto/drop-debug-info.ll b/test/ELF/lto/drop-debug-info.ll new file mode 100644 index 000000000000..7a7ed5ea41d1 --- /dev/null +++ b/test/ELF/lto/drop-debug-info.ll @@ -0,0 +1,9 @@ +; REQUIRES: x86 +; +; drop-debug-info.bc was created from "void f(void) {}" with clang 3.5 and +; -gline-tables-only, so it contains old debug info. +; +; RUN: ld.lld -m elf_x86_64 -shared %p/Inputs/drop-debug-info.bc \ +; RUN: -disable-verify 2>&1 | FileCheck %s +; CHECK: warning: ignoring debug info with an invalid version (1) in {{.*}}drop-debug-info.bc + diff --git a/test/ELF/lto/drop-linkage.ll b/test/ELF/lto/drop-linkage.ll new file mode 100644 index 000000000000..fd111c18bd13 --- /dev/null +++ b/test/ELF/lto/drop-linkage.ll @@ -0,0 +1,14 @@ +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +; REQUIRES: x86 +; RUN: llc %s -o %t.o -filetype=obj +; RUN: llvm-as %p/Inputs/drop-linkage.ll -o %t2.o +; RUN: ld.lld %t.o %t2.o -o %t.so -save-temps -shared +; RUN: llvm-dis %t.so.lto.opt.bc -o - | FileCheck %s + +define void @foo() { + ret void +} + +; CHECK: declare void @foo() diff --git a/test/ELF/lto/duplicated.ll b/test/ELF/lto/duplicated.ll new file mode 100644 index 000000000000..6ef6772c5f20 --- /dev/null +++ b/test/ELF/lto/duplicated.ll @@ -0,0 +1,10 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: not ld.lld -m elf_x86_64 %t.o %t.o -o %t.so -shared 2>&1 | FileCheck %s +; CHECK: duplicate symbol: f in {{.*}}.o and {{.*}}.o +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +define void @f() { + ret void +} diff --git a/test/ELF/lto/dynamic-list.ll b/test/ELF/lto/dynamic-list.ll new file mode 100644 index 000000000000..0e950b3c83fd --- /dev/null +++ b/test/ELF/lto/dynamic-list.ll @@ -0,0 +1,25 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: echo "{ foo; };" > %t.list +; RUN: ld.lld -m elf_x86_64 -o %t --dynamic-list %t.list -pie %t.o +; RUN: llvm-readobj -dyn-symbols %t | FileCheck %s + +; CHECK: Name: foo@ +; CHECK-NEXT: Value: 0x1010 +; CHECK-NEXT: Size: 1 +; CHECK-NEXT: Binding: Global (0x1) +; CHECK-NEXT: Type: Function +; CHECK-NEXT: Other: 0 +; CHECK-NEXT: Section: .text +; CHECK-NEXT: } + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +define void @_start() { + ret void +} + +define void @foo() { + ret void +} diff --git a/test/ELF/lto/dynsym.ll b/test/ELF/lto/dynsym.ll new file mode 100644 index 000000000000..5885960c7bc3 --- /dev/null +++ b/test/ELF/lto/dynsym.ll @@ -0,0 +1,25 @@ +; REQUIRES: x86 +; RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux -o %t.o %p/Inputs/dynsym.s +; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -shared +; RUN: llvm-as %s -o %t2.o +; RUN: ld.lld -m elf_x86_64 %t2.o %t.so -o %t +; RUN: llvm-readobj -dyn-symbols %t | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @_start() { + call void @foo() + ret void +} + +; CHECK: Name: foo +; CHECK-NEXT: Value: +; CHECK-NEXT: Size: +; CHECK-NEXT: Binding: +; CHECK-NEXT: Type: +; CHECK-NEXT: Other: +; CHECK-NEXT: Section: .text +define void @foo() { + ret void +} diff --git a/test/ELF/lto/inline-asm.ll b/test/ELF/lto/inline-asm.ll new file mode 100644 index 000000000000..b6af6a5a5cbb --- /dev/null +++ b/test/ELF/lto/inline-asm.ll @@ -0,0 +1,11 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -shared + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @foo() { + call void asm "nop", ""() + ret void +} diff --git a/test/ELF/lto/internalize-basic.ll b/test/ELF/lto/internalize-basic.ll new file mode 100644 index 000000000000..396b9cb60f17 --- /dev/null +++ b/test/ELF/lto/internalize-basic.ll @@ -0,0 +1,21 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld -m elf_x86_64 %t.o -o %t2 -save-temps +; RUN: llvm-dis < %t2.lto.bc | FileCheck %s + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +define void @_start() { + ret void +} + +define hidden void @foo() { + ret void +} + +; Check that _start is not internalized. +; CHECK: define void @_start() + +; Check that foo function is correctly internalized. +; CHECK: define internal void @foo() diff --git a/test/ELF/lto/internalize-exportdyn.ll b/test/ELF/lto/internalize-exportdyn.ll new file mode 100644 index 000000000000..bee9a1e6a1ee --- /dev/null +++ b/test/ELF/lto/internalize-exportdyn.ll @@ -0,0 +1,47 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: llvm-as %p/Inputs/internalize-exportdyn.ll -o %t2.o +; RUN: ld.lld -m elf_x86_64 %t.o %t2.o -o %t2 --export-dynamic -save-temps +; RUN: llvm-dis < %t2.lto.bc | FileCheck %s + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +define void @_start() { + ret void +} + +define void @foo() { + ret void +} + +define hidden void @bar() { + ret void +} + +define linkonce_odr void @zed() local_unnamed_addr { + ret void +} + +define linkonce_odr void @zed2() unnamed_addr { + ret void +} + +define linkonce_odr void @bah() { + ret void +} + +define linkonce_odr void @baz() { + ret void +} + +@use_baz = global void ()* @baz + +; Check what gets internalized. +; CHECK: define void @_start() +; CHECK: define void @foo() +; CHECK: define internal void @bar() +; CHECK: define internal void @zed() +; CHECK: define internal void @zed2() +; CHECK: define weak_odr void @bah() +; CHECK: define weak_odr void @baz() diff --git a/test/ELF/lto/internalize-llvmused.ll b/test/ELF/lto/internalize-llvmused.ll new file mode 100644 index 000000000000..46c90a65ff72 --- /dev/null +++ b/test/ELF/lto/internalize-llvmused.ll @@ -0,0 +1,20 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld -m elf_x86_64 %t.o -o %t2 -save-temps +; RUN: llvm-dis < %t2.lto.bc | FileCheck %s + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +define void @_start() { + ret void +} + +define hidden void @f() { + ret void +} + +@llvm.used = appending global [1 x i8*] [ i8* bitcast (void ()* @f to i8*)] + +; Check that f is not internalized. +; CHECK: define hidden void @f() diff --git a/test/ELF/lto/internalize-undef.ll b/test/ELF/lto/internalize-undef.ll new file mode 100644 index 000000000000..5d74c31eee8b --- /dev/null +++ b/test/ELF/lto/internalize-undef.ll @@ -0,0 +1,16 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: llvm-as %p/Inputs/internalize-undef.ll -o %t2.o +; RUN: ld.lld -m elf_x86_64 %t.o %t2.o -o %t -save-temps +; RUN: llvm-dis < %t.lto.bc | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +declare void @f() +define void @_start() { + call void @f() + ret void +} + +; CHECK: define internal void @f() diff --git a/test/ELF/lto/internalize-version-script.ll b/test/ELF/lto/internalize-version-script.ll new file mode 100644 index 000000000000..c25328fb56e2 --- /dev/null +++ b/test/ELF/lto/internalize-version-script.ll @@ -0,0 +1,22 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: echo "{ global: foo; local: *; };" > %t.script +; RUN: ld.lld -m elf_x86_64 %t.o -o %t2 -shared --version-script %t.script -save-temps +; RUN: llvm-dis < %t2.lto.bc | FileCheck %s + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +define void @foo() { + ret void +} + +define void @bar() { + ret void +} + +; Check that foo is not internalized. +; CHECK: define void @foo() + +; Check that bar is correctly internalized. +; CHECK: define internal void @bar() diff --git a/test/ELF/lto/invalid-bitcode.ll b/test/ELF/lto/invalid-bitcode.ll new file mode 100644 index 000000000000..eceffb10d8ad --- /dev/null +++ b/test/ELF/lto/invalid-bitcode.ll @@ -0,0 +1,12 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: not ld.lld -m elf_x86_64 %t.o 2>&1 | FileCheck %s + +; CHECK: invalid bitcode file: + +; This bitcode file has no datalayout. +target triple = "x86_64-unknown-linux-gnu" + +define void @_start() { + ret void +} diff --git a/test/ELF/lto/irmover-error.ll b/test/ELF/lto/irmover-error.ll new file mode 100644 index 000000000000..aee411441c47 --- /dev/null +++ b/test/ELF/lto/irmover-error.ll @@ -0,0 +1,12 @@ +; RUN: llvm-as -o %t1.bc %s +; RUN: llvm-as -o %t2.bc %S/Inputs/irmover-error.ll +; RUN: not ld.lld -m elf_x86_64 %t1.bc %t2.bc -o %t 2>&1 | FileCheck %s + +; CHECK: failed to link module {{.*}}2.bc: linking module flags 'foo': IDs have conflicting values + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +!0 = !{ i32 1, !"foo", i32 1 } + +!llvm.module.flags = !{ !0 } diff --git a/test/ELF/lto/linkage.ll b/test/ELF/lto/linkage.ll new file mode 100644 index 000000000000..5af9b321eeec --- /dev/null +++ b/test/ELF/lto/linkage.ll @@ -0,0 +1,20 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t1.o +; RUN: ld.lld -m elf_x86_64 %t1.o %t1.o -o %t.so -shared +; RUN: llvm-nm %t.so | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; Should not encounter a duplicate symbol error for @.str +@.str = private unnamed_addr constant [4 x i8] c"Hey\00", align 1 + +; Should not encounter a duplicate symbol error for @llvm.global_ctors +@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @ctor, i8* null }] +define internal void @ctor() { + ret void +} + +; Should not try to merge a declaration into the combined module. +declare i32 @llvm.ctpop.i32(i32) +; CHECK-NOT: llvm.ctpop.i32 diff --git a/test/ELF/lto/linkonce-odr.ll b/test/ELF/lto/linkonce-odr.ll new file mode 100644 index 000000000000..569e27154545 --- /dev/null +++ b/test/ELF/lto/linkonce-odr.ll @@ -0,0 +1,17 @@ +; REQUIRES: x86 +; RUN: llvm-as %p/Inputs/linkonce-odr.ll -o %t1.o +; RUN: llc -relocation-model=pic %s -o %t2.o -filetype=obj +; RUN: ld.lld %t1.o %t2.o -o %t.so -shared -save-temps +; RUN: llvm-dis %t.so.lto.opt.bc -o - | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" +declare void @f() + +define void @g() { + call void @f() + ret void +} + +; Be sure that 'f' is kept and has weak_odr linkage. +; CHECK: define weak_odr void @f() diff --git a/test/ELF/lto/linkonce.ll b/test/ELF/lto/linkonce.ll new file mode 100644 index 000000000000..f980eff887b1 --- /dev/null +++ b/test/ELF/lto/linkonce.ll @@ -0,0 +1,17 @@ +; REQUIRES: x86 +; RUN: llvm-as %p/Inputs/linkonce.ll -o %t1.o +; RUN: llc -relocation-model=pic %s -o %t2.o -filetype=obj +; RUN: ld.lld %t1.o %t2.o -o %t.so -shared -save-temps +; RUN: llvm-dis %t.so.lto.opt.bc -o - | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" +declare void @f() + +define void @g() { + call void @f() + ret void +} + +; Be sure that 'f' is kept and has weak linkage. +; CHECK: define weak void @f() diff --git a/test/ELF/lto/lto-start.ll b/test/ELF/lto/lto-start.ll new file mode 100644 index 000000000000..e93eecfbf033 --- /dev/null +++ b/test/ELF/lto/lto-start.ll @@ -0,0 +1,23 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld -m elf_x86_64 %t.o -o %t2 +; RUN: llvm-readobj -t %t2 | FileCheck %s + +; CHECK: Format: ELF64-x86-64 +; CHECK-NEXT: Arch: x86_64 +; CHECK-NEXT: AddressSize: 64bit + +; CHECK: Name: _start +; CHECK-NEXT: Value: +; CHECK-NEXT: Size: 1 +; CHECK-NEXT: Binding: Global +; CHECK-NEXT: Type: Function +; CHECK-NEXT: Other: +; CHECK-NEXT: Section: .text + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +define void @_start() { + ret void +} diff --git a/test/ELF/lto/ltopasses-basic.ll b/test/ELF/lto/ltopasses-basic.ll new file mode 100644 index 000000000000..5bd5f4122fd0 --- /dev/null +++ b/test/ELF/lto/ltopasses-basic.ll @@ -0,0 +1,18 @@ +; REQUIRES: x86 +; RUN: rm -f %t.so.lto.bc %t.so.lto.opt.bc %t.so.lto.o +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -save-temps -mllvm -debug-pass=Arguments -shared 2>&1 | FileCheck %s --check-prefix=MLLVM +; RUN: llvm-dis %t.so.lto.opt.bc -o - | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @ctor, i8* null }] +define void @ctor() { + ret void +} + +; `@ctor` doesn't do anything and so the optimizer should kill it, leaving no ctors +; CHECK: @llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer + +; MLLVM: Pass Arguments: diff --git a/test/ELF/lto/ltopasses-custom.ll b/test/ELF/lto/ltopasses-custom.ll new file mode 100644 index 000000000000..3e982e079fb1 --- /dev/null +++ b/test/ELF/lto/ltopasses-custom.ll @@ -0,0 +1,30 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -save-temps --lto-aa-pipeline=basic-aa \ +; RUN: --lto-newpm-passes=ipsccp -shared +; RUN: ld.lld -m elf_x86_64 %t.o -o %t2.so -save-temps --lto-newpm-passes=loweratomic -shared +; RUN: llvm-dis %t.so.lto.opt.bc -o - | FileCheck %s +; RUN: llvm-dis %t2.so.lto.opt.bc -o - | FileCheck %s --check-prefix=ATOMIC + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @barrier() { + fence seq_cst + ret void +} + +; IPSCCP won't remove the fence. +; CHECK: define void @barrier() { +; CHECK-NEXT: fence seq_cst +; CHECK-NEXT: ret void + +; LowerAtomic will remove the fence. +; ATOMIC: define void @barrier() { +; ATOMIC-NEXT: ret void + +; Check that invalid passes are rejected gracefully. +; RUN: not ld.lld -m elf_x86_64 %t.o -o %t2.so \ +; RUN: --lto-newpm-passes=iamnotapass -shared 2>&1 | \ +; RUN: FileCheck %s --check-prefix=INVALID +; INVALID: unable to parse pass pipeline description: iamnotapass diff --git a/test/ELF/lto/metadata.ll b/test/ELF/lto/metadata.ll new file mode 100644 index 000000000000..3e73de5aab47 --- /dev/null +++ b/test/ELF/lto/metadata.ll @@ -0,0 +1,13 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t1.o +; RUN: ld.lld -m elf_x86_64 %t1.o %t1.o -o %t.so -shared + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define weak void @foo(i32* %p) { + store i32 5, i32* %p, align 4, !tbaa !0 + ret void +} + +!0 = !{!"Simple C/C++ TBAA"} diff --git a/test/ELF/lto/mix-platforms.ll b/test/ELF/lto/mix-platforms.ll new file mode 100644 index 000000000000..3478caa5cff6 --- /dev/null +++ b/test/ELF/lto/mix-platforms.ll @@ -0,0 +1,10 @@ +; REQUIRES: x86 +; RUN: llvm-mc %p/Inputs/shared.s -o %t386.o -filetype=obj -triple=i386-pc-linux +; RUN: ld.lld %t386.o -o %ti386.so -shared +; RUN: llvm-as %s -o %tx64.o +; RUN: not ld.lld %ti386.so %tx64.o -o %t 2>&1 | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; CHECK: {{.*}}x64.o is incompatible with {{.*}}i386.so diff --git a/test/ELF/lto/module-asm.ll b/test/ELF/lto/module-asm.ll new file mode 100644 index 000000000000..1389b9f5472e --- /dev/null +++ b/test/ELF/lto/module-asm.ll @@ -0,0 +1,19 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld -m elf_x86_64 %t.o -o %t +; RUN: llvm-nm %t | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +module asm ".text" +module asm ".globl foo" +; CHECK: T foo +module asm "foo: ret" + +declare void @foo() + +define void @_start() { + call void @foo() + ret void +} diff --git a/test/ELF/lto/opt-level.ll b/test/ELF/lto/opt-level.ll new file mode 100644 index 000000000000..934bf01b6c32 --- /dev/null +++ b/test/ELF/lto/opt-level.ll @@ -0,0 +1,29 @@ +; RUN: llvm-as -o %t.o %s +; RUN: ld.lld -o %t0 -m elf_x86_64 -e main --lto-O0 %t.o +; RUN: llvm-nm %t0 | FileCheck --check-prefix=CHECK-O0 %s +; RUN: ld.lld -o %t2 -m elf_x86_64 -e main --lto-O2 %t.o +; RUN: llvm-nm %t2 | FileCheck --check-prefix=CHECK-O2 %s +; RUN: ld.lld -o %t2a -m elf_x86_64 -e main %t.o +; RUN: llvm-nm %t2a | FileCheck --check-prefix=CHECK-O2 %s + +; Reject invalid optimization levels. +; RUN: not ld.lld -o %t3 -m elf_x86_64 -e main --lto-O6 %t.o 2>&1 | \ +; RUN: FileCheck --check-prefix=INVALID %s +; INVALID: invalid optimization level for LTO: 6 +; RUN: not ld.lld -o %t3 -m elf_x86_64 -e main --lto-O-1 %t.o 2>&1 | \ +; RUN: FileCheck --check-prefix=INVALIDNEGATIVE %s +; INVALIDNEGATIVE: invalid optimization level for LTO: -1 + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; CHECK-O0: foo +; CHECK-O2-NOT: foo +define internal void @foo() { + ret void +} + +define void @main() { + call void @foo() + ret void +} diff --git a/test/ELF/lto/parallel-internalize.ll b/test/ELF/lto/parallel-internalize.ll new file mode 100644 index 000000000000..58ed50eab894 --- /dev/null +++ b/test/ELF/lto/parallel-internalize.ll @@ -0,0 +1,57 @@ +; REQUIRES: x86 +; RUN: llvm-as -o %t.bc %s +; RUN: ld.lld -m elf_x86_64 --lto-jobs=2 -save-temps -o %t %t.bc -e foo --lto-O0 +; RUN: llvm-readobj -t -dyn-symbols %t | FileCheck %s +; RUN: llvm-nm %t0.lto.o | FileCheck --check-prefix=CHECK0 %s +; RUN: llvm-nm %t1.lto.o | FileCheck --check-prefix=CHECK1 %s + +; CHECK: Symbols [ +; CHECK-NEXT: Symbol { +; CHECK-NEXT: Name: (0) +; CHECK-NEXT: Value: 0x0 +; CHECK-NEXT: Size: 0 +; CHECK-NEXT: Binding: Local (0x0) +; CHECK-NEXT: Type: None (0x0) +; CHECK-NEXT: Other: 0 +; CHECK-NEXT: Section: Undefined (0x0) +; CHECK-NEXT: } +; CHECK-NEXT: Symbol { +; CHECK-NEXT: Name: bar (5) +; CHECK-NEXT: Value: 0x11010 +; CHECK-NEXT: Size: 8 +; CHECK-NEXT: Binding: Local (0x0) +; CHECK-NEXT: Type: Function (0x2) +; CHECK-NEXT: Other [ (0x2) +; CHECK-NEXT: STV_HIDDEN (0x2) +; CHECK-NEXT: ] +; CHECK-NEXT: Section: .text (0x2) +; CHECK-NEXT: } +; CHECK-NEXT: Symbol { +; CHECK-NEXT: Name: foo (1) +; CHECK-NEXT: Value: 0x11000 +; CHECK-NEXT: Size: 8 +; CHECK-NEXT: Binding: Global (0x1) +; CHECK-NEXT: Type: Function (0x2) +; CHECK-NEXT: Other: 0 +; CHECK-NEXT: Section: .text (0x2) +; CHECK-NEXT: } +; CHECK-NEXT: ] +; CHECK-NEXT: DynamicSymbols [ +; CHECK-NEXT: ] + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; CHECK0: U bar +; CHECK0: T foo +define void @foo() { + call void @bar() + ret void +} + +; CHECK1: T bar +; CHECK1: U foo +define void @bar() { + call void @foo() + ret void +} diff --git a/test/ELF/lto/parallel.ll b/test/ELF/lto/parallel.ll new file mode 100644 index 000000000000..8ea62ef3ae08 --- /dev/null +++ b/test/ELF/lto/parallel.ll @@ -0,0 +1,24 @@ +; REQUIRES: x86 +; RUN: llvm-as -o %t.bc %s +; RUN: ld.lld -m elf_x86_64 --lto-jobs=2 -save-temps -o %t %t.bc -shared +; RUN: llvm-nm %t0.lto.o | FileCheck --check-prefix=CHECK0 %s +; RUN: llvm-nm %t1.lto.o | FileCheck --check-prefix=CHECK1 %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; CHECK0-NOT: bar +; CHECK0: T foo +; CHECK0-NOT: bar +define void @foo() { + call void @bar() + ret void +} + +; CHECK1-NOT: foo +; CHECK1: T bar +; CHECK1-NOT: foo +define void @bar() { + call void @foo() + ret void +} diff --git a/test/ELF/lto/pic.ll b/test/ELF/lto/pic.ll new file mode 100644 index 000000000000..abc514d7ca3d --- /dev/null +++ b/test/ELF/lto/pic.ll @@ -0,0 +1,20 @@ +; REQUIRES: x86 + +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld %t.o -o %t.so -shared +; RUN: llvm-readobj -r %t.so | FileCheck %s + +; CHECK: Relocations [ +; CHECK-NEXT: Section ({{.*}}) .rela.plt { +; CHECK-NEXT: R_X86_64_JUMP_SLOT bar 0x0 +; CHECK-NEXT: } +; CHECK-NEXT: ] + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +declare void @bar() +define void @foo() { + call void @bar() + ret void +} diff --git a/test/ELF/lto/relax-relocs.ll b/test/ELF/lto/relax-relocs.ll new file mode 100644 index 000000000000..929e124b2d8e --- /dev/null +++ b/test/ELF/lto/relax-relocs.ll @@ -0,0 +1,15 @@ +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld -m elf_x86_64 -save-temps -shared %t.o -o %t.so +; RUN: llvm-readobj -r %t.so.lto.o | FileCheck %s + +; Test that we produce R_X86_64_REX_GOTPCRELX instead of R_X86_64_GOTPCREL +; CHECK: R_X86_64_REX_GOTPCRELX foo + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@foo = external global i32 +define i32 @bar() { + %t = load i32, i32* @foo + ret i32 %t +} diff --git a/test/ELF/lto/resolution.ll b/test/ELF/lto/resolution.ll new file mode 100644 index 000000000000..b3fcf1db3a1b --- /dev/null +++ b/test/ELF/lto/resolution.ll @@ -0,0 +1,27 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t1.o +; RUN: llvm-mc -triple=x86_64-pc-linux %p/Inputs/resolution.s -o %t2.o -filetype=obj +; RUN: ld.lld %t1.o %t2.o -o %t.so -shared +; RUN: llvm-readobj -s --section-data %t.so | FileCheck %s + +; CHECK: Name: .data +; CHECK-NEXT: Type: SHT_PROGBITS +; CHECK-NEXT: Flags [ +; CHECK-NEXT: SHF_ALLOC +; CHECK-NEXT: SHF_WRITE +; CHECK-NEXT: ] +; CHECK-NEXT: Address: +; CHECK-NEXT: Offset: +; CHECK-NEXT: Size: 4 +; CHECK-NEXT: Link: 0 +; CHECK-NEXT: Info: 0 +; CHECK-NEXT: AddressAlignment: 1 +; CHECK-NEXT: EntrySize: 0 +; CHECK-NEXT: SectionData ( +; CHECK-NEXT: 0000: 09000000 |{{.*}}| +; CHECK-NEXT: ) + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@a = weak global i32 8 diff --git a/test/ELF/lto/save-temps.ll b/test/ELF/lto/save-temps.ll new file mode 100644 index 000000000000..0b0f939c53f1 --- /dev/null +++ b/test/ELF/lto/save-temps.ll @@ -0,0 +1,20 @@ +; REQUIRES: x86 +; RUN: cd %T +; RUN: rm -f a.out a.out.lto.bc a.out.lto.o +; RUN: llvm-as %s -o %t.o +; RUN: llvm-as %p/Inputs/save-temps.ll -o %t2.o +; RUN: ld.lld -shared -m elf_x86_64 %t.o %t2.o -save-temps +; RUN: llvm-nm a.out | FileCheck %s +; RUN: llvm-nm a.out.lto.bc | FileCheck %s +; RUN: llvm-nm a.out.lto.o | FileCheck %s +; RUN: llvm-dis a.out.lto.bc + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +define void @foo() { + ret void +} + +; CHECK: T bar +; CHECK: T foo diff --git a/test/ELF/lto/shlib-undefined.ll b/test/ELF/lto/shlib-undefined.ll new file mode 100644 index 000000000000..db60de8e21b2 --- /dev/null +++ b/test/ELF/lto/shlib-undefined.ll @@ -0,0 +1,27 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: echo .global __progname > %t2.s +; RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t2.s -o %t2.o +; RUN: ld.lld -shared %t2.o -o %t2.so +; RUN: ld.lld -o %t %t.o %t2.so +; RUN: llvm-readobj -dyn-symbols %t | FileCheck %s + +; CHECK: Name: __progname@ +; CHECK-NEXT: Value: 0x11010 +; CHECK-NEXT: Size: 1 +; CHECK-NEXT: Binding: Global (0x1) +; CHECK-NEXT: Type: Function +; CHECK-NEXT: Other: 0 +; CHECK-NEXT: Section: .text +; CHECK-NEXT: } + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +define void @_start() { + ret void +} + +define void @__progname() { + ret void +} diff --git a/test/ELF/lto/start-lib.ll b/test/ELF/lto/start-lib.ll new file mode 100644 index 000000000000..ec73954a80ca --- /dev/null +++ b/test/ELF/lto/start-lib.ll @@ -0,0 +1,27 @@ +; REQUIRES: x86 +; +; RUN: llvm-as %s -o %t1.o +; RUN: llvm-as %p/Inputs/start-lib1.ll -o %t2.o +; RUN: llvm-as %p/Inputs/start-lib2.ll -o %t3.o +; +; RUN: ld.lld -m elf_x86_64 -shared -o %t3 %t1.o %t2.o %t3.o +; RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=TEST1 %s +; TEST1: Name: bar +; TEST1: Name: foo +; +; RUN: ld.lld -m elf_x86_64 -shared -o %t3 -u bar %t1.o --start-lib %t2.o %t3.o +; RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=TEST2 %s +; TEST2: Name: bar +; TEST2-NOT: Name: foo +; +; RUN: ld.lld -m elf_x86_64 -shared -o %t3 %t1.o --start-lib %t2.o %t3.o +; RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=TEST3 %s +; TEST3-NOT: Name: bar +; TEST3-NOT: Name: foo + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @_start() { + ret void +} diff --git a/test/ELF/lto/tls-mixed.ll b/test/ELF/lto/tls-mixed.ll new file mode 100644 index 000000000000..524bb4fb44a3 --- /dev/null +++ b/test/ELF/lto/tls-mixed.ll @@ -0,0 +1,10 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t1.o +; RUN: llvm-mc %p/Inputs/tls-mixed.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux +; RUN: ld.lld -m elf_x86_64 %t1.o %t2.o -o %t.so -shared + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; Should not encounter TLS-ness mismatch for @foo +@foo = external thread_local global i32, align 4 diff --git a/test/ELF/lto/tls-preserve.ll b/test/ELF/lto/tls-preserve.ll new file mode 100644 index 000000000000..8aebcb783f48 --- /dev/null +++ b/test/ELF/lto/tls-preserve.ll @@ -0,0 +1,25 @@ +; TLS attribute needs to be preserved. +; REQUIRES: x86 +; RUN: llvm-as %s -o %t1.o +; RUN: ld.lld -shared %t1.o -m elf_x86_64 -o %t1 +; RUN: llvm-readobj -t %t1 | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@tsp_int = thread_local global i32 1 + +define void @_start() { + %val = load i32, i32* @tsp_int + ret void +} + +; CHECK: Symbol { +; CHECK: Name: tsp_int +; CHECK-NEXT: Value: 0x0 +; CHECK-NEXT: Size: 4 +; CHECK-NEXT: Binding: Global +; CHECK-NEXT: Type: TLS +; CHECK-NEXT: Other: 0 +; CHECK-NEXT: Section: .tdata +; CHECK-NEXT: } diff --git a/test/ELF/lto/type-merge.ll b/test/ELF/lto/type-merge.ll new file mode 100644 index 000000000000..98db53970b0c --- /dev/null +++ b/test/ELF/lto/type-merge.ll @@ -0,0 +1,26 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: llvm-as %p/Inputs/type-merge.ll -o %t2.o +; RUN: ld.lld -m elf_x86_64 %t.o %t2.o -o %t -shared -save-temps +; RUN: llvm-dis < %t.lto.bc | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @foo() { + call void @bar(i8* null) + ret void +} +declare void @bar(i8*) + +; CHECK: define void @foo() { +; CHECK-NEXT: call void @bar(i8* null) +; CHECK-NEXT: ret void +; CHECK-NEXT: } + +; CHECK: declare void @bar(i8*) + +; CHECK: define void @zed() { +; CHECK-NEXT: call void bitcast (void (i8*)* @bar to void ()*)() +; CHECK-NEXT: ret void +; CHECK-NEXT: } diff --git a/test/ELF/lto/type-merge2.ll b/test/ELF/lto/type-merge2.ll new file mode 100644 index 000000000000..f0931ddc9d5e --- /dev/null +++ b/test/ELF/lto/type-merge2.ll @@ -0,0 +1,27 @@ +; RUN: llvm-as %s -o %t.o +; RUN: llvm-as %p/Inputs/type-merge2.ll -o %t2.o +; RUN: ld.lld -m elf_x86_64 %t.o %t2.o -o %t.so -shared -save-temps +; RUN: llvm-dis %t.so.lto.bc -o - | FileCheck %s + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +%zed = type { i8 } +define void @foo() { + call void @bar(%zed* null) + ret void +} +declare void @bar(%zed*) + +; CHECK: %zed = type { i8 } +; CHECK-NEXT: %zed.0 = type { i16 } + +; CHECK: define void @foo() { +; CHECK-NEXT: call void bitcast (void (%zed.0*)* @bar to void (%zed*)*)(%zed* null) +; CHECK-NEXT: ret void +; CHECK-NEXT: } + +; CHECK: define void @bar(%zed.0* %this) { +; CHECK-NEXT: store %zed.0* %this, %zed.0** null +; CHECK-NEXT: ret void +; CHECK-NEXT: } diff --git a/test/ELF/lto/undef-mixed.ll b/test/ELF/lto/undef-mixed.ll new file mode 100644 index 000000000000..0fff5781020c --- /dev/null +++ b/test/ELF/lto/undef-mixed.ll @@ -0,0 +1,22 @@ +; REQUIRES: x86 +; RUN: llvm-mc %p/Inputs/undef-mixed.s -o %t.o -filetype=obj -triple=x86_64-pc-linux +; RUN: llvm-as %s -o %t2.o +; RUN: ld.lld %t2.o %t.o -o %t.so -shared +; RUN: llvm-readobj -t %t.so | FileCheck %s + +; CHECK: Name: bar +; CHECK-NEXT: Value: +; CHECK-NEXT: Size: 0 +; CHECK-NEXT: Binding: Global +; CHECK-NEXT: Type: None +; CHECK-NEXT: Other: 0 +; CHECK-NEXT: Section: .text + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +declare void @bar() +define void @foo() { + call void @bar() + ret void +} diff --git a/test/ELF/lto/undef-weak.ll b/test/ELF/lto/undef-weak.ll new file mode 100644 index 000000000000..215978a73df0 --- /dev/null +++ b/test/ELF/lto/undef-weak.ll @@ -0,0 +1,29 @@ +; REQUIRES: x86 + +; RUN: llvm-as %S/Inputs/archive.ll -o %t1.o +; RUN: rm -f %t.a +; RUN: llvm-ar rcs %t.a %t1.o + + +; RUN: llvm-as %s -o %t2.o +; RUN: ld.lld -m elf_x86_64 %t2.o -o %t2.so %t.a -shared +; RUN: llvm-readobj -t %t2.so | FileCheck %s +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +declare extern_weak void @f() +define void @foo() { + call void @f() + ret void +} + +; We should not fetch the archive member. + +; CHECK: Name: f ({{.*}}) +; CHECK-NEXT: Value: 0x0 +; CHECK-NEXT: Size: 0 +; CHECK-NEXT: Binding: Weak +; CHECK-NEXT: Type: None +; CHECK-NEXT: Other: 0 +; CHECK-NEXT: Section: Undefined + diff --git a/test/ELF/lto/undef.ll b/test/ELF/lto/undef.ll new file mode 100644 index 000000000000..41da61052290 --- /dev/null +++ b/test/ELF/lto/undef.ll @@ -0,0 +1,20 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -shared +; RUN: llvm-readobj -t %t.so | FileCheck %s +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +declare void @bar() +define void @foo() { + call void @bar() + ret void +} + +; CHECK: Name: bar +; CHECK-NEXT: Value: 0x0 +; CHECK-NEXT: Size: 0 +; CHECK-NEXT: Binding: Global +; CHECK-NEXT: Type: None +; CHECK-NEXT: Other: 0 +; CHECK-NEXT: Section: Undefined diff --git a/test/ELF/lto/undefined-puts.ll b/test/ELF/lto/undefined-puts.ll new file mode 100644 index 000000000000..54fb32cef4a2 --- /dev/null +++ b/test/ELF/lto/undefined-puts.ll @@ -0,0 +1,28 @@ +; REQUIRES: x86 +; RUN: llvm-mc %p/Inputs/shared.s -o %t1.o -filetype=obj -triple=x86_64-unknown-linux +; RUN: ld.lld %t1.o -o %t1.so -shared +; RUN: llvm-as %s -o %t2.o +; RUN: ld.lld %t1.so %t2.o -m elf_x86_64 -o %t +; RUN: llvm-readobj -dyn-symbols -dyn-relocations %t | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@.str = private unnamed_addr constant [6 x i8] c"blah\0A\00", align 1 + +define i32 @_start() { + %str = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0)) + ret i32 0 +} + +declare i32 @printf(i8*, ...) + +; Check that puts symbol is present in the dynamic symbol table and +; there's a relocation for it. +; CHECK: Dynamic Relocations { +; CHECK-NEXT: 0x13018 R_X86_64_JUMP_SLOT puts 0x0 +; CHECK-NEXT: } + +; CHECK: DynamicSymbols [ +; CHECK: Symbol { +; CHECK: Name: puts@ diff --git a/test/ELF/lto/unnamed-addr-comdat.ll b/test/ELF/lto/unnamed-addr-comdat.ll new file mode 100644 index 000000000000..c8c36de88d4c --- /dev/null +++ b/test/ELF/lto/unnamed-addr-comdat.ll @@ -0,0 +1,11 @@ +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld -m elf_x86_64 %t.o %t.o -o %t.so -save-temps -shared +; RUN: llvm-dis %t.so.lto.bc -o - | FileCheck %s + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +$foo = comdat any +@foo = linkonce_odr unnamed_addr constant i32 42, comdat + +; CHECK: @foo = internal unnamed_addr constant i32 42, comdat diff --git a/test/ELF/lto/unnamed-addr-lib.ll b/test/ELF/lto/unnamed-addr-lib.ll new file mode 100644 index 000000000000..c1c31f84bc8e --- /dev/null +++ b/test/ELF/lto/unnamed-addr-lib.ll @@ -0,0 +1,21 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: llvm-mc %p/Inputs/unnamed-addr-lib.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux +; RUN: ld.lld %t2.o -shared -o %t2.so +; RUN: ld.lld -m elf_x86_64 %t.o %t2.so -o %t.so -save-temps -shared +; RUN: llvm-dis %t.so.lto.bc -o - | FileCheck %s + +; This documents a small limitation of lld's internalization logic. We decide +; that bar should be in the symbol table because if it is it will preempt the +; one in the shared library. +; We could add one extra bit for ODR so that we know that preemption is not +; necessary, but that is probably not worth it. + +; CHECK: @foo = internal unnamed_addr constant i8 42 +; CHECK: @bar = weak_odr unnamed_addr constant i8 42 + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@foo = linkonce_odr unnamed_addr constant i8 42 +@bar = linkonce_odr unnamed_addr constant i8 42 diff --git a/test/ELF/lto/unnamed-addr.ll b/test/ELF/lto/unnamed-addr.ll new file mode 100644 index 000000000000..a2c0105fd85f --- /dev/null +++ b/test/ELF/lto/unnamed-addr.ll @@ -0,0 +1,14 @@ +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -save-temps -shared +; RUN: llvm-dis %t.so.lto.opt.bc -o - | FileCheck %s + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +@a = internal unnamed_addr constant i8 42 + +define i8* @f() { + ret i8* @a +} + +; CHECK: @a = internal unnamed_addr constant i8 42 diff --git a/test/ELF/lto/verify-invalid.ll b/test/ELF/lto/verify-invalid.ll new file mode 100644 index 000000000000..16d6a3e54f12 --- /dev/null +++ b/test/ELF/lto/verify-invalid.ll @@ -0,0 +1,17 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld -m elf_x86_64 %t.o -o %t2 -mllvm -debug-pass=Arguments \ +; RUN: 2>&1 | FileCheck -check-prefix=DEFAULT %s +; RUN: ld.lld -m elf_x86_64 %t.o -o %t2 -mllvm -debug-pass=Arguments \ +; RUN: -disable-verify 2>&1 | FileCheck -check-prefix=DISABLE %s + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +define void @_start() { + ret void +} + +; -disable-verify should disable the verification of bitcode. +; DEFAULT: Pass Arguments: {{.*}} -verify {{.*}} -verify +; DISABLE-NOT: Pass Arguments: {{.*}} -verify {{.*}} -verify diff --git a/test/ELF/lto/version-script.ll b/test/ELF/lto/version-script.ll new file mode 100644 index 000000000000..11a7f073ab51 --- /dev/null +++ b/test/ELF/lto/version-script.ll @@ -0,0 +1,50 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: echo "VERSION_1.0{ global: foo; local: *; }; VERSION_2.0{ global: bar; local: *; };" > %t.script +; RUN: ld.lld -m elf_x86_64 %t.o -o %t2 -shared --version-script %t.script -save-temps +; RUN: llvm-dis < %t2.lto.bc | FileCheck %s +; RUN: llvm-readobj -V -dyn-symbols %t2 | FileCheck --check-prefix=DSO %s + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +define void @foo() { + ret void +} + +define void @bar() { + ret void +} + +; CHECK: define void @foo() +; CHECK: define void @bar() + +; DSO: DynamicSymbols [ +; DSO: Symbol { +; DSO: Name: @ (0) +; DSO: Value: 0x0 +; DSO: Size: 0 +; DSO: Binding: Local +; DSO: Type: None +; DSO: Other: 0 +; DSO: Section: Undefined +; DSO: } +; DSO: Symbol { +; DSO: Name: foo@@VERSION_1.0 +; DSO: Value: 0x1000 +; DSO: Size: 1 +; DSO: Binding: Global +; DSO: Type: Function +; DSO: Other: 0 +; DSO: Section: .text +; DSO: } +; DSO: Symbol { +; DSO: Name: bar@@VERSION_2.0 +; DSO: Value: 0x1010 +; DSO: Size: 1 +; DSO: Binding: Global +; DSO: Type: Function +; DSO: Other: 0 +; DSO: Section: .text +; DSO: } +; DSO: ] diff --git a/test/ELF/lto/visibility.ll b/test/ELF/lto/visibility.ll new file mode 100644 index 000000000000..718cc5b06986 --- /dev/null +++ b/test/ELF/lto/visibility.ll @@ -0,0 +1,35 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t1.o +; RUN: llvm-mc -triple=x86_64-pc-linux %p/Inputs/visibility.s -o %t2.o -filetype=obj +; RUN: ld.lld %t1.o %t2.o -o %t.so -shared +; RUN: llvm-readobj -t %t.so | FileCheck %s + +; CHECK: Name: g +; CHECK-NEXT: Value: 0x1000 +; CHECK-NEXT: Size: 0 +; CHECK-NEXT: Binding: Local +; CHECK-NEXT: Type: None +; CHECK-NEXT: Other [ (0x2) +; CHECK-NEXT: STV_HIDDEN +; CHECK-NEXT: ] +; CHECK-NEXT: Section: .text + +; CHECK: Name: a +; CHECK-NEXT: Value: 0x3000 +; CHECK-NEXT: Size: 0 +; CHECK-NEXT: Binding: Local +; CHECK-NEXT: Type: None +; CHECK-NEXT: Other [ (0x2) +; CHECK-NEXT: STV_HIDDEN +; CHECK-NEXT: ] +; CHECK-NEXT: Section: .data + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +declare hidden void @g() +define void @f() { + call void @g() + ret void +} +@a = weak hidden global i32 42 diff --git a/test/ELF/lto/weak.ll b/test/ELF/lto/weak.ll new file mode 100644 index 000000000000..381ef7a1a347 --- /dev/null +++ b/test/ELF/lto/weak.ll @@ -0,0 +1,16 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld -m elf_x86_64 %t.o %t.o -o %t.so -shared +; RUN: llvm-readobj -t %t.so | FileCheck %s + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +define weak void @f() { + ret void +} + +; CHECK: Name: f +; CHECK-NEXT: Value: 0x1000 +; CHECK-NEXT: Size: 1 +; CHECK-NEXT: Binding: Weak diff --git a/test/ELF/merge-shared-str.s b/test/ELF/merge-shared-str.s new file mode 100644 index 000000000000..2ab03a4d66ab --- /dev/null +++ b/test/ELF/merge-shared-str.s @@ -0,0 +1,28 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: ld.lld %t.o -o %t.so -shared -O3 +// RUN: llvm-readobj -r -s %t.so | FileCheck %s + + + .section foo,"aMS",@progbits,1 + .asciz "bar" + .asciz "ar" + + .data + .quad foo + 4 + + +// CHECK: Name: foo +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_MERGE +// CHECK-NEXT: SHF_STRINGS +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x1C8 + +// CHECK: Relocations [ +// CHECK-NEXT: Section ({{.*}}) .rela.dyn { +// CHECK-NEXT: 0x{{.*}} R_X86_64_RELATIVE - 0x1C9 +// CHECK-NEXT: } +// CHECK-NEXT: ] diff --git a/test/ELF/merge-shared.s b/test/ELF/merge-shared.s index 702a4e195f32..4c1d7c06a0ba 100644 --- a/test/ELF/merge-shared.s +++ b/test/ELF/merge-shared.s @@ -7,7 +7,7 @@ .long 42 .long 42 - .text + .data .quad foo + 6 diff --git a/test/ELF/merge-string-align.s b/test/ELF/merge-string-align.s index b06920ac0af8..0cb1afc8ba7d 100644 --- a/test/ELF/merge-string-align.s +++ b/test/ELF/merge-string-align.s @@ -1,15 +1,20 @@ // REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: ld.lld %t.o -o %t.so -shared -// RUN: llvm-readobj -s %t.so | FileCheck %s +// RUN: llvm-readobj -s -section-data %t.so | FileCheck %s - .section .rodata.str1.16,"aMS",@progbits,1 + .section .rodata.foo,"aMS",@progbits,1 .align 16 .asciz "foo" - .section .rodata.str1.1,"aMS",@progbits,1 + .section .rodata.foo2,"aMS",@progbits,1 + .align 16 .asciz "foo" + .section .rodata.bar,"aMS",@progbits,1 + .align 16 + .asciz "bar" + // CHECK: Name: .rodata // CHECK-NEXT: Type: SHT_PROGBITS // CHECK-NEXT: Flags [ @@ -19,10 +24,18 @@ // CHECK-NEXT: ] // CHECK-NEXT: Address: // CHECK-NEXT: Offset: -// CHECK-NEXT: Size: 4 +// CHECK-NEXT: Size: 20 // CHECK-NEXT: Link: 0 // CHECK-NEXT: Info: 0 // CHECK-NEXT: AddressAlignment: 16 +// CHECK-NEXT: EntrySize: +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 666F6F00 00000000 00000000 00000000 |foo.............| +// CHECK-NEXT: 0010: 62617200 |bar.| +// CHECK-NEXT: ) + + .section .rodata.str1.1,"aMS",@progbits,1 + .asciz "foo" // CHECK: Name: .rodata // CHECK-NEXT: Type: SHT_PROGBITS @@ -37,3 +50,7 @@ // CHECK-NEXT: Link: 0 // CHECK-NEXT: Info: 0 // CHECK-NEXT: AddressAlignment: 1 +// CHECK-NEXT: EntrySize: +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 666F6F00 |foo.| +// CHECK-NEXT: ) diff --git a/test/ELF/merge-string-error.s b/test/ELF/merge-string-error.s index 58a624329ed9..c5088acf63b6 100644 --- a/test/ELF/merge-string-error.s +++ b/test/ELF/merge-string-error.s @@ -5,7 +5,7 @@ .section .rodata.str1.1,"aMS",@progbits,1 .asciz "abc" - .text + .data .long .rodata.str1.1 + 4 -// CHECK: Entry is past the end of the section +// CHECK: entry is past the end of the section diff --git a/test/ELF/merge-string-no-null.s b/test/ELF/merge-string-no-null.s index 70d6bbbc32e8..fd3f5073810a 100644 --- a/test/ELF/merge-string-no-null.s +++ b/test/ELF/merge-string-no-null.s @@ -5,4 +5,4 @@ .section .rodata.str1.1,"aMS",@progbits,1 .ascii "abc" -// CHECK: String is not null terminated +// CHECK: string is not null terminated diff --git a/test/ELF/merge-string.s b/test/ELF/merge-string.s index 40cc4415f956..2ad8afa53d6e 100644 --- a/test/ELF/merge-string.s +++ b/test/ELF/merge-string.s @@ -4,6 +4,8 @@ // RUN: llvm-readobj -s -section-data -t %t.so | FileCheck %s // RUN: ld.lld -O1 %t.o -o %t.so -shared // RUN: llvm-readobj -s -section-data -t %t.so | FileCheck --check-prefix=NOTAIL %s +// RUN: ld.lld -O0 %t.o -o %t.so -shared +// RUN: llvm-readobj -s -section-data -t %t.so | FileCheck --check-prefix=NOMERGE %s .section .rodata.str1.1,"aMS",@progbits,1 .asciz "abc" @@ -32,7 +34,7 @@ zed: // CHECK-NEXT: Link: 0 // CHECK-NEXT: Info: 0 // CHECK-NEXT: AddressAlignment: 1 -// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: EntrySize: 1 // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 61626300 |abc.| // CHECK-NEXT: ) @@ -50,11 +52,29 @@ zed: // NOTAIL-NEXT: Link: 0 // NOTAIL-NEXT: Info: 0 // NOTAIL-NEXT: AddressAlignment: 1 -// NOTAIL-NEXT: EntrySize: 0 +// NOTAIL-NEXT: EntrySize: 1 // NOTAIL-NEXT: SectionData ( // NOTAIL-NEXT: 0000: 61626300 626300 |abc.bc.| // NOTAIL-NEXT: ) +// NOMERGE: Name: .rodata +// NOMERGE-NEXT: Type: SHT_PROGBITS +// NOMERGE-NEXT: Flags [ +// NOMERGE-NEXT: SHF_ALLOC +// NOMERGE-NEXT: SHF_MERGE +// NOMERGE-NEXT: SHF_STRINGS +// NOMERGE-NEXT: ] +// NOMERGE-NEXT: Address: 0x1C8 +// NOMERGE-NEXT: Offset: 0x1C8 +// NOMERGE-NEXT: Size: 16 +// NOMERGE-NEXT: Link: 0 +// NOMERGE-NEXT: Info: 0 +// NOMERGE-NEXT: AddressAlignment: 2 +// NOMERGE-NEXT: EntrySize: 0 +// NOMERGE-NEXT: SectionData ( +// NOMERGE-NEXT: 0000: 61626300 61626300 62630000 14000000 |abc.abc.bc......| +// NOMERGE-NEXT: ) + // CHECK: Name: .rodata // CHECK-NEXT: Type: SHT_PROGBITS // CHECK-NEXT: Flags [ @@ -68,7 +88,7 @@ zed: // CHECK-NEXT: Link: 0 // CHECK-NEXT: Info: 0 // CHECK-NEXT: AddressAlignment: 2 -// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: EntrySize: 2 // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 14000000 |....| // CHECK-NEXT: ) diff --git a/test/ELF/merge.s b/test/ELF/merge.s index 9cead642fa8c..5039ec2251c0 100644 --- a/test/ELF/merge.s +++ b/test/ELF/merge.s @@ -29,7 +29,7 @@ zed: // CHECK-NEXT: Link: 0 // CHECK-NEXT: Info: 0 // CHECK-NEXT: AddressAlignment: 4 -// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: EntrySize: 4 // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 10000000 42000000 // CHECK-NEXT: ) @@ -61,7 +61,9 @@ zed: // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 2 +// CHECK-NEXT: Other [ (0x2) +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] // CHECK-NEXT: Section: .mysec // CHECK: ] diff --git a/test/ELF/mips-26.s b/test/ELF/mips-26.s new file mode 100644 index 000000000000..b463c1ac2127 --- /dev/null +++ b/test/ELF/mips-26.s @@ -0,0 +1,95 @@ +# Check R_MIPS_26 relocation handling. + +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t1.o +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \ +# RUN: %S/Inputs/mips-dynamic.s -o %t2.o +# RUN: ld.lld %t2.o -shared -o %t.so +# RUN: ld.lld %t1.o %t.so -o %t.exe +# RUN: llvm-objdump -d %t.exe | FileCheck %s +# RUN: llvm-readobj -dynamic-table -s -r -mips-plt-got %t.exe \ +# RUN: | FileCheck -check-prefix=REL %s + +# REQUIRES: mips + +# CHECK: Disassembly of section .text: +# CHECK-NEXT: bar: +# CHECK-NEXT: 20000: 0c 00 80 06 jal 131096 +# CHECK-NEXT: 20004: 00 00 00 00 nop +# +# CHECK: __start: +# CHECK-NEXT: 20008: 0c 00 80 00 jal 131072 +# CHECK-NEXT: 2000c: 00 00 00 00 nop +# CHECK-NEXT: 20010: 0c 00 80 10 jal 131136 +# ^-- 0x20040 gotplt[foo0] +# CHECK-NEXT: 20014: 00 00 00 00 nop +# +# CHECK: loc: +# CHECK-NEXT: 20018: 00 00 00 00 nop +# CHECK-NEXT: Disassembly of section .plt: +# CHECK-NEXT: .plt: +# CHECK-NEXT: 20020: 3c 1c 00 04 lui $gp, 4 +# CHECK-NEXT: 20024: 8f 99 00 04 lw $25, 4($gp) +# CHECK-NEXT: 20028: 27 9c 00 04 addiu $gp, $gp, 4 +# CHECK-NEXT: 2002c: 03 1c c0 23 subu $24, $24, $gp +# CHECK-NEXT: 20030: 03 e0 78 25 move $15, $ra +# CHECK-NEXT: 20034: 00 18 c0 82 srl $24, $24, 2 +# CHECK-NEXT: 20038: 03 20 f8 09 jalr $25 +# CHECK-NEXT: 2003c: 27 18 ff fe addiu $24, $24, -2 +# CHECK-NEXT: 20040: 3c 0f 00 04 lui $15, 4 +# CHECK-NEXT: 20044: 8d f9 00 0c lw $25, 12($15) +# CHECK-NEXT: 20048: 03 20 00 08 jr $25 +# CHECK-NEXT: 2004c: 25 f8 00 0c addiu $24, $15, 12 + +# REL: Name: .plt +# REL-NEXT: Type: SHT_PROGBITS +# REL-NEXT: Flags [ (0x6) +# REL-NEXT: SHF_ALLOC +# REL-NEXT: SHF_EXECINSTR +# REL-NEXT: ] +# REL-NEXT: Address: 0x[[PLTADDR:[0-9A-F]+]] + +# REL: Name: .got.plt +# REL-NEXT: Type: SHT_PROGBITS +# REL-NEXT: Flags [ (0x3) +# REL-NEXT: SHF_ALLOC +# REL-NEXT: SHF_WRITE +# REL-NEXT: ] +# REL-NEXT: Address: 0x[[GOTPLTADDR:[0-9A-F]+]] + +# REL: Relocations [ +# REL-NEXT: Section (7) .rel.plt { +# REL-NEXT: 0x[[PLTSLOT:[0-9A-F]+]] R_MIPS_JUMP_SLOT foo0 0x0 +# REL-NEXT: } +# REL-NEXT: ] + +# REL: 0x70000032 MIPS_PLTGOT 0x[[GOTPLTADDR]] + +# REL: Primary GOT { +# REL: Local entries [ +# REL-NEXT: ] +# REL-NEXT: Global entries [ +# REL-NEXT: ] +# REL: PLT GOT { +# REL: Entries [ +# REL-NEXT: Entry { +# REL-NEXT: Address: 0x[[PLTSLOT]] +# REL-NEXT: Initial: 0x[[PLTADDR]] +# REL-NEXT: Value: 0x0 +# REL-NEXT: Type: Function +# REL-NEXT: Section: Undefined +# REL-NEXT: Name: foo0 +# REL-NEXT: } +# REL-NEXT: ] + + .text + .globl bar +bar: + jal loc # R_MIPS_26 against .text + offset + + .globl __start +__start: + jal bar # R_MIPS_26 against global 'bar' from object file + jal foo0 # R_MIPS_26 against 'foo0' from DSO + +loc: + nop diff --git a/test/ELF/mips-32.s b/test/ELF/mips-32.s new file mode 100644 index 000000000000..7875c48d64d7 --- /dev/null +++ b/test/ELF/mips-32.s @@ -0,0 +1,78 @@ +# Check R_MIPS_32 relocation calculation. + +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t-be.o +# RUN: ld.lld -shared %t-be.o -o %t-be.so +# RUN: llvm-objdump -t -s %t-be.so \ +# RUN: | FileCheck -check-prefix=SYM -check-prefix=BE %s +# RUN: llvm-readobj -r -dynamic-table -mips-plt-got %t-be.so \ +# RUN: | FileCheck -check-prefix=REL %s + +# RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux %s -o %t-el.o +# RUN: ld.lld -shared %t-el.o -o %t-el.so +# RUN: llvm-objdump -t -s %t-el.so \ +# RUN: | FileCheck -check-prefix=SYM -check-prefix=EL %s +# RUN: llvm-readobj -r -dynamic-table -mips-plt-got %t-el.so \ +# RUN: | FileCheck -check-prefix=REL %s + +# REQUIRES: mips + + .globl __start +__start: + nop + + .data + .type v1,@object + .size v1,4 +v1: + .word 0 + + .globl v2 + .type v2,@object + .size v2,8 +v2: + .word v2+4 # R_MIPS_32 target v2 addend 4 + .word v1 # R_MIPS_32 target v1 addend 0 + +# BE: Contents of section .data: +# BE-NEXT: 30000 00000000 00000004 00030000 +# ^-- v2+4 ^-- v1 + +# EL: Contents of section .data: +# EL-NEXT: 30000 00000000 04000000 00000300 +# ^-- v2+4 ^-- v1 + +# SYM: SYMBOL TABLE: +# SYM: 00030000 l .data 00000004 v1 +# SYM: 00030004 g .data 00000008 v2 + +# REL: Relocations [ +# REL-NEXT: Section (7) .rel.dyn { +# REL-NEXT: 0x30008 R_MIPS_REL32 - 0x0 +# REL-NEXT: 0x30004 R_MIPS_REL32 v2 0x0 +# REL-NEXT: } +# REL-NEXT: ] + +# REL: DynamicSection [ +# REL: Tag Type Name/Value +# REL: 0x00000012 RELSZ 16 (bytes) +# REL: 0x00000013 RELENT 8 (bytes) + +# REL: Primary GOT { +# REL-NEXT: Canonical gp value: +# REL-NEXT: Reserved entries [ +# REL: ] +# REL-NEXT: Local entries [ +# REL-NEXT: ] +# REL-NEXT: Global entries [ +# REL-NEXT: Entry { +# REL-NEXT: Address: +# REL-NEXT: Access: +# REL-NEXT: Initial: 0x30004 +# REL-NEXT: Value: 0x30004 +# REL-NEXT: Type: Object +# REL-NEXT: Section: .data +# REL-NEXT: Name: v2 +# REL-NEXT: } +# REL-NEXT: ] +# REL-NEXT: Number of TLS and multi-GOT entries: 0 +# REL-NEXT: } diff --git a/test/ELF/mips-64-disp.s b/test/ELF/mips-64-disp.s new file mode 100644 index 000000000000..1c66ba4fb9a1 --- /dev/null +++ b/test/ELF/mips-64-disp.s @@ -0,0 +1,89 @@ +# Check R_MIPS_GOT_DISP relocations against various kind of symbols. + +# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \ +# RUN: %p/Inputs/mips-pic.s -o %t.so.o +# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t.exe.o +# RUN: ld.lld %t.so.o -shared -o %t.so +# RUN: ld.lld %t.exe.o %t.so -o %t.exe +# RUN: llvm-objdump -d -t %t.exe | FileCheck %s +# RUN: llvm-readobj -r -mips-plt-got %t.exe | FileCheck -check-prefix=GOT %s + +# REQUIRES: mips + +# CHECK: __start: +# CHECK-NEXT: 20000: 24 42 80 40 addiu $2, $2, -32704 +# CHECK-NEXT: 20004: 24 42 80 20 addiu $2, $2, -32736 +# CHECK-NEXT: 20008: 24 42 80 28 addiu $2, $2, -32728 +# CHECK-NEXT: 2000c: 24 42 80 30 addiu $2, $2, -32720 +# CHECK-NEXT: 20010: 24 42 80 38 addiu $2, $2, -32712 + +# CHECK: 0000000000020014 .text 00000000 foo +# CHECK: 0000000000037ff0 .got 00000000 .hidden _gp +# CHECK: 0000000000020000 .text 00000000 __start +# CHECK: 0000000000000000 g F *UND* 00000000 foo1a + +# GOT: Relocations [ +# GOT-NEXT: ] +# GOT-NEXT: Primary GOT { +# GOT-NEXT: Canonical gp value: 0x37FF0 +# GOT-NEXT: Reserved entries [ +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x30000 +# GOT-NEXT: Access: -32752 +# GOT-NEXT: Initial: 0x0 +# GOT-NEXT: Purpose: Lazy resolver +# GOT-NEXT: } +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x30008 +# GOT-NEXT: Access: -32744 +# GOT-NEXT: Initial: 0x8000000000000000 +# GOT-NEXT: Purpose: Module pointer (GNU extension) +# GOT-NEXT: } +# GOT-NEXT: ] +# GOT-NEXT: Local entries [ +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x30010 +# GOT-NEXT: Access: -32736 +# GOT-NEXT: Initial: 0x20014 +# GOT-NEXT: } +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x30018 +# GOT-NEXT: Access: -32728 +# GOT-NEXT: Initial: 0x20004 +# GOT-NEXT: } +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x30020 +# GOT-NEXT: Access: -32720 +# GOT-NEXT: Initial: 0x20008 +# GOT-NEXT: } +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x30028 +# GOT-NEXT: Access: -32712 +# GOT-NEXT: Initial: 0x2000C +# GOT-NEXT: } +# GOT-NEXT: ] +# GOT-NEXT: Global entries [ +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x30030 +# GOT-NEXT: Access: -32704 +# GOT-NEXT: Initial: 0x0 +# GOT-NEXT: Value: 0x0 +# GOT-NEXT: Type: Function +# GOT-NEXT: Section: Undefined +# GOT-NEXT: Name: foo1a +# GOT-NEXT: } +# GOT-NEXT: ] +# GOT-NEXT: Number of TLS and multi-GOT entries: 0 +# GOT-NEXT: } + + .text + .global __start +__start: + addiu $v0,$v0,%got_disp(foo1a) # R_MIPS_GOT_DISP + addiu $v0,$v0,%got_disp(foo) # R_MIPS_GOT_DISP + addiu $v0,$v0,%got_disp(.text+4) # R_MIPS_GOT_DISP + addiu $v0,$v0,%got_disp(.text+8) # R_MIPS_GOT_DISP + addiu $v0,$v0,%got_disp(.text+12) # R_MIPS_GOT_DISP + +foo: + nop diff --git a/test/ELF/mips-64-got.s b/test/ELF/mips-64-got.s new file mode 100644 index 000000000000..52ce6fb4d351 --- /dev/null +++ b/test/ELF/mips-64-got.s @@ -0,0 +1,87 @@ +# Check MIPS N64 ABI GOT relocations + +# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \ +# RUN: %p/Inputs/mips-pic.s -o %t.so.o +# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t.exe.o +# RUN: ld.lld %t.so.o -shared -o %t.so +# RUN: ld.lld %t.exe.o %t.so -o %t.exe +# RUN: llvm-objdump -d -t %t.exe | FileCheck %s +# RUN: llvm-readobj -r -mips-plt-got %t.exe | FileCheck -check-prefix=GOT %s + +# REQUIRES: mips + +# CHECK: __start: + +# CHECK-NEXT: 20000: df 82 80 20 ld $2, -32736($gp) +# CHECK-NEXT: 20004: 64 42 00 18 daddiu $2, $2, 24 +# CHECK-NEXT: 20008: 24 42 80 38 addiu $2, $2, -32712 +# CHECK-NEXT: 2000c: 24 42 80 28 addiu $2, $2, -32728 +# CHECK-NEXT: 20010: 24 42 80 30 addiu $2, $2, -32720 + +# CHECK: 0000000000020018 .text 00000000 foo +# CHECK: 0000000000037ff0 .got 00000000 .hidden _gp +# CHECK: 0000000000020000 .text 00000000 __start +# CHECK: 0000000000020014 .text 00000000 bar + +# GOT: Relocations [ +# GOT-NEXT: ] +# GOT-NEXT: Primary GOT { +# GOT-NEXT: Canonical gp value: 0x37FF0 +# GOT-NEXT: Reserved entries [ +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x30000 +# GOT-NEXT: Access: -32752 +# GOT-NEXT: Initial: 0x0 +# GOT-NEXT: Purpose: Lazy resolver +# GOT-NEXT: } +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x30008 +# GOT-NEXT: Access: -32744 +# GOT-NEXT: Initial: 0x8000000000000000 +# GOT-NEXT: Purpose: Module pointer (GNU extension) +# GOT-NEXT: } +# GOT-NEXT: ] +# GOT-NEXT: Local entries [ +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x30010 +# GOT-NEXT: Access: -32736 +# GOT-NEXT: Initial: 0x20000 +# GOT-NEXT: } +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x30018 +# GOT-NEXT: Access: -32728 +# GOT-NEXT: Initial: 0x20014 +# GOT-NEXT: } +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x30020 +# GOT-NEXT: Access: -32720 +# GOT-NEXT: Initial: 0x20018 +# GOT-NEXT: } +# GOT-NEXT: ] +# GOT-NEXT: Global entries [ +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x30028 +# GOT-NEXT: Access: -32712 +# GOT-NEXT: Initial: 0x0 +# GOT-NEXT: Value: 0x0 +# GOT-NEXT: Type: Function +# GOT-NEXT: Section: Undefined +# GOT-NEXT: Name: foo1a +# GOT-NEXT: } +# GOT-NEXT: ] +# GOT-NEXT: Number of TLS and multi-GOT entries: 0 +# GOT-NEXT: } + + .text + .global __start, bar +__start: + ld $v0,%got_page(foo)($gp) # R_MIPS_GOT_PAGE + daddiu $v0,$v0,%got_ofst(foo) # R_MIPS_GOT_OFST + addiu $v0,$v0,%got_disp(foo1a) # R_MIPS_GOT_DISP + addiu $v0,$v0,%got_disp(bar) # R_MIPS_GOT_DISP + addiu $v0,$v0,%got_disp(foo) # R_MIPS_GOT_DISP + +bar: + nop +foo: + nop diff --git a/test/ELF/mips-64-gprel-so.s b/test/ELF/mips-64-gprel-so.s new file mode 100644 index 000000000000..437238ef5f26 --- /dev/null +++ b/test/ELF/mips-64-gprel-so.s @@ -0,0 +1,23 @@ +# Check setup of GP relative offsets in a function's prologue. + +# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t.o +# RUN: ld.lld %t.o -shared -o %t.so +# RUN: llvm-objdump -d -t %t.so | FileCheck %s + +# REQUIRES: mips + +# CHECK: Disassembly of section .text: +# CHECK-NEXT: foo: +# CHECK-NEXT: 10000: 3c 1c 00 01 lui $gp, 1 +# CHECK-NEXT: 10004: 03 99 e0 2d daddu $gp, $gp, $25 +# CHECK-NEXT: 10008: 67 9c 7f f0 daddiu $gp, $gp, 32752 + +# CHECK: 0000000000027ff0 .got 00000000 .hidden _gp +# CHECK: 0000000000010000 .text 00000000 foo + + .text + .global foo +foo: + lui $gp,%hi(%neg(%gp_rel(foo))) + daddu $gp,$gp,$t9 + daddiu $gp,$gp,%lo(%neg(%gp_rel(foo))) diff --git a/test/ELF/mips-64-rels.s b/test/ELF/mips-64-rels.s new file mode 100644 index 000000000000..7126afc1e595 --- /dev/null +++ b/test/ELF/mips-64-rels.s @@ -0,0 +1,46 @@ +# Check handling multiple MIPS N64 ABI relocations packed +# into the single relocation record. + +# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t.o +# RUN: ld.lld %t.o -o %t.exe +# RUN: llvm-objdump -d -s -t %t.exe | FileCheck %s +# RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=REL %s + +# REQUIRES: mips + +# CHECK: __start: +# CHECK-NEXT: 20000: 3c 1c 00 01 lui $gp, 1 +# ^-- 0x20000 - 0x37ff0 +# ^-- 0 - 0xfffffffffffe8010 +# ^-- %hi(0x17ff0) +# CHECK: loc: +# CHECK-NEXT: 20004: 67 9c 7f f0 daddiu $gp, $gp, 32752 +# ^-- 0x20000 - 0x37ff0 +# ^-- 0 - 0xfffffffffffe8010 +# ^-- %lo(0x17ff0) + +# CHECK: Contents of section .rodata: +# CHECK-NEXT: 10190 ffffffff fffe8014 +# ^-- 0x20004 - 0x37ff0 = 0xfffffffffffe8014 + +# CHECK: 0000000000020004 .text 00000000 loc +# CHECK: 0000000000037ff0 .got 00000000 .hidden _gp +# CHECK: 0000000000020000 .text 00000000 __start + +# REL: Relocations [ +# REL-NEXT: ] + + .text + .global __start +__start: + lui $gp,%hi(%neg(%gp_rel(__start))) # R_MIPS_GPREL16 + # R_MIPS_SUB + # R_MIPS_HI16 +loc: + daddiu $gp,$gp,%lo(%neg(%gp_rel(__start))) # R_MIPS_GPREL16 + # R_MIPS_SUB + # R_MIPS_LO16 + + .section .rodata,"a",@progbits + .gpdword(loc) # R_MIPS_GPREL32 + # R_MIPS_64 diff --git a/test/ELF/mips-64.s b/test/ELF/mips-64.s new file mode 100644 index 000000000000..689669e4b09f --- /dev/null +++ b/test/ELF/mips-64.s @@ -0,0 +1,63 @@ +# Check R_MIPS_64 relocation calculation. + +# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t.o +# RUN: ld.lld -shared %t.o -o %t.so +# RUN: llvm-objdump -t %t.so | FileCheck -check-prefix=SYM %s +# RUN: llvm-readobj -r -dynamic-table -mips-plt-got %t.so | FileCheck %s + +# REQUIRES: mips + + .global __start +__start: + nop + + .data + .type v1,@object + .size v1,4 +v1: + .quad 0 + + .globl v2 + .type v2,@object + .size v2,8 +v2: + .quad v2+8 # R_MIPS_64 target v2 addend 8 + .quad v1 # R_MIPS_64 target v1 addend 0 + + +# SYM: SYMBOL TABLE: +# SYM: 00030000 l .data 00000004 v1 +# SYM: 00030008 g .data 00000008 v2 + +# CHECK: Relocations [ +# CHECK-NEXT: Section (7) .rela.dyn { +# CHECK-NEXT: 0x30010 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE - 0x30000 +# ^-- v1 +# CHECK-NEXT: 0x30008 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE v2 0x8 +# CHECK-NEXT: } +# CHECK-NEXT: ] + +# CHECK: DynamicSection [ +# CHECK: Tag Type Name/Value +# CHECK: 0x0000000000000008 RELASZ 48 (bytes) +# CHECK: 0x0000000000000009 RELAENT 24 (bytes) + +# CHECK: Primary GOT { +# CHECK-NEXT: Canonical gp value: +# CHECK-NEXT: Reserved entries [ +# CHECK: ] +# CHECK-NEXT: Local entries [ +# CHECK-NEXT: ] +# CHECK-NEXT: Global entries [ +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: +# CHECK-NEXT: Access: +# CHECK-NEXT: Initial: 0x30008 +# CHECK-NEXT: Value: 0x30008 +# CHECK-NEXT: Type: Object +# CHECK-NEXT: Section: .data +# CHECK-NEXT: Name: v2 +# CHECK-NEXT: } +# CHECK-NEXT: ] +# CHECK-NEXT: Number of TLS and multi-GOT entries: 0 +# CHECK-NEXT: } diff --git a/test/ELF/mips-align-err.s b/test/ELF/mips-align-err.s new file mode 100644 index 000000000000..28b192ac29f3 --- /dev/null +++ b/test/ELF/mips-align-err.s @@ -0,0 +1,12 @@ +# REQUIRES: mips +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o \ +# RUN: -mcpu=mips32r6 +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \ +# RUN: -mcpu=mips32r6 %S/Inputs/mips-align-err.s -o %t2.o +# RUN: not ld.lld %t.o %t2.o -o %t.exe 2>&1 | FileCheck %s +# CHECK: improper alignment for relocation R_MIPS_PC16 + + .globl __start +__start: +.zero 1 + beqc $5, $6, _foo # R_MIPS_PC16 diff --git a/test/ELF/mips-dynamic.s b/test/ELF/mips-dynamic.s index 626a3556d361..3cb5c63a49f2 100644 --- a/test/ELF/mips-dynamic.s +++ b/test/ELF/mips-dynamic.s @@ -8,6 +8,10 @@ # RUN: llvm-readobj -sections -dynamic-table %t.exe \ # RUN: | FileCheck -check-prefix=EXE %s +# RUN: ld.lld %t.o --image-base=0x123000 %td.so -o %t.exe +# RUN: llvm-readobj -sections -dynamic-table %t.exe \ +# RUN: | FileCheck -check-prefix=IMAGE_BASE %s + # RUN: ld.lld -shared %t.o %td.so -o %t.so # RUN: llvm-readobj -sections -dyn-symbols -dynamic-table %t.so \ # RUN: | FileCheck -check-prefix=DSO %s @@ -24,6 +28,7 @@ # EXE-NEXT: Type: SHT_PROGBITS # EXE-NEXT: Flags [ (0x10000003) # EXE-NEXT: SHF_ALLOC +# EXE-NEXT: SHF_MIPS_GPREL # EXE-NEXT: SHF_WRITE # EXE-NEXT: ] # EXE-NEXT: Address: [[GOTADDR:0x[0-9a-f]+]] @@ -44,13 +49,15 @@ # EXE-DAG: 0x00000003 PLTGOT [[GOTADDR]] # EXE-DAG: 0x70000001 MIPS_RLD_VERSION 1 # EXE-DAG: 0x70000005 MIPS_FLAGS NOTPOT -# EXE-DAG: 0x70000006 MIPS_BASE_ADDRESS +# EXE-DAG: 0x70000006 MIPS_BASE_ADDRESS 0x10000 # EXE-DAG: 0x7000000A MIPS_LOCAL_GOTNO 2 -# EXE-DAG: 0x70000011 MIPS_SYMTABNO 1 -# EXE-DAG: 0x70000013 MIPS_GOTSYM 0x1 +# EXE-DAG: 0x70000011 MIPS_SYMTABNO 2 +# EXE-DAG: 0x70000013 MIPS_GOTSYM 0x2 # EXE-DAG: 0x70000016 MIPS_RLD_MAP [[RLDMAPADDR]] # EXE: ] +# IMAGE_BASE: 0x70000006 MIPS_BASE_ADDRESS 0x123000 + # DSO: Sections [ # DSO: Name: .dynamic # DSO-NEXT: Type: SHT_DYNAMIC @@ -61,6 +68,7 @@ # DSO-NEXT: Type: SHT_PROGBITS # DSO-NEXT: Flags [ (0x10000003) # DSO-NEXT: SHF_ALLOC +# DSO-NEXT: SHF_MIPS_GPREL # DSO-NEXT: SHF_WRITE # DSO-NEXT: ] # DSO-NEXT: Address: [[GOTADDR:0x[0-9a-f]+]] @@ -69,7 +77,6 @@ # DSO: ] # DSO: DynamicSymbols [ # DSO: Name: @ -# DSO: Name: _gp@ # DSO: Name: __start@ # DSO: Name: _foo@ # DSO: ] @@ -80,8 +87,8 @@ # DSO-DAG: 0x70000005 MIPS_FLAGS NOTPOT # DSO-DAG: 0x70000006 MIPS_BASE_ADDRESS 0x0 # DSO-DAG: 0x7000000A MIPS_LOCAL_GOTNO 2 -# DSO-DAG: 0x70000011 MIPS_SYMTABNO 4 -# DSO-DAG: 0x70000013 MIPS_GOTSYM 0x4 +# DSO-DAG: 0x70000011 MIPS_SYMTABNO 3 +# DSO-DAG: 0x70000013 MIPS_GOTSYM 0x3 # DSO: ] .text diff --git a/test/ELF/mips-gnu-hash.s b/test/ELF/mips-gnu-hash.s index 4b11f213518c..288d54043fc1 100644 --- a/test/ELF/mips-gnu-hash.s +++ b/test/ELF/mips-gnu-hash.s @@ -6,7 +6,7 @@ # RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux %s -o %t-el.o # RUN: not ld.lld -shared -hash-style=gnu %t-el.o -o %t-el.so 2>&1 | FileCheck %s -# CHECK: The .gnu.hash section is not compatible with the MIPS target. +# CHECK: the .gnu.hash section is not compatible with the MIPS target. # REQUIRES: mips diff --git a/test/ELF/mips-got-and-copy.s b/test/ELF/mips-got-and-copy.s new file mode 100644 index 000000000000..453b8c957b56 --- /dev/null +++ b/test/ELF/mips-got-and-copy.s @@ -0,0 +1,57 @@ +# REQUIRES: mips + +# If there are two relocations such that the first one requires +# dynamic COPY relocation, the second one requires GOT entry +# creation, linker should create both - dynamic relocation +# and GOT entry. + +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \ +# RUN: %S/Inputs/mips-dynamic.s -o %t.so.o +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o +# RUN: ld.lld %t.so.o -shared -o %t.so +# RUN: ld.lld %t.o %t.so -o %t.exe +# RUN: llvm-readobj -r -mips-plt-got %t.exe | FileCheck %s + +# CHECK: Relocations [ +# CHECK-NEXT: Section (7) .rel.dyn { +# CHECK-NEXT: 0x{{[0-9A-F]+}} R_MIPS_COPY data0 +# CHECK-NEXT: 0x{{[0-9A-F]+}} R_MIPS_COPY data1 +# CHECK-NEXT: } +# CHECK-NEXT: ] +# CHECK-NEXT: Primary GOT { +# CHECK-NEXT: Canonical gp value: 0x37FF0 +# CHECK-NEXT: Reserved entries [ +# CHECK: ] +# CHECK-NEXT: Local entries [ +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x30008 +# CHECK-NEXT: Access: -32744 +# CHECK-NEXT: Initial: 0x40010 +# CHECK-NEXT: } +# CHECK-NEXT: ] +# CHECK-NEXT: Global entries [ +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x3000C +# CHECK-NEXT: Access: -32740 +# CHECK-NEXT: Initial: 0x40014 +# CHECK-NEXT: Value: 0x40014 +# CHECK-NEXT: Type: Object (0x1) +# CHECK-NEXT: Section: .bss (0xD) +# CHECK-NEXT: Name: data1@ (7) +# CHECK-NEXT: } +# CHECK-NEXT: ] +# CHECK-NEXT: Number of TLS and multi-GOT entries: 0 +# CHECK-NEXT: } + + .text + .global __start +__start: + # Case A: 'got' relocation goes before 'copy' relocation + lui $t0,%hi(data0) # R_MIPS_HI16 - requires R_MISP_COPY relocation + addi $t0,$t0,%lo(data0) + lw $t0,%got(data0)($gp) # R_MIPS_GOT16 - requires GOT entry + + # Case B: 'copy' relocation goes before 'got' relocation + lw $t0,%got(data1)($gp) # R_MIPS_GOT16 - requires GOT entry + lui $t0,%hi(data1) # R_MIPS_HI16 - requires R_MISP_COPY relocation + addi $t0,$t0,%lo(data1) diff --git a/test/ELF/mips-got-extsym.s b/test/ELF/mips-got-extsym.s new file mode 100644 index 000000000000..1cf99aeed49b --- /dev/null +++ b/test/ELF/mips-got-extsym.s @@ -0,0 +1,59 @@ +# Check creation of GOT entries for global symbols in case of executable +# file linking. Symbols defined in DSO should get entries in the global part +# of the GOT. Symbols defined in the executable itself should get local GOT +# entries and does not need a row in .dynsym table. + +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \ +# RUN: %S/Inputs/mips-dynamic.s -o %t.so.o +# RUN: ld.lld -shared %t.so.o -o %t.so +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o +# RUN: ld.lld %t.o %t.so -o %t.exe +# RUN: llvm-readobj -dt -t -mips-plt-got %t.exe | FileCheck %s + +# REQUIRES: mips + +# CHECK: Symbols [ +# CHECK: Symbol { +# CHECK: Name: _foo +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Global + +# CHECK: Symbol { +# CHECK: Name: bar +# CHECK-NEXT: Value: 0x20008 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Global + +# CHECK: DynamicSymbols [ +# CHECK-NOT: Name: bar + +# CHECK: Local entries [ +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x30008 +# CHECK-NEXT: Access: -32744 +# CHECK-NEXT: Initial: 0x20008 +# ^-- bar +# CHECK-NEXT: } +# CHECK-NEXT: ] +# CHECK-NEXT: Global entries [ +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x3000C +# CHECK-NEXT: Access: -32740 +# CHECK-NEXT: Initial: 0x0 +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Type: None +# CHECK-NEXT: Section: Undefined +# CHECK-NEXT: Name: _foo@ +# CHECK-NEXT: } +# CHECK-NEXT: ] + + .text + .globl __start +__start: + lw $t0,%got(bar)($gp) + lw $t0,%got(_foo)($gp) + +.global bar +bar: + .word 0 diff --git a/test/ELF/mips-got-redundant.s b/test/ELF/mips-got-redundant.s new file mode 100644 index 000000000000..07c3c249f4fa --- /dev/null +++ b/test/ELF/mips-got-redundant.s @@ -0,0 +1,58 @@ +# Check number of redundant entries in the local part of MIPS GOT. + +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o +# RUN: ld.lld %t.o -shared -o %t.so +# RUN: llvm-readobj -mips-plt-got %t.so | FileCheck %s + +# REQUIRES: mips + +# CHECK: Local entries [ +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x20008 +# CHECK-NEXT: Access: -32744 +# CHECK-NEXT: Initial: 0x30000 +# ^-- loc1 +# CHECK-NEXT: } +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x2000C +# CHECK-NEXT: Access: -32740 +# CHECK-NEXT: Initial: 0x40000 +# ^-- loc2, loc3, loc4 +# CHECK-NEXT: } +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x20010 +# CHECK-NEXT: Access: -32736 +# CHECK-NEXT: Initial: 0x40008 +# ^-- glb1 +# CHECK-NEXT: } +# CHECK-NEXT: ] + + .text + .globl foo +foo: + lw $t0, %got(loc1)($gp) + addi $t0, $t0, %lo(loc1) + lw $t0, %got(loc2)($gp) + addi $t0, $t0, %lo(loc2) + lw $t0, %got(loc3)($gp) + addi $t0, $t0, %lo(loc3) + lw $t0, %got(loc4)($gp) + addi $t0, $t0, %lo(loc4) + lw $t0, %got(glb1)($gp) + lw $t0, %got(glb1)($gp) + + .section .data.1,"aw",%progbits +loc1: + .space 0x10000 +loc2: + .word 0 +loc3: + .word 0 + .global glb1 + .hidden glb1 +glb1: + .word 0 + + .section .data.2,"aw",%progbits +loc4: + .word 0 diff --git a/test/ELF/mips-got-relocs.s b/test/ELF/mips-got-relocs.s index 27180fbf82ea..c44cf90b7be3 100644 --- a/test/ELF/mips-got-relocs.s +++ b/test/ELF/mips-got-relocs.s @@ -47,10 +47,11 @@ v1: # EXE_SYM: Sections: # EXE_SYM: .got 0000000c 0000000000030000 DATA # EXE_SYM: SYMBOL TABLE: -# EXE_SYM: 00037ff0 *ABS* 00000000 _gp +# EXE_SYM: 00037ff0 .got 00000000 .hidden _gp # ^-- .got + GP offset (0x7ff0) # EXE_SYM: 00040000 g .data 00000004 v1 + # EXE_GOT_BE: Contents of section .got: # EXE_GOT_BE: 30000 00000000 80000000 00040000 # ^ ^ ^-- v1 (0x40000) @@ -70,7 +71,7 @@ v1: # DSO_SYM: Sections: # DSO_SYM: .got 0000000c 0000000000020000 DATA # DSO_SYM: SYMBOL TABLE: -# DSO_SYM: 00027ff0 *ABS* 00000000 _gp +# DSO_SYM: 00027ff0 .got 00000000 .hidden _gp # ^-- .got + GP offset (0x7ff0) # DSO_SYM: 00030000 g .data 00000004 v1 diff --git a/test/ELF/mips-got-weak.s b/test/ELF/mips-got-weak.s new file mode 100644 index 000000000000..a77924692a10 --- /dev/null +++ b/test/ELF/mips-got-weak.s @@ -0,0 +1,172 @@ +# Check R_MIPS_GOT16 relocation against weak symbols. + +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o +# RUN: ld.lld %t.o -shared -o %t1.so +# RUN: llvm-readobj -r -dt -dynamic-table -mips-plt-got %t1.so \ +# RUN: | FileCheck -check-prefix=NOSYM %s +# RUN: ld.lld %t.o -shared -Bsymbolic -o %t2.so +# RUN: llvm-readobj -r -dt -dynamic-table -mips-plt-got %t2.so \ +# RUN: | FileCheck -check-prefix=SYM %s + +# REQUIRES: mips + +# NOSYM: Relocations [ +# NOSYM-NEXT: ] + +# NOSYM: Symbol { +# NOSYM: Name: foo +# NOSYM-NEXT: Value: 0x30000 +# NOSYM-NEXT: Size: 0 +# NOSYM-NEXT: Binding: Weak +# NOSYM-NEXT: Type: None +# NOSYM-NEXT: Other: 0 +# NOSYM-NEXT: Section: .data +# NOSYM-NEXT: } +# NOSYM-NEXT: Symbol { +# NOSYM-NEXT: Name: bar +# NOSYM-NEXT: Value: 0x0 +# NOSYM-NEXT: Size: 0 +# NOSYM-NEXT: Binding: Weak +# NOSYM-NEXT: Type: None +# NOSYM-NEXT: Other: 0 +# NOSYM-NEXT: Section: Undefined +# NOSYM-NEXT: } +# NOSYM-NEXT: Symbol { +# NOSYM-NEXT: Name: sym +# NOSYM-NEXT: Value: 0x30004 +# NOSYM-NEXT: Size: 0 +# NOSYM-NEXT: Binding: Global +# NOSYM-NEXT: Type: None +# NOSYM-NEXT: Other: 0 +# NOSYM-NEXT: Section: .data +# NOSYM-NEXT: } +# NOSYM-NEXT: ] + +# NOSYM: 0x70000011 MIPS_SYMTABNO 4 +# NOSYM-NEXT: 0x7000000A MIPS_LOCAL_GOTNO 2 +# NOSYM-NEXT: 0x70000013 MIPS_GOTSYM 0x1 + +# NOSYM: Primary GOT { +# NOSYM-NEXT: Canonical gp value: 0x27FF0 +# NOSYM-NEXT: Reserved entries [ +# NOSYM-NEXT: Entry { +# NOSYM-NEXT: Address: 0x20000 +# NOSYM-NEXT: Access: -32752 +# NOSYM-NEXT: Initial: 0x0 +# NOSYM-NEXT: Purpose: Lazy resolver +# NOSYM-NEXT: } +# NOSYM-NEXT: Entry { +# NOSYM-NEXT: Address: 0x20004 +# NOSYM-NEXT: Access: -32748 +# NOSYM-NEXT: Initial: 0x80000000 +# NOSYM-NEXT: Purpose: Module pointer (GNU extension) +# NOSYM-NEXT: } +# NOSYM-NEXT: ] +# NOSYM-NEXT: Local entries [ +# NOSYM-NEXT: ] +# NOSYM-NEXT: Global entries [ +# NOSYM-NEXT: Entry { +# NOSYM-NEXT: Address: 0x20008 +# NOSYM-NEXT: Access: -32744 +# NOSYM-NEXT: Initial: 0x30000 +# NOSYM-NEXT: Value: 0x30000 +# NOSYM-NEXT: Type: None +# NOSYM-NEXT: Section: .data +# NOSYM-NEXT: Name: foo +# NOSYM-NEXT: } +# NOSYM-NEXT: Entry { +# NOSYM-NEXT: Address: 0x2000C +# NOSYM-NEXT: Access: -32740 +# NOSYM-NEXT: Initial: 0x0 +# NOSYM-NEXT: Value: 0x0 +# NOSYM-NEXT: Type: None +# NOSYM-NEXT: Section: Undefined +# NOSYM-NEXT: Name: bar +# NOSYM-NEXT: } +# NOSYM-NEXT: Entry { +# NOSYM-NEXT: Address: 0x20010 +# NOSYM-NEXT: Access: -32736 +# NOSYM-NEXT: Initial: 0x30004 +# NOSYM-NEXT: Value: 0x30004 +# NOSYM-NEXT: Type: None +# NOSYM-NEXT: Section: .data +# NOSYM-NEXT: Name: sym +# NOSYM-NEXT: } +# NOSYM-NEXT: ] +# NOSYM-NEXT: Number of TLS and multi-GOT entries: 0 +# NOSYM-NEXT: } + +# SYM: Relocations [ +# SYM-NEXT: ] + +# SYM: Symbol { +# SYM: Name: bar +# SYM-NEXT: Value: 0x0 +# SYM-NEXT: Size: 0 +# SYM-NEXT: Binding: Weak +# SYM-NEXT: Type: None +# SYM-NEXT: Other: 0 +# SYM-NEXT: Section: Undefined +# SYM-NEXT: } +# SYM-NEXT: ] + +# SYM: 0x70000011 MIPS_SYMTABNO 4 +# SYM-NEXT: 0x7000000A MIPS_LOCAL_GOTNO 4 +# SYM-NEXT: 0x70000013 MIPS_GOTSYM 0x3 + +# SYM: Primary GOT { +# SYM-NEXT: Canonical gp value: 0x27FF0 +# SYM-NEXT: Reserved entries [ +# SYM-NEXT: Entry { +# SYM-NEXT: Address: 0x20000 +# SYM-NEXT: Access: -32752 +# SYM-NEXT: Initial: 0x0 +# SYM-NEXT: Purpose: Lazy resolver +# SYM-NEXT: } +# SYM-NEXT: Entry { +# SYM-NEXT: Address: 0x20004 +# SYM-NEXT: Access: -32748 +# SYM-NEXT: Initial: 0x80000000 +# SYM-NEXT: Purpose: Module pointer (GNU extension) +# SYM-NEXT: } +# SYM-NEXT: ] +# SYM-NEXT: Local entries [ +# SYM-NEXT: Entry { +# SYM-NEXT: Address: 0x20008 +# SYM-NEXT: Access: -32744 +# SYM-NEXT: Initial: 0x30000 +# SYM-NEXT: } +# SYM-NEXT: Entry { +# SYM-NEXT: Address: 0x2000C +# SYM-NEXT: Access: -32740 +# SYM-NEXT: Initial: 0x30004 +# SYM-NEXT: } +# SYM-NEXT: ] +# SYM-NEXT: Global entries [ +# SYM-NEXT: Entry { +# SYM-NEXT: Address: 0x20010 +# SYM-NEXT: Access: -32736 +# SYM-NEXT: Initial: 0x0 +# SYM-NEXT: Value: 0x0 +# SYM-NEXT: Type: None +# SYM-NEXT: Section: Undefined +# SYM-NEXT: Name: bar +# SYM-NEXT: } +# SYM-NEXT: ] +# SYM-NEXT: Number of TLS and multi-GOT entries: 0 +# SYM-NEXT: } + + .text + .global sym + .weak foo,bar +func: + lw $t0,%got(foo)($gp) + lw $t0,%got(bar)($gp) + lw $t0,%got(sym)($gp) + + .data + .weak foo +foo: + .word 0 +sym: + .word 0 diff --git a/test/ELF/mips-got16.s b/test/ELF/mips-got16.s new file mode 100644 index 000000000000..ef80418ef032 --- /dev/null +++ b/test/ELF/mips-got16.s @@ -0,0 +1,120 @@ +# Check R_MIPS_GOT16 relocation calculation. + +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o +# RUN: ld.lld %t.o -shared -o %t.so +# RUN: llvm-objdump -d -t %t.so | FileCheck %s +# RUN: llvm-readobj -r -mips-plt-got %t.so | FileCheck -check-prefix=GOT %s + +# REQUIRES: mips + +# CHECK: Disassembly of section .text: +# CHECK-NEXT: __start: +# CHECK-NEXT: 10000: 8f 88 80 18 lw $8, -32744($gp) +# CHECK-NEXT: 10004: 21 08 00 2c addi $8, $8, 44 +# CHECK-NEXT: 10008: 8f 88 80 1c lw $8, -32740($gp) +# CHECK-NEXT: 1000c: 21 08 90 00 addi $8, $8, -28672 +# CHECK-NEXT: 10010: 8f 88 80 20 lw $8, -32736($gp) +# CHECK-NEXT: 10014: 21 08 90 04 addi $8, $8, -28668 +# CHECK-NEXT: 10018: 8f 88 80 20 lw $8, -32736($gp) +# CHECK-NEXT: 1001c: 21 08 10 04 addi $8, $8, 4100 +# CHECK-NEXT: 10020: 8f 88 80 28 lw $8, -32728($gp) +# CHECK-NEXT: 10024: 21 08 10 08 addi $8, $8, 4104 +# CHECK-NEXT: 10028: 8f 88 80 2c lw $8, -32724($gp) +# +# CHECK: SYMBOL TABLE: +# CHECK: 00051008 .data 00000000 .hidden bar +# CHECK: 00000000 *UND* 00000000 foo + +# GOT: Relocations [ +# GOT-NEXT: ] + +# GOT: Primary GOT { +# GOT-NEXT: Canonical gp value: 0x27FF0 +# GOT-NEXT: Reserved entries [ +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x20000 +# GOT-NEXT: Access: -32752 +# GOT-NEXT: Initial: 0x0 +# GOT-NEXT: Purpose: Lazy resolver +# GOT-NEXT: } +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x20004 +# GOT-NEXT: Access: -32748 +# GOT-NEXT: Initial: 0x80000000 +# GOT-NEXT: Purpose: Module pointer (GNU extension) +# GOT-NEXT: } +# GOT-NEXT: ] +# GOT-NEXT: Local entries [ +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x20008 +# GOT-NEXT: Access: -32744 +# GOT-NEXT: Initial: 0x10000 +# ^-- (0x1002c + 0x8000) & ~0xffff +# GOT-NEXT: } +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x2000C +# GOT-NEXT: Access: -32740 +# GOT-NEXT: Initial: 0x40000 +# ^-- (0x39000 + 0x8000) & ~0xffff +# GOT-NEXT: } +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x20010 +# GOT-NEXT: Access: -32736 +# GOT-NEXT: Initial: 0x50000 +# ^-- (0x39000 + 0x10004 + 0x8000) & ~0xffff +# ^-- (0x39000 + 0x18004 + 0x8000) & ~0xffff +# GOT-NEXT: } +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x20014 +# GOT-NEXT: Access: -32732 +# GOT-NEXT: Initial: 0x0 +# ^-- redundant unused entry +# GOT-NEXT: } +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x20018 +# GOT-NEXT: Access: -327 +# GOT-NEXT: Initial: 0x51008 +# ^-- 'bar' address +# GOT-NEXT: } +# GOT-NEXT: ] +# GOT-NEXT: Global entries [ +# GOT-NEXT: Entry { +# GOT-NEXT: Address: 0x2001C +# GOT-NEXT: Access: -32724 +# GOT-NEXT: Initial: 0x0 +# GOT-NEXT: Value: 0x0 +# GOT-NEXT: Type: None +# GOT-NEXT: Section: Undefined +# GOT-NEXT: Name: foo@ +# GOT-NEXT: } +# GOT-NEXT: ] +# GOT-NEXT: Number of TLS and multi-GOT entries: 0 +# GOT-NEXT: } + + .text + .globl __start +__start: + lw $t0,%got($LC0)($gp) + addi $t0,$t0,%lo($LC0) + lw $t0,%got($LC1)($gp) + addi $t0,$t0,%lo($LC1) + lw $t0,%got($LC1+0x10004)($gp) + addi $t0,$t0,%lo($LC1+0x10004) + lw $t0,%got($LC1+0x18004)($gp) + addi $t0,$t0,%lo($LC1+0x18004) + lw $t0,%got(bar)($gp) + addi $t0,$t0,%lo(bar) + lw $t0,%got(foo)($gp) +$LC0: + nop + + .data + .space 0x9000 +$LC1: + .word 0 + .space 0x18000 + .word 0 +.global bar +.hidden bar +bar: + .word 0 diff --git a/test/ELF/mips-gp-disp.s b/test/ELF/mips-gp-disp.s index a08829c18bd4..7a0fd6409d18 100644 --- a/test/ELF/mips-gp-disp.s +++ b/test/ELF/mips-gp-disp.s @@ -11,17 +11,20 @@ # REQUIRES: mips -# INT-SO-NOT: Name: _gp_disp +# INT-SO: Name: _gp_disp +# INT-SO-NEXT: Value: +# INT-SO-NEXT: Size: +# INT-SO-NEXT: Binding: Local # EXT-SO: Name: _gp_disp -# EXT-SO-NEXT: Value: 0x20010 +# EXT-SO-NEXT: Value: 0x20000 # DIS: Disassembly of section .text: # DIS-NEXT: __start: # DIS-NEXT: 10000: 3c 08 00 01 lui $8, 1 # DIS-NEXT: 10004: 21 08 7f f0 addi $8, $8, 32752 # ^-- 0x37ff0 & 0xffff -# DIS: 00027ff0 *ABS* 00000000 _gp +# DIS: 00027ff0 .got 00000000 .hidden _gp # REL: Relocations [ # REL-NEXT: ] diff --git a/test/ELF/mips-gp-local.s b/test/ELF/mips-gp-local.s new file mode 100644 index 000000000000..8bb3c236edf0 --- /dev/null +++ b/test/ELF/mips-gp-local.s @@ -0,0 +1,20 @@ +# Check handling of relocations against __gnu_local_gp symbol. + +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o +# RUN: ld.lld -o %t.exe %t.o +# RUN: llvm-objdump -d -t %t.exe | FileCheck %s + +# REQUIRES: mips + +# CHECK: Disassembly of section .text: +# CHECK-NEXT: __start: +# CHECK-NEXT: 20000: 3c 08 00 03 lui $8, 3 +# CHECK-NEXT: 20004: 21 08 7f f0 addi $8, $8, 32752 + +# CHECK: 00037ff0 .got 00000000 .hidden _gp + + .text + .globl __start +__start: + lui $t0,%hi(__gnu_local_gp) + addi $t0,$t0,%lo(__gnu_local_gp) diff --git a/test/ELF/mips-gprel32-relocs-gp0.test b/test/ELF/mips-gprel32-relocs-gp0.test new file mode 100644 index 000000000000..6cc837ef7889 --- /dev/null +++ b/test/ELF/mips-gprel32-relocs-gp0.test @@ -0,0 +1,31 @@ +# Check R_MIPS_GPREL32 relocation calculation if input file conatins +# non-zero GP0 value in the .reginfo section. +# FIXME: The only way to get an object file with non-zero GP0 value +# is to link multiple object files with GOT relocations using '-r' +# option. LLD does not calculate and generate GP0 correctly so we +# use a binary input in this test. The input object file is a result +# of linking two object files with R_MIPS_GPREL32 relocations. + +# RUN: ld.lld -shared -o %t.so %S/Inputs/mips-gprel32-gp0.o +# RUN: llvm-objdump -s %S/Inputs/mips-gprel32-gp0.o \ +# RUN: | FileCheck -check-prefix=OBJ %s +# RUN: llvm-objdump -s -t %t.so | FileCheck %s + +# OBJ: Contents of section .reginfo: +# OBJ-NEXT: 0000 00000001 00000000 00000000 00000000 +# OBJ-NEXT: 0010 00000000 00007fef +# ^-- GP0 value +# OBJ: Contents of section .rodata: +# OBJ-NEXT: 0000 ffff8011 ffff8011 +# ^-- foo addend +# ^-- bar addend + +# CHECK: Contents of section .rodata: +# CHECK: 012c fffe8010 fffe8020 +# ^ 0x10000 + 0xffff8011 + 0x7fef - 0x27ff0 +# ^ 0x10010 + 0xffff8011 + 0x7fef - 0x27ff0 + +# CHECK: SYMBOL TABLE: +# CHECK: 00010000 .text 00000000 foo +# CHECK: 00010010 .text 00000000 bar +# CHECK: 00027ff0 .got 00000000 .hidden _gp diff --git a/test/ELF/mips-gprel32-relocs.s b/test/ELF/mips-gprel32-relocs.s index 4f93d50363c0..fa1c5cfe9956 100644 --- a/test/ELF/mips-gprel32-relocs.s +++ b/test/ELF/mips-gprel32-relocs.s @@ -28,4 +28,4 @@ v1: # CHECK: SYMBOL TABLE: # CHECK: 00010008 .text 00000000 bar # CHECK: 00010004 .text 00000000 foo -# CHECK: 00027ff0 *ABS* 00000000 _gp +# CHECK: 00027ff0 .got 00000000 .hidden _gp diff --git a/test/ELF/mips-hilo-gp-disp.s b/test/ELF/mips-hilo-gp-disp.s index e2e9ae7bc2e2..37cf90d9728b 100644 --- a/test/ELF/mips-hilo-gp-disp.s +++ b/test/ELF/mips-hilo-gp-disp.s @@ -16,6 +16,9 @@ __start: lui $t0,%hi(_gp_disp) addi $t0,$t0,%lo(_gp_disp) lw $v0,%call16(_foo)($gp) +bar: + lui $t0,%hi(_gp_disp) + addi $t0,$t0,%lo(_gp_disp) # EXE: Disassembly of section .text: # EXE-NEXT: __start: @@ -23,11 +26,16 @@ __start: # ^-- %hi(0x37ff0-0x20000) # EXE-NEXT: 20004: 21 08 7f f0 addi $8, $8, 32752 # ^-- %lo(0x37ff0-0x20004+4) +# EXE: bar: +# EXE-NEXT: 2000c: 3c 08 00 01 lui $8, 1 +# ^-- %hi(0x37ff0-0x2000c) +# EXE-NEXT: 20010: 21 08 7f e4 addi $8, $8, 32740 +# ^-- %lo(0x37ff0-0x20010+4) # EXE: SYMBOL TABLE: -# EXE: 00037ff0 *ABS* 00000000 _gp +# EXE: 0002000c .text 00000000 bar +# EXE: 00037ff0 .got 00000000 .hidden _gp # EXE: 00020000 .text 00000000 __start -# EXE: 00020010 .text 00000000 _foo # SO: Disassembly of section .text: # SO-NEXT: __start: @@ -35,8 +43,13 @@ __start: # ^-- %hi(0x27ff0-0x10000) # SO-NEXT: 10004: 21 08 7f f0 addi $8, $8, 32752 # ^-- %lo(0x27ff0-0x10004+4) +# SO: bar: +# SO-NEXT: 1000c: 3c 08 00 01 lui $8, 1 +# ^-- %hi(0x27ff0-0x1000c) +# SO-NEXT: 10010: 21 08 7f e4 addi $8, $8, 32740 +# ^-- %lo(0x27ff0-0x10010+4) # SO: SYMBOL TABLE: -# SO: 00027ff0 *ABS* 00000000 _gp +# SO: 0001000c .text 00000000 bar +# SO: 00027ff0 .got 00000000 .hidden _gp # SO: 00010000 .text 00000000 __start -# SO: 00010010 .text 00000000 _foo diff --git a/test/ELF/mips-hilo-hi-only.s b/test/ELF/mips-hilo-hi-only.s index ad18a9f9161a..97808b515da5 100644 --- a/test/ELF/mips-hilo-hi-only.s +++ b/test/ELF/mips-hilo-hi-only.s @@ -14,7 +14,7 @@ __start: _label: nop -# WARN: Can't find matching R_MIPS_LO16 relocation for R_MIPS_HI16 +# WARN: can't find matching R_MIPS_LO16 relocation for R_MIPS_HI16 # CHECK: Disassembly of section .text: # CHECK-NEXT: __start: diff --git a/test/ELF/mips-hilo.s b/test/ELF/mips-hilo.s index d5de9422c427..4f1452831ae6 100644 --- a/test/ELF/mips-hilo.s +++ b/test/ELF/mips-hilo.s @@ -34,20 +34,20 @@ g1: # CHECK-NEXT: __start: # CHECK-NEXT: 20000: 3c 08 00 02 lui $8, 2 # ^-- %hi(__start+4) -# CHECK-NEXT: 20004: 3c 09 00 03 lui $9, 3 +# CHECK-NEXT: 20004: 3c 09 00 04 lui $9, 4 # ^-- %hi(g1+8) # CHECK-NEXT: 20008: 21 08 00 04 addi $8, $8, 4 # ^-- %lo(__start+4) # CHECK-NEXT: 2000c: 21 08 00 0c addi $8, $8, 12 # ^-- %lo(g1+8) -# CHECK-NEXT: 20010: 3c 08 00 04 lui $8, 4 +# CHECK-NEXT: 20010: 3c 08 00 05 lui $8, 5 # ^-- %hi(l1+0x10000-4) -# CHECK-NEXT: 20014: 3c 09 00 05 lui $9, 5 +# CHECK-NEXT: 20014: 3c 09 00 06 lui $9, 6 # ^-- %hi(l1+0x20000-4) # CHECK-NEXT: 20018: 21 08 ff fc addi $8, $8, -4 # ^-- %lo(l1-4) # CHECK: SYMBOL TABLE: -# CHECK: 0030000 l .data 00000004 l1 +# CHECK: 0040000 l .data 00000004 l1 # CHECK: 0020000 .text 00000000 __start -# CHECK: 0030004 g .data 00000004 g1 +# CHECK: 0040004 g .data 00000004 g1 diff --git a/test/ELF/mips-jalr.test b/test/ELF/mips-jalr.test index 4bdf8b6e7f00..c1b119c701b6 100644 --- a/test/ELF/mips-jalr.test +++ b/test/ELF/mips-jalr.test @@ -1,13 +1,18 @@ # Check that lld ignores R_MIPS_JALR relocation for now. -# RUN: yaml2obj -format elf %s -o %t.o +# RUN: yaml2obj %s -o %t.o # RUN: ld.lld %t.o -o %t.so -shared # RUN: llvm-objdump -d %t.so | FileCheck %s +# RUN: llvm-readobj -relocations %t.so | FileCheck -check-prefix=REL %s # REQUIRES: mips # CHECK: 10000: 09 f8 20 03 jalr $25 +# REL: Relocations [ +# REL-NEXT: ] + +!ELF FileHeader: Class: ELFCLASS32 Data: ELFDATA2LSB diff --git a/test/ELF/mips-lo16-not-relative.s b/test/ELF/mips-lo16-not-relative.s new file mode 100644 index 000000000000..614e6396cc92 --- /dev/null +++ b/test/ELF/mips-lo16-not-relative.s @@ -0,0 +1,23 @@ +# Check that R_MIPS_LO16 relocation is handled as non-relative, +# and if a target symbol is a DSO data symbol, LLD create a copy +# relocation. + +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \ +# RUN: %S/Inputs/mips-dynamic.s -o %t.so.o +# RUN: ld.lld %t.so.o -shared -o %t.so +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o +# RUN: ld.lld %t.o %t.so -o %t.exe +# RUN: llvm-readobj -r %t.exe | FileCheck %s + +# REQUIRES: mips + +# CHECK: Relocations [ +# CHECK-NEXT: Section (7) .rel.dyn { +# CHECK-NEXT: 0x{{[0-9A-F]+}} R_MIPS_COPY data0 0x0 +# CHECK-NEXT: } +# CHECK-NEXT: ] + + .text + .global __start +__start: + addi $t0, $t0, %lo(data0) diff --git a/test/ELF/mips-nonalloc.s b/test/ELF/mips-nonalloc.s new file mode 100644 index 000000000000..7b0aa9469f9f --- /dev/null +++ b/test/ELF/mips-nonalloc.s @@ -0,0 +1,21 @@ +# Check reading addends for relocations in non-allocatable sections. + +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t1.o +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \ +# RUN: %S/Inputs/mips-nonalloc.s -o %t2.o +# RUN: ld.lld %t1.o %t2.o -o %t.exe +# RUN: llvm-objdump -s %t.exe | FileCheck %s + +# REQUIRES: mips + +# CHECK: Contents of section .debug_info: +# CHECK-NEXT: 0000 ffffffff 00020000 00020000 +# ^--------^-- __start + + .global __start +__start: + nop + +.section .debug_info + .word 0xffffffff + .word __start diff --git a/test/ELF/mips-npic-call-pic.s b/test/ELF/mips-npic-call-pic.s new file mode 100644 index 000000000000..dbf053570bd9 --- /dev/null +++ b/test/ELF/mips-npic-call-pic.s @@ -0,0 +1,144 @@ +# REQUIRES: mips +# Check LA25 stubs creation. This stub code is necessary when +# non-PIC code calls PIC function. + +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \ +# RUN: %p/Inputs/mips-pic.s -o %t-pic.o +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t-npic.o +# RUN: ld.lld %t-npic.o %t-pic.o %p/Inputs/mips-sto-pic.o -o %t.exe +# RUN: llvm-objdump -d %t.exe | FileCheck %s + +# CHECK: Disassembly of section .text: +# CHECK-NEXT: __start: +# CHECK-NEXT: 20000: 0c 00 80 0e jal 131128 +# ^-- .pic.foo1a +# CHECK-NEXT: 20004: 00 00 00 00 nop +# CHECK-NEXT: 20008: 0c 00 80 19 jal 131172 +# ^-- .pic.foo2 +# CHECK-NEXT: 2000c: 00 00 00 00 nop +# CHECK-NEXT: 20010: 0c 00 80 12 jal 131144 +# ^-- .pic.foo1b +# CHECK-NEXT: 20014: 00 00 00 00 nop +# CHECK-NEXT: 20018: 0c 00 80 19 jal 131172 +# ^-- .pic.foo2 +# CHECK-NEXT: 2001c: 00 00 00 00 nop +# CHECK-NEXT: 20020: 0c 00 80 28 jal 131232 +# ^-- .pic.fpic +# CHECK-NEXT: 20024: 00 00 00 00 nop +# CHECK-NEXT: 20028: 0c 00 80 24 jal 131216 +# CHECK-NEXT: 2002c: 00 00 00 00 nop +# +# CHECK: foo1a: +# CHECK-NEXT: 20030: 00 00 00 00 nop +# +# CHECK: foo1b: +# CHECK-NEXT: 20034: 00 00 00 00 nop +# +# CHECK-NEXT: 20038: 3c 19 00 02 lui $25, 2 +# CHECK-NEXT: 2003c: 08 00 80 0c j 131120 +# CHECK-NEXT: 20040: 27 39 00 30 addiu $25, $25, 48 +# CHECK-NEXT: 20044: 00 00 00 00 nop +# CHECK-NEXT: 20048: 3c 19 00 02 lui $25, 2 +# CHECK-NEXT: 2004c: 08 00 80 0d j 131124 +# CHECK-NEXT: 20050: 27 39 00 34 addiu $25, $25, 52 +# CHECK-NEXT: 20054: 00 00 00 00 nop +# CHECK-NEXT: 20058: 00 00 00 00 nop +# CHECK-NEXT: 2005c: 00 00 00 00 nop +# +# CHECK: foo2: +# CHECK-NEXT: 20060: 00 00 00 00 nop +# +# CHECK-NEXT: 20064: 3c 19 00 02 lui $25, 2 +# CHECK-NEXT: 20068: 08 00 80 18 j 131168 +# CHECK-NEXT: 2006c: 27 39 00 60 addiu $25, $25, 96 +# CHECK-NEXT: 20070: 00 00 00 00 nop +# CHECK-NEXT: 20074: 00 00 00 00 nop +# CHECK-NEXT: 20078: 00 00 00 00 nop +# CHECK-NEXT: 2007c: 00 00 00 00 nop +# +# CHECK: fpic: +# CHECK-NEXT: 20080: 00 00 00 00 nop +# CHECK-NEXT: 20084: 00 00 00 00 nop +# CHECK-NEXT: 20088: 00 00 00 00 nop +# CHECK-NEXT: 2008c: 00 00 00 00 nop +# +# CHECK: fnpic: +# CHECK-NEXT: 20090: 00 00 00 00 nop +# CHECK-NEXT: 20094: 00 00 00 00 nop +# CHECK-NEXT: 20098: 00 00 00 00 nop +# CHECK-NEXT: 2009c: 00 00 00 00 nop +# CHECK-NEXT: 200a0: 3c 19 00 02 lui $25, 2 +# CHECK-NEXT: 200a4: 08 00 80 20 j 131200 +# CHECK-NEXT: 200a8: 27 39 00 80 addiu $25, $25, 128 + +# Make sure tha thunks are created properly no matter how +# objects are laid out. +# +# RUN: ld.lld %t-pic.o %t-npic.o %p/Inputs/mips-sto-pic.o -o %t.exe +# RUN: llvm-objdump -d %t.exe | FileCheck -check-prefix=REVERSE %s + +# REVERSE: foo1a: +# REVERSE-NEXT: 20000: 00 00 00 00 nop +# +# REVERSE: foo1b: +# REVERSE-NEXT: 20004: 00 00 00 00 nop +# REVERSE-NEXT: 20008: 3c 19 00 02 lui $25, 2 +# REVERSE-NEXT: 2000c: 08 00 80 00 j 131072 +# REVERSE-NEXT: 20010: 27 39 00 00 addiu $25, $25, 0 +# REVERSE-NEXT: 20014: 00 00 00 00 nop +# REVERSE-NEXT: 20018: 3c 19 00 02 lui $25, 2 +# REVERSE-NEXT: 2001c: 08 00 80 01 j 131076 +# REVERSE-NEXT: 20020: 27 39 00 04 addiu $25, $25, 4 +# REVERSE-NEXT: 20024: 00 00 00 00 nop +# REVERSE-NEXT: 20028: 00 00 00 00 nop +# REVERSE-NEXT: 2002c: 00 00 00 00 nop +# +# REVERSE: foo2: +# REVERSE-NEXT: 20030: 00 00 00 00 nop +# REVERSE-NEXT: 20034: 3c 19 00 02 lui $25, 2 +# REVERSE-NEXT: 20038: 08 00 80 0c j 131120 +# REVERSE-NEXT: 2003c: 27 39 00 30 addiu $25, $25, 48 +# REVERSE-NEXT: 20040: 00 00 00 00 nop +# REVERSE-NEXT: 20044: 00 00 00 00 nop +# REVERSE-NEXT: 20048: 00 00 00 00 nop +# REVERSE-NEXT: 2004c: 00 00 00 00 nop +# +# REVERSE: __start: +# REVERSE-NEXT: 20050: 0c 00 80 02 jal 131080 +# REVERSE-NEXT: 20054: 00 00 00 00 nop +# REVERSE-NEXT: 20058: 0c 00 80 0d jal 131124 +# REVERSE-NEXT: 2005c: 00 00 00 00 nop +# REVERSE-NEXT: 20060: 0c 00 80 06 jal 131096 +# REVERSE-NEXT: 20064: 00 00 00 00 nop +# REVERSE-NEXT: 20068: 0c 00 80 0d jal 131124 +# REVERSE-NEXT: 2006c: 00 00 00 00 nop +# REVERSE-NEXT: 20070: 0c 00 80 28 jal 131232 +# REVERSE-NEXT: 20074: 00 00 00 00 nop +# REVERSE-NEXT: 20078: 0c 00 80 24 jal 131216 +# REVERSE-NEXT: 2007c: 00 00 00 00 nop +# +# REVERSE: fpic: +# REVERSE-NEXT: 20080: 00 00 00 00 nop +# REVERSE-NEXT: 20084: 00 00 00 00 nop +# REVERSE-NEXT: 20088: 00 00 00 00 nop +# REVERSE-NEXT: 2008c: 00 00 00 00 nop +# +# REVERSE: fnpic: +# REVERSE-NEXT: 20090: 00 00 00 00 nop +# REVERSE-NEXT: 20094: 00 00 00 00 nop +# REVERSE-NEXT: 20098: 00 00 00 00 nop +# REVERSE-NEXT: 2009c: 00 00 00 00 nop +# REVERSE-NEXT: 200a0: 3c 19 00 02 lui $25, 2 +# REVERSE-NEXT: 200a4: 08 00 80 20 j 131200 +# REVERSE-NEXT: 200a8: 27 39 00 80 addiu $25, $25, 128 +# REVERSE-NEXT: 200ac: 00 00 00 00 nop + + .text + .globl __start +__start: + jal foo1a + jal foo2 + jal foo1b + jal foo2 + jal fpic + jal fnpic diff --git a/test/ELF/mips-options-r.test b/test/ELF/mips-options-r.test new file mode 100644 index 000000000000..c4144057e9ad --- /dev/null +++ b/test/ELF/mips-options-r.test @@ -0,0 +1,19 @@ +# Check that if input file contains .MIPS.options section and symbol +# points to the section and the linker generates a relocatable output, +# LLD does not crash and write section symbols point to the output +# .MIPS.options section. +# +# PR 27878 +# +# Input object file created using the following script: +# % cat t.s +# .text +# nop +# % as -mabi=64 -mips64r2 t.s + +# RUN: ld.lld -r %p/Inputs/mips-options.o -o %t.o +# RUN: llvm-readobj -t %t.o | FileCheck %s + +# REQUIRES: mips + +# CHECK: Section: .MIPS.options diff --git a/test/ELF/mips-options.s b/test/ELF/mips-options.s new file mode 100644 index 000000000000..30381ae55af7 --- /dev/null +++ b/test/ELF/mips-options.s @@ -0,0 +1,28 @@ +# Check MIPS .MIPS.options section generation. + +# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t1.o +# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \ +# RUN: %S/Inputs/mips-dynamic.s -o %t2.o +# RUN: ld.lld %t1.o %t2.o -shared -o %t.so +# RUN: llvm-readobj -symbols -mips-options %t.so | FileCheck %s + +# REQUIRES: mips + + .text + .globl __start +__start: + lw $t0,%call16(g1)($gp) + +# CHECK: Name: _gp +# CHECK-NEXT: Value: 0x[[GP:[0-9A-F]+]] + +# CHECK: MIPS Options { +# CHECK-NEXT: ODK_REGINFO { +# CHECK-NEXT: GP: 0x[[GP]] +# CHECK-NEXT: General Mask: 0x10001001 +# CHECK-NEXT: Co-Proc Mask0: 0x0 +# CHECK-NEXT: Co-Proc Mask1: 0x0 +# CHECK-NEXT: Co-Proc Mask2: 0x0 +# CHECK-NEXT: Co-Proc Mask3: 0x0 +# CHECK-NEXT: } +# CHECK-NEXT: } diff --git a/test/ELF/mips-pc-relocs.s b/test/ELF/mips-pc-relocs.s index 631dd433925a..209d7d2971f5 100644 --- a/test/ELF/mips-pc-relocs.s +++ b/test/ELF/mips-pc-relocs.s @@ -5,7 +5,7 @@ # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \ # RUN: -mcpu=mips32r6 %S/Inputs/mips-dynamic.s -o %t2.o # RUN: ld.lld %t1.o %t2.o -o %t.exe -# RUN: llvm-objdump -mcpu=mips32r6 -d -t %t.exe | FileCheck %s +# RUN: llvm-objdump -mcpu=mips32r6 -d -t -s %t.exe | FileCheck %s # REQUIRES: mips @@ -19,20 +19,27 @@ __start: aluipc $2, %pcrel_hi(_foo) # R_MIPS_PCHI16 addiu $2, $2, %pcrel_lo(_foo) # R_MIPS_PCLO16 + .data + .word _foo+8-. # R_MIPS_PC32 + # CHECK: Disassembly of section .text: # CHECK-NEXT: __start: # CHECK-NEXT: 20000: ec c8 00 08 lwpc $6, 32 # ^-- (0x20020-0x20000)>>2 -# CHECK-NEXT: 20004: 20 a6 00 06 beqc $5, $6, 24 +# CHECK-NEXT: 20004: 20 a6 00 06 beqc $5, $6, 28 # ^-- (0x20020-4-0x20004)>>2 -# CHECK-NEXT: 20008: d9 20 00 05 beqzc $9, 20 +# CHECK-NEXT: 20008: d9 20 00 05 beqzc $9, 24 # ^-- (0x20020-4-0x20008)>>2 -# CHECK-NEXT: 2000c: c8 00 00 04 bc 16 +# CHECK-NEXT: 2000c: c8 00 00 04 bc 20 # ^-- (0x20020-4-0x2000c)>>2 # CHECK-NEXT: 20010: ec 5f 00 00 aluipc $2, 0 # ^-- %hi(0x20020-0x20010) # CHECK-NEXT: 20014: 24 42 00 0c addiu $2, $2, 12 # ^-- %lo(0x20020-0x20014) +# CHECK: Contents of section .data: +# CHECK-NEXT: 40000 fffe0028 00000000 00000000 00000000 +# ^-- 0x20020 + 8 - 0x40000 + # CHECK: 00020000 .text 00000000 __start # CHECK: 00020020 .text 00000000 _foo diff --git a/test/ELF/mips-plt-copy.s b/test/ELF/mips-plt-copy.s new file mode 100644 index 000000000000..58883d884563 --- /dev/null +++ b/test/ELF/mips-plt-copy.s @@ -0,0 +1,85 @@ +# Check creating of R_MIPS_COPY and R_MIPS_JUMP_SLOT dynamic relocations +# and corresponding PLT entries. + +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \ +# RUN: %S/Inputs/mips-dynamic.s -o %t.so.o +# RUN: ld.lld %t.so.o -shared -o %t.so +# RUN: ld.lld %t.o %t.so -o %t.exe +# RUN: llvm-readobj -r -mips-plt-got %t.exe | FileCheck %s + +# REQUIRES: mips + +# CHECK: Relocations [ +# CHECK-NEXT: Section ({{.*}}) .rel.dyn { +# CHECK-NEXT: 0x{{[0-9A-F]+}} R_MIPS_COPY data0 0x0 +# CHECK-NEXT: 0x{{[0-9A-F]+}} R_MIPS_COPY data1 0x0 +# CHECK-NEXT: } +# CHECK-NEXT: Section ({{.*}}) .rel.plt { +# CHECK-NEXT: 0x{{[0-9A-F]+}} R_MIPS_JUMP_SLOT foo0 0x0 +# CHECK-NEXT: 0x{{[0-9A-F]+}} R_MIPS_JUMP_SLOT foo1 0x0 +# CHECK-NEXT: } +# CHECK-NEXT: ] + +# CHECK: Primary GOT { +# CHECK: Local entries [ +# CHECK-NEXT: ] +# CHECK-NEXT: Global entries [ +# CHECK-NEXT: ] +# CHECK-NEXT: Number of TLS and multi-GOT entries: 0 +# CHECK-NEXT: } + +# CHECK: PLT GOT { +# CHECK: Entries [ +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x{{[0-9A-F]+}} +# CHECK-NEXT: Initial: 0x{{[0-9A-F]+}} +# CHECK-NEXT: Value: 0x{{[0-9A-F]+}} +# CHECK-NEXT: Type: Function +# CHECK-NEXT: Section: Undefined +# CHECK-NEXT: Name: foo0 +# CHECK-NEXT: } +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x{{[0-9A-F]+}} +# CHECK-NEXT: Initial: 0x{{[0-9A-F]+}} +# CHECK-NEXT: Value: 0x{{[0-9A-F]+}} +# CHECK-NEXT: Type: Function +# CHECK-NEXT: Section: Undefined +# CHECK-NEXT: Name: foo1 +# CHECK-NEXT: } +# CHECK-NEXT: ] +# CHECK-NEXT: } + + .text + .globl __start +__start: + lui $t0,%hi(foo0) # R_MIPS_HI16 requires JUMP_SLOT/PLT entry + # for DSO defined func. + addi $t0,$t0,%lo(foo0) + lui $t0,%hi(bar) # Does not require PLT for locally defined func. + addi $t0,$t0,%lo(bar) + lui $t0,%hi(loc) # Does not require PLT for local func. + addi $t0,$t0,%lo(loc) + + lui $t0,%hi(data0) # R_MIPS_HI16 requires COPY rel for DSO defined data. + addi $t0,$t0,%lo(data0) + lui $t0,%hi(gd) # Does not require COPY rel for locally defined data. + addi $t0,$t0,%lo(gd) + lui $t0,%hi(ld) # Does not require COPY rel for local data. + addi $t0,$t0,%lo(ld) + + .globl bar + .type bar, @function +bar: + nop +loc: + nop + + .rodata + .globl gd +gd: + .word 0 +ld: + .word data1+8 # R_MIPS_32 requires REL32 dnamic relocation + # for DSO defined data. For now we generate COPY one. + .word foo1+8 # R_MIPS_32 requires PLT entry for DSO defined func. diff --git a/test/ELF/mips-relocs.s b/test/ELF/mips-relocs.s deleted file mode 100644 index c05b8fd3bdd1..000000000000 --- a/test/ELF/mips-relocs.s +++ /dev/null @@ -1,42 +0,0 @@ -# Check R_MIPS_32 relocation calculation. - -# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t-be.o -# RUN: ld.lld %t-be.o -o %t-be.exe -# RUN: llvm-objdump -t %t-be.exe | FileCheck %s -# RUN: llvm-objdump -s %t-be.exe | FileCheck -check-prefix=BE %s - -# RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux %s -o %t-el.o -# RUN: ld.lld %t-el.o -o %t-el.exe -# RUN: llvm-objdump -t %t-el.exe | FileCheck %s -# RUN: llvm-objdump -s %t-el.exe | FileCheck -check-prefix=EL %s - -# REQUIRES: mips - - .globl __start -__start: - nop - - .data - .type v1,@object - .size v1,4 -v1: - .word 0 - - .globl v2 - .type v2,@object - .size v2,8 -v2: - .word v2+4 # R_MIPS_32 target v2 addend 4 - .word v1 # R_MIPS_32 target v1 addend 0 - -# CHECK: SYMBOL TABLE: -# CHECK: 00030000 l .data 00000004 v1 -# CHECK: 00030004 g .data 00000008 v2 - -# BE: Contents of section .data: -# BE-NEXT: 30000 00000000 00030008 00030000 -# ^-- v2+4 ^-- v1 - -# EL: Contents of section .data: -# EL-NEXT: 30000 00000000 08000300 00000300 -# ^-- v2+4 ^-- v1 diff --git a/test/ELF/mips-sto-plt.s b/test/ELF/mips-sto-plt.s new file mode 100644 index 000000000000..bd8de416680a --- /dev/null +++ b/test/ELF/mips-sto-plt.s @@ -0,0 +1,66 @@ +# Check assigning STO_MIPS_PLT flag to symbol needs a pointer equality. + +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \ +# RUN: %S/Inputs/mips-dynamic.s -o %t.so.o +# RUN: ld.lld %t.so.o -shared -o %t.so +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o +# RUN: ld.lld %t.o %t.so -o %t.exe +# RUN: llvm-readobj -dt -mips-plt-got %t.exe | FileCheck %s + +# REQUIRES: mips + +# CHECK: Symbol { +# CHECK: Name: foo0@ +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Global +# CHECK-NEXT: Type: Function +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Undefined +# CHECK-NEXT: } +# CHECK: Symbol { +# CHECK: Name: foo1@ +# CHECK-NEXT: Value: 0x20050 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Global +# CHECK-NEXT: Type: Function +# CHECK-NEXT: Other [ (0x8) +# CHECK-NEXT: STO_MIPS_PLT +# CHECK-NEXT: ] +# CHECK-NEXT: Section: Undefined +# CHECK-NEXT: } + +# CHECK: Primary GOT { +# CHECK: Local entries [ +# CHECK-NEXT: ] +# CHECK-NEXT: Global entries [ +# CHECK-NEXT: ] +# CHECK: PLT GOT { +# CHECK: Entries [ +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: +# CHECK-NEXT: Initial: +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Type: Function +# CHECK-NEXT: Section: Undefined +# CHECK-NEXT: Name: foo0 +# CHECK-NEXT: } +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: +# CHECK-NEXT: Initial: +# CHECK-NEXT: Value: 0x20050 +# CHECK-NEXT: Type: Function +# CHECK-NEXT: Section: Undefined +# CHECK-NEXT: Name: foo1 +# CHECK-NEXT: } +# CHECK-NEXT: ] + + .text + .globl __start +__start: + jal foo0 # R_MIPS_26 against 'foo0' from DSO + lui $t0,%hi(foo1) # R_MIPS_HI16/LO16 against 'foo1' from DSO + addi $t0,$t0,%lo(foo1) + +loc: + nop diff --git a/test/ELF/mips-tls-64.s b/test/ELF/mips-tls-64.s new file mode 100644 index 000000000000..9c05e940b1c1 --- /dev/null +++ b/test/ELF/mips-tls-64.s @@ -0,0 +1,86 @@ +# Check MIPS TLS 64-bit relocations handling. + +# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \ +# RUN: %p/Inputs/mips-dynamic.s -o %t.so.o +# RUN: ld.lld -shared %t.so.o -o %t.so +# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t.o +# RUN: ld.lld %t.o %t.so -o %t.exe +# RUN: llvm-objdump -d -s -t %t.exe | FileCheck -check-prefix=DIS %s +# RUN: llvm-readobj -r -mips-plt-got %t.exe | FileCheck %s + +# REQUIRES: mips + +# DIS: __start: +# DIS-NEXT: 20000: 24 62 80 28 addiu $2, $3, -32728 +# DIS-NEXT: 20004: 24 62 80 38 addiu $2, $3, -32712 +# DIS-NEXT: 20008: 8f 82 80 20 lw $2, -32736($gp) +# DIS-NEXT: 2000c: 24 62 80 48 addiu $2, $3, -32696 + +# DIS: Contents of section .got: +# DIS_NEXT: 30008 00000000 00000000 80000000 00000000 +# DIS_NEXT: 30018 00000000 00020000 00000000 00000000 +# DIS_NEXT: 30028 00000000 00000004 00000000 00000000 +# DIS_NEXT: 30038 00000000 00000000 00000000 00000004 + +# DIS: 0000000000030000 l .tdata 00000000 .tdata +# DIS: 0000000000030000 l .tdata 00000000 loc +# DIS: 0000000000000004 g .tdata 00000000 foo + +# CHECK: Relocations [ +# CHECK-NEXT: Section (7) .rela.dyn { +# CHECK-NEXT: 0x30020 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE - 0x0 +# CHECK-NEXT: 0x30028 R_MIPS_TLS_DTPREL64/R_MIPS_NONE/R_MIPS_NONE - 0x0 +# CHECK-NEXT: 0x30030 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE - 0x0 +# CHECK-NEXT: 0x30040 R_MIPS_TLS_TPREL64/R_MIPS_NONE/R_MIPS_NONE - 0x4 +# CHECK-NEXT: } +# CHECK-NEXT: ] +# CHECK-NEXT: Primary GOT { +# CHECK-NEXT: Canonical gp value: 0x37FF8 +# CHECK-NEXT: Reserved entries [ +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x30008 +# CHECK-NEXT: Access: -32752 +# CHECK-NEXT: Initial: 0x0 +# CHECK-NEXT: Purpose: Lazy resolver +# CHECK-NEXT: } +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x30010 +# CHECK-NEXT: Access: -32744 +# CHECK-NEXT: Initial: 0x80000000 +# CHECK-NEXT: Purpose: Module pointer (GNU extension) +# CHECK-NEXT: } +# CHECK-NEXT: ] +# CHECK-NEXT: Local entries [ +# CHECK-NEXT: ] +# CHECK-NEXT: Global entries [ +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x30018 +# CHECK-NEXT: Access: -32736 +# CHECK-NEXT: Initial: 0x0 +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Type: Function +# CHECK-NEXT: Section: Undefined +# CHECK-NEXT: Name: foo0 +# CHECK-NEXT: } +# CHECK-NEXT: ] +# CHECK-NEXT: Number of TLS and multi-GOT entries: 5 +# ^-- 0x30020 / -32728 - R_MIPS_TLS_GD - R_MIPS_TLS_DTPMOD32 foo +# ^-- 0x30028 / -32720 - R_MIPS_TLS_DTPREL32 foo +# ^-- 0x30030 / -32712 - R_MIPS_TLS_LDM - R_MIPS_TLS_DTPMOD32 loc +# ^-- 0x30038 / -32704 +# ^-- 0x30040 / -32696 - R_MIPS_TLS_GOTTPREL - R_MIPS_TLS_TPREL32 + + .text + .global __start +__start: + addiu $2, $3, %tlsgd(foo) # R_MIPS_TLS_GD + addiu $2, $3, %tlsldm(loc) # R_MIPS_TLS_LDM + lw $2, %got(foo0)($gp) + addiu $2, $3, %gottprel(foo) # R_MIPS_TLS_GOTTPREL + + .section .tdata,"awT",%progbits + .global foo +loc: + .word 0 +foo: + .word 0 diff --git a/test/ELF/mips-tls-hilo.s b/test/ELF/mips-tls-hilo.s new file mode 100644 index 000000000000..7628cb3a6ec6 --- /dev/null +++ b/test/ELF/mips-tls-hilo.s @@ -0,0 +1,52 @@ +# Check MIPS R_MIPS_TLS_DTPREL_HI16/LO16 and R_MIPS_TLS_TPREL_HI16/LO16 +# relocations handling. + +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o +# RUN: ld.lld %t.o -o %t.exe +# RUN: llvm-objdump -d -t %t.exe | FileCheck -check-prefix=DIS %s +# RUN: llvm-readobj -r -mips-plt-got %t.exe | FileCheck %s + +# RUN: ld.lld %t.o -shared -o %t.so +# RUN: llvm-readobj -r -mips-plt-got %t.so | FileCheck -check-prefix=SO %s + +# REQUIRES: mips + +# DIS: __start: +# DIS-NEXT: 20000: 24 62 00 00 addiu $2, $3, 0 +# %hi(loc0 - .tdata - 0x8000) --^ +# DIS-NEXT: 20004: 24 62 80 00 addiu $2, $3, -32768 +# %lo(loc0 - .tdata - 0x8000) --^ +# DIS-NEXT: 20008: 24 62 00 00 addiu $2, $3, 0 +# %hi(loc0 - .tdata - 0x7000) --^ +# DIS-NEXT: 2000c: 24 62 90 00 addiu $2, $3, -28672 +# %lo(loc0 - .tdata - 0x7000) --^ + +# DIS: 00030000 l .tdata 00000000 .tdata +# DIS: 00030000 l .tdata 00000000 loc0 + +# CHECK: Relocations [ +# CHECK-NEXT: ] +# CHECK-NOT: Primary GOT + +# SO: Relocations [ +# SO-NEXT: ] +# SO: Primary GOT { +# SO: Local entries [ +# SO-NEXT: ] +# SO-NEXT: Global entries [ +# SO-NEXT: ] +# SO-NEXT: Number of TLS and multi-GOT entries: 0 +# SO-NEXT: } + + .text + .globl __start + .type __start,@function +__start: + addiu $2, $3, %dtprel_hi(loc0) # R_MIPS_TLS_DTPREL_HI16 + addiu $2, $3, %dtprel_lo(loc0) # R_MIPS_TLS_DTPREL_LO16 + addiu $2, $3, %tprel_hi(loc0) # R_MIPS_TLS_TPREL_HI16 + addiu $2, $3, %tprel_lo(loc0) # R_MIPS_TLS_TPREL_LO16 + + .section .tdata,"awT",%progbits +loc0: + .word 0 diff --git a/test/ELF/mips-tls.s b/test/ELF/mips-tls.s new file mode 100644 index 000000000000..9635558c2d95 --- /dev/null +++ b/test/ELF/mips-tls.s @@ -0,0 +1,77 @@ +# Check MIPS TLS relocations handling. + +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \ +# RUN: %p/Inputs/mips-tls.s -o %t.so.o +# RUN: ld.lld -shared %t.so.o -o %t.so +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o +# RUN: ld.lld %t.o %t.so -o %t.exe +# RUN: llvm-objdump -d -s -t %t.exe | FileCheck -check-prefix=DIS %s +# RUN: llvm-readobj -r -mips-plt-got %t.exe | FileCheck %s + +# REQUIRES: mips + +# DIS: __start: +# DIS-NEXT: 20000: 24 62 80 1c addiu $2, $3, -32740 +# DIS-NEXT: 20004: 24 62 80 24 addiu $2, $3, -32732 +# DIS-NEXT: 20008: 8f 82 80 18 lw $2, -32744($gp) +# DIS-NEXT: 2000c: 24 62 80 2c addiu $2, $3, -32724 + +# DIS: Contents of section .got: +# DIS_NEXT: 30004 00000000 80000000 00020000 00000000 +# DIS_NEXT: 30014 00000000 00000000 00000000 00000000 + +# DIS: 00030000 l .tdata 00000000 .tdata +# DIS: 00030000 l .tdata 00000000 loc +# DIS: 00000000 g *UND* 00000000 foo + +# CHECK: Relocations [ +# CHECK-NEXT: Section (7) .rel.dyn { +# CHECK-NEXT: 0x30018 R_MIPS_TLS_DTPMOD32 - 0x0 +# CHECK-NEXT: 0x30010 R_MIPS_TLS_DTPMOD32 foo 0x0 +# CHECK-NEXT: 0x30014 R_MIPS_TLS_DTPREL32 foo 0x0 +# CHECK-NEXT: 0x30020 R_MIPS_TLS_TPREL32 foo 0x0 +# CHECK-NEXT: } +# CHECK-NEXT: ] +# CHECK-NEXT: Primary GOT { +# CHECK-NEXT: Canonical gp value: 0x37FF4 +# CHECK-NEXT: Reserved entries [ +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x30004 +# CHECK-NEXT: Access: -32752 +# CHECK-NEXT: Initial: 0x0 +# CHECK-NEXT: Purpose: Lazy resolver +# CHECK-NEXT: } +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x30008 +# CHECK-NEXT: Access: -32748 +# CHECK-NEXT: Initial: 0x80000000 +# CHECK-NEXT: Purpose: Module pointer (GNU extension) +# CHECK-NEXT: } +# CHECK-NEXT: ] +# CHECK-NEXT: Local entries [ +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x3000C +# CHECK-NEXT: Access: -32744 +# CHECK-NEXT: Initial: 0x20000 +# CHECK-NEXT: } +# CHECK-NEXT: ] +# CHECK-NEXT: Global entries [ +# CHECK-NEXT: ] +# CHECK-NEXT: Number of TLS and multi-GOT entries: 5 +# ^-- 0x30010 / -32740 - R_MIPS_TLS_GD - R_MIPS_TLS_DTPMOD32 foo +# ^-- 0x30018 / -32736 - R_MIPS_TLS_DTPREL32 foo +# ^-- 0x3001C / -32732 - R_MIPS_TLS_LDM - R_MIPS_TLS_DTPMOD32 loc +# ^-- 0x30020 / -32728 +# ^-- 0x30024 / -32724 - R_MIPS_TLS_GOTTPREL - R_MIPS_TLS_TPREL32 + + .text + .global __start +__start: + addiu $2, $3, %tlsgd(foo) # R_MIPS_TLS_GD + addiu $2, $3, %tlsldm(loc) # R_MIPS_TLS_LDM + lw $2, %got(__start)($gp) + addiu $2, $3, %gottprel(foo) # R_MIPS_TLS_GOTTPREL + + .section .tdata,"awT",%progbits +loc: + .word 0 diff --git a/test/ELF/no-augmentation.s b/test/ELF/no-augmentation.s new file mode 100644 index 000000000000..31cd92e39b1c --- /dev/null +++ b/test/ELF/no-augmentation.s @@ -0,0 +1,19 @@ +// RUN: llvm-mc -filetype=obj -triple=mips64-unknown-freebsd %s -o %t.o +// RUN: ld.lld --eh-frame-hdr %t.o -o %t | FileCheck -allow-empty %s + +// REQUIRES: mips + +// CHECK-NOT: corrupted or unsupported CIE information +// CHECK-NOT: corrupted CIE + +.global __start +__start: + +.section .eh_frame,"aw",@progbits + .4byte 9 + .4byte 0x0 + .byte 0x1 + .string "" + .uleb128 0x1 + .sleb128 -4 + .byte 0x1f diff --git a/test/ELF/no-inhibit-exec.s b/test/ELF/no-inhibit-exec.s index fe2240b731fe..31638fd92cc9 100644 --- a/test/ELF/no-inhibit-exec.s +++ b/test/ELF/no-inhibit-exec.s @@ -6,10 +6,10 @@ # CHECK: Disassembly of section .text: # CHECK-NEXT: _start -# CHECK-NEXT: 11000: e8 fb ef fe ff callq -69637 +# CHECK-NEXT: 11000: e8 fb ef fe ff callq -69637 # next code will not link without noinhibit-exec flag # because of undefined symbol _bar -.globl _start; +.globl _start _start: call _bar diff --git a/test/ELF/no-plt-shared.s b/test/ELF/no-plt-shared.s new file mode 100644 index 000000000000..ac45ed502c38 --- /dev/null +++ b/test/ELF/no-plt-shared.s @@ -0,0 +1,17 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/shared.s -o %t.o +// RUN: ld.lld %t.o -o %t.so -shared + +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t2.o +// RUN: ld.lld %t2.o %t.so -o %t2.so -shared +// RUN: llvm-readobj -r %t2.so | FileCheck %s + + .data +fp: + .quad bar + +// CHECK: Relocations [ +// CHECK-NEXT: Section ({{.*}}) .rela.dyn { +// CHECK-NEXT: R_X86_64_64 bar 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: ] diff --git a/test/ELF/no-undefined.s b/test/ELF/no-undefined.s index 94378bde40a2..fa4d5e928763 100644 --- a/test/ELF/no-undefined.s +++ b/test/ELF/no-undefined.s @@ -4,4 +4,4 @@ .globl _shared _shared: - call _unresolved + callq _unresolved@PLT diff --git a/test/ELF/noplt-pie.s b/test/ELF/noplt-pie.s new file mode 100644 index 000000000000..1eb84934184e --- /dev/null +++ b/test/ELF/noplt-pie.s @@ -0,0 +1,21 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o +# RUN: ld.lld -shared %t2.o -o %t2.so +# RUN: ld.lld %t1.o %t2.so -o %t.out +# RUN: llvm-readobj -s -r %t.out | FileCheck %s + +# CHECK: Section { +# CHECK-NOT: Name: .plt + +# CHECK: Relocations [ +# CHECK-NEXT: Section ({{.*}}) .rela.dyn { +# CHECK-NEXT: 0x120B0 R_X86_64_GLOB_DAT bar 0x0 +# CHECK-NEXT: 0x120B8 R_X86_64_GLOB_DAT zed 0x0 +# CHECK-NEXT: } +# CHECK-NEXT: ] + +.global _start +_start: + movq bar@GOTPCREL(%rip), %rcx + movq zed@GOTPCREL(%rip), %rcx diff --git a/test/ELF/note.s b/test/ELF/note.s new file mode 100644 index 000000000000..a383b95c9907 --- /dev/null +++ b/test/ELF/note.s @@ -0,0 +1,18 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: ld.lld %t.o -o %t -shared +// RUN: llvm-readobj -program-headers %t | FileCheck %s + +// CHECK: Type: PT_NOTE +// CHECK-NEXT: Offset: +// CHECK-NEXT: VirtualAddress: +// CHECK-NEXT: PhysicalAddress: +// CHECK-NEXT: FileSize: 8 +// CHECK-NEXT: MemSize: 8 +// CHECK-NEXT: Flags [ +// CHECK-NEXT: PF_R +// CHECK-NEXT: ] +// CHECK-NEXT: Alignment: 1 + + .section .note.test,"a",@note + .quad 42 diff --git a/test/ELF/phdr-align.s b/test/ELF/phdr-align.s new file mode 100644 index 000000000000..58d537b46840 --- /dev/null +++ b/test/ELF/phdr-align.s @@ -0,0 +1,82 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + +# RUN: echo "SECTIONS { \ +# RUN: .bss : { *(.bss) } \ +# RUN: .data : { *(.data) } \ +# RUN: .text : { *(.text) } }" > %t.script +# RUN: ld.lld %t.o --script %t.script -o %t +# RUN: llvm-readobj -sections -symbols %t | FileCheck %s + +# CHECK: Sections [ +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: 0 +# CHECK-NEXT: Name: (0) +# CHECK-NEXT: Type: SHT_NULL +# CHECK-NEXT: Flags [ +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x0 +# CHECK-NEXT: Offset: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Link: 0 +# CHECK-NEXT: Info: 0 +# CHECK-NEXT: AddressAlignment: 0 +# CHECK-NEXT: EntrySize: 0 +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: 1 +# CHECK-NEXT: Name: .bss +# CHECK-NEXT: Type: SHT_NOBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: SHF_WRITE +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x158 +# CHECK-NEXT: Offset: 0x158 +# CHECK-NEXT: Size: 6 +# CHECK-NEXT: Link: 0 +# CHECK-NEXT: Info: 0 +# CHECK-NEXT: AddressAlignment: 1 +# CHECK-NEXT: EntrySize: 0 +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: 2 +# CHECK-NEXT: Name: .data +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: SHF_WRITE +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x15E +# CHECK-NEXT: Offset: 0x15E +# CHECK-NEXT: Size: 2 +# CHECK-NEXT: Link: 0 +# CHECK-NEXT: Info: 0 +# CHECK-NEXT: AddressAlignment: 1 +# CHECK-NEXT: EntrySize: 0 +# CHECK-NEXT: } +# CHECK-NEXT: Section { +# CHECK-NEXT: Index: 3 +# CHECK-NEXT: Name: .text +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: SHF_EXECINSTR +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x160 +# CHECK-NEXT: Offset: 0x160 +# CHECK-NEXT: Size: 1 +# CHECK-NEXT: Link: 0 +# CHECK-NEXT: Info: 0 +# CHECK-NEXT: AddressAlignment: 4 +# CHECK-NEXT: EntrySize: 0 +# CHECK-NEXT: } + +.global _start +.text +_start: + nop +.data + .word 1 +.bss + .space 6 diff --git a/test/ELF/pie-weak.s b/test/ELF/pie-weak.s new file mode 100644 index 000000000000..e74bcdfc09c0 --- /dev/null +++ b/test/ELF/pie-weak.s @@ -0,0 +1,16 @@ +# RUN: llvm-mc -filetype=obj -relax-relocations=false -triple=x86_64-unknown-linux %s -o %t.o +# RUN: ld.lld -pie %t.o -o %t +# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOCS %s +# RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s + +# RELOCS: Relocations [ +# RELOCS-NEXT: ] + +.weak foo + +.globl _start +_start: +# DISASM: _start: +# DISASM-NEXT: 1000: 48 8b 05 69 10 00 00 movq 4201(%rip), %rax +# ^ .got - (.text + 7) +mov foo@gotpcrel(%rip), %rax diff --git a/test/ELF/pie.s b/test/ELF/pie.s new file mode 100644 index 000000000000..4cf1743ee736 --- /dev/null +++ b/test/ELF/pie.s @@ -0,0 +1,102 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o +# RUN: ld.lld -pie %t1.o -o %t +# RUN: llvm-readobj -file-headers -sections -program-headers -symbols -r %t | FileCheck %s + +## Test --pic-executable alias +# RUN: ld.lld --pic-executable %t1.o -o %t +# RUN: llvm-readobj -file-headers -sections -program-headers -symbols -r %t | FileCheck %s + +# CHECK: ElfHeader { +# CHECK-NEXT: Ident { +# CHECK-NEXT: Magic: (7F 45 4C 46) +# CHECK-NEXT: Class: 64-bit +# CHECK-NEXT: DataEncoding: LittleEndian +# CHECK-NEXT: FileVersion: 1 +# CHECK-NEXT: OS/ABI: SystemV +# CHECK-NEXT: ABIVersion: 0 +# CHECK-NEXT: Unused: (00 00 00 00 00 00 00) +# CHECK-NEXT: } +# CHECK-NEXT: Type: SharedObject +# CHECK-NEXT: Machine: EM_X86_64 +# CHECK-NEXT: Version: 1 +# CHECK-NEXT: Entry: 0x1000 +# CHECK-NEXT: ProgramHeaderOffset: 0x40 +# CHECK-NEXT: SectionHeaderOffset: 0x1110 +# CHECK-NEXT: Flags [ +# CHECK-NEXT: ] +# CHECK-NEXT: HeaderSize: 64 +# CHECK-NEXT: ProgramHeaderEntrySize: 56 +# CHECK-NEXT: ProgramHeaderCount: 7 +# CHECK-NEXT: SectionHeaderEntrySize: 64 +# CHECK-NEXT: SectionHeaderCount: 9 +# CHECK-NEXT: StringTableSectionIndex: 7 +# CHECK-NEXT: } + +# CHECK: ProgramHeaders [ +# CHECK-NEXT: ProgramHeader { +# CHECK-NEXT: Type: PT_PHDR +# CHECK-NEXT: Offset: 0x40 +# CHECK-NEXT: VirtualAddress: 0x40 +# CHECK-NEXT: PhysicalAddress: 0x40 +# CHECK-NEXT: FileSize: 392 +# CHECK-NEXT: MemSize: 392 +# CHECK-NEXT: Flags [ +# CHECK-NEXT: PF_R +# CHECK-NEXT: ] +# CHECK-NEXT: Alignment: 8 +# CHECK-NEXT: } +# CHECK-NEXT: ProgramHeader { +# CHECK-NEXT: Type: PT_LOAD +# CHECK-NEXT: Offset: 0x0 +# CHECK-NEXT: VirtualAddress: 0x0 +# CHECK-NEXT: PhysicalAddress: 0x0 +# CHECK-NEXT: FileSize: 497 +# CHECK-NEXT: MemSize: 497 +# CHECK-NEXT: Flags [ +# CHECK-NEXT: PF_R +# CHECK-NEXT: ] +# CHECK-NEXT: Alignment: 4096 +# CHECK-NEXT: } +# CHECK-NEXT: ProgramHeader { +# CHECK-NEXT: Type: PT_LOAD +# CHECK-NEXT: Offset: 0x1000 +# CHECK-NEXT: VirtualAddress: 0x1000 +# CHECK-NEXT: PhysicalAddress: 0x1000 +# CHECK-NEXT: FileSize: 0 +# CHECK-NEXT: MemSize: 0 +# CHECK-NEXT: Flags [ +# CHECK-NEXT: PF_R +# CHECK-NEXT: PF_X +# CHECK-NEXT: ] +# CHECK-NEXT: Alignment: 4096 +# CHECK-NEXT: } +# CHECK-NEXT: ProgramHeader { +# CHECK-NEXT: Type: PT_LOAD +# CHECK-NEXT: Offset: 0x1000 +# CHECK-NEXT: VirtualAddress: 0x1000 +# CHECK-NEXT: PhysicalAddress: 0x1000 +# CHECK-NEXT: FileSize: 112 +# CHECK-NEXT: MemSize: 112 +# CHECK-NEXT: Flags [ +# CHECK-NEXT: PF_R +# CHECK-NEXT: PF_W +# CHECK-NEXT: ] +# CHECK-NEXT: Alignment: 4096 +# CHECK-NEXT: } +# CHECK-NEXT: ProgramHeader { +# CHECK-NEXT: Type: PT_DYNAMIC +# CHECK-NEXT: Offset: 0x1000 +# CHECK-NEXT: VirtualAddress: 0x1000 +# CHECK-NEXT: PhysicalAddress: 0x1000 +# CHECK-NEXT: FileSize: 112 +# CHECK-NEXT: MemSize: 112 +# CHECK-NEXT: Flags [ +# CHECK-NEXT: PF_R +# CHECK-NEXT: PF_W +# CHECK-NEXT: ] +# CHECK-NEXT: Alignment: 8 +# CHECK-NEXT: } + +.globl _start +_start: diff --git a/test/ELF/plt-aarch64.s b/test/ELF/plt-aarch64.s index 6ea732ec7c68..3f124b0af49c 100644 --- a/test/ELF/plt-aarch64.s +++ b/test/ELF/plt-aarch64.s @@ -1,5 +1,5 @@ // RUN: llvm-mc -filetype=obj -triple=aarch64-pc-freebsd %s -o %t.o -// RUN: llvm-mc -filetype=obj -triple=aarch64-pc-freebsd %p/Inputs/shared.s -o %t2.o +// RUN: llvm-mc -filetype=obj -triple=aarch64-pc-freebsd %p/Inputs/plt-aarch64.s -o %t2.o // RUN: ld.lld -shared %t2.o -o %t2.so // RUN: ld.lld -shared %t.o %t2.so -o %t.so // RUN: ld.lld %t.o %t2.so -o %t.exe diff --git a/test/ELF/plt-i686.s b/test/ELF/plt-i686.s index 4947e0e734fd..bf07fede7989 100644 --- a/test/ELF/plt-i686.s +++ b/test/ELF/plt-i686.s @@ -2,12 +2,13 @@ // RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %p/Inputs/shared.s -o %t2.o // RUN: ld.lld -shared %t2.o -o %t2.so // RUN: ld.lld %t.o %t2.so -o %t -// RUN: llvm-readobj -s -r %t | FileCheck --check-prefix=CHECK %s +// RUN: llvm-readobj -s -r %t | FileCheck %s // RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s // RUN: ld.lld -shared %t.o %t2.so -o %t // RUN: llvm-readobj -s -r %t | FileCheck --check-prefix=CHECKSHARED %s // RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASMSHARED %s - +// RUN: ld.lld -pie %t.o %t2.so -o %t +// RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASMPIE %s // REQUIRES: x86 // CHECK: Name: .plt @@ -147,6 +148,21 @@ // DISASMSHARED-NEXT: 1046: 68 08 00 00 00 pushl $8 // DISASMSHARED-NEXT: 104b: e9 d0 ff ff ff jmp -48 <.plt> +// DISASMPIE: Disassembly of section .plt: +// DISASMPIE-NEXT: .plt: +// DISASMPIE-NEXT: 1020: ff b3 04 00 00 00 pushl 4(%ebx) +// DISASMPIE-NEXT: 1026: ff a3 08 00 00 00 jmpl *8(%ebx) +// DISASMPIE-NEXT: 102c: 90 nop +// DISASMPIE-NEXT: 102d: 90 nop +// DISASMPIE-NEXT: 102e: 90 nop +// DISASMPIE-NEXT: 102f: 90 nop +// DISASMPIE-NEXT: 1030: ff a3 0c 30 00 00 jmpl *12300(%ebx) +// DISASMPIE-NEXT: 1036: 68 00 00 00 00 pushl $0 +// DISASMPIE-NEXT: 103b: e9 e0 ff ff ff jmp -32 <.plt> +// DISASMPIE-NEXT: 1040: ff a3 10 30 00 00 jmpl *12304(%ebx) +// DISASMPIE-NEXT: 1046: 68 08 00 00 00 pushl $8 +// DISASMPIE-NEXT: 104b: e9 d0 ff ff ff jmp -48 <.plt> + local: .long 0 diff --git a/test/ELF/plt.s b/test/ELF/plt.s index 1183d32c3ccc..60268a68195a 100644 --- a/test/ELF/plt.s +++ b/test/ELF/plt.s @@ -109,7 +109,7 @@ // DISASM2-NEXT: 11040: ff 25 da 1f 00 00 jmpq *8154(%rip) // DISASM2-NEXT: 11046: 68 01 00 00 00 pushq $1 // DISASM2-NEXT: 1104b: e9 d0 ff ff ff jmp -48 <.plt> -// DISASM2-NEXT-NOT: 110C0 +// DISASM2-NOT: 110C0 .global _start _start: diff --git a/test/ELF/ppc64-addr16-error.s b/test/ELF/ppc64-addr16-error.s index 57a919a9b338..2bc8ef2ae4d7 100644 --- a/test/ELF/ppc64-addr16-error.s +++ b/test/ELF/ppc64-addr16-error.s @@ -1,7 +1,8 @@ // RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t -// RUN: not ld.lld -shared %t -o %t2 2>&1 | FileCheck %s +// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/ppc64-addr16-error.s -o %t2 +// RUN: not ld.lld -shared %t %t2 -o %t3 2>&1 | FileCheck %s // REQUIRES: ppc .short sym+65539 -// CHECK: Relocation R_PPC64_ADDR16 out of range +// CHECK: relocation R_PPC64_ADDR16 out of range diff --git a/test/ELF/ppc64-relocs.s b/test/ELF/ppc64-relocs.s index 61f9a1eb3ce3..28902aed26df 100644 --- a/test/ELF/ppc64-relocs.s +++ b/test/ELF/ppc64-relocs.s @@ -43,7 +43,7 @@ _start: # CHECK: Disassembly of section .R_PPC64_TOC16_HI: # CHECK: .FR_PPC64_TOC16_HI: -# CHECK: 10010014: 3c 22 10 01 addis 1, 2, 4097 +# CHECK: 10010014: 3c 22 ff ff addis 1, 2, -1 .section .R_PPC64_TOC16_HA,"ax",@progbits .globl .FR_PPC64_TOC16_HA @@ -52,7 +52,7 @@ _start: # CHECK: Disassembly of section .R_PPC64_TOC16_HA: # CHECK: .FR_PPC64_TOC16_HA: -# CHECK: 10010018: 3c 22 10 02 addis 1, 2, 4098 +# CHECK: 10010018: 3c 22 00 00 addis 1, 2, 0 .section .R_PPC64_REL24,"ax",@progbits .globl .FR_PPC64_REL24 diff --git a/test/ELF/ppc64-toc-restore.s b/test/ELF/ppc64-toc-restore.s index cee105b35e64..dbfeaece7db4 100644 --- a/test/ELF/ppc64-toc-restore.s +++ b/test/ELF/ppc64-toc-restore.s @@ -53,8 +53,8 @@ last: // CHECK: Disassembly of section .plt: // CHECK: .plt: // CHECK: 10010020: f8 41 00 28 std 2, 40(1) -// CHECK: 10010024: 3d 62 00 00 addis 11, 2, 0 -// CHECK: 10010028: e9 8b 80 00 ld 12, -32768(11) +// CHECK: 10010024: 3d 62 10 03 addis 11, 2, 4099 +// CHECK: 10010028: e9 8b 80 18 ld 12, -32744(11) // CHECK: 1001002c: e9 6c 00 00 ld 11, 0(12) // CHECK: 10010030: 7d 69 03 a6 mtctr 11 // CHECK: 10010034: e8 4c 00 08 ld 2, 8(12) diff --git a/test/ELF/pre_init_fini_array.s b/test/ELF/pre_init_fini_array.s index bf32283d2579..4ddcb6947e5b 100644 --- a/test/ELF/pre_init_fini_array.s +++ b/test/ELF/pre_init_fini_array.s @@ -67,7 +67,9 @@ _start: // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Other [ +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] // CHECK-NEXT: Section: .fini_array // CHECK-NEXT: } // CHECK-NEXT: Symbol { @@ -76,7 +78,9 @@ _start: // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Other [ +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] // CHECK-NEXT: Section: .fini_array // CHECK-NEXT: } // CHECK-NEXT: Symbol { @@ -85,7 +89,9 @@ _start: // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Other [ +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] // CHECK-NEXT: Section: .init_array // CHECK-NEXT: } // CHECK-NEXT: Symbol { @@ -94,7 +100,9 @@ _start: // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Other [ +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] // CHECK-NEXT: Section: .init_array // CHECK-NEXT: } // CHECK-NEXT: Symbol { @@ -103,7 +111,9 @@ _start: // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Other [ +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] // CHECK-NEXT: Section: .preinit_array // CHECK-NEXT: } // CHECK-NEXT: Symbol { @@ -112,7 +122,9 @@ _start: // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Other [ +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] // CHECK-NEXT: Section: .preinit_array // CHECK-NEXT: } diff --git a/test/ELF/progname.s b/test/ELF/progname.s index 5712b95d276d..10cbf177c69b 100644 --- a/test/ELF/progname.s +++ b/test/ELF/progname.s @@ -1,10 +1,29 @@ // RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %s -o %t.o -// RUN: echo '.global __progname' > %t2.s +// RUN: echo .global __progname > %t2.s // RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %t2.s -o %t2.o // RUN: ld.lld -shared %t2.o -o %t2.so // RUN: ld.lld -o %t %t.o %t2.so // RUN: llvm-readobj -dyn-symbols %t | FileCheck %s + +// Inputs/progname-ver.so consists of the assembly file +// +// .global bar +// bar: +// .quad __progname +// +// linked into a library with the version script +// +// VER_1 { +// global: +// bar; +// }; +// +// We should create it with lld itself once we it supports that. + +// RUN: ld.lld -o %t %t.o %p/Inputs/progname-ver.so +// RUN: llvm-readobj -dyn-symbols %t | FileCheck %s + // CHECK: Name: __progname@ // CHECK-NEXT: Value: 0x11000 // CHECK-NEXT: Size: 0 diff --git a/test/ELF/protected-shared.s b/test/ELF/protected-shared.s new file mode 100644 index 000000000000..e69b10899dae --- /dev/null +++ b/test/ELF/protected-shared.s @@ -0,0 +1,52 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/protected-shared.s -o %t2.o +// RUN: ld.lld -shared %t2.o -o %t2.so +// RUN: ld.lld %t.o %t2.so -o %t +// RUN: llvm-readobj -t --dyn-symbols %t | FileCheck %s + + .global _start +_start: + + .global bar +bar: + + .data + .quad foo + +// CHECK: Name: bar +// CHECK-NEXT: Value: +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .text + +// CHECK: Name: foo +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: Undefined + +// CHECK: DynamicSymbols [ +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: @ +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local (0x0) +// CHECK-NEXT: Type: None (0x0) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: Undefined (0x0) +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: foo@ +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: Undefined +// CHECK-NEXT: } +// CHECK-NEXT: ] diff --git a/test/ELF/rel-offset.s b/test/ELF/rel-offset.s new file mode 100644 index 000000000000..6f35bcebc4b0 --- /dev/null +++ b/test/ELF/rel-offset.s @@ -0,0 +1,15 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: ld.lld %t.o -o %t -shared +// RUN: llvm-readobj -r %t | FileCheck %s + + .section .data.foo,"aw",@progbits + .quad foo + + .section .data.zed,"aw",@progbits + .quad foo + +// CHECK: Section ({{.*}}) .rela.dyn { +// CHECK-NEXT: 0x2000 R_X86_64_64 foo 0x0 +// CHECK-NEXT: 0x2008 R_X86_64_64 foo 0x0 +// CHECK-NEXT: } diff --git a/test/ELF/relative-dynamic-reloc-pie.s b/test/ELF/relative-dynamic-reloc-pie.s new file mode 100644 index 000000000000..d9967af52eb6 --- /dev/null +++ b/test/ELF/relative-dynamic-reloc-pie.s @@ -0,0 +1,26 @@ +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: ld.lld -pie %t.o -o %t.pie +# RUN: llvm-readobj -r -dyn-symbols %t.pie | FileCheck %s + +## Test that we create R_X86_64_RELATIVE relocations with -pie. +# CHECK: Relocations [ +# CHECK-NEXT: Section ({{.*}}) .rela.dyn { +# CHECK-NEXT: 0x3000 R_X86_64_RELATIVE - 0x3000 +# CHECK-NEXT: 0x3008 R_X86_64_RELATIVE - 0x3008 +# CHECK-NEXT: 0x3010 R_X86_64_RELATIVE - 0x3009 +# CHECK-NEXT: } +# CHECK-NEXT: ] + +.globl _start +_start: +nop + + .data +foo: + .quad foo + +.hidden bar +.global bar +bar: + .quad bar + .quad bar + 1 diff --git a/test/ELF/relative-dynamic-reloc-ppc64.s b/test/ELF/relative-dynamic-reloc-ppc64.s index b22b33f9f469..81a7a7027bb8 100644 --- a/test/ELF/relative-dynamic-reloc-ppc64.s +++ b/test/ELF/relative-dynamic-reloc-ppc64.s @@ -10,10 +10,10 @@ // CHECK-NEXT: Section ({{.*}}) .rela.dyn { // CHECK-NEXT: 0x[[FOO_ADDR:.*]] R_PPC64_RELATIVE - 0x[[FOO_ADDR]] // CHECK-NEXT: 0x[[BAR_ADDR:.*]] R_PPC64_RELATIVE - 0x[[BAR_ADDR]] -// CHECK-NEXT: 0x10010 R_PPC64_RELATIVE - 0x10009 +// CHECK-NEXT: 0x20010 R_PPC64_RELATIVE - 0x20009 // CHECK-NEXT: 0x{{.*}} R_PPC64_RELATIVE - 0x[[ZED_ADDR:.*]] // CHECK-NEXT: 0x{{.*}} R_PPC64_RELATIVE - 0x[[FOO_ADDR]] -// CHECK-NEXT: 0x1D0 R_PPC64_ADDR64 external 0x0 +// CHECK-NEXT: 0x20028 R_PPC64_ADDR64 external 0x0 // CHECK-NEXT: } // CHECK-NEXT: ] @@ -47,6 +47,7 @@ // CHECK-NEXT: } // CHECK-NEXT: ] + .data foo: .quad foo @@ -60,7 +61,7 @@ bar: .comm zed,1 .quad zed - .section abc,"a" + .section abc,"aw" .quad foo .quad external diff --git a/test/ELF/relative-dynamic-reloc.s b/test/ELF/relative-dynamic-reloc.s index 41fcd8a6a556..aac55669bb17 100644 --- a/test/ELF/relative-dynamic-reloc.s +++ b/test/ELF/relative-dynamic-reloc.s @@ -9,10 +9,10 @@ // CHECK-NEXT: Section ({{.*}}) .rela.dyn { // CHECK-NEXT: 0x[[FOO_ADDR:.*]] R_X86_64_RELATIVE - 0x[[FOO_ADDR]] // CHECK-NEXT: 0x[[BAR_ADDR:.*]] R_X86_64_RELATIVE - 0x[[BAR_ADDR]] -// CHECK-NEXT: 0x1010 R_X86_64_RELATIVE - 0x1009 +// CHECK-NEXT: 0x2010 R_X86_64_RELATIVE - 0x2009 // CHECK-NEXT: 0x{{.*}} R_X86_64_RELATIVE - 0x[[ZED_ADDR:.*]] // CHECK-NEXT: 0x{{.*}} R_X86_64_RELATIVE - 0x[[FOO_ADDR]] -// CHECK-NEXT: 0x1D0 R_X86_64_64 external 0x0 +// CHECK-NEXT: 0x2028 R_X86_64_64 external 0x0 // CHECK-NEXT: } // CHECK-NEXT: ] @@ -46,6 +46,7 @@ // CHECK-NEXT: } // CHECK-NEXT: ] + .data foo: .quad foo @@ -59,7 +60,7 @@ bar: .comm zed,1 .quad zed - .section abc,"a" + .section abc,"aw" .quad foo .quad external diff --git a/test/ELF/relocatable-bss.s b/test/ELF/relocatable-bss.s new file mode 100644 index 000000000000..0411bf339c43 --- /dev/null +++ b/test/ELF/relocatable-bss.s @@ -0,0 +1,40 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o +# RUN: ld.lld -r %t1.o -o %t +# RUN: llvm-readobj -file-headers -sections -program-headers -symbols -r %t | FileCheck %s + +## We check here that .bss does not occupy the space in file. +## If it would, the SectionHeaderOffset would have offset about 5 megabytes. +# CHECK: ElfHeader { +# CHECK-NEXT: Ident { +# CHECK-NEXT: Magic: (7F 45 4C 46) +# CHECK-NEXT: Class: 64-bit +# CHECK-NEXT: DataEncoding: LittleEndian +# CHECK-NEXT: FileVersion: 1 +# CHECK-NEXT: OS/ABI: SystemV +# CHECK-NEXT: ABIVersion: 0 +# CHECK-NEXT: Unused: (00 00 00 00 00 00 00) +# CHECK-NEXT: } +# CHECK-NEXT: Type: Relocatable +# CHECK-NEXT: Machine: EM_X86_64 +# CHECK-NEXT: Version: +# CHECK-NEXT: Entry: +# CHECK-NEXT: ProgramHeaderOffset: +# CHECK-NEXT: SectionHeaderOffset: 0xA8 +# CHECK-NEXT: Flags [ +# CHECK-NEXT: ] +# CHECK-NEXT: HeaderSize: +# CHECK-NEXT: ProgramHeaderEntrySize: +# CHECK-NEXT: ProgramHeaderCount: +# CHECK-NEXT: SectionHeaderEntrySize: +# CHECK-NEXT: SectionHeaderCount: +# CHECK-NEXT: StringTableSectionIndex: +# CHECK-NEXT: } + +.text +.globl _start +_start: + nop + +.bss + .space 5242880 diff --git a/test/ELF/relocatable-ehframe.s b/test/ELF/relocatable-ehframe.s new file mode 100644 index 000000000000..d48402099c36 --- /dev/null +++ b/test/ELF/relocatable-ehframe.s @@ -0,0 +1,51 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/relocatable-ehframe.s -o %t2.o +# RUN: ld.lld -r %t1.o %t2.o -o %t +# RUN: llvm-readobj -r -s -section-data %t | FileCheck %s + +# CHECK: Name: .strtab +# CHECK-NEXT: Type: SHT_STRTAB +# CHECK-NEXT: Flags [ +# CHECK-NEXT: ] +# CHECK-NEXT: Address: +# CHECK-NEXT: Offset +# CHECK-NEXT: Size: 9 +# CHECK-NEXT: Link: 0 +# CHECK-NEXT: Info: 0 +# CHECK-NEXT: AddressAlignment: 1 +# CHECK-NEXT: EntrySize: 0 +# CHECK-NEXT: SectionData ( +# CHECK-NEXT: 0000: 00005F73 74617274 00 |.._start.| +# CHECK-NEXT: ) + +# CHECK: Relocations [ +# CHECK-NEXT: Section {{.*}} .rela.eh_frame { +# CHECK-NEXT: 0x20 R_X86_64_PC32 foo 0x0 +# CHECK-NEXT: 0x34 R_X86_64_PC32 bar 0x0 +# CHECK-NEXT: 0x48 R_X86_64_PC32 dah 0x0 +# CHECK-NEXT: 0x78 R_X86_64_PC32 foo1 0x0 +# CHECK-NEXT: 0x8C R_X86_64_PC32 bar1 0x0 +# CHECK-NEXT: 0xA0 R_X86_64_PC32 dah1 0x0 +# CHECK-NEXT: } +# CHECK-NEXT: ] + +.section foo,"ax",@progbits +.cfi_startproc + nop +.cfi_endproc + +.section bar,"ax",@progbits +.cfi_startproc + nop +.cfi_endproc + +.section dah,"ax",@progbits +.cfi_startproc + nop +.cfi_endproc + +.text +.globl _start +_start: + nop diff --git a/test/ELF/relocatable-reloc.s b/test/ELF/relocatable-reloc.s new file mode 100644 index 000000000000..c576073a7510 --- /dev/null +++ b/test/ELF/relocatable-reloc.s @@ -0,0 +1,14 @@ +// RUN: llvm-mc -filetype=obj %s -o %t.o -triple=x86_64-pc-linux +// RUN: ld.lld %t.o %t.o -r -o %t2.o +// RUN: llvm-readobj -r %t2.o | FileCheck %s + +.weak foo +foo: +.quad foo + +// CHECK: Relocations [ +// CHECK-NEXT: Section ({{.*}}) .rela.text { +// CHECK-NEXT: 0x0 R_X86_64_64 foo 0x0 +// CHECK-NEXT: 0x8 R_X86_64_64 foo 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: ] diff --git a/test/ELF/relocatable-symbols.s b/test/ELF/relocatable-symbols.s new file mode 100644 index 000000000000..75ed17ec5f6f --- /dev/null +++ b/test/ELF/relocatable-symbols.s @@ -0,0 +1,183 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: ld.lld -r %t -o %tout +# RUN: llvm-objdump -d %tout | FileCheck -check-prefix=DISASM %s +# RUN: llvm-readobj -symbols -r %tout | FileCheck -check-prefix=SYMBOL %s + +# DISASM: _start: +# DISASM-NEXT: 0: {{.*}} callq 0 +# DISASM-NEXT: 5: {{.*}} callq 0 +# DISASM-NEXT: a: {{.*}} callq 0 +# DISASM-NEXT: f: {{.*}} callq 0 +# DISASM-NEXT: 14: {{.*}} callq 0 +# DISASM-NEXT: 19: {{.*}} callq 0 +# DISASM-NEXT: 1e: {{.*}} callq 0 +# DISASM-NEXT: 23: {{.*}} callq 0 +# DISASM-NEXT: 28: {{.*}} callq 0 +# DISASM-NEXT: 2d: {{.*}} callq 0 +# DISASM-NEXT: 32: {{.*}} callq 0 +# DISASM-NEXT: 37: {{.*}} callq 0 +# DISASM-NEXT: Disassembly of section foo: +# DISASM-NEXT: foo: +# DISASM-NEXT: 0: 90 nop +# DISASM-NEXT: 1: 90 nop +# DISASM-NEXT: 2: 90 nop +# DISASM-NEXT: Disassembly of section bar: +# DISASM-NEXT: bar: +# DISASM-NEXT: 0: 90 nop +# DISASM-NEXT: 1: 90 nop +# DISASM-NEXT: 2: 90 nop + +# SYMBOL: Relocations [ +# SYMBOL-NEXT: Section ({{.*}}) .rela.text { +# SYMBOL-NEXT: 0x1 R_X86_64_PC32 __start_foo 0x0 +# SYMBOL-NEXT: 0x6 R_X86_64_PC32 __stop_foo 0x0 +# SYMBOL-NEXT: 0xB R_X86_64_PC32 __start_bar 0x0 +# SYMBOL-NEXT: 0x10 R_X86_64_PC32 __stop_bar 0x0 +# SYMBOL-NEXT: 0x15 R_X86_64_PC32 __start_doo 0x0 +# SYMBOL-NEXT: 0x1A R_X86_64_PC32 __stop_doo 0x0 +# SYMBOL-NEXT: 0x1F R_X86_64_PC32 __preinit_array_start 0x0 +# SYMBOL-NEXT: 0x24 R_X86_64_PC32 __preinit_array_end 0x0 +# SYMBOL-NEXT: 0x29 R_X86_64_PC32 __init_array_start 0x0 +# SYMBOL-NEXT: 0x2E R_X86_64_PC32 __init_array_end 0x0 +# SYMBOL-NEXT: 0x33 R_X86_64_PC32 __fini_array_start 0x0 +# SYMBOL-NEXT: 0x38 R_X86_64_PC32 __fini_array_end 0x0 +# SYMBOL-NEXT: } +# SYMBOL-NEXT: ] +# SYMBOL: Symbol { +# SYMBOL: Name: __fini_array_end +# SYMBOL-NEXT: Value: 0x0 +# SYMBOL-NEXT: Size: 0 +# SYMBOL-NEXT: Binding: Global +# SYMBOL-NEXT: Type: None +# SYMBOL-NEXT: Other: 0 +# SYMBOL-NEXT: Section: Undefined +# SYMBOL-NEXT: } +# SYMBOL-NEXT: Symbol { +# SYMBOL-NEXT: Name: __fini_array_start +# SYMBOL-NEXT: Value: 0x0 +# SYMBOL-NEXT: Size: 0 +# SYMBOL-NEXT: Binding: Global +# SYMBOL-NEXT: Type: None +# SYMBOL-NEXT: Other: 0 +# SYMBOL-NEXT: Section: Undefined +# SYMBOL-NEXT: } +# SYMBOL-NEXT: Symbol { +# SYMBOL-NEXT: Name: __init_array_end +# SYMBOL-NEXT: Value: 0x0 +# SYMBOL-NEXT: Size: 0 +# SYMBOL-NEXT: Binding: Global +# SYMBOL-NEXT: Type: None +# SYMBOL-NEXT: Other: 0 +# SYMBOL-NEXT: Section: Undefined +# SYMBOL-NEXT: } +# SYMBOL-NEXT: Symbol { +# SYMBOL-NEXT: Name: __init_array_start +# SYMBOL-NEXT: Value: 0x0 +# SYMBOL-NEXT: Size: 0 +# SYMBOL-NEXT: Binding: Global +# SYMBOL-NEXT: Type: None +# SYMBOL-NEXT: Other: 0 +# SYMBOL-NEXT: Section: Undefined +# SYMBOL-NEXT: } +# SYMBOL-NEXT: Symbol { +# SYMBOL-NEXT: Name: __preinit_array_end +# SYMBOL-NEXT: Value: 0x0 +# SYMBOL-NEXT: Size: 0 +# SYMBOL-NEXT: Binding: Global +# SYMBOL-NEXT: Type: None +# SYMBOL-NEXT: Other: 0 +# SYMBOL-NEXT: Section: Undefined +# SYMBOL-NEXT: } +# SYMBOL-NEXT: Symbol { +# SYMBOL-NEXT: Name: __preinit_array_start +# SYMBOL-NEXT: Value: 0x0 +# SYMBOL-NEXT: Size: 0 +# SYMBOL-NEXT: Binding: Global +# SYMBOL-NEXT: Type: None +# SYMBOL-NEXT: Other: 0 +# SYMBOL-NEXT: Section: Undefined +# SYMBOL-NEXT: } +# SYMBOL-NEXT: Symbol { +# SYMBOL-NEXT: Name: __start_bar +# SYMBOL-NEXT: Value: 0x0 +# SYMBOL-NEXT: Size: 0 +# SYMBOL-NEXT: Binding: Global +# SYMBOL-NEXT: Type: None +# SYMBOL-NEXT: Other: 0 +# SYMBOL-NEXT: Section: Undefined +# SYMBOL-NEXT: } +# SYMBOL-NEXT: Symbol { +# SYMBOL-NEXT: Name: __start_doo +# SYMBOL-NEXT: Value: 0x0 +# SYMBOL-NEXT: Size: 0 +# SYMBOL-NEXT: Binding: Global +# SYMBOL-NEXT: Type: None +# SYMBOL-NEXT: Other: 0 +# SYMBOL-NEXT: Section: Undefined +# SYMBOL-NEXT: } +# SYMBOL-NEXT: Symbol { +# SYMBOL-NEXT: Name: __start_foo +# SYMBOL-NEXT: Value: 0x0 +# SYMBOL-NEXT: Size: 0 +# SYMBOL-NEXT: Binding: Global +# SYMBOL-NEXT: Type: None +# SYMBOL-NEXT: Other: 0 +# SYMBOL-NEXT: Section: Undefined +# SYMBOL-NEXT: } +# SYMBOL-NEXT: Symbol { +# SYMBOL-NEXT: Name: __stop_bar +# SYMBOL-NEXT: Value: 0x0 +# SYMBOL-NEXT: Size: 0 +# SYMBOL-NEXT: Binding: Global +# SYMBOL-NEXT: Type: None +# SYMBOL-NEXT: Other: 0 +# SYMBOL-NEXT: Section: Undefined +# SYMBOL-NEXT: } +# SYMBOL-NEXT: Symbol { +# SYMBOL-NEXT: Name: __stop_doo +# SYMBOL-NEXT: Value: 0x0 +# SYMBOL-NEXT: Size: 0 +# SYMBOL-NEXT: Binding: Global +# SYMBOL-NEXT: Type: None +# SYMBOL-NEXT: Other: 0 +# SYMBOL-NEXT: Section: Undefined +# SYMBOL-NEXT: } +# SYMBOL-NEXT: Symbol { +# SYMBOL-NEXT: Name: __stop_foo +# SYMBOL-NEXT: Value: 0x0 +# SYMBOL-NEXT: Size: 0 +# SYMBOL-NEXT: Binding: Global +# SYMBOL-NEXT: Type: None +# SYMBOL-NEXT: Other: 0 +# SYMBOL-NEXT: Section: Undefined +# SYMBOL-NEXT: } + +.global _start +.text +_start: + call __start_foo + call __stop_foo + + call __start_bar + call __stop_bar + + call __start_doo + call __stop_doo + + call __preinit_array_start + call __preinit_array_end + call __init_array_start + call __init_array_end + call __fini_array_start + call __fini_array_end + +.section foo,"ax" + nop + nop + nop + +.section bar,"ax" + nop + nop + nop diff --git a/test/ELF/relocatable.s b/test/ELF/relocatable.s index 9fb171d4ed50..032cb6336c08 100644 --- a/test/ELF/relocatable.s +++ b/test/ELF/relocatable.s @@ -1,9 +1,120 @@ # REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/relocatable.s -o %t2.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/relocatable2.s -o %t3.o +# RUN: ld.lld -r %t1.o %t2.o %t3.o -o %t +# RUN: llvm-readobj -file-headers -sections -program-headers -symbols -r %t | FileCheck %s +# RUN: llvm-objdump -s -d %t | FileCheck -check-prefix=CHECKTEXT %s -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t -# RUN: not ld.lld -r %t -o %t2 2>&1 | FileCheck %s +## Test --relocatable alias +# RUN: ld.lld --relocatable %t1.o %t2.o %t3.o -o %t +# RUN: llvm-readobj -file-headers -sections -program-headers -symbols -r %t | FileCheck %s +# RUN: llvm-objdump -s -d %t | FileCheck -check-prefix=CHECKTEXT %s -# CHECK: -r option is not supported. Use 'ar' command instead. +## Verify that we can use our relocation output as input to produce executable +# RUN: ld.lld -e main %t -o %texec +# RUN: llvm-readobj -file-headers %texec | FileCheck -check-prefix=CHECKEXE %s -.globl _start; -_start: +# CHECK: ElfHeader { +# CHECK-NEXT: Ident { +# CHECK-NEXT: Magic: (7F 45 4C 46) +# CHECK-NEXT: Class: 64-bit +# CHECK-NEXT: DataEncoding: LittleEndian +# CHECK-NEXT: FileVersion: 1 +# CHECK-NEXT: OS/ABI: SystemV +# CHECK-NEXT: ABIVersion: 0 +# CHECK-NEXT: Unused: (00 00 00 00 00 00 00) +# CHECK-NEXT: } +# CHECK-NEXT: Type: Relocatable +# CHECK-NEXT: Machine: EM_X86_64 +# CHECK-NEXT: Version: 1 +# CHECK-NEXT: Entry: 0x0 +# CHECK-NEXT: ProgramHeaderOffset: 0x0 +# CHECK-NEXT: SectionHeaderOffset: 0x2C0 +# CHECK-NEXT: Flags [ +# CHECK-NEXT: ] +# CHECK-NEXT: HeaderSize: 64 +# CHECK-NEXT: ProgramHeaderEntrySize: 0 +# CHECK-NEXT: ProgramHeaderCount: 0 +# CHECK-NEXT: SectionHeaderEntrySize: 64 +# CHECK-NEXT: SectionHeaderCount: 7 +# CHECK-NEXT: StringTableSectionIndex: 5 +# CHECK-NEXT: } + +# CHECK: Relocations [ +# CHECK-NEXT: Section (3) .rela.text { +# CHECK-NEXT: 0x3 R_X86_64_32S x 0x0 +# CHECK-NEXT: 0xE R_X86_64_32S y 0x0 +# CHECK-NEXT: 0x23 R_X86_64_32S xx 0x0 +# CHECK-NEXT: 0x2E R_X86_64_32S yy 0x0 +# CHECK-NEXT: 0x43 R_X86_64_32S xxx 0x0 +# CHECK-NEXT: 0x4E R_X86_64_32S yyy 0x0 +# CHECK-NEXT: } + +# CHECKTEXT: Disassembly of section .text: +# CHECKTEXT-NEXT: main: +# CHECKTEXT-NEXT: 0: c7 04 25 00 00 00 00 05 00 00 00 movl $5, 0 +# CHECKTEXT-NEXT: b: c7 04 25 00 00 00 00 07 00 00 00 movl $7, 0 +# CHECKTEXT: foo: +# CHECKTEXT-NEXT: 20: c7 04 25 00 00 00 00 01 00 00 00 movl $1, 0 +# CHECKTEXT-NEXT: 2b: c7 04 25 00 00 00 00 02 00 00 00 movl $2, 0 +# CHECKTEXT: bar: +# CHECKTEXT-NEXT: 40: c7 04 25 00 00 00 00 08 00 00 00 movl $8, 0 +# CHECKTEXT-NEXT: 4b: c7 04 25 00 00 00 00 09 00 00 00 movl $9, 0 + +# CHECKEXE: Format: ELF64-x86-64 +# CHECKEXE-NEXT: Arch: x86_64 +# CHECKEXE-NEXT: AddressSize: 64bit +# CHECKEXE-NEXT: LoadName: +# CHECKEXE-NEXT: ElfHeader { +# CHECKEXE-NEXT: Ident { +# CHECKEXE-NEXT: Magic: (7F 45 4C 46) +# CHECKEXE-NEXT: Class: 64-bit +# CHECKEXE-NEXT: DataEncoding: LittleEndian +# CHECKEXE-NEXT: FileVersion: 1 +# CHECKEXE-NEXT: OS/ABI: SystemV (0x0) +# CHECKEXE-NEXT: ABIVersion: 0 +# CHECKEXE-NEXT: Unused: (00 00 00 00 00 00 00) +# CHECKEXE-NEXT: } +# CHECKEXE-NEXT: Type: Executable +# CHECKEXE-NEXT: Machine: EM_X86_64 +# CHECKEXE-NEXT: Version: 1 +# CHECKEXE-NEXT: Entry: 0x11000 +# CHECKEXE-NEXT: ProgramHeaderOffset: 0x40 +# CHECKEXE-NEXT: SectionHeaderOffset: 0x11E8 +# CHECKEXE-NEXT: Flags [ +# CHECKEXE-NEXT: ] +# CHECKEXE-NEXT: HeaderSize: 64 +# CHECKEXE-NEXT: ProgramHeaderEntrySize: 56 +# CHECKEXE-NEXT: ProgramHeaderCount: 5 +# CHECKEXE-NEXT: SectionHeaderEntrySize: 64 +# CHECKEXE-NEXT: SectionHeaderCount: 6 +# CHECKEXE-NEXT: StringTableSectionIndex: 4 +# CHECKEXE-NEXT: } + +.text +.type x,@object +.bss +.globl x +.align 4 +x: +.long 0 +.size x, 4 +.type y,@object +.globl y +.align 4 +y: +.long 0 +.size y, 4 + +.text +.globl main +.align 16, 0x90 +.type main,@function +main: +movl $5, x +movl $7, y + +blah: +goo: +abs = 42 diff --git a/test/ELF/relocation-copy-alias.s b/test/ELF/relocation-copy-alias.s new file mode 100644 index 000000000000..15712e39bc93 --- /dev/null +++ b/test/ELF/relocation-copy-alias.s @@ -0,0 +1,67 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/relocation-copy-alias.s -o %t2.o +// RUN: ld.lld -shared %t2.o -o %t.so +// RUN: ld.lld %t.o %t.so -o %t3 +// RUN: llvm-readobj --dyn-symbols -r --expand-relocs %t3 | FileCheck %s + +.global _start +_start: +movl $5, a1 +movl $5, b1 +movl $5, b2 + +// CHECK: .rela.dyn { +// CHECK-NEXT: Relocation { +// CHECK-NEXT: Offset: +// CHECK-NEXT: Type: R_X86_64_COPY +// CHECK-NEXT: Symbol: a1 +// CHECK-NEXT: Addend: 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: Relocation { +// CHECK-NEXT: Offset: +// CHECK-NEXT: Type: R_X86_64_COPY +// CHECK-NEXT: Symbol: b1 +// CHECK-NEXT: Addend: 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: } + +// CHECK: Name: a1 +// CHECK-NEXT: Value: [[A:.*]] +// CHECK-NEXT: Size: 1 +// CHECK-NEXT: Binding: Global (0x1) +// CHECK-NEXT: Type: Object (0x1) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .bss (0x7) + +// CHECK: Name: b1 +// CHECK-NEXT: Value: [[B:.*]] +// CHECK-NEXT: Size: 1 +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: Object (0x1) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .bss + +// CHECK: Name: b2 +// CHECK-NEXT: Value: [[B]] +// CHECK-NEXT: Size: 1 +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: Object (0x1) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .bss + +// CHECK: Name: a2 +// CHECK-NEXT: Value: [[A]] +// CHECK-NEXT: Size: 1 +// CHECK-NEXT: Binding: Weak +// CHECK-NEXT: Type: Object (0x1) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .bss + +// CHECK: Name: b3 +// CHECK-NEXT: Value: [[B]] +// CHECK-NEXT: Size: 1 +// CHECK-NEXT: Binding: Weak +// CHECK-NEXT: Type: Object (0x1) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .bss diff --git a/test/ELF/relocation-copy-flags.s b/test/ELF/relocation-copy-flags.s new file mode 100644 index 000000000000..50b4b15267e6 --- /dev/null +++ b/test/ELF/relocation-copy-flags.s @@ -0,0 +1,73 @@ +// REQUIRES: x86 + +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/relocation-copy.s -o %t2.o +// RUN: ld.lld %t2.o -o %t2.so -shared +// RUN: ld.lld %t.o %t2.so -o %t.exe +// RUN: llvm-readobj -s -section-data -r %t.exe | FileCheck %s + + .global _start +_start: + .quad x + + .section foo + .quad y + + .section bar, "aw" + .quad z + +// CHECK: Name: .text +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_EXECINSTR +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x11000 +// CHECK-NEXT: Offset: 0x1000 +// CHECK-NEXT: Size: 8 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 4 +// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 10300100 +// CHECK-NEXT: ) + +// CHECK: Name: bar +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x13000 +// CHECK-NEXT: Offset: 0x3000 +// CHECK-NEXT: Size: 8 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 1 +// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 00000000 +// CHECK-NEXT: ) + +// CHECK: Name: foo +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x0 +// CHECK-NEXT: Offset: 0x3008 +// CHECK-NEXT: Size: 8 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 1 +// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 00000000 +// CHECK-NEXT: ) + +// CHECK: Relocations [ +// CHECK-NEXT: Section (4) .rela.dyn { +// CHECK-NEXT: 0x13010 R_X86_64_COPY x 0x0 +// CHECK-NEXT: 0x13000 R_X86_64_64 z 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: ] diff --git a/test/ELF/relocation-copy-i686.s b/test/ELF/relocation-copy-i686.s index d61f84783cb6..f9ee32e2b35e 100644 --- a/test/ELF/relocation-copy-i686.s +++ b/test/ELF/relocation-copy-i686.s @@ -22,7 +22,7 @@ movl $9, z // CHECK-NEXT: SHF_WRITE // CHECK-NEXT: ] // CHECK-NEXT: Address: 0x13000 -// CHECK-NEXT: Offset: 0x3000 +// CHECK-NEXT: Offset: // CHECK-NEXT: Size: 24 // CHECK-NEXT: Link: 0 // CHECK-NEXT: Info: 0 diff --git a/test/ELF/relocation-copy.s b/test/ELF/relocation-copy.s index 2e958ad5e955..9d13241f5496 100644 --- a/test/ELF/relocation-copy.s +++ b/test/ELF/relocation-copy.s @@ -23,7 +23,7 @@ movl $z, %edx // CHECK-NEXT: SHF_WRITE (0x1) // CHECK-NEXT: ] // CHECK-NEXT: Address: 0x13000 -// CHECK-NEXT: Offset: 0x3000 +// CHECK-NEXT: Offset: // CHECK-NEXT: Size: 24 // CHECK-NEXT: Link: 0 // CHECK-NEXT: Info: 0 diff --git a/test/ELF/relocation-i686.s b/test/ELF/relocation-i686.s index 529a35765f9e..96d760601127 100644 --- a/test/ELF/relocation-i686.s +++ b/test/ELF/relocation-i686.s @@ -45,8 +45,8 @@ movl bar@GOT, %eax // ADDR-NEXT: SHF_ALLOC // ADDR-NEXT: SHF_EXECINSTR // ADDR-NEXT: ] -// ADDR-NEXT: Address: 0x11030 -// ADDR-NEXT: Offset: 0x1030 +// ADDR-NEXT: Address: 0x11040 +// ADDR-NEXT: Offset: 0x1040 // ADDR-NEXT: Size: 32 // ADDR: Name: .got @@ -69,16 +69,26 @@ R_386_GOTPC: .section .dynamic_reloc, "ax",@progbits call bar -// 0x11030 - (0x11019 + 5) = 18 +// addr(.plt) + 16 - (0x11019 + 5) = 50 // CHECK: Disassembly of section .dynamic_reloc: // CHECK-NEXT: .dynamic_reloc: -// CHECK-NEXT: 11019: e8 22 00 00 00 calll 34 +// CHECK-NEXT: 11019: e8 32 00 00 00 calll 50 .section .R_386_GOT32,"ax",@progbits .global R_386_GOT32 R_386_GOT32: - movl zed@GOT, %eax -// This is the second symbol in the got, so the offset is 4. + movl bar@GOT, %eax + movl zed@GOT, %eax + movl bar+8@GOT, %eax + movl zed+4@GOT, %eax + +// 4294967288 = 0xFFFFFFF8 = got[0](0x12070) - .got(0x12070) - sizeof(.got)(8) +// 4294967292 = 0xFFFFFFFC = got[1](0x12074) - .got(0x12070) - sizeof(.got)(8) +// 0xFFFFFFF8 + 8 = 0 +// 0xFFFFFFFC + 4 = 0 // CHECK: Disassembly of section .R_386_GOT32: // CHECK-NEXT: R_386_GOT32: -// CHECK-NEXT: 1101e: {{.*}} movl 4, %eax +// CHECK-NEXT: 1101e: a1 f8 ff ff ff movl 4294967288, %eax +// CHECK-NEXT: 11023: a1 fc ff ff ff movl 4294967292, %eax +// CHECK-NEXT: 11028: a1 00 00 00 00 movl 0, %eax +// CHECK-NEXT: 1102d: a1 00 00 00 00 movl 0, %eax diff --git a/test/ELF/relocation-in-merge.s b/test/ELF/relocation-in-merge.s index 820208a2cafe..9ce2e4f79150 100644 --- a/test/ELF/relocation-in-merge.s +++ b/test/ELF/relocation-in-merge.s @@ -1,7 +1,7 @@ // REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux // RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s -// CHECK: Relocations pointing to SHF_MERGE are not supported +// CHECK: relocations pointing to SHF_MERGE are not supported .section .foo,"aM",@progbits,4 .long bar diff --git a/test/ELF/relocation-non-alloc.s b/test/ELF/relocation-non-alloc.s new file mode 100644 index 000000000000..43f6f5ff1e4b --- /dev/null +++ b/test/ELF/relocation-non-alloc.s @@ -0,0 +1,60 @@ +// REQUIRES: x86 + +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t +// RUN: ld.lld %t -o %t2 -shared +// RUN: llvm-readobj -s -section-data -r %t2 | FileCheck %s + +// CHECK: Name: .data +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x2000 +// CHECK-NEXT: Offset: 0x2000 +// CHECK-NEXT: Size: 16 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 1 +// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 00000000 00000000 00000000 00000000 +// CHECK-NEXT: ) + +// CHECK: Name: foo +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x0 +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: 32 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 1 +// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 00200000 00000000 00200000 00000000 +// CHECK-NEXT: 0010: 00200000 00000000 00200000 00000000 +// CHECK-NEXT: ) + +// CHECK: Relocations [ +// CHECK-NEXT: Section ({{.}}) .rela.dyn { +// CHECK-NEXT: 0x2000 R_X86_64_RELATIVE - 0x2000 +// CHECK-NEXT: 0x2008 R_X86_64_64 zed 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: ] + +.data + .global zed +zed: +bar: + .quad bar + .quad zed + + .section foo + .quad bar + .quad zed + + .section foo + .quad bar + .quad zed diff --git a/test/ELF/relocation-past-merge-end.s b/test/ELF/relocation-past-merge-end.s index 4dadea1e7acd..993b071f62d2 100644 --- a/test/ELF/relocation-past-merge-end.s +++ b/test/ELF/relocation-past-merge-end.s @@ -1,7 +1,8 @@ // REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux // RUN: not ld.lld %t.o -o %t.so -shared 2>&1 | FileCheck %s -// CHECK: Entry is past the end of the section +// CHECK: entry is past the end of the section + .data .long .foo + 1 .section .foo,"aM",@progbits,4 diff --git a/test/ELF/relocation-relative-absolute.s b/test/ELF/relocation-relative-absolute.s new file mode 100644 index 000000000000..5253191331cc --- /dev/null +++ b/test/ELF/relocation-relative-absolute.s @@ -0,0 +1,12 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: not ld.lld %t.o -o %t -pie 2>&1 | FileCheck %s + +.globl _start +_start: + +# CHECK: relocation R_X86_64_PLT32 cannot refer to absolute symbol answer +call answer@PLT + +.globl answer +answer = 42 diff --git a/test/ELF/relocation-relative-synthetic.s b/test/ELF/relocation-relative-synthetic.s new file mode 100644 index 000000000000..f4d449b844e4 --- /dev/null +++ b/test/ELF/relocation-relative-synthetic.s @@ -0,0 +1,11 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: ld.lld %t.o -o %t -pie +# RUN: llvm-readobj -dyn-relocations %t | FileCheck %s + +# CHECK: Dynamic Relocations { +# CHECK-NEXT: } + +.globl _start +_start: +call __init_array_start@PLT diff --git a/test/ELF/relocation-relative-weak.s b/test/ELF/relocation-relative-weak.s new file mode 100644 index 000000000000..c525012acf67 --- /dev/null +++ b/test/ELF/relocation-relative-weak.s @@ -0,0 +1,14 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: ld.lld %t.o -o %t -pie +# RUN: llvm-readobj -dyn-relocations %t | FileCheck %s + +# CHECK: Dynamic Relocations { +# CHECK-NEXT: } + +.globl _start +_start: + +.globl w +.weak w +call w@PLT diff --git a/test/ELF/relocation-shared.s b/test/ELF/relocation-shared.s new file mode 100644 index 000000000000..e1850944c459 --- /dev/null +++ b/test/ELF/relocation-shared.s @@ -0,0 +1,35 @@ +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: ld.lld %t.o -shared -o %t.so +// RUN: llvm-readobj -r -s -section-data %t.so | FileCheck %s + +// CHECK: Name: foo +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x1C8 +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: 8 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 1 +// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 380E0000 00000000 +// 0x1000 - 0x1C8 = 0xE38 +// CHECK-NEXT: ) + +// CHECK: Name: .text +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_EXECINSTR +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x1000 + +// CHECK: Relocations [ +// CHECK-NEXT: ] + +bar: + .section foo,"a",@progbits + .quad bar - . diff --git a/test/ELF/relocation-size-shared.s b/test/ELF/relocation-size-shared.s index 1b52e77b7d5f..d6274e9ae12e 100644 --- a/test/ELF/relocation-size-shared.s +++ b/test/ELF/relocation-size-shared.s @@ -7,48 +7,48 @@ // RELOCSHARED: Relocations [ // RELOCSHARED-NEXT: Section ({{.*}}) .rela.dyn { -// RELOCSHARED-NEXT: 0x11018 R_X86_64_SIZE64 fooshared 0xFFFFFFFFFFFFFFFF -// RELOCSHARED-NEXT: 0x11020 R_X86_64_SIZE64 fooshared 0x0 -// RELOCSHARED-NEXT: 0x11028 R_X86_64_SIZE64 fooshared 0x1 -// RELOCSHARED-NEXT: 0x11048 R_X86_64_SIZE32 fooshared 0xFFFFFFFFFFFFFFFF -// RELOCSHARED-NEXT: 0x1104F R_X86_64_SIZE32 fooshared 0x0 -// RELOCSHARED-NEXT: 0x11056 R_X86_64_SIZE32 fooshared 0x1 +// RELOCSHARED-NEXT: 0x13018 R_X86_64_SIZE64 fooshared 0xFFFFFFFFFFFFFFFF +// RELOCSHARED-NEXT: 0x13020 R_X86_64_SIZE64 fooshared 0x0 +// RELOCSHARED-NEXT: 0x13028 R_X86_64_SIZE64 fooshared 0x1 +// RELOCSHARED-NEXT: 0x13048 R_X86_64_SIZE32 fooshared 0xFFFFFFFFFFFFFFFF +// RELOCSHARED-NEXT: 0x1304F R_X86_64_SIZE32 fooshared 0x0 +// RELOCSHARED-NEXT: 0x13056 R_X86_64_SIZE32 fooshared 0x1 // RELOCSHARED-NEXT: } // RELOCSHARED-NEXT:] -// DISASM: Disassembly of section .text: +// DISASM: Disassembly of section test // DISASM: _data: -// DISASM-NEXT: 11000: 19 00 -// DISASM-NEXT: 11002: 00 00 -// DISASM-NEXT: 11004: 00 00 -// DISASM-NEXT: 11006: 00 00 -// DISASM-NEXT: 11008: 1a 00 -// DISASM-NEXT: 1100a: 00 00 -// DISASM-NEXT: 1100c: 00 00 -// DISASM-NEXT: 1100e: 00 00 -// DISASM-NEXT: 11010: 1b 00 -// DISASM-NEXT: 11012: 00 00 -// DISASM-NEXT: 11014: 00 00 -// DISASM-NEXT: 11016: 00 00 -// DISASM-NEXT: 11018: 00 00 -// DISASM-NEXT: 1101a: 00 00 -// DISASM-NEXT: 1101c: 00 00 -// DISASM-NEXT: 1101e: 00 00 -// DISASM-NEXT: 11020: 00 00 -// DISASM-NEXT: 11022: 00 00 -// DISASM-NEXT: 11024: 00 00 -// DISASM-NEXT: 11026: 00 00 -// DISASM-NEXT: 11028: 00 00 -// DISASM-NEXT: 1102a: 00 00 -// DISASM-NEXT: 1102c: 00 00 -// DISASM-NEXT: 1102e: 00 00 +// DISASM-NEXT: 13000: 19 00 +// DISASM-NEXT: 13002: 00 00 +// DISASM-NEXT: 13004: 00 00 +// DISASM-NEXT: 13006: 00 00 +// DISASM-NEXT: 13008: 1a 00 +// DISASM-NEXT: 1300a: 00 00 +// DISASM-NEXT: 1300c: 00 00 +// DISASM-NEXT: 1300e: 00 00 +// DISASM-NEXT: 13010: 1b 00 +// DISASM-NEXT: 13012: 00 00 +// DISASM-NEXT: 13014: 00 00 +// DISASM-NEXT: 13016: 00 00 +// DISASM-NEXT: 13018: 00 00 +// DISASM-NEXT: 1301a: 00 00 +// DISASM-NEXT: 1301c: 00 00 +// DISASM-NEXT: 1301e: 00 00 +// DISASM-NEXT: 13020: 00 00 +// DISASM-NEXT: 13022: 00 00 +// DISASM-NEXT: 13024: 00 00 +// DISASM-NEXT: 13026: 00 00 +// DISASM-NEXT: 13028: 00 00 +// DISASM-NEXT: 1302a: 00 00 +// DISASM-NEXT: 1302c: 00 00 +// DISASM-NEXT: 1302e: 00 00 // DISASM: _start: -// DISASM-NEXT: 11030: 8b 04 25 19 00 00 00 movl 25, %eax -// DISASM-NEXT: 11037: 8b 04 25 1a 00 00 00 movl 26, %eax -// DISASM-NEXT: 1103e: 8b 04 25 1b 00 00 00 movl 27, %eax -// DISASM-NEXT: 11045: 8b 04 25 00 00 00 00 movl 0, %eax -// DISASM-NEXT: 1104c: 8b 04 25 00 00 00 00 movl 0, %eax -// DISASM-NEXT: 11053: 8b 04 25 00 00 00 00 movl 0, %eax +// DISASM-NEXT: 13030: 8b 04 25 19 00 00 00 movl 25, %eax +// DISASM-NEXT: 13037: 8b 04 25 1a 00 00 00 movl 26, %eax +// DISASM-NEXT: 1303e: 8b 04 25 1b 00 00 00 movl 27, %eax +// DISASM-NEXT: 13045: 8b 04 25 00 00 00 00 movl 0, %eax +// DISASM-NEXT: 1304c: 8b 04 25 00 00 00 00 movl 0, %eax +// DISASM-NEXT: 13053: 8b 04 25 00 00 00 00 movl 0, %eax .data .global foo @@ -57,7 +57,7 @@ foo: .zero 26 -.text +.section test, "awx" _data: // R_X86_64_SIZE64: .quad foo@SIZE-1 diff --git a/test/ELF/relocation-size.s b/test/ELF/relocation-size.s index aea3dafea071..58604dbcb4e4 100644 --- a/test/ELF/relocation-size.s +++ b/test/ELF/relocation-size.s @@ -9,84 +9,84 @@ // NORELOC: Relocations [ // NORELOC-NEXT: ] -// DISASM: Disassembly of section .text: +// DISASM: Disassembly of section test: // DISASM-NEXT: _data: -// DISASM-NEXT: 11000: 19 00 -// DISASM-NEXT: 11002: 00 00 -// DISASM-NEXT: 11004: 00 00 -// DISASM-NEXT: 11006: 00 00 -// DISASM-NEXT: 11008: 1a 00 -// DISASM-NEXT: 1100a: 00 00 -// DISASM-NEXT: 1100c: 00 00 -// DISASM-NEXT: 1100e: 00 00 -// DISASM-NEXT: 11010: 1b 00 -// DISASM-NEXT: 11012: 00 00 -// DISASM-NEXT: 11014: 00 00 -// DISASM-NEXT: 11016: 00 00 -// DISASM-NEXT: 11018: 19 00 -// DISASM-NEXT: 1101a: 00 00 -// DISASM-NEXT: 1101c: 00 00 -// DISASM-NEXT: 1101e: 00 00 -// DISASM-NEXT: 11020: 1a 00 -// DISASM-NEXT: 11022: 00 00 -// DISASM-NEXT: 11024: 00 00 -// DISASM-NEXT: 11026: 00 00 -// DISASM-NEXT: 11028: 1b 00 -// DISASM-NEXT: 1102a: 00 00 -// DISASM-NEXT: 1102c: 00 00 -// DISASM-NEXT: 1102e: 00 00 +// DISASM-NEXT: 12000: 19 00 +// DISASM-NEXT: 12002: 00 00 +// DISASM-NEXT: 12004: 00 00 +// DISASM-NEXT: 12006: 00 00 +// DISASM-NEXT: 12008: 1a 00 +// DISASM-NEXT: 1200a: 00 00 +// DISASM-NEXT: 1200c: 00 00 +// DISASM-NEXT: 1200e: 00 00 +// DISASM-NEXT: 12010: 1b 00 +// DISASM-NEXT: 12012: 00 00 +// DISASM-NEXT: 12014: 00 00 +// DISASM-NEXT: 12016: 00 00 +// DISASM-NEXT: 12018: 19 00 +// DISASM-NEXT: 1201a: 00 00 +// DISASM-NEXT: 1201c: 00 00 +// DISASM-NEXT: 1201e: 00 00 +// DISASM-NEXT: 12020: 1a 00 +// DISASM-NEXT: 12022: 00 00 +// DISASM-NEXT: 12024: 00 00 +// DISASM-NEXT: 12026: 00 00 +// DISASM-NEXT: 12028: 1b 00 +// DISASM-NEXT: 1202a: 00 00 +// DISASM-NEXT: 1202c: 00 00 +// DISASM-NEXT: 1202e: 00 00 // DISASM: _start: -// DISASM-NEXT: 11030: 8b 04 25 19 00 00 00 movl 25, %eax -// DISASM-NEXT: 11037: 8b 04 25 1a 00 00 00 movl 26, %eax -// DISASM-NEXT: 1103e: 8b 04 25 1b 00 00 00 movl 27, %eax -// DISASM-NEXT: 11045: 8b 04 25 19 00 00 00 movl 25, %eax -// DISASM-NEXT: 1104c: 8b 04 25 1a 00 00 00 movl 26, %eax -// DISASM-NEXT: 11053: 8b 04 25 1b 00 00 00 movl 27, %eax +// DISASM-NEXT: 12030: 8b 04 25 19 00 00 00 movl 25, %eax +// DISASM-NEXT: 12037: 8b 04 25 1a 00 00 00 movl 26, %eax +// DISASM-NEXT: 1203e: 8b 04 25 1b 00 00 00 movl 27, %eax +// DISASM-NEXT: 12045: 8b 04 25 19 00 00 00 movl 25, %eax +// DISASM-NEXT: 1204c: 8b 04 25 1a 00 00 00 movl 26, %eax +// DISASM-NEXT: 12053: 8b 04 25 1b 00 00 00 movl 27, %eax // RELOCSHARED: Relocations [ // RELOCSHARED-NEXT: Section ({{.*}}) .rela.dyn { -// RELOCSHARED-NEXT: 0x1000 R_X86_64_SIZE64 foo 0xFFFFFFFFFFFFFFFF -// RELOCSHARED-NEXT: 0x1008 R_X86_64_SIZE64 foo 0x0 -// RELOCSHARED-NEXT: 0x1010 R_X86_64_SIZE64 foo 0x1 -// RELOCSHARED-NEXT: 0x1033 R_X86_64_SIZE32 foo 0xFFFFFFFFFFFFFFFF -// RELOCSHARED-NEXT: 0x103A R_X86_64_SIZE32 foo 0x0 -// RELOCSHARED-NEXT: 0x1041 R_X86_64_SIZE32 foo 0x1 +// RELOCSHARED-NEXT: 0x3000 R_X86_64_SIZE64 foo 0xFFFFFFFFFFFFFFFF +// RELOCSHARED-NEXT: 0x3008 R_X86_64_SIZE64 foo 0x0 +// RELOCSHARED-NEXT: 0x3010 R_X86_64_SIZE64 foo 0x1 +// RELOCSHARED-NEXT: 0x3033 R_X86_64_SIZE32 foo 0xFFFFFFFFFFFFFFFF +// RELOCSHARED-NEXT: 0x303A R_X86_64_SIZE32 foo 0x0 +// RELOCSHARED-NEXT: 0x3041 R_X86_64_SIZE32 foo 0x1 // RELOCSHARED-NEXT: } // RELOCSHARED-NEXT: ] -// DISASMSHARED: Disassembly of section .text: +// DISASMSHARED: Disassembly of section test: // DISASMSHARED-NEXT: _data: -// DISASMSHARED-NEXT: 1000: 00 00 -// DISASMSHARED-NEXT: 1002: 00 00 -// DISASMSHARED-NEXT: 1004: 00 00 -// DISASMSHARED-NEXT: 1006: 00 00 -// DISASMSHARED-NEXT: 1008: 00 00 -// DISASMSHARED-NEXT: 100a: 00 00 -// DISASMSHARED-NEXT: 100c: 00 00 -// DISASMSHARED-NEXT: 100e: 00 00 -// DISASMSHARED-NEXT: 1010: 00 00 -// DISASMSHARED-NEXT: 1012: 00 00 -// DISASMSHARED-NEXT: 1014: 00 00 -// DISASMSHARED-NEXT: 1016: 00 00 -// DISASMSHARED-NEXT: 1018: 19 00 -// DISASMSHARED-NEXT: 101a: 00 00 -// DISASMSHARED-NEXT: 101c: 00 00 -// DISASMSHARED-NEXT: 101e: 00 00 -// DISASMSHARED-NEXT: 1020: 1a 00 -// DISASMSHARED-NEXT: 1022: 00 00 -// DISASMSHARED-NEXT: 1024: 00 00 -// DISASMSHARED-NEXT: 1026: 00 00 -// DISASMSHARED-NEXT: 1028: 1b 00 -// DISASMSHARED-NEXT: 102a: 00 00 -// DISASMSHARED-NEXT: 102c: 00 00 -// DISASMSHARED-NEXT: 102e: 00 00 +// DISASMSHARED-NEXT: 3000: 00 00 +// DISASMSHARED-NEXT: 3002: 00 00 +// DISASMSHARED-NEXT: 3004: 00 00 +// DISASMSHARED-NEXT: 3006: 00 00 +// DISASMSHARED-NEXT: 3008: 00 00 +// DISASMSHARED-NEXT: 300a: 00 00 +// DISASMSHARED-NEXT: 300c: 00 00 +// DISASMSHARED-NEXT: 300e: 00 00 +// DISASMSHARED-NEXT: 3010: 00 00 +// DISASMSHARED-NEXT: 3012: 00 00 +// DISASMSHARED-NEXT: 3014: 00 00 +// DISASMSHARED-NEXT: 3016: 00 00 +// DISASMSHARED-NEXT: 3018: 19 00 +// DISASMSHARED-NEXT: 301a: 00 00 +// DISASMSHARED-NEXT: 301c: 00 00 +// DISASMSHARED-NEXT: 301e: 00 00 +// DISASMSHARED-NEXT: 3020: 1a 00 +// DISASMSHARED-NEXT: 3022: 00 00 +// DISASMSHARED-NEXT: 3024: 00 00 +// DISASMSHARED-NEXT: 3026: 00 00 +// DISASMSHARED-NEXT: 3028: 1b 00 +// DISASMSHARED-NEXT: 302a: 00 00 +// DISASMSHARED-NEXT: 302c: 00 00 +// DISASMSHARED-NEXT: 302e: 00 00 // DISASMSHARED: _start: -// DISASMSHARED-NEXT: 1030: 8b 04 25 00 00 00 00 movl 0, %eax -// DISASMSHARED-NEXT: 1037: 8b 04 25 00 00 00 00 movl 0, %eax -// DISASMSHARED-NEXT: 103e: 8b 04 25 00 00 00 00 movl 0, %eax -// DISASMSHARED-NEXT: 1045: 8b 04 25 19 00 00 00 movl 25, %eax -// DISASMSHARED-NEXT: 104c: 8b 04 25 1a 00 00 00 movl 26, %eax -// DISASMSHARED-NEXT: 1053: 8b 04 25 1b 00 00 00 movl 27, %eax +// DISASMSHARED-NEXT: 3030: 8b 04 25 00 00 00 00 movl 0, %eax +// DISASMSHARED-NEXT: 3037: 8b 04 25 00 00 00 00 movl 0, %eax +// DISASMSHARED-NEXT: 303e: 8b 04 25 00 00 00 00 movl 0, %eax +// DISASMSHARED-NEXT: 3045: 8b 04 25 19 00 00 00 movl 25, %eax +// DISASMSHARED-NEXT: 304c: 8b 04 25 1a 00 00 00 movl 26, %eax +// DISASMSHARED-NEXT: 3053: 8b 04 25 1b 00 00 00 movl 27, %eax .data .global foo @@ -103,7 +103,7 @@ foo: foohidden: .zero 26 -.text +.section test,"axw" _data: // R_X86_64_SIZE64: .quad foo@SIZE-1 diff --git a/test/ELF/relocation.s b/test/ELF/relocation.s index 33b0e23ee972..11832683d9be 100644 --- a/test/ELF/relocation.s +++ b/test/ELF/relocation.s @@ -14,7 +14,7 @@ // SEC-NEXT: ] // SEC-NEXT: Address: 0x11030 // SEC-NEXT: Offset: 0x1030 -// SEC-NEXT: Size: 32 +// SEC-NEXT: Size: 48 // SEC: Name: .got // SEC-NEXT: Type: SHT_PROGBITS @@ -39,7 +39,7 @@ // SEC-NEXT: ] // SEC-NEXT: Address: 0x13000 // SEC-NEXT: Offset: 0x3000 -// SEC-NEXT: Size: 32 +// SEC-NEXT: Size: 40 // SEC-NEXT: Link: 0 // SEC-NEXT: Info: 0 // SEC-NEXT: AddressAlignment: 8 @@ -98,6 +98,15 @@ R_X86_64_PC32: // CHECK-NEXT: 11017: {{.*}} callq 36 // CHECK-NEXT: 1101c: {{.*}} movl $69696, %eax +.section .R_X86_64_32S_2,"ax",@progbits +.global R_X86_64_32S_2 +R_X86_64_32S_2: + mov bar2, %eax +// plt is at 0x11030. The second plt entry is at 0x11050 == 69712 +// CHECK: Disassembly of section .R_X86_64_32S_2: +// CHECK-NEXT: R_X86_64_32S_2: +// CHECK-NEXT: 11021: {{.*}} movl 69712, %eax + .section .R_X86_64_64,"a",@progbits .global R_X86_64_64 R_X86_64_64: @@ -115,3 +124,11 @@ R_X86_64_GOTPCREL: // 7952 = 0x101f0000 in little endian // CHECK: Contents of section .R_X86_64_GOTPCREL // CHECK-NEXT: 101d0 201f0000 + +.section .R_X86_64_GOT32,"a",@progbits +.global R_X86_64_GOT32 +R_X86_64_GOT32: + .long zed@got + +// CHECK: Contents of section .R_X86_64_GOT32: +// CHECK-NEXT: f8ffffff diff --git a/test/ELF/relro-tls.s b/test/ELF/relro-tls.s new file mode 100644 index 000000000000..0ee5b6d328c2 --- /dev/null +++ b/test/ELF/relro-tls.s @@ -0,0 +1,23 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +// RUN: ld.lld %t -o %tout +// RUN: llvm-readobj -program-headers %tout | FileCheck %s + +// CHECK: Type: PT_GNU_RELRO +// CHECK-NEXT: Offset: +// CHECK-NEXT: VirtualAddress: +// CHECK-NEXT: PhysicalAddress: +// CHECK-NEXT: FileSize: 4 +// CHECK-NEXT: MemSize: 4 +// CHECK-NEXT: Flags [ +// CHECK-NEXT: PF_R +// CHECK-NEXT: ] +// CHECK-NEXT: Alignment: 1 + +.global _start +_start: + +.global d +.section .foo,"awT",@progbits +d: +.long 2 diff --git a/test/ELF/relro.s b/test/ELF/relro.s index 692d6b271cf8..d35548740001 100644 --- a/test/ELF/relro.s +++ b/test/ELF/relro.s @@ -232,7 +232,7 @@ .global _start _start: .long bar - jmp *bar@GOTPCREL(%rip) + jmp *bar2@GOTPCREL(%rip) .section .data,"aw" .quad 0 diff --git a/test/ELF/reproduce-error.s b/test/ELF/reproduce-error.s new file mode 100644 index 000000000000..c66132c4bd01 --- /dev/null +++ b/test/ELF/reproduce-error.s @@ -0,0 +1,15 @@ +# Extracting the cpio archive can get over the path limit on windows. +# REQUIRES: shell + +# RUN: rm -rf %t.dir +# RUN: mkdir -p %t.dir +# RUN: cd %t.dir + +# RUN: not ld.lld --reproduce repro abc -o t 2>&1 | FileCheck %s +# CHECK: cannot open abc: {{N|n}}o such file or directory + +# RUN: grep TRAILER repro.cpio +# RUN: cpio -id < repro.cpio +# RUN: FileCheck --check-prefix=RSP %s < repro/response.txt +# RSP: abc +# RSP: -o t diff --git a/test/ELF/reproduce-linkerscript.s b/test/ELF/reproduce-linkerscript.s new file mode 100644 index 000000000000..a020fcc9a4f1 --- /dev/null +++ b/test/ELF/reproduce-linkerscript.s @@ -0,0 +1,17 @@ +# REQUIRES: x86, shell + +# RUN: rm -rf %t.dir +# RUN: mkdir -p %t.dir/build +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/build/foo.o +# RUN: echo "INPUT(\"%t.dir/build/foo.o\")" > %t.dir/build/foo.script +# RUN: cd %t.dir +# RUN: ld.lld build/foo.script -o bar --reproduce repro +# RUN: cpio -id < repro.cpio +# RUN: diff build/foo.script repro/%:t.dir/build/foo.script +# RUN: diff build/foo.o repro/%:t.dir/build/foo.o + +.globl _start +_start: + mov $60, %rax + mov $42, %rdi + syscall diff --git a/test/ELF/reproduce-thin-archive.s b/test/ELF/reproduce-thin-archive.s new file mode 100644 index 000000000000..0797b6c67e9c --- /dev/null +++ b/test/ELF/reproduce-thin-archive.s @@ -0,0 +1,15 @@ +# REQUIRES: x86, shell + +# RUN: rm -rf %t.dir +# RUN: mkdir -p %t.dir +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.dir/foo.o +# RUN: cd %t.dir +# RUN: llvm-ar --format=gnu rcT foo.a foo.o +# RUN: ld.lld -m elf_x86_64 foo.a -o bar --reproduce repro +# RUN: cpio -id < repro.cpio +# RUN: diff foo.a repro/%:t.dir/foo.a +# RUN: diff foo.o repro/%:t.dir/foo.o + +.globl _start +_start: + nop diff --git a/test/ELF/reproduce-windows.s b/test/ELF/reproduce-windows.s new file mode 100644 index 000000000000..464b27098694 --- /dev/null +++ b/test/ELF/reproduce-windows.s @@ -0,0 +1,12 @@ +# REQUIRES: x86 + +# Test that a repro archive always uses / instead of \. +# RUN: rm -rf %t.dir +# RUN: mkdir -p %t.dir/build +# RUN: llvm-mc %s -o %t.dir/build/foo.o -filetype=obj -triple=x86_64-pc-linux +# RUN: cd %t.dir +# RUN: not ld.lld build/foo.o --reproduce repro +# RUN: cpio -t < repro.cpio | FileCheck %s + +# CHECK: repro/response.txt +# CHECK: repro/{{.*}}/build/foo.o diff --git a/test/ELF/reproduce.s b/test/ELF/reproduce.s new file mode 100644 index 000000000000..9d256c12d827 --- /dev/null +++ b/test/ELF/reproduce.s @@ -0,0 +1,67 @@ +# REQUIRES: x86 + +# Extracting the cpio archive can get over the path limit on windows. +# REQUIRES: shell + +# RUN: rm -rf %t.dir +# RUN: mkdir -p %t.dir/build1 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/build1/foo.o +# RUN: cd %t.dir +# RUN: ld.lld --hash-style=gnu build1/foo.o -o bar -shared --as-needed --reproduce repro +# RUN: cpio -id < repro.cpio +# RUN: diff build1/foo.o repro/%:t.dir/build1/foo.o + +# RUN: FileCheck %s --check-prefix=RSP < repro/response.txt +# RSP: {{^}}--hash-style gnu{{$}} +# RSP-NOT: repro{{[/\\]}} +# RSP-NEXT: {{[/\\]}}foo.o +# RSP-NEXT: -o bar +# RSP-NEXT: -shared +# RSP-NEXT: --as-needed + +# RUN: FileCheck %s --check-prefix=VERSION < repro/version.txt +# VERSION: LLD + +# RUN: mkdir -p %t.dir/build2/a/b/c +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/build2/foo.o +# RUN: cd %t.dir/build2/a/b/c +# RUN: env LLD_REPRODUCE=repro ld.lld ./../../../foo.o -o bar -shared --as-needed +# RUN: cpio -id < repro.cpio +# RUN: diff %t.dir/build2/foo.o repro/%:t.dir/build2/foo.o + +# RUN: echo "{ local: *; };" > ver +# RUN: echo > dyn +# RUN: echo > file +# RUN: echo > file2 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o 'foo bar' +# RUN: ld.lld --reproduce repro2 'foo bar' -L"foo bar" -Lfile -Tfile2 \ +# RUN: --dynamic-list dyn -rpath file --script file --version-script ver \ +# RUN: --dynamic-linker "some unusual/path" -soname 'foo bar' -soname='foo bar' +# RUN: cpio -id < repro2.cpio +# RUN: FileCheck %s --check-prefix=RSP2 < repro2/response.txt +# RSP2: "{{.*}}foo bar" +# RSP2-NEXT: -L "{{.*}}foo bar" +# RSP2-NEXT: -L {{.+}}file +# RSP2-NEXT: --script {{.+}}file2 +# RSP2-NEXT: --dynamic-list {{.+}}dyn +# RSP2-NEXT: -rpath {{.+}}file +# RSP2-NEXT: --script {{.+}}file +# RSP2-NEXT: --version-script [[PATH:.*]]ver +# RSP2-NEXT: --dynamic-linker "some unusual/path" +# RSP2-NEXT: -soname="foo bar" +# RSP2-NEXT: -soname="foo bar" + +# RUN: cpio -t < repro2.cpio | FileCheck %s +# CHECK: repro2/response.txt +# CHECK-NEXT: repro2/version.txt +# CHECK-NEXT: repro2/{{.*}}/dyn +# CHECK-NEXT: repro2/{{.*}}/ver +# CHECK-NEXT: repro2/{{.*}}/foo bar +# CHECK-NEXT: repro2/{{.*}}/file2 +# CHECK-NEXT: repro2/{{.*}}/file + +.globl _start +_start: + mov $60, %rax + mov $42, %rdi + syscall diff --git a/test/ELF/resolution-shared.s b/test/ELF/resolution-shared.s new file mode 100644 index 000000000000..e1eac070e5af --- /dev/null +++ b/test/ELF/resolution-shared.s @@ -0,0 +1,15 @@ +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/resolution-shared.s -o %t2.o +// RUN: ld.lld %t2.o -o %t2.so -shared +// RUN: ld.lld %t.o %t2.so -o %t3 -shared +// RUN: llvm-readobj -t %t3 | FileCheck %s +// REQUIRES: x86 + + .weak foo +foo: + +// CHECK: Symbol { +// CHECK: Name: foo +// CHECK-NEXT: Value: +// CHECK-NEXT: Size: +// CHECK-NEXT: Binding: Weak diff --git a/test/ELF/resolution.s b/test/ELF/resolution.s index ce275c2934a4..5596212b3bac 100644 --- a/test/ELF/resolution.s +++ b/test/ELF/resolution.s @@ -309,7 +309,7 @@ // CHECK-NEXT: Symbol { // CHECK-NEXT: Name: UndefWeak_with_UndefWeak // CHECK-NEXT: Value: 0x0 -// CHECK-NEXT: Size: 15 +// CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Weak // CHECK-NEXT: Type: None // CHECK-NEXT: Other: 0 diff --git a/test/ELF/section-align-0.test b/test/ELF/section-align-0.test index fc27ee95fd4b..35783f5a894b 100644 --- a/test/ELF/section-align-0.test +++ b/test/ELF/section-align-0.test @@ -1,8 +1,9 @@ -# RUN: yaml2obj -format elf %s -o %t +# RUN: yaml2obj %s -o %t # RUN: ld.lld %t -o %tout # Verify that lld can handle sections with an alignment of zero. +!ELF FileHeader: Class: ELFCLASS64 Data: ELFDATA2LSB diff --git a/test/ELF/section-name.s b/test/ELF/section-name.s index 2d7ed4e63717..f470c48c6a37 100644 --- a/test/ELF/section-name.s +++ b/test/ELF/section-name.s @@ -21,11 +21,17 @@ _start: .section .data.rel.ro.a,"aw",%progbits .section .data.rel.ro.local,"aw",%progbits .section .data.rel.ro.local.a,"aw",%progbits +.section .tbss.foo,"aGwT",@nobits,foo,comdat +.section .gcc_except_table.foo,"aG",@progbits,foo,comdat +.section .tdata.foo,"aGwT",@progbits,foo,comdat // CHECK-NOT: Name: .rodata.a // CHECK: Name: .rodata +// CHECK: Name: .gcc_except_table ({{.*}}) // CHECK-NOT: Name: .text.a // CHECK: Name: .text +// CHECK: Name: .tdata ({{.*}}) +// CHECK: Name: .tbss ({{.*}}) // CHECK-NOT: Name: .data.rel.ro.a // CHECK-NOT: Name: .data.rel.ro.local.a // CHECK: Name: .data.rel.ro diff --git a/test/ELF/section-symbol.s b/test/ELF/section-symbol.s index 5f04606914fb..5cf71aceec72 100644 --- a/test/ELF/section-symbol.s +++ b/test/ELF/section-symbol.s @@ -23,7 +23,18 @@ // CHECK-NEXT: Other: 0 // CHECK-NEXT: Section: .text // CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: _DYNAMIC +// CHECK-NEXT: Value: +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other [ (0x2) +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] +// CHECK-NEXT: Section: .dynamic +// CHECK-NEXT: } // CHECK-NEXT: ] foo: - .quad foo + .quad foo - . diff --git a/test/ELF/shared-be.s b/test/ELF/shared-be.s index 0f57a4b7f0c3..12eb3131050a 100644 --- a/test/ELF/shared-be.s +++ b/test/ELF/shared-be.s @@ -20,17 +20,18 @@ // CHECK: DynamicSection [ // CHECK-NEXT: Tag Type Name/Value +// CHECK-NEXT: 0x000000000000001D RUNPATH foo:bar +// CHECK-NEXT: 0x0000000000000001 NEEDED SharedLibrary ({{.*}}2.so) // CHECK-NEXT: 0x0000000000000007 RELA [[RELADDR]] // CHECK-NEXT: 0x0000000000000008 RELASZ [[RELSIZE]] (bytes) // CHECK-NEXT: 0x0000000000000009 RELAENT [[RELENT]] (bytes) -// CHECK: 0x000000000000001D RUNPATH foo:bar -// CHECK-NEXT: 0x0000000000000001 NEEDED SharedLibrary ({{.*}}2.so) -// CHECK-NEXT: 0x0000000000000015 DEBUG 0x0 +// CHECK: 0x0000000000000015 DEBUG 0x0 // CHECK-NEXT: 0x0000000000000000 NULL 0x0 // CHECK-NEXT: ] .global _start _start: +.data .long bar .long zed diff --git a/test/ELF/shared.s b/test/ELF/shared.s index 1bf5bd1795bc..a81a09370999 100644 --- a/test/ELF/shared.s +++ b/test/ELF/shared.s @@ -144,6 +144,17 @@ // CHECK-NEXT: Section: Undefined // CHECK-NEXT: } // CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: _DYNAMIC +// CHECK-NEXT: Value: 0x12000 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other [ (0x2) +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] +// CHECK-NEXT: Section: .dynamic +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { // CHECK-NEXT: Name: _start // CHECK-NEXT: Value: 0x11000 // CHECK-NEXT: Size: 0 @@ -243,6 +254,8 @@ // CHECK: DynamicSection [ // CHECK-NEXT: Tag Type Name/Value +// CHECK-NEXT: 0x0000001D RUNPATH foo:bar +// CHECK-NEXT: 0x00000001 NEEDED SharedLibrary ({{.*}}2.so) // CHECK-NEXT: 0x00000011 REL [[RELADDR]] // CHECK-NEXT: 0x00000012 RELSZ [[RELSIZE]] (bytes) // CHECK-NEXT: 0x00000013 RELENT [[RELENT]] (bytes) @@ -251,8 +264,6 @@ // CHECK-NEXT: 0x00000005 STRTAB [[DYNSTRADDR]] // CHECK-NEXT: 0x0000000A STRSZ // CHECK-NEXT: 0x00000004 HASH [[HASHADDR]] -// CHECK-NEXT: 0x0000001D RUNPATH foo:bar -// CHECK-NEXT: 0x00000001 NEEDED SharedLibrary ({{.*}}2.so) // CHECK-NEXT: 0x00000015 DEBUG 0x0 // CHECK-NEXT: 0x00000000 NULL 0x0 // CHECK-NEXT: ] @@ -291,5 +302,5 @@ .global _start _start: -.long bar -.long zed +.long bar@GOT +.long zed@GOT diff --git a/test/ELF/soname.s b/test/ELF/soname.s index 9d6fe7681dac..65e95ce85add 100644 --- a/test/ELF/soname.s +++ b/test/ELF/soname.s @@ -1,6 +1,6 @@ // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: ld.lld %t.o -shared -soname=bar -o %t.so -// RUN: ld.lld %t.o -shared -soname=bar -o %t2.so +// RUN: ld.lld %t.o -shared --soname=bar -o %t2.so // RUN: ld.lld %t.o %t.so %t2.so -o %t // RUN: llvm-readobj --dynamic-table %t | FileCheck %s diff --git a/test/ELF/splitstacks.s b/test/ELF/splitstacks.s new file mode 100644 index 000000000000..6506b48a2513 --- /dev/null +++ b/test/ELF/splitstacks.s @@ -0,0 +1,11 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o + +# RUN: not ld.lld %t1.o -o %t 2>&1 | FileCheck %s +# CHECK: objects using splitstacks are not supported + +.globl _start +_start: + nop + +.section .note.GNU-split-stack,"",@progbits diff --git a/test/ELF/start-lib-comdat.s b/test/ELF/start-lib-comdat.s new file mode 100644 index 000000000000..ce03959fd74b --- /dev/null +++ b/test/ELF/start-lib-comdat.s @@ -0,0 +1,23 @@ +// REQUIRES: x86 + +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux \ +// RUN: %p/Inputs/start-lib-comdat.s -o %t2.o +// RUN: ld.lld -shared -o %t3 %t1.o --start-lib %t2.o --end-lib +// RUN: llvm-readobj -t %t3 | FileCheck %s +// RUN: ld.lld -shared -o %t3 --start-lib %t2.o --end-lib %t1.o +// RUN: llvm-readobj -t %t3 | FileCheck %s + +// CHECK: Name: zed +// CHECK-NEXT: Value: +// CHECK-NEXT: Size: +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: +// CHECK-NEXT: Other: +// CHECK-NEXT: Section: Undefined + + call bar@plt +// The other file also has a section in the zed comdat, but it defines the +// symbol zed. That means that we will have a lazy symbol zed, but when adding +// the actual file zed will be undefined. + .section .sec,"aG",@progbits,zed,comdat diff --git a/test/ELF/start-lib.s b/test/ELF/start-lib.s new file mode 100644 index 000000000000..013a2b206a1f --- /dev/null +++ b/test/ELF/start-lib.s @@ -0,0 +1,25 @@ +// REQUIRES: x86 + +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \ +// RUN: %p/Inputs/start-lib1.s -o %t2.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \ +// RUN: %p/Inputs/start-lib2.s -o %t3.o + +// RUN: ld.lld -o %t3 %t1.o %t2.o %t3.o +// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=TEST1 %s +// TEST1: Name: bar +// TEST1: Name: foo + +// RUN: ld.lld -o %t3 %t1.o -u bar --start-lib %t2.o %t3.o +// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=TEST2 %s +// TEST2: Name: bar +// TEST2-NOT: Name: foo + +// RUN: ld.lld -o %t3 %t1.o --start-lib %t2.o %t3.o +// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=TEST3 %s +// TEST3-NOT: Name: bar +// TEST3-NOT: Name: foo + +.globl _start +_start: diff --git a/test/ELF/startstop-gccollect.s b/test/ELF/startstop-gccollect.s new file mode 100644 index 000000000000..b0cd41337e34 --- /dev/null +++ b/test/ELF/startstop-gccollect.s @@ -0,0 +1,32 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t + +## Default run: sections foo and bar exist in output +# RUN: ld.lld %t -o %tout +# RUN: llvm-objdump -d %tout | FileCheck -check-prefix=DISASM %s + +## Check that foo and bar sections are not garbage collected, +## we do not want to reclaim sections if they can be referred +## by __start_* and __stop_* symbols. +# RUN: ld.lld %t --gc-sections -o %tout +# RUN: llvm-objdump -d %tout | FileCheck -check-prefix=DISASM %s + +# DISASM: _start: +# DISASM-NEXT: 11000: 90 nop +# DISASM-NEXT: Disassembly of section foo: +# DISASM-NEXT: foo: +# DISASM-NEXT: 11001: 90 nop +# DISASM-NEXT: Disassembly of section bar: +# DISASM-NEXT: bar: +# DISASM-NEXT: 11002: 90 nop + +.global _start +.text +_start: + nop + +.section foo,"ax" + nop + +.section bar,"ax" + nop diff --git a/test/ELF/startstop-shared.s b/test/ELF/startstop-shared.s index 108184648f97..77411f3f25c9 100644 --- a/test/ELF/startstop-shared.s +++ b/test/ELF/startstop-shared.s @@ -3,16 +3,24 @@ // RUN: ld.lld %t.o -o %t.so -shared // RUN: llvm-readobj -r -t %t.so | FileCheck %s + .data .quad __start_foo - .section foo,"a" -// By default the symbol is visible and we need a dynamic reloc. -// CHECK: R_X86_64_64 __start_foo 0x0 + .section foo,"aw" +// By default the symbol is hidden. +// CHECK: R_X86_64_RELATIVE - 0x[[ADDR1:.*]] .hidden __start_bar .quad __start_bar .section bar,"a" -// Test that we are able to hide the symbol. -// CHECK: R_X86_64_RELATIVE - 0x[[ADDR:.*]] +// References do not affect the visibility. +// CHECK: R_X86_64_RELATIVE - 0x[[ADDR2:.*]] // CHECK: Name: __start_bar -// CHECK-NEXT: Value: 0x[[ADDR]] +// CHECK-NEXT: Value: 0x[[ADDR2]] +// CHECK-NEXT: Size: +// CHECK-NEXT: Binding: Local + +// CHECK: Name: __start_foo +// CHECK-NEXT: Value: 0x[[ADDR1]] +// CHECK-NEXT: Size: +// CHECK-NEXT: Binding: Local diff --git a/test/ELF/startstop.s b/test/ELF/startstop.s index d0e88df4e7eb..a7b2e43e6a5f 100644 --- a/test/ELF/startstop.s +++ b/test/ELF/startstop.s @@ -20,7 +20,13 @@ // DISASM: 1014: 90 nop -// SYMBOL: Relocations [ +// SYMBOL: Relocations [ +// SYMBOL-NEXT: Section ({{.*}}) .rela.dyn { +// SYMBOL-NEXT: 0x3000 R_X86_64_RELATIVE - 0x3020 +// SYMBOL-NEXT: 0x3008 R_X86_64_RELATIVE - 0x3021 +// SYMBOL-NEXT: 0x3010 R_X86_64_RELATIVE - 0x3010 +// SYMBOL-NEXT: 0x3018 R_X86_64_RELATIVE - 0x3011 +// SYMBOL-NEXT: } // SYMBOL-NEXT: ] // SYMBOL: Symbol { @@ -59,3 +65,11 @@ _start: nop nop nop + +.section zed1, "aw" + .quad __stop_zed2 + .quad __stop_zed2 + 1 + +.section zed2, "aw" + .quad __stop_zed1 + .quad __stop_zed1 + 1 diff --git a/test/ELF/string-gc.s b/test/ELF/string-gc.s new file mode 100644 index 000000000000..e7f86a1c6077 --- /dev/null +++ b/test/ELF/string-gc.s @@ -0,0 +1,73 @@ +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: ld.lld %t.o -o %t --gc-sections +// RUN: llvm-readobj -symbols %t | FileCheck %s + +// CHECK: Symbols [ +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: (0) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local (0x0) +// CHECK-NEXT: Type: None (0x0) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: Undefined (0x0) +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: s3 +// CHECK-NEXT: Value: 0x10125 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local (0x0) +// CHECK-NEXT: Type: Object (0x1) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .rodata (0x1) +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: s1 +// CHECK-NEXT: Value: 0x10120 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local (0x0) +// CHECK-NEXT: Type: Object (0x1) +// CHECK-NEXT: Other [ (0x2) +// CHECK-NEXT: STV_HIDDEN (0x2) +// CHECK-NEXT: ] +// CHECK-NEXT: Section: .rodata (0x1) +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: _start +// CHECK-NEXT: Value: 0x11000 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Global (0x1) +// CHECK-NEXT: Type: Function (0x2) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .text (0x2) +// CHECK-NEXT: } +// CHECK-NEXT: ] + +.text +.globl _start +.type _start,@function +_start: +movl $s1, %eax +movl $s3, %eax + +.hidden s1 +.type s1,@object +.section .rodata.str1.1,"aMS",@progbits,1 +.globl s1 +s1: +.asciz "abcd" + +.hidden s2 +.type s2,@object +.globl s2 +s2: +.asciz "efgh" + +.type s3,@object +s3: +.asciz "ijkl" + +.type s4,@object +.globl s4 +s4: +.asciz "mnop" diff --git a/test/ELF/string-table.s b/test/ELF/string-table.s index 8393d6de6cc5..892c348f6fd0 100644 --- a/test/ELF/string-table.s +++ b/test/ELF/string-table.s @@ -59,9 +59,8 @@ _start: // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 00626172 002E7465 78740066 6F6F6261 |.bar..text.fooba| -// CHECK-NEXT: 0010: 7200666F 6F626172 00666F6F 62617200 |r.foobar.foobar.| -// CHECK-NEXT: 0020: 2E73796D 74616200 2E736873 74727461 |.symtab..shstrta| -// CHECK-NEXT: 0030: 62002E73 74727461 6200 |b..strtab.| +// CHECK-NEXT: 0010: 72002E73 796D7461 62002E73 68737472 |r..symtab..shstr| +// CHECK-NEXT: 0020: 74616200 2E737472 74616200 |tab..strtab.| // CHECK-NEXT: ) // CHECK-NEXT:} // CHECK: Name: .strtab diff --git a/test/ELF/strip-all.s b/test/ELF/strip-all.s index 6d18431668ae..f322119b0dbb 100644 --- a/test/ELF/strip-all.s +++ b/test/ELF/strip-all.s @@ -13,12 +13,16 @@ #AFTER: .shstrtab #AFTER-NOT: .strtab +# Ignore --strip-all if -r is specified +#RUN: ld.lld %t.o --strip-all -r -o %t1 +#RUN: llvm-objdump -section-headers %t1 | FileCheck %s -check-prefix BEFORE + # Test alias -s #RUN: ld.lld %t.o -s -o %t1 #RUN: llvm-objdump -section-headers %t1 | FileCheck %s -check-prefix AFTER # exits with return code 42 on linux -.globl _start; +.globl _start _start: mov $60, %rax mov $42, %rdi diff --git a/test/ELF/strip-debug.s b/test/ELF/strip-debug.s new file mode 100644 index 000000000000..81f7572aa7c5 --- /dev/null +++ b/test/ELF/strip-debug.s @@ -0,0 +1,25 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux -g %s -o %t +# RUN: ld.lld %t -o %t2 +# RUN: llvm-readobj -sections -symbols %t2 | FileCheck -check-prefix=DEFAULT %s +# RUN: ld.lld %t -o %t2 --strip-debug +# RUN: llvm-readobj -sections -symbols %t2 | FileCheck -check-prefix=STRIP %s +# RUN: ld.lld %t -o %t2 -S +# RUN: llvm-readobj -sections -symbols %t2 | FileCheck -check-prefix=STRIP %s +# RUN: ld.lld %t -o %t2 --strip-all +# RUN: llvm-readobj -sections -symbols %t2 | FileCheck -check-prefix=STRIP %s + +# DEFAULT: Name: .debug_info +# DEFAULT: Name: .debug_abbrev +# DEFAULT: Name: .debug_aranges +# DEFAULT: Name: .debug_line + +# STRIP-NOT: Name: .debug_info +# STRIP-NOT: Name: .debug_abbrev +# STRIP-NOT: Name: .debug_aranges +# STRIP-NOT: Name: .debug_line + +.globl _start +_start: + ret diff --git a/test/ELF/symbol-override.s b/test/ELF/symbol-override.s new file mode 100644 index 000000000000..487885b75b36 --- /dev/null +++ b/test/ELF/symbol-override.s @@ -0,0 +1,46 @@ +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/symbol-override.s -o %t2.o +// RUN: ld.lld -shared %t2.o -o %t2.so +// RUN: ld.lld %t1.o %t2.so -o %t +// RUN: llvm-readobj -dyn-symbols %t | FileCheck %s + +// CHECK: DynamicSymbols [ +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: Undefined +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: do +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: Function +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: Undefined +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: foo +// CHECK-NEXT: Value: 0x11000 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: Function +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .text +// CHECK-NEXT: } +// CHECK-NEXT: ] + +.text +.globl foo +.type foo,@function +foo: +nop + +.text +.globl _start +_start: +callq do@plt diff --git a/test/ELF/symbols.s b/test/ELF/symbols.s index ccf83afdf567..a6c838cf0b74 100644 --- a/test/ELF/symbols.s +++ b/test/ELF/symbols.s @@ -67,7 +67,7 @@ internal: // CHECK-NEXT: SHF_WRITE // CHECK-NEXT: ] // CHECK-NEXT: Address: 0x12000 -// CHECK-NEXT: Offset: 0x2000 +// CHECK-NEXT: Offset: // CHECK-NEXT: Size: 4 // CHECK: Symbols [ @@ -86,7 +86,9 @@ internal: // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 2 +// CHECK-NEXT: Other [ (0x2) +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] // CHECK-NEXT: Section: foobar // CHECK-NEXT: } // CHECK-NEXT: Symbol { @@ -95,7 +97,9 @@ internal: // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 1 +// CHECK-NEXT: Other [ (0x1) +// CHECK-NEXT: STV_INTERNAL +// CHECK-NEXT: ] // CHECK-NEXT: Section: foobar // CHECK-NEXT: } // CHECK-NEXT: Symbol { @@ -149,7 +153,9 @@ internal: // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Global // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 3 +// CHECK-NEXT: Other [ (0x3) +// CHECK-NEXT: STV_PROTECTED +// CHECK-NEXT: ] // CHECK-NEXT: Section: foobar // CHECK-NEXT: } // CHECK-NEXT: Symbol { diff --git a/test/ELF/sysroot.s b/test/ELF/sysroot.s index 35154be125a3..38fd8cdde402 100644 --- a/test/ELF/sysroot.s +++ b/test/ELF/sysroot.s @@ -14,7 +14,7 @@ // We need to be sure that there is no suitable library in the /lib directory // RUN: not ld.lld -o %t/r %t/m.o -L/lib -l:libls.a 2>&1 \ // RUN: | FileCheck --check-prefix=NOLIB %s -// NOLIB: Unable to find library -l:libls.a +// NOLIB: unable to find library -l:libls.a // Should just remove the '=' symbol if --sysroot is not specified. // Case 1: relative path @@ -32,5 +32,5 @@ // RUN: not ld.lld -o %t/r %r/m.o --sysroot=%t -Llib -l:libls.a // RUN: not ld.lld -o %t/r %r/m.o --sysroot=%t -L/lib -l:libls.a -.globl _start,_bar; +.globl _start,_bar _start: diff --git a/test/ELF/tail-merge-string-align.s b/test/ELF/tail-merge-string-align.s new file mode 100644 index 000000000000..a5d4603b6f8b --- /dev/null +++ b/test/ELF/tail-merge-string-align.s @@ -0,0 +1,35 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: ld.lld %t.o -o %t.so -shared -O3 +// RUN: llvm-readobj -s -section-data %t.so | FileCheck %s + + .section .rodata.4a,"aMS",@progbits,1 + .align 4 + .asciz "abcdef" + + .section .rodata.4b,"aMS",@progbits,1 + .align 4 + .asciz "ef" + + .section .rodata.4c,"aMS",@progbits,1 + .align 4 + .asciz "f" + + +// CHECK: Name: .rodata +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_MERGE +// CHECK-NEXT: SHF_STRINGS +// CHECK-NEXT: ] +// CHECK-NEXT: Address: +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: 1 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 4 +// CHECK-NEXT: EntrySize: +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 61626364 65660000 6600 |abcdef..f.| +// CHECK-NEXT: ) diff --git a/test/ELF/tls-archive.s b/test/ELF/tls-archive.s new file mode 100644 index 000000000000..9a88fddffd36 --- /dev/null +++ b/test/ELF/tls-archive.s @@ -0,0 +1,10 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/tls-mismatch.s -o %t2 +// RUN: rm -f %t.a +// RUN: llvm-ar cru %t.a %t2 +// RUN: ld.lld %t.a %t -o %t3 + +.globl _start,tlsvar +_start: + movq tlsvar@GOTTPOFF(%rip),%rdx diff --git a/test/ELF/tls-dynamic-i686.s b/test/ELF/tls-dynamic-i686.s index b2620d048864..4db6278ca21b 100644 --- a/test/ELF/tls-dynamic-i686.s +++ b/test/ELF/tls-dynamic-i686.s @@ -19,6 +19,14 @@ tls1: .long 0 .size tls1, 4 +.type tls2,@object +.globl tls2 +.hidden tls2 +.align 4 +tls2: + .long 0 + .size tls2, 4 + .section .text .globl _start _start: @@ -28,13 +36,13 @@ call __tls_get_addr@plt leal tls1@tlsgd(,%ebx,1),%eax call __tls_get_addr@plt -leal tls0@tlsldm(%ebx),%eax +leal tls2@tlsldm(%ebx),%eax call __tls_get_addr@plt -leal tls0@dtpoff(%eax),%edx +leal tls2@dtpoff(%eax),%edx -leal tls1@tlsldm(%ebx),%eax +leal tls2@tlsldm(%ebx),%eax call __tls_get_addr@plt -leal tls1@dtpoff(%eax),%edx +leal tls2@dtpoff(%eax),%edx movl %gs:0,%eax addl tls0@gotntpoff(%ebx),%eax @@ -59,12 +67,12 @@ addl tls1@gotntpoff(%ebx),%eax // CHECK: Relocations [ // CHECK: Section ({{.+}}) .rel.dyn { +// CHECK-NEXT: 0x2078 R_386_TLS_DTPMOD32 - 0x0 // CHECK-NEXT: 0x2068 R_386_TLS_DTPMOD32 tls0 0x0 // CHECK-NEXT: 0x206C R_386_TLS_DTPOFF32 tls0 0x0 +// CHECK-NEXT: 0x2080 R_386_TLS_TPOFF tls0 0x0 // CHECK-NEXT: 0x2070 R_386_TLS_DTPMOD32 tls1 0x0 // CHECK-NEXT: 0x2074 R_386_TLS_DTPOFF32 tls1 0x0 -// CHECK-NEXT: 0x2078 R_386_TLS_DTPMOD32 - 0x0 -// CHECK-NEXT: 0x2080 R_386_TLS_TPOFF tls0 0x0 // CHECK-NEXT: 0x2084 R_386_TLS_TPOFF tls1 0x0 // CHECK-NEXT: } @@ -81,10 +89,10 @@ addl tls1@gotntpoff(%ebx),%eax // -16 is a local module tls index offset. // DIS-NEXT: 1018: 8d 83 f0 ff ff ff leal -16(%ebx), %eax // DIS-NEXT: 101e: e8 4d 00 00 00 calll 77 -// DIS-NEXT: 1023: 8d 90 00 00 00 00 leal (%eax), %edx +// DIS-NEXT: 1023: 8d 90 08 00 00 00 leal 8(%eax), %edx // DIS-NEXT: 1029: 8d 83 f0 ff ff ff leal -16(%ebx), %eax // DIS-NEXT: 102f: e8 3c 00 00 00 calll 60 -// DIS-NEXT: 1034: 8d 90 04 00 00 00 leal 4(%eax), %edx +// DIS-NEXT: 1034: 8d 90 08 00 00 00 leal 8(%eax), %edx // Initial exec model: // DIS-NEXT: 103a: 65 a1 00 00 00 00 movl %gs:0, %eax // DIS-NEXT: 1040: 03 83 f8 ff ff ff addl -8(%ebx), %eax diff --git a/test/ELF/tls-dynamic.s b/test/ELF/tls-dynamic.s index b6ae6da61bb2..b627977e3c6f 100644 --- a/test/ELF/tls-dynamic.s +++ b/test/ELF/tls-dynamic.s @@ -14,10 +14,13 @@ leaq c@tlsgd(%rip), %rdi rex64 callq __tls_get_addr@PLT - leaq c@dtpoff(%rax), %rcx + leaq a@dtpoff(%rax), %rcx // Initial Exec Model Code Sequence, II movq c@gottpoff(%rip),%rax movq %fs:(%rax),%rax + movabs $a@dtpoff, %rax + movabs $b@dtpoff, %rax + movabs $a@dtpoff, %rax .global a .hidden a @@ -76,6 +79,9 @@ c: // DIS-NEXT: 102c: 00 00 // DIS-NEXT: 102e: {{.+}} leaq 4267(%rip), %rdi // DIS-NEXT: 1035: {{.+}} callq -// DIS-NEXT: 103b: {{.+}} leaq 8(%rax), %rcx +// DIS-NEXT: 103b: {{.+}} leaq (%rax), %rcx // DIS-NEXT: 1042: {{.+}} movq 4263(%rip), %rax // DIS-NEXT: 1049: {{.+}} movq %fs:(%rax), %rax +// DIS-NEXT: 104d: {{.+}} movabsq $0, %rax +// DIS-NEXT: 1057: {{.+}} movabsq $4, %rax +// DIS-NEXT: 1061: {{.+}} movabsq $0, %rax diff --git a/test/ELF/tls-got-entry.s b/test/ELF/tls-got-entry.s new file mode 100644 index 000000000000..c7b96697ab30 --- /dev/null +++ b/test/ELF/tls-got-entry.s @@ -0,0 +1,25 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/tls-got-entry.s -o %tso.o +// RUN: ld.lld -shared %tso.o -o %t.so +// RUN: ld.lld %t.o %t.so -o %t1 +// RUN: llvm-readobj -r %t1 | FileCheck %s + +// CHECK: Relocations [ +// CHECK-NEXT: Section ({{.*}}) .rela.dyn { +// CHECK-NEXT: R_X86_64_TPOFF64 tlsshared0 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: ] + +.globl _start +_start: + .byte 0x66 + leaq tlsshared0@tlsgd(%rip),%rdi + .word 0x6666 + rex64 + call __tls_get_addr@plt + .byte 0x66 + leaq tlsshared0@tlsgd(%rip),%rdi + .word 0x6666 + rex64 + call __tls_get_addr@plt diff --git a/test/ELF/tls-got.s b/test/ELF/tls-got.s index aa024519a64a..f36d94e40cb1 100644 --- a/test/ELF/tls-got.s +++ b/test/ELF/tls-got.s @@ -24,8 +24,8 @@ // CHECK: Relocations [ // CHECK-NEXT: Section (4) .rela.dyn { -// CHECK-NEXT: [[ADDR]] R_X86_64_TPOFF64 tls1 0x0 // CHECK-NEXT: 0x120B8 R_X86_64_TPOFF64 tls0 0x0 +// CHECK-NEXT: [[ADDR]] R_X86_64_TPOFF64 tls1 0x0 // CHECK-NEXT: } // CHECK-NEXT: ] diff --git a/test/ELF/tls-i686.s b/test/ELF/tls-i686.s index 62940d6cd164..e0a1007fde16 100644 --- a/test/ELF/tls-i686.s +++ b/test/ELF/tls-i686.s @@ -15,7 +15,7 @@ var: var1: .long 1 -.text +.section test, "awx" .global _start _start: movl $var@tpoff, %edx @@ -30,40 +30,40 @@ _start: movl %gs:0, %ecx leal var1@ntpoff(%ecx), %eax -// DIS: Disassembly of section .text: +// DIS: Disassembly of section test: // DIS-NEXT: _start: -// DIS-NEXT: 11000: ba 08 00 00 00 movl $8, %edx -// DIS-NEXT: 11005: 65 8b 0d 00 00 00 00 movl %gs:0, %ecx -// DIS-NEXT: 1100c: 29 d0 subl %edx, %eax -// DIS-NEXT: 1100e: ba 04 00 00 00 movl $4, %edx -// DIS-NEXT: 11013: 65 8b 0d 00 00 00 00 movl %gs:0, %ecx -// DIS-NEXT: 1101a: 29 d0 subl %edx, %eax -// DIS-NEXT: 1101c: 65 8b 0d 00 00 00 00 movl %gs:0, %ecx -// DIS-NEXT: 11023: 8d 81 f8 ff ff ff leal -8(%ecx), %eax -// DIS-NEXT: 11029: 65 8b 0d 00 00 00 00 movl %gs:0, %ecx -// DIS-NEXT: 11030: 8d 81 fc ff ff ff leal -4(%ecx), %eax +// DIS-NEXT: 12000: ba 08 00 00 00 movl $8, %edx +// DIS-NEXT: 12005: 65 8b 0d 00 00 00 00 movl %gs:0, %ecx +// DIS-NEXT: 1200c: 29 d0 subl %edx, %eax +// DIS-NEXT: 1200e: ba 04 00 00 00 movl $4, %edx +// DIS-NEXT: 12013: 65 8b 0d 00 00 00 00 movl %gs:0, %ecx +// DIS-NEXT: 1201a: 29 d0 subl %edx, %eax +// DIS-NEXT: 1201c: 65 8b 0d 00 00 00 00 movl %gs:0, %ecx +// DIS-NEXT: 12023: 8d 81 f8 ff ff ff leal -8(%ecx), %eax +// DIS-NEXT: 12029: 65 8b 0d 00 00 00 00 movl %gs:0, %ecx +// DIS-NEXT: 12030: 8d 81 fc ff ff ff leal -4(%ecx), %eax // RELOC: Relocations [ // RELOC-NEXT: ] -// DISSHARED: Disassembly of section .text: +// DISSHARED: Disassembly of section test: // DISSHARED-NEXT: _start: -// DISSHARED-NEXT: 1000: ba 00 00 00 00 movl $0, %edx -// DISSHARED-NEXT: 1005: 65 8b 0d 00 00 00 00 movl %gs:0, %ecx -// DISSHARED-NEXT: 100c: 29 d0 subl %edx, %eax -// DISSHARED-NEXT: 100e: ba 00 00 00 00 movl $0, %edx -// DISSHARED-NEXT: 1013: 65 8b 0d 00 00 00 00 movl %gs:0, %ecx -// DISSHARED-NEXT: 101a: 29 d0 subl %edx, %eax -// DISSHARED-NEXT: 101c: 65 8b 0d 00 00 00 00 movl %gs:0, %ecx -// DISSHARED-NEXT: 1023: 8d 81 00 00 00 00 leal (%ecx), %eax -// DISSHARED-NEXT: 1029: 65 8b 0d 00 00 00 00 movl %gs:0, %ecx -// DISSHARED-NEXT: 1030: 8d 81 00 00 00 00 leal (%ecx), %eax +// DISSHARED-NEXT: 2000: ba 00 00 00 00 movl $0, %edx +// DISSHARED-NEXT: 2005: 65 8b 0d 00 00 00 00 movl %gs:0, %ecx +// DISSHARED-NEXT: 200c: 29 d0 subl %edx, %eax +// DISSHARED-NEXT: 200e: ba 00 00 00 00 movl $0, %edx +// DISSHARED-NEXT: 2013: 65 8b 0d 00 00 00 00 movl %gs:0, %ecx +// DISSHARED-NEXT: 201a: 29 d0 subl %edx, %eax +// DISSHARED-NEXT: 201c: 65 8b 0d 00 00 00 00 movl %gs:0, %ecx +// DISSHARED-NEXT: 2023: 8d 81 00 00 00 00 leal (%ecx), %eax +// DISSHARED-NEXT: 2029: 65 8b 0d 00 00 00 00 movl %gs:0, %ecx +// DISSHARED-NEXT: 2030: 8d 81 00 00 00 00 leal (%ecx), %eax // RELOCSHARED: Relocations [ // RELOCSHARED-NEXT: Section (4) .rel.dyn { -// RELOCSHARED-NEXT: 0x1001 R_386_TLS_TPOFF32 var 0x0 -// RELOCSHARED-NEXT: 0x100F R_386_TLS_TPOFF32 var1 0x0 -// RELOCSHARED-NEXT: 0x1025 R_386_TLS_TPOFF var 0x0 -// RELOCSHARED-NEXT: 0x1032 R_386_TLS_TPOFF var1 0x0 +// RELOCSHARED-NEXT: 0x2001 R_386_TLS_TPOFF32 var 0x0 +// RELOCSHARED-NEXT: 0x2025 R_386_TLS_TPOFF var 0x0 +// RELOCSHARED-NEXT: 0x200F R_386_TLS_TPOFF32 var1 0x0 +// RELOCSHARED-NEXT: 0x2032 R_386_TLS_TPOFF var1 0x0 // RELOCSHARED-NEXT: } // RELOCSHARED-NEXT: ] diff --git a/test/ELF/tls-in-archive.s b/test/ELF/tls-in-archive.s new file mode 100644 index 000000000000..71f60e380f33 --- /dev/null +++ b/test/ELF/tls-in-archive.s @@ -0,0 +1,11 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/tls-in-archive.s -o %t1.o +// RUN: llvm-ar cru %t.a %t1.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t2.o +// RUN: ld.lld %t2.o %t.a -o %tout + + .globl _start +_start: + movq foo@gottpoff(%rip), %rax + .section .tbss,"awT",@nobits + .weak foo diff --git a/test/ELF/tls-initial-exec-local.s b/test/ELF/tls-initial-exec-local.s new file mode 100644 index 000000000000..0aef3c8237b6 --- /dev/null +++ b/test/ELF/tls-initial-exec-local.s @@ -0,0 +1,36 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: ld.lld -shared %t.o -o %t +// RUN: llvm-readobj -r -s %t | FileCheck %s +// RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s + +// CHECK: Name: .got +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC (0x2) +// CHECK-NEXT: SHF_WRITE (0x1) +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x2090 + +// CHECK: Relocations [ +// CHECK-NEXT: Section ({{.*}}) .rela.dyn { +// CHECK-NEXT: 0x2090 R_X86_64_TPOFF64 - 0x0 +// CHECK-NEXT: 0x2098 R_X86_64_TPOFF64 - 0x4 +// CHECK-NEXT: } +// CHECK-NEXT: ] + +// 0x1007 + 4233 = 0x2090 +// 0x100e + 4234 = 0x2098 +// DISASM: Disassembly of section .text: +// DISASM-NEXT: .text: +// DISASM-NEXT: 1000: {{.*}} addq 4233(%rip), %rax +// DISASM-NEXT: 1007: {{.*}} addq 4234(%rip), %rax + + addq foo@GOTTPOFF(%rip), %rax + addq bar@GOTTPOFF(%rip), %rax + + .section .tbss,"awT",@nobits +foo: + .long 0 +bar: + .long 0 diff --git a/test/ELF/tls-offset.s b/test/ELF/tls-offset.s new file mode 100644 index 000000000000..8f5a46d988da --- /dev/null +++ b/test/ELF/tls-offset.s @@ -0,0 +1,56 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +// RUN: ld.lld %t -o %tout +// RUN: llvm-readobj -s %tout | FileCheck %s + + .global _start +_start: + retq + + .section .tdata,"awT",@progbits + .align 4 + .long 42 + + .section .tbss,"awT",@nobits + .align 16 + .zero 16 + + .data + .long 1 + + +// Test that .tbss doesn't show up in the offset or in the address. If this +// gets out of sync what we get a runtime is different from what the section +// table says. + +// CHECK: Name: .tdata +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_TLS +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x12000 +// CHECK-NEXT: Offset: 0x2000 +// CHECK-NEXT: Size: 4 + +// CHECK: Name: .tbss +// CHECK-NEXT: Type: SHT_NOBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_TLS +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x12010 +// CHECK-NEXT: Offset: 0x2004 +// CHECK-NEXT: Size: 16 + +// CHECK: Name: .data +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x12004 +// CHECK-NEXT: Offset: 0x2004 +// CHECK-NEXT: Size: 4 diff --git a/test/ELF/tls-opt-gdie.s b/test/ELF/tls-opt-gdie.s index 3f83157086e7..6ed370e3f0b2 100644 --- a/test/ELF/tls-opt-gdie.s +++ b/test/ELF/tls-opt-gdie.s @@ -6,15 +6,15 @@ // RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASM %s //RELOC: Section { -//RELOC: Index: 9 -//RELOC-NEXT: Name: .got +//RELOC: Index: +//RELOC: Name: .got //RELOC-NEXT: Type: SHT_PROGBITS //RELOC-NEXT: Flags [ //RELOC-NEXT: SHF_ALLOC //RELOC-NEXT: SHF_WRITE //RELOC-NEXT: ] -//RELOC-NEXT: Address: 0x120F0 -//RELOC-NEXT: Offset: 0x20F0 +//RELOC-NEXT: Address: 0x120B0 +//RELOC-NEXT: Offset: 0x20B0 //RELOC-NEXT: Size: 16 //RELOC-NEXT: Link: 0 //RELOC-NEXT: Info: 0 @@ -23,22 +23,19 @@ //RELOC-NEXT: } //RELOC: Relocations [ //RELOC-NEXT: Section (4) .rela.dyn { -//RELOC-NEXT: 0x120F0 R_X86_64_TPOFF64 tlsshared0 0x0 -//RELOC-NEXT: 0x120F8 R_X86_64_TPOFF64 tlsshared1 0x0 -//RELOC-NEXT: } -//RELOC-NEXT: Section (5) .rela.plt { -//RELOC-NEXT: 0x13018 R_X86_64_JUMP_SLOT __tls_get_addr 0x0 +//RELOC-NEXT: 0x120B0 R_X86_64_TPOFF64 tlsshared0 0x0 +//RELOC-NEXT: 0x120B8 R_X86_64_TPOFF64 tlsshared1 0x0 //RELOC-NEXT: } //RELOC-NEXT: ] -//0x11009 + (4304 + 7) = 0x120F0 -//0x11019 + (4296 + 7) = 0x120F8 +//0x11009 + (4256 + 7) = 0x120B0 +//0x11019 + (4248 + 7) = 0x120B8 // DISASM: Disassembly of section .text: // DISASM-NEXT: _start: -// DISASM-NEXT: 11000: 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax -// DISASM-NEXT: 11009: 48 03 05 e0 10 00 00 addq 4320(%rip), %rax -// DISASM-NEXT: 11010: 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax -// DISASM-NEXT: 11019: 48 03 05 d8 10 00 00 addq 4312(%rip), %rax +// DISASM-NEXT: 11000: {{.*}} movq %fs:0, %rax +// DISASM-NEXT: 11009: {{.*}} addq 4256(%rip), %rax +// DISASM-NEXT: 11010: {{.*}} movq %fs:0, %rax +// DISASM-NEXT: 11019: {{.*}} addq 4248(%rip), %rax .section .text .globl _start diff --git a/test/ELF/tls-opt-iele-i686-nopic.s b/test/ELF/tls-opt-iele-i686-nopic.s index 50ade0fc76cc..b6608c16551c 100644 --- a/test/ELF/tls-opt-iele-i686-nopic.s +++ b/test/ELF/tls-opt-iele-i686-nopic.s @@ -4,9 +4,6 @@ // RUN: ld.lld %t.o %tso -o %t1 // RUN: llvm-readobj -s -r %t1 | FileCheck --check-prefix=GOTREL %s // RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASM %s -// RUN: ld.lld -shared %t.o %tso -o %t1 -// RUN: llvm-readobj -s -r %t1 | FileCheck --check-prefix=GOTRELSHARED %s -// RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASMSHARED %s // GOTREL: Section { // GOTREL: Index: @@ -54,62 +51,6 @@ // DISASM-NEXT: 1103d: 03 0d 5c 20 01 00 addl 73820, %ecx // DISASM-NEXT: 11043: 65 8b 01 movl %gs:(%ecx), %eax -// GOTRELSHARED: Section { -// GOTRELSHARED: Index: 8 -// GOTRELSHARED: Name: .got -// GOTRELSHARED-NEXT: Type: SHT_PROGBITS -// GOTRELSHARED-NEXT: Flags [ -// GOTRELSHARED-NEXT: SHF_ALLOC -// GOTRELSHARED-NEXT: SHF_WRITE -// GOTRELSHARED-NEXT: ] -// GOTRELSHARED-NEXT: Address: 0x2050 -// GOTRELSHARED-NEXT: Offset: 0x2050 -// GOTRELSHARED-NEXT: Size: 16 -// GOTRELSHARED-NEXT: Link: 0 -// GOTRELSHARED-NEXT: Info: 0 -// GOTRELSHARED-NEXT: AddressAlignment: 4 -// GOTRELSHARED-NEXT: EntrySize: 0 -// GOTRELSHARED-NEXT: } -// GOTRELSHARED: Relocations [ -// GOTRELSHARED-NEXT: Section ({{.*}}) .rel.dyn { -// GOTRELSHARED-NEXT: 0x1002 R_386_RELATIVE - 0x0 -// GOTRELSHARED-NEXT: 0x2050 R_386_TLS_TPOFF tlslocal0 0x0 -// GOTRELSHARED-NEXT: 0x100A R_386_RELATIVE - 0x0 -// GOTRELSHARED-NEXT: 0x1013 R_386_RELATIVE - 0x0 -// GOTRELSHARED-NEXT: 0x101C R_386_RELATIVE - 0x0 -// GOTRELSHARED-NEXT: 0x2054 R_386_TLS_TPOFF tlslocal1 0x0 -// GOTRELSHARED-NEXT: 0x1024 R_386_RELATIVE - 0x0 -// GOTRELSHARED-NEXT: 0x102D R_386_RELATIVE - 0x0 -// GOTRELSHARED-NEXT: 0x1036 R_386_RELATIVE - 0x0 -// GOTRELSHARED-NEXT: 0x2058 R_386_TLS_TPOFF tlsshared0 0x0 -// GOTRELSHARED-NEXT: 0x103F R_386_RELATIVE - 0x0 -// GOTRELSHARED-NEXT: 0x205C R_386_TLS_TPOFF tlsshared1 0x0 -// GOTRELSHARED-NEXT: } -// GOTRELSHARED-NEXT: ] - -// DISASMSHARED: Disassembly of section .text: -// DISASMSHARED-NEXT: _start: -// (.got)[0] = 0x2050 = 8272 -// (.got)[1] = 0x2054 = 8276 -// (.got)[2] = 0x2058 = 8280 -// (.got)[3] = 0x205C = 8284 -// DISASMSHARED-NEXT: 1000: 8b 0d 50 20 00 00 movl 8272, %ecx -// DISASMSHARED-NEXT: 1006: 65 8b 01 movl %gs:(%ecx), %eax -// DISASMSHARED-NEXT: 1009: a1 50 20 00 00 movl 8272, %eax -// DISASMSHARED-NEXT: 100e: 65 8b 00 movl %gs:(%eax), %eax -// DISASMSHARED-NEXT: 1011: 03 0d 50 20 00 00 addl 8272, %ecx -// DISASMSHARED-NEXT: 1017: 65 8b 01 movl %gs:(%ecx), %eax -// DISASMSHARED-NEXT: 101a: 8b 0d 54 20 00 00 movl 8276, %ecx -// DISASMSHARED-NEXT: 1020: 65 8b 01 movl %gs:(%ecx), %eax -// DISASMSHARED-NEXT: 1023: a1 54 20 00 00 movl 8276, %eax -// DISASMSHARED-NEXT: 1028: 65 8b 00 movl %gs:(%eax), %eax -// DISASMSHARED-NEXT: 102b: 03 0d 54 20 00 00 addl 8276, %ecx -// DISASMSHARED-NEXT: 1031: 65 8b 01 movl %gs:(%ecx), %eax -// DISASMSHARED-NEXT: 1034: 8b 0d 58 20 00 00 movl 8280, %ecx -// DISASMSHARED-NEXT: 103a: 65 8b 01 movl %gs:(%ecx), %eax -// DISASMSHARED-NEXT: 103d: 03 0d 5c 20 00 00 addl 8284, %ecx -// DISASMSHARED-NEXT: 1043: 65 8b 01 movl %gs:(%ecx), %eax - .type tlslocal0,@object .section .tbss,"awT",@nobits .globl tlslocal0 diff --git a/test/ELF/tls-opt-no-plt.s b/test/ELF/tls-opt-no-plt.s new file mode 100644 index 000000000000..53655d0934d5 --- /dev/null +++ b/test/ELF/tls-opt-no-plt.s @@ -0,0 +1,34 @@ +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/tls-opt-gdie.s -o %t2.o +// RUN: ld.lld %t2.o -o %t2.so -shared +// RUN: ld.lld %t.o %t2.so -o %t.exe +// RUN: llvm-readobj -s %t.exe | FileCheck %s + +// CHECK-NOT: .plt + + .global _start +_start: + data16 + leaq foo@TLSGD(%rip), %rdi + data16 + data16 + rex64 + callq __tls_get_addr@PLT + + leaq bar@TLSLD(%rip), %rdi + callq __tls_get_addr@PLT + leaq bar@DTPOFF(%rax), %rax + + .type bar,@object + .section .tdata,"awT",@progbits + .align 8 +bar: + .long 42 + + + .type foo,@object + .section .tdata,"awT",@progbits + .globl foo + .align 8 +foo: + .long 42 diff --git a/test/ELF/tls-opt.s b/test/ELF/tls-opt.s index 06577d7e1021..52468f16b09d 100644 --- a/test/ELF/tls-opt.s +++ b/test/ELF/tls-opt.s @@ -6,35 +6,37 @@ // NORELOC: Relocations [ // NORELOC-NEXT: ] -// DISASM: Disassembly of section .text: -// DISASM-NEXT: _start: -// DISASM-NEXT: 11000: 48 c7 c0 f8 ff ff ff movq $-8, %rax -// DISASM-NEXT: 11007: 49 c7 c7 f8 ff ff ff movq $-8, %r15 -// DISASM-NEXT: 1100e: 48 8d 80 f8 ff ff ff leaq -8(%rax), %rax -// DISASM-NEXT: 11015: 4d 8d bf f8 ff ff ff leaq -8(%r15), %r15 -// DISASM-NEXT: 1101c: 48 81 c4 f8 ff ff ff addq $-8, %rsp -// DISASM-NEXT: 11023: 49 81 c4 f8 ff ff ff addq $-8, %r12 -// DISASM-NEXT: 1102a: 48 c7 c0 fc ff ff ff movq $-4, %rax -// DISASM-NEXT: 11031: 49 c7 c7 fc ff ff ff movq $-4, %r15 -// DISASM-NEXT: 11038: 48 8d 80 fc ff ff ff leaq -4(%rax), %rax -// DISASM-NEXT: 1103f: 4d 8d bf fc ff ff ff leaq -4(%r15), %r15 -// DISASM-NEXT: 11046: 48 81 c4 fc ff ff ff addq $-4, %rsp -// DISASM-NEXT: 1104d: 49 81 c4 fc ff ff ff addq $-4, %r12 -// Corrupred output: -// DISASM-NEXT: 11054: 48 8d 80 f8 ff ff ff leaq -8(%rax), %rax -// DISASM-NEXT: 1105b: 48 d1 81 c4 f8 ff ff rolq -1852(%rcx) -// DISASM-NEXT: 11062: ff 48 d1 decl -47(%rax) -// DISASM-NEXT: 11065: 81 c4 f8 ff ff ff addl $4294967288, %esp +// DISASM: _start: +// DISASM-NEXT: 11000: 48 c7 c0 f8 ff ff ff movq $-8, %rax +// DISASM-NEXT: 11007: 49 c7 c7 f8 ff ff ff movq $-8, %r15 +// DISASM-NEXT: 1100e: 48 8d 80 f8 ff ff ff leaq -8(%rax), %rax +// DISASM-NEXT: 11015: 4d 8d bf f8 ff ff ff leaq -8(%r15), %r15 +// DISASM-NEXT: 1101c: 48 81 c4 f8 ff ff ff addq $-8, %rsp +// DISASM-NEXT: 11023: 49 81 c4 f8 ff ff ff addq $-8, %r12 +// DISASM-NEXT: 1102a: 48 c7 c0 fc ff ff ff movq $-4, %rax +// DISASM-NEXT: 11031: 49 c7 c7 fc ff ff ff movq $-4, %r15 +// DISASM-NEXT: 11038: 48 8d 80 fc ff ff ff leaq -4(%rax), %rax +// DISASM-NEXT: 1103f: 4d 8d bf fc ff ff ff leaq -4(%r15), %r15 +// DISASM-NEXT: 11046: 48 81 c4 fc ff ff ff addq $-4, %rsp +// DISASM-NEXT: 1104d: 49 81 c4 fc ff ff ff addq $-4, %r12 + // LD to LE: -// DISASM-NEXT: 1106b: 66 66 66 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax -// DISASM-NEXT: 11077: 48 8d 88 f8 ff ff ff leaq -8(%rax), %rcx -// DISASM-NEXT: 1107e: 66 66 66 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax -// DISASM-NEXT: 1108a: 48 8d 88 fc ff ff ff leaq -4(%rax), %rcx +// DISASM-NEXT: 11054: 66 66 66 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax +// DISASM-NEXT: 11060: 48 8d 88 f8 ff ff ff leaq -8(%rax), %rcx +// DISASM-NEXT: 11067: 66 66 66 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax +// DISASM-NEXT: 11073: 48 8d 88 fc ff ff ff leaq -4(%rax), %rcx + // GD to LE: -// DISASM-NEXT: 11091: 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax -// DISASM-NEXT: 1109a: 48 8d 80 f8 ff ff ff leaq -8(%rax), %rax -// DISASM-NEXT: 110a1: 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax -// DISASM-NEXT: 110aa: 48 8d 80 fc ff ff ff leaq -4(%rax), %rax +// DISASM-NEXT: 1107a: 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax +// DISASM-NEXT: 11083: 48 8d 80 f8 ff ff ff leaq -8(%rax), %rax +// DISASM-NEXT: 1108a: 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax +// DISASM-NEXT: 11093: 48 8d 80 fc ff ff ff leaq -4(%rax), %rax + +// LD to LE: +// DISASM: _DTPOFF64_1: +// DISASM-NEXT: 1109a: f8 clc +// DISASM: _DTPOFF64_2: +// DISASM-NEXT: 110a3: fc cld .type tls0,@object .section .tbss,"awT",@nobits @@ -67,12 +69,7 @@ _start: addq tls1@GOTTPOFF(%rip), %rsp addq tls1@GOTTPOFF(%rip), %r12 - //Invalid input case: - xchgq tls0@gottpoff(%rip),%rax - shlq tls0@gottpoff - rolq tls0@gottpoff - - //LD to LE: + // LD to LE leaq tls0@tlsld(%rip), %rdi callq __tls_get_addr@PLT leaq tls0@dtpoff(%rax),%rcx @@ -80,7 +77,7 @@ _start: callq __tls_get_addr@PLT leaq tls1@dtpoff(%rax),%rcx - //GD to LE: + // GD to LE .byte 0x66 leaq tls0@tlsgd(%rip),%rdi .word 0x6666 @@ -91,3 +88,12 @@ _start: .word 0x6666 rex64 call __tls_get_addr@plt + + // LD to LE +_DTPOFF64_1: + .quad tls0@DTPOFF + nop + +_DTPOFF64_2: + .quad tls1@DTPOFF + nop diff --git a/test/ELF/tls-two-relocs.s b/test/ELF/tls-two-relocs.s new file mode 100644 index 000000000000..7c5d6abf77f4 --- /dev/null +++ b/test/ELF/tls-two-relocs.s @@ -0,0 +1,30 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +// RUN: ld.lld %t -o %tout -shared +// RUN: llvm-readobj -r %tout | FileCheck %s + + data16 + leaq g_tls_s@TLSGD(%rip), %rdi + data16 + data16 + rex64 + callq __tls_get_addr@PLT + + data16 + leaq g_tls_s@TLSGD(%rip), %rdi + data16 + data16 + rex64 + callq __tls_get_addr@PLT + +// Check that we handle two gd relocations to the same symbol. + +// CHECK: Relocations [ +// CHECK-NEXT: Section (4) .rela.dyn { +// CHECK-NEXT: R_X86_64_DTPMOD64 g_tls_s 0x0 +// CHECK-NEXT: R_X86_64_DTPOFF64 g_tls_s 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: Section (5) .rela.plt { +// CHECK-NEXT: R_X86_64_JUMP_SLOT __tls_get_addr 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: ] diff --git a/test/ELF/trace-ar.s b/test/ELF/trace-ar.s new file mode 100644 index 000000000000..1d178dc9dd37 --- /dev/null +++ b/test/ELF/trace-ar.s @@ -0,0 +1,21 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.foo.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/trace-ar1.s -o %t.obj1.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/trace-ar2.s -o %t.obj2.o +# RUN: llvm-ar rcs %t.boo.a %t.obj1.o %t.obj2.o + +## Check how -t works with achieves +# RUN: ld.lld %t.foo.o %t.boo.a -o %t.out -t 2>&1 | FileCheck %s +# CHECK: {{.*}}.foo.o +# CHECK-NEXT: {{.*}}.boo.a({{.*}}.obj1.o) +# CHECK-NOT: {{.*}}.boo.a({{.*}}.obj2.o) + +## Test output with --start-lib +# RUN: ld.lld %t.foo.o --start-lib %t.obj1.o %t.obj2.o -o %t.out -t 2>&1 | FileCheck --check-prefix=STARTLIB %s +# STARTLIB: {{.*}}.foo.o +# STARTLIB-NEXT: {{.*}}.obj1.o +# STARTLIB-NOT: {{.*}}.obj2.o + +.globl _start, _used +_start: + call _used diff --git a/test/ELF/trace-symbols.s b/test/ELF/trace-symbols.s new file mode 100644 index 000000000000..7f6bca8be216 --- /dev/null +++ b/test/ELF/trace-symbols.s @@ -0,0 +1,78 @@ +# Test -y symbol and -trace-symbol=symbol + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \ +# RUN: %p/Inputs/trace-symbols-foo-weak.s -o %t1 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \ +# RUN: %p/Inputs/trace-symbols-foo-strong.s -o %t2 +# RUN: ld.lld -shared %t1 -o %t1.so +# RUN: ld.lld -shared %t2 -o %t2.so +# RUN: llvm-ar rcs %t1.a %t1 +# RUN: llvm-ar rcs %t2.a %t2 + +# RUN: ld.lld -y foo -trace-symbol=common -trace-symbol=hsymbol \ +# RUN: %t %t1 %t2 -o %t3 2>&1 | FileCheck -check-prefix=OBJECTRFOO %s +# OBJECTRFOO: trace-symbols.s.tmp: reference to foo + +# RUN: ld.lld -y foo -trace-symbol=common -trace-symbol=hsymbol \ +# RUN: %t %t1 %t2 -o %t3 2>&1 | FileCheck -check-prefix=OBJECTDCOMMON %s +# OBJECTDCOMMON: trace-symbols.s.tmp1: common definition of common + +# RUN: ld.lld -y foo -trace-symbol=common -trace-symbol=hsymbol \ +# RUN: %t %t1 %t2 -o %t3 2>&1 | FileCheck -check-prefix=OBJECTD1FOO %s +# OBJECTD1FOO: trace-symbols.s.tmp: reference to foo +# OBJECTD1FOO: trace-symbols.s.tmp1: common definition of common +# OBJECTD1FOO: trace-symbols.s.tmp1: definition of foo +# OBJECTD1FOO: trace-symbols.s.tmp2: definition of foo + +# RUN: ld.lld -y foo -trace-symbol=common -trace-symbol=hsymbol \ +# RUN: %t %t1 %t2 -o %t3 2>&1 | FileCheck -check-prefix=OBJECTD2FOO %s +# RUN: ld.lld -y foo -y common --trace-symbol=hsymbol \ +# RUN: %t %t2 %t1 -o %t4 2>&1 | FileCheck -check-prefix=OBJECTD2FOO %s +# RUN: ld.lld -y foo -y common %t %t1.so %t2 -o %t3 2>&1 | \ +# RUN: FileCheck -check-prefix=OBJECTD2FOO %s +# RUN: ld.lld -y foo -y common %t %t2 %t1.a -o %t3 2>&1 | \ +# RUN: FileCheck -check-prefix=OBJECTD2FOO %s +# OBJECTD2FOO: trace-symbols.s.tmp2: definition of foo + +# RUN: ld.lld -y foo -y common %t %t1.so %t2 -o %t3 2>&1 | \ +# RUN: FileCheck -check-prefix=SHLIBDCOMMON %s +# SHLIBDCOMMON: trace-symbols.s.tmp1.so: definition of common + +# RUN: ld.lld -y foo -y common %t %t2.so %t1.so -o %t3 2>&1 | \ +# RUN: FileCheck -check-prefix=SHLIBD2FOO %s +# RUN: ld.lld -y foo %t %t1.a %t2.so -o %t3 | \ +# RUN: FileCheck -check-prefix=NO-SHLIBD2FOO %s +# SHLIBD2FOO: trace-symbols.s.tmp2.so: definition of foo +# NO-SHLIBD2FOO-NOT: trace-symbols.s.tmp2.so: definition of foo + +# RUN: ld.lld -y foo -y common %t %t2 %t1.a -o %t3 2>&1 | \ +# RUN: FileCheck -check-prefix=ARCHIVEDCOMMON %s +# ARCHIVEDCOMMON-NOT: trace-symbols.s.tmp1.a(trace-symbols.s.tmp1): definition of \ +# common + +# RUN: ld.lld -y foo %t %t1.a %t2.so -o %t3 | \ +# RUN: FileCheck -check-prefix=ARCHIVED1FOO %s +# ARCHIVED1FOO: trace-symbols.s.tmp1.a(trace-symbols.s.tmp1): definition of foo + +# RUN: ld.lld -y foo %t %t1.a %t2.a -o %t3 | \ +# RUN: FileCheck -check-prefix=ARCHIVED2FOO %s +# ARCHIVED2FOO: trace-symbols.s.tmp2.a(trace-symbols.s.tmp2): definition of foo + +# RUN: ld.lld -y bar %t %t1.so %t2.so -o %t3 | \ +# RUN: FileCheck -check-prefix=SHLIBDBAR %s +# SHLIBDBAR: trace-symbols.s.tmp2.so: definition of bar + +# RUN: ld.lld -y foo -y bar %t %t1.so %t2.so -o %t3 | \ +# RUN: FileCheck -check-prefix=SHLIBRBAR %s +# SHLIBRBAR-NOT: trace-symbols.s.tmp1.so: reference to bar + +# RUN: ld.lld -y foo -y bar %t -u bar --start-lib %t1 %t2 --end-lib -o %t3 | \ +# RUN: FileCheck -check-prefix=STARTLIB %s +# STARTLIB: trace-symbols.s.tmp1: reference to bar + +.hidden hsymbol +.globl _start +.type _start, @function +_start: +call foo diff --git a/test/ELF/trace.s b/test/ELF/trace.s new file mode 100644 index 000000000000..4374d93da648 --- /dev/null +++ b/test/ELF/trace.s @@ -0,0 +1,9 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.foo.o + +## Check -t +# RUN: ld.lld -shared %t.foo.o -o %t.so -t 2>&1 | FileCheck %s +# CHECK: {{.*}}.foo.o + +## Check --trace alias +# RUN: ld.lld -shared %t.foo.o -o %t.so -t 2>&1 | FileCheck %s diff --git a/test/ELF/undef-shared.s b/test/ELF/undef-shared.s new file mode 100644 index 000000000000..ed9103571443 --- /dev/null +++ b/test/ELF/undef-shared.s @@ -0,0 +1,14 @@ +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: not ld.lld %t.o -o %t.so -shared 2>&1 | FileCheck %s + +# CHECK: undefined symbol: hidden in {{.*}} +.global hidden +.hidden hidden + +# CHECK: undefined symbol: internal in {{.*}} +.global internal +.internal internal + +# CHECK: undefined symbol: protected in {{.*}} +.global protected +.protected protected diff --git a/test/ELF/undef-version-script.s b/test/ELF/undef-version-script.s new file mode 100644 index 000000000000..9f0a5a49e72e --- /dev/null +++ b/test/ELF/undef-version-script.s @@ -0,0 +1,40 @@ +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: echo "{ local: *; };" > %t.script +# RUN: ld.lld --version-script %t.script -shared %t.o -o %t.so +# RUN: llvm-readobj -dyn-symbols %t.so | FileCheck %s + +# This does not match gold's behavior because gold does not create undefined +# symbols in dynsym without an appropriate (e.g. PLT) relocation in the input. + +# CHECK: DynamicSymbols [ +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: @ (0) +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Local (0x0) +# CHECK-NEXT: Type: None (0x0) +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Undefined (0x0) +# CHECK-NEXT: } +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: bar@ (1) +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Weak (0x2) +# CHECK-NEXT: Type: None (0x0) +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Undefined (0x0) +# CHECK-NEXT: } +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: foo@ (5) +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Global (0x1) +# CHECK-NEXT: Type: None (0x0) +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Undefined (0x0) +# CHECK-NEXT: } +# CHECK-NEXT: ] + +.global foo +.weak bar diff --git a/test/ELF/undef-with-plt-addr-i686.s b/test/ELF/undef-with-plt-addr-i686.s new file mode 100644 index 000000000000..755f0daced2e --- /dev/null +++ b/test/ELF/undef-with-plt-addr-i686.s @@ -0,0 +1,23 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %s -o %t.o +// RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %p/Inputs/undef-with-plt-addr.s -o %t2.o +// RUN: ld.lld %t2.o -o %t2.so -shared +// RUN: ld.lld %t.o %t2.so -o %t3 +// RUN: llvm-readobj -t -s %t3 | FileCheck %s + +.globl _start +_start: +mov $set_data, %eax + +// Test that set_data has an address in the .plt + +// CHECK: Name: .plt +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_EXECINSTR +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x11010 + +// CHECK: Name: set_data +// CHECK-NEXT: Value: 0x11020 diff --git a/test/ELF/undef-with-plt-addr.s b/test/ELF/undef-with-plt-addr.s new file mode 100644 index 000000000000..792d85f3da61 --- /dev/null +++ b/test/ELF/undef-with-plt-addr.s @@ -0,0 +1,45 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/undef-with-plt-addr.s -o %t2.o +// RUN: ld.lld %t2.o -o %t2.so -shared +// RUN: ld.lld %t.o %t2.so -o %t3 +// RUN: llvm-readobj -t -s -r %t3 | FileCheck %s + +.globl _start +_start: +movabsq $set_data, %rax + +.data +.quad foo +// Test that set_data has an address in the .plt, but foo is not + +// CHECK: Name: .plt +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_EXECINSTR +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x11010 + +// CHECK: Section ({{.*}}) .rela.dyn { +// CHECK-NEXT: 0x13000 R_X86_64_64 foo 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: Section ({{.*}}) .rela.plt { +// CHECK-NEXT: 0x13020 R_X86_64_JUMP_SLOT set_data 0x0 +// CHECK-NEXT: } + +// CHECK: Name: foo +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: Function +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: Undefined + +// CHECK: Name: set_data +// CHECK-NEXT: Value: 0x11020 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Global +// CHECK-NEXT: Type: Function +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: Undefined diff --git a/test/ELF/undef.s b/test/ELF/undef.s index 374c9c884d5f..c8211c73866f 100644 --- a/test/ELF/undef.s +++ b/test/ELF/undef.s @@ -1,8 +1,15 @@ -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t -# RUN: not ld.lld %t -o %t2 2>&1 | FileCheck %s -# CHECK: undefined symbol: foo in {{.*}} # REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/undef.s -o %t2.o +# RUN: llvm-ar rc %t2.a %t2.o +# RUN: not ld.lld %t.o %t2.a -o %t.exe 2>&1 | FileCheck %s +# RUN: not ld.lld -pie %t.o %t2.a -o %t.exe 2>&1 | FileCheck %s +# CHECK: undefined symbol: bar in {{.*}} +# CHECK: undefined symbol: foo in {{.*}} +# CHECK: undefined symbol: zed2 in {{.*}}2.a({{.*}}.o) - .globl _start; + .globl _start _start: call foo + call bar + call zed1 diff --git a/test/ELF/undefined-opt.s b/test/ELF/undefined-opt.s index 97ab5a63490a..ddd34f49b748 100644 --- a/test/ELF/undefined-opt.s +++ b/test/ELF/undefined-opt.s @@ -51,5 +51,16 @@ # UNK-UNDEFINED-SO-NOT: Name: unknown # UNK-UNDEFINED-SO: ] -.globl _start; +# Added undefined symbols should appear in the dynamic table if necessary. +# RUN: ld.lld -shared -o %t5 %t.o -u export +# RUN: llvm-readobj --dyn-symbols %t5 | \ +# RUN: FileCheck --check-prefix=EXPORT-SO %s +# EXPORT-SO: DynamicSymbols [ +# EXPORT-SO: Name: export +# EXPORT-SO: ] + +.globl _start _start: + +.globl export +export: diff --git a/test/ELF/unresolved-symbols.s b/test/ELF/unresolved-symbols.s new file mode 100644 index 000000000000..2fa59cb0ffd7 --- /dev/null +++ b/test/ELF/unresolved-symbols.s @@ -0,0 +1,63 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/unresolved-symbols.s -o %t2.o +# RUN: ld.lld -shared %t2.o -o %t.so + +## Check that %t2.o contains undefined symbol undef. +# RUN: not ld.lld %t1.o %t2.o -o %t 2>&1 | \ +# RUN: FileCheck -check-prefix=UNDCHECK %s +# UNDCHECK: undefined symbol: undef in {{.*}}2.o + +## Error out if unknown option value was set. +# RUN: not ld.lld %t1.o %t2.o -o %t --unresolved-symbols=xxx 2>&1 | \ +# RUN: FileCheck -check-prefix=ERR1 %s +# ERR1: unknown --unresolved-symbols value: xxx + +## Ignore all should not produce error for symbols from object except +## case when --no-undefined specified. +# RUN: ld.lld %t2.o -o %t1_1 --unresolved-symbols=ignore-all +# RUN: llvm-readobj %t1_1 > /dev/null 2>&1 +# RUN: not ld.lld %t2.o -o %t1_2 --unresolved-symbols=ignore-all --no-undefined 2>&1 | \ +# RUN: FileCheck -check-prefix=ERRUND %s +# ERRUND: undefined symbol: undef +## Also ignore all should not produce error for symbols from DSOs. +# RUN: ld.lld %t1.o %t.so -o %t1_3 --unresolved-symbols=ignore-all +# RUN: llvm-readobj %t1_3 > /dev/null 2>&1 + +## Ignoring undefines in objects should not produce error for symbol from object. +# RUN: ld.lld %t1.o %t2.o -o %t2 --unresolved-symbols=ignore-in-object-files +# RUN: llvm-readobj %t2 > /dev/null 2>&1 +## And still should not should produce for undefines from DSOs. +# RUN: ld.lld %t1.o %t.so -o %t2_1 --unresolved-symbols=ignore-in-object-files +# RUN: llvm-readobj %t2 > /dev/null 2>&1 + +## Ignoring undefines in shared should produce error for symbol from object. +# RUN: not ld.lld %t2.o -o %t3 --unresolved-symbols=ignore-in-shared-libs 2>&1 | \ +# RUN: FileCheck -check-prefix=ERRUND %s +## And should not produce errors for symbols from DSO. +# RUN: ld.lld %t1.o %t.so -o %t3_1 --unresolved-symbols=ignore-in-shared-libs +# RUN: llvm-readobj %t3_1 > /dev/null 2>&1 + +## Ignoring undefines in shared libs should not produce error for symbol from object +## if we are linking DSO. +# RUN: ld.lld -shared %t1.o -o %t4 --unresolved-symbols=ignore-in-shared-libs +# RUN: llvm-readobj %t4 > /dev/null 2>&1 + +## Do not report undefines if linking relocatable. +# RUN: ld.lld -r %t1.o %t2.o -o %t5 --unresolved-symbols=report-all +# RUN: llvm-readobj %t5 > /dev/null 2>&1 + +## report-all is the default one. Check that we do not report +## undefines from DSO and do report undefines from object. With +## report-all specified and without. +# RUN: ld.lld -shared %t1.o %t.so -o %t6 --unresolved-symbols=report-all +# RUN: llvm-readobj %t6 > /dev/null 2>&1 +# RUN: ld.lld -shared %t1.o %t.so -o %t6_1 +# RUN: llvm-readobj %t6_1 > /dev/null 2>&1 +# RUN: not ld.lld %t2.o -o %t7 --unresolved-symbols=report-all 2>&1 | \ +# RUN: FileCheck -check-prefix=ERRUND %s +# RUN: not ld.lld %t2.o -o %t7_1 2>&1 | \ +# RUN: FileCheck -check-prefix=ERRUND %s + +.globl _start +_start: diff --git a/test/ELF/user_def_init_array_start.s b/test/ELF/user_def_init_array_start.s new file mode 100644 index 000000000000..6c33166d1d4e --- /dev/null +++ b/test/ELF/user_def_init_array_start.s @@ -0,0 +1,10 @@ +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: ld.lld %t.o -o %t2.so -shared +// Allow user defined __init_array_start. This is used by musl because of the +// the bfd linker not handling these properly. We always create them as +// hidden, musl should not have problems with lld. + + .hidden __init_array_start + .globl __init_array_start +__init_array_start: + .zero 8 diff --git a/test/ELF/valid-cie-length-dw64.s b/test/ELF/valid-cie-length-dw64.s deleted file mode 100644 index 65d6952448a2..000000000000 --- a/test/ELF/valid-cie-length-dw64.s +++ /dev/null @@ -1,13 +0,0 @@ -// REQUIRES: x86 - -// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t -// RUN: not ld.lld %t -o %t2 2>&1 | FileCheck %s - - .section .eh_frame - .long 0xFFFFFFFF - .quad 1 - nop - -// CHECK-NOT: Truncated CIE/FDE length -// CHECK-NOT: CIE/FIE size is too large -// CHECK-NOT: CIE/FIE ends past the end of the section diff --git a/test/ELF/verdef-defaultver.s b/test/ELF/verdef-defaultver.s new file mode 100644 index 000000000000..4d847344f996 --- /dev/null +++ b/test/ELF/verdef-defaultver.s @@ -0,0 +1,205 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/verdef-defaultver.s -o %t1 +# RUN: echo "LIBSAMPLE_1.0{ \ +# RUN: global: a; \ +# RUN: local: *; }; \ +# RUN: LIBSAMPLE_2.0{ \ +# RUN: global: b; c; \ +# RUN: }LIBSAMPLE_1.0;" > %t.script +# RUN: ld.lld -shared -soname shared %t1 --version-script %t.script -o %t.so +# RUN: llvm-readobj -V -dyn-symbols %t.so | FileCheck --check-prefix=DSO %s + +# DSO: DynamicSymbols [ +# DSO-NEXT: Symbol { +# DSO-NEXT: Name: @ +# DSO-NEXT: Value: 0x0 +# DSO-NEXT: Size: 0 +# DSO-NEXT: Binding: Local +# DSO-NEXT: Type: None +# DSO-NEXT: Other: 0 +# DSO-NEXT: Section: Undefined +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Name: a@@LIBSAMPLE_1.0 +# DSO-NEXT: Value: 0x1000 +# DSO-NEXT: Size: 0 +# DSO-NEXT: Binding: Global +# DSO-NEXT: Type: Function +# DSO-NEXT: Other: 0 +# DSO-NEXT: Section: .text +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Name: b@@LIBSAMPLE_2.0 +# DSO-NEXT: Value: 0x1002 +# DSO-NEXT: Size: 0 +# DSO-NEXT: Binding: Global +# DSO-NEXT: Type: Function +# DSO-NEXT: Other: 0 +# DSO-NEXT: Section: .text +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Name: b@LIBSAMPLE_1.0 +# DSO-NEXT: Value: 0x1001 +# DSO-NEXT: Size: 0 +# DSO-NEXT: Binding: Global +# DSO-NEXT: Type: Function +# DSO-NEXT: Other: 0 +# DSO-NEXT: Section: .text +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Name: c@@LIBSAMPLE_2.0 +# DSO-NEXT: Value: 0x1003 +# DSO-NEXT: Size: 0 +# DSO-NEXT: Binding: Global +# DSO-NEXT: Type: Function +# DSO-NEXT: Other: 0 +# DSO-NEXT: Section: .text +# DSO-NEXT: } +# DSO-NEXT: ] +# DSO-NEXT: Version symbols { +# DSO-NEXT: Section Name: .gnu.version +# DSO-NEXT: Address: 0x240 +# DSO-NEXT: Offset: 0x240 +# DSO-NEXT: Link: 1 +# DSO-NEXT: Symbols [ +# DSO-NEXT: Symbol { +# DSO-NEXT: Version: 0 +# DSO-NEXT: Name: @ +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Version: 2 +# DSO-NEXT: Name: a@@LIBSAMPLE_1.0 +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Version: 3 +# DSO-NEXT: Name: b@@LIBSAMPLE_2.0 +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Version: 2 +# DSO-NEXT: Name: b@LIBSAMPLE_1.0 +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Version: 3 +# DSO-NEXT: Name: c@@LIBSAMPLE_2.0 +# DSO-NEXT: } +# DSO-NEXT: ] +# DSO-NEXT: } +# DSO-NEXT: SHT_GNU_verdef { +# DSO-NEXT: Definition { +# DSO-NEXT: Version: 1 +# DSO-NEXT: Flags: Base +# DSO-NEXT: Index: 1 +# DSO-NEXT: Hash: 127830196 +# DSO-NEXT: Name: shared +# DSO-NEXT: } +# DSO-NEXT: Definition { +# DSO-NEXT: Version: 1 +# DSO-NEXT: Flags: 0x0 +# DSO-NEXT: Index: 2 +# DSO-NEXT: Hash: 98457184 +# DSO-NEXT: Name: LIBSAMPLE_1.0 +# DSO-NEXT: } +# DSO-NEXT: Definition { +# DSO-NEXT: Version: 1 +# DSO-NEXT: Flags: 0x0 +# DSO-NEXT: Index: 3 +# DSO-NEXT: Hash: 98456416 +# DSO-NEXT: Name: LIBSAMPLE_2.0 +# DSO-NEXT: } +# DSO-NEXT: } + +## Check that we can link against DSO produced. +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t2 +# RUN: ld.lld %t2 %t.so -o %t3 +# RUN: llvm-readobj -V -dyn-symbols %t3 | FileCheck --check-prefix=EXE %s + +# EXE: DynamicSymbols [ +# EXE-NEXT: Symbol { +# EXE-NEXT: Name: @ +# EXE-NEXT: Value: 0x0 +# EXE-NEXT: Size: 0 +# EXE-NEXT: Binding: Local +# EXE-NEXT: Type: None +# EXE-NEXT: Other: 0 +# EXE-NEXT: Section: Undefined +# EXE-NEXT: } +# EXE-NEXT: Symbol { +# EXE-NEXT: Name: a@LIBSAMPLE_1.0 +# EXE-NEXT: Value: 0x11020 +# EXE-NEXT: Size: 0 +# EXE-NEXT: Binding: Global +# EXE-NEXT: Type: Function +# EXE-NEXT: Other: 0 +# EXE-NEXT: Section: Undefined +# EXE-NEXT: } +# EXE-NEXT: Symbol { +# EXE-NEXT: Name: b@LIBSAMPLE_2.0 +# EXE-NEXT: Value: 0x11030 +# EXE-NEXT: Size: 0 +# EXE-NEXT: Binding: Global +# EXE-NEXT: Type: Function +# EXE-NEXT: Other: 0 +# EXE-NEXT: Section: Undefined +# EXE-NEXT: } +# EXE-NEXT: Symbol { +# EXE-NEXT: Name: c@LIBSAMPLE_2.0 +# EXE-NEXT: Value: 0x11040 +# EXE-NEXT: Size: 0 +# EXE-NEXT: Binding: Global +# EXE-NEXT: Type: Function +# EXE-NEXT: Other: 0 +# EXE-NEXT: Section: Undefined +# EXE-NEXT: } +# EXE-NEXT: ] +# EXE-NEXT: Version symbols { +# EXE-NEXT: Section Name: .gnu.version +# EXE-NEXT: Address: 0x10228 +# EXE-NEXT: Offset: 0x228 +# EXE-NEXT: Link: 1 +# EXE-NEXT: Symbols [ +# EXE-NEXT: Symbol { +# EXE-NEXT: Version: 0 +# EXE-NEXT: Name: @ +# EXE-NEXT: } +# EXE-NEXT: Symbol { +# EXE-NEXT: Version: 2 +# EXE-NEXT: Name: a@LIBSAMPLE_1.0 +# EXE-NEXT: } +# EXE-NEXT: Symbol { +# EXE-NEXT: Version: 3 +# EXE-NEXT: Name: b@LIBSAMPLE_2.0 +# EXE-NEXT: } +# EXE-NEXT: Symbol { +# EXE-NEXT: Version: 3 +# EXE-NEXT: Name: c@LIBSAMPLE_2.0 +# EXE-NEXT: } +# EXE-NEXT: ] +# EXE-NEXT: } +# EXE-NEXT: SHT_GNU_verdef { +# EXE-NEXT: } +# EXE-NEXT: SHT_GNU_verneed { +# EXE-NEXT: Dependency { +# EXE-NEXT: Version: 1 +# EXE-NEXT: Count: 2 +# EXE-NEXT: FileName: shared +# EXE-NEXT: Entry { +# EXE-NEXT: Hash: 98457184 +# EXE-NEXT: Flags: 0x0 +# EXE-NEXT: Index: 2 +# EXE-NEXT: Name: LIBSAMPLE_1.0 +# EXE-NEXT: } +# EXE-NEXT: Entry { +# EXE-NEXT: Hash: 98456416 +# EXE-NEXT: Flags: 0x0 +# EXE-NEXT: Index: 3 +# EXE-NEXT: Name: LIBSAMPLE_2.0 +# EXE-NEXT: } +# EXE-NEXT: } +# EXE-NEXT: } + +.globl _start +_start: + callq a + callq b + callq c diff --git a/test/ELF/verdef-dependency.s b/test/ELF/verdef-dependency.s new file mode 100644 index 000000000000..92627ddc5c0f --- /dev/null +++ b/test/ELF/verdef-dependency.s @@ -0,0 +1,44 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: echo "LIBSAMPLE_1.0{ \ +# RUN: global: a; \ +# RUN: local: *; }; \ +# RUN: LIBSAMPLE_2.0{ \ +# RUN: global: b; \ +# RUN: local: *; }LIBSAMPLE_1.0; \ +# RUN: LIBSAMPLE_3.0{ \ +# RUN: global: c; \ +# RUN: }LIBSAMPLE_2.0;" > %t.script +# RUN: ld.lld --version-script %t.script -shared -soname shared %t.o -o %t.so +# RUN: llvm-readobj -V -dyn-symbols %t.so | FileCheck --check-prefix=DSO %s + +# DSO: SHT_GNU_verdef { +# DSO-NEXT: Definition { +# DSO-NEXT: Version: 1 +# DSO-NEXT: Flags: Base +# DSO-NEXT: Index: 1 +# DSO-NEXT: Hash: 127830196 +# DSO-NEXT: Name: shared +# DSO-NEXT: } +# DSO-NEXT: Definition { +# DSO-NEXT: Version: 1 +# DSO-NEXT: Flags: 0x0 +# DSO-NEXT: Index: 2 +# DSO-NEXT: Hash: 98457184 +# DSO-NEXT: Name: LIBSAMPLE_1.0 +# DSO-NEXT: } +# DSO-NEXT: Definition { +# DSO-NEXT: Version: 1 +# DSO-NEXT: Flags: 0x0 +# DSO-NEXT: Index: 3 +# DSO-NEXT: Hash: 98456416 +# DSO-NEXT: Name: LIBSAMPLE_2.0 +# DSO-NEXT: } +# DSO-NEXT: Definition { +# DSO-NEXT: Version: 1 +# DSO-NEXT: Flags: 0x0 +# DSO-NEXT: Index: 4 +# DSO-NEXT: Hash: 98456672 +# DSO-NEXT: Name: LIBSAMPLE_3.0 +# DSO-NEXT: } +# DSO-NEXT: } diff --git a/test/ELF/verdef.s b/test/ELF/verdef.s new file mode 100644 index 000000000000..9463de0c0a0c --- /dev/null +++ b/test/ELF/verdef.s @@ -0,0 +1,117 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: echo "LIBSAMPLE_1.0{ \ +# RUN: global: a; \ +# RUN: local: *; }; \ +# RUN: LIBSAMPLE_2.0{ \ +# RUN: global: b; \ +# RUN: local: *; }; \ +# RUN: LIBSAMPLE_3.0{ \ +# RUN: global: c; \ +# RUN: local: *; };" > %t.script +# RUN: ld.lld --version-script %t.script -shared -soname shared %t.o -o %t.so +# RUN: llvm-readobj -V -dyn-symbols %t.so | FileCheck --check-prefix=DSO %s + +# DSO: Version symbols { +# DSO-NEXT: Section Name: .gnu.version +# DSO-NEXT: Address: 0x228 +# DSO-NEXT: Offset: 0x228 +# DSO-NEXT: Link: 1 +# DSO-NEXT: Symbols [ +# DSO-NEXT: Symbol { +# DSO-NEXT: Version: 0 +# DSO-NEXT: Name: @ +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Version: 2 +# DSO-NEXT: Name: a@@LIBSAMPLE_1.0 +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Version: 3 +# DSO-NEXT: Name: b@@LIBSAMPLE_2.0 +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Version: 4 +# DSO-NEXT: Name: c@@LIBSAMPLE_3.0 +# DSO-NEXT: } +# DSO-NEXT: ] +# DSO-NEXT: } +# DSO-NEXT: SHT_GNU_verdef { +# DSO-NEXT: Definition { +# DSO-NEXT: Version: 1 +# DSO-NEXT: Flags: Base +# DSO-NEXT: Index: 1 +# DSO-NEXT: Hash: 127830196 +# DSO-NEXT: Name: shared +# DSO-NEXT: } +# DSO-NEXT: Definition { +# DSO-NEXT: Version: 1 +# DSO-NEXT: Flags: 0x0 +# DSO-NEXT: Index: 2 +# DSO-NEXT: Hash: 98457184 +# DSO-NEXT: Name: LIBSAMPLE_1.0 +# DSO-NEXT: } +# DSO-NEXT: Definition { +# DSO-NEXT: Version: 1 +# DSO-NEXT: Flags: 0x0 +# DSO-NEXT: Index: 3 +# DSO-NEXT: Hash: 98456416 +# DSO-NEXT: Name: LIBSAMPLE_2.0 +# DSO-NEXT: } +# DSO-NEXT: Definition { +# DSO-NEXT: Version: 1 +# DSO-NEXT: Flags: 0x0 +# DSO-NEXT: Index: 4 +# DSO-NEXT: Hash: 98456672 +# DSO-NEXT: Name: LIBSAMPLE_3.0 +# DSO-NEXT: } +# DSO-NEXT: } +# DSO-NEXT: SHT_GNU_verneed { +# DSO-NEXT: } + +## Check that we can link agains DSO we produced. +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/verdef.s -o %tmain.o +# RUN: ld.lld %tmain.o %t.so -o %tout +# RUN: llvm-readobj -V %tout | FileCheck --check-prefix=MAIN %s + +# MAIN: Version symbols { +# MAIN-NEXT: Section Name: .gnu.version +# MAIN-NEXT: Address: 0x10228 +# MAIN-NEXT: Offset: 0x228 +# MAIN-NEXT: Link: 1 +# MAIN-NEXT: Symbols [ +# MAIN-NEXT: Symbol { +# MAIN-NEXT: Version: 0 +# MAIN-NEXT: Name: @ +# MAIN-NEXT: } +# MAIN-NEXT: Symbol { +# MAIN-NEXT: Version: 2 +# MAIN-NEXT: Name: a@LIBSAMPLE_1.0 +# MAIN-NEXT: } +# MAIN-NEXT: Symbol { +# MAIN-NEXT: Version: 3 +# MAIN-NEXT: Name: b@LIBSAMPLE_2.0 +# MAIN-NEXT: } +# MAIN-NEXT: Symbol { +# MAIN-NEXT: Version: 4 +# MAIN-NEXT: Name: c@LIBSAMPLE_3.0 +# MAIN-NEXT: } +# MAIN-NEXT: ] +# MAIN-NEXT: } +# MAIN-NEXT: SHT_GNU_verdef { +# MAIN-NEXT: } + +.globl a +.type a,@function +a: +retq + +.globl b +.type b,@function +b: +retq + +.globl c +.type c,@function +c: +retq diff --git a/test/ELF/verneed-as-needed-weak.s b/test/ELF/verneed-as-needed-weak.s new file mode 100644 index 000000000000..a8efdc42d6d4 --- /dev/null +++ b/test/ELF/verneed-as-needed-weak.s @@ -0,0 +1,14 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: ld.lld %t.o --as-needed %S/Inputs/verneed1.so -o %t +# RUN: llvm-readobj -V %t | FileCheck %s + +# CHECK: SHT_GNU_verneed { +# CHECK-NEXT: } + +.weak f1 + +.globl _start +_start: +.data +.quad f1 diff --git a/test/ELF/verneed-local.s b/test/ELF/verneed-local.s new file mode 100644 index 000000000000..a50f670ed7bd --- /dev/null +++ b/test/ELF/verneed-local.s @@ -0,0 +1,8 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: not ld.lld %t.o %S/Inputs/verneed1.so -o %t 2>&1 | FileCheck %s + +# CHECK: undefined symbol: f3 in +.globl _start +_start: +call f3 diff --git a/test/ELF/verneed.s b/test/ELF/verneed.s new file mode 100644 index 000000000000..e9d7c53ba334 --- /dev/null +++ b/test/ELF/verneed.s @@ -0,0 +1,173 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: ld.lld %t.o %S/Inputs/verneed1.so %S/Inputs/verneed2.so -o %t +# RUN: llvm-readobj -V -sections -section-data -dyn-symbols -dynamic-table %t | FileCheck %s + +# CHECK: Section { +# CHECK: Index: 1 +# CHECK-NEXT: Name: .dynsym (1) +# CHECK-NEXT: Type: SHT_DYNSYM (0xB) +# CHECK-NEXT: Flags [ (0x2) +# CHECK-NEXT: SHF_ALLOC (0x2) +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x101C8 +# CHECK-NEXT: Offset: 0x1C8 +# CHECK-NEXT: Size: 96 +# CHECK-NEXT: Link: 5 +# CHECK-NEXT: Info: 1 +# CHECK-NEXT: AddressAlignment: 8 +# CHECK-NEXT: EntrySize: 24 +# CHECK: Section { +# CHECK-NEXT: Index: 2 +# CHECK-NEXT: Name: .gnu.version (9) +# CHECK-NEXT: Type: SHT_GNU_versym (0x6FFFFFFF) +# CHECK-NEXT: Flags [ (0x2) +# CHECK-NEXT: SHF_ALLOC (0x2) +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x10228 +# CHECK-NEXT: Offset: 0x228 +# CHECK-NEXT: Size: 8 +# CHECK-NEXT: Link: 1 +# CHECK-NEXT: Info: 0 +# CHECK-NEXT: AddressAlignment: 2 +# CHECK-NEXT: EntrySize: 2 +# CHECK: Section { +# CHECK-NEXT: Index: 3 +# CHECK-NEXT: Name: .gnu.version_r (22) +# CHECK-NEXT: Type: SHT_GNU_verneed (0x6FFFFFFE) +# CHECK-NEXT: Flags [ (0x2) +# CHECK-NEXT: SHF_ALLOC (0x2) +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x10230 +# CHECK-NEXT: Offset: 0x230 +# CHECK-NEXT: Size: 80 +# CHECK-NEXT: Link: 5 +# CHECK-NEXT: Info: 2 +# CHECK-NEXT: AddressAlignment: 4 +# CHECK-NEXT: EntrySize: 0 +# CHECK: Section { +# CHECK: Index: 5 +# CHECK-NEXT: Name: .dynstr +# CHECK-NEXT: Type: SHT_STRTAB +# CHECK-NEXT: Flags [ (0x2) +# CHECK-NEXT: SHF_ALLOC (0x2) +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x102A8 +# CHECK-NEXT: Offset: 0x2A8 +# CHECK-NEXT: Size: 47 +# CHECK-NEXT: Link: 0 +# CHECK-NEXT: Info: 0 +# CHECK-NEXT: AddressAlignment: 1 +# CHECK-NEXT: EntrySize: 0 +# CHECK-NEXT: SectionData ( +# CHECK-NEXT: 0000: 00663100 7665726E 65656431 2E736F2E |.f1.verneed1.so.| +# CHECK-NEXT: 0010: 30007633 00663200 76320067 31007665 |0.v3.f2.v2.g1.ve| +# CHECK-NEXT: 0020: 726E6565 64322E73 6F2E3000 763100 |rneed2.so.0.v1.| +# CHECK-NEXT: ) +# CHECK-NEXT: } + +# CHECK: DynamicSymbols [ +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: @ (0) +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Local (0x0) +# CHECK-NEXT: Type: None (0x0) +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Undefined (0x0) +# CHECK-NEXT: } +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: f1@v3 (1) +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Global (0x1) +# CHECK-NEXT: Type: None (0x0) +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Undefined (0x0) +# CHECK-NEXT: } +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: f2@v2 (21) +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Global (0x1) +# CHECK-NEXT: Type: None (0x0) +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Undefined (0x0) +# CHECK-NEXT: } +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: g1@v1 (27) +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Global (0x1) +# CHECK-NEXT: Type: None (0x0) +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Undefined (0x0) +# CHECK-NEXT: } +# CHECK-NEXT: ] + +# CHECK: 0x000000006FFFFFF0 VERSYM 0x10228 +# CHECK-NEXT: 0x000000006FFFFFFE VERNEED 0x10230 +# CHECK-NEXT: 0x000000006FFFFFFF VERNEEDNUM 2 + +# CHECK: Version symbols { +# CHECK-NEXT: Section Name: .gnu.version +# CHECK-NEXT: Address: 0x10228 +# CHECK-NEXT: Offset: 0x228 +# CHECK-NEXT: Link: 1 +# CHECK-NEXT: Symbols [ +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Version: 0 +# CHECK-NEXT: Name: @ +# CHECK-NEXT: } +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Version: 2 +# CHECK-NEXT: Name: f1@v3 +# CHECK-NEXT: } +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Version: 3 +# CHECK-NEXT: Name: f2@v2 +# CHECK-NEXT: } +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Version: 4 +# CHECK-NEXT: Name: g1@v1 +# CHECK-NEXT: } +# CHECK-NEXT: ] +# CHECK-NEXT: } +# CHECK-NEXT: SHT_GNU_verdef { +# CHECK-NEXT: } +# CHECK-NEXT: SHT_GNU_verneed { +# CHECK-NEXT: Dependency { +# CHECK-NEXT: Version: 1 +# CHECK-NEXT: Count: 2 +# CHECK-NEXT: FileName: verneed1.so.0 +# CHECK-NEXT: Entry { +# CHECK-NEXT: Hash: 1938 +# CHECK-NEXT: Flags: 0x0 +# CHECK-NEXT: Index: 3 +# CHECK-NEXT: Name: v2 +# CHECK-NEXT: } +# CHECK-NEXT: Entry { +# CHECK-NEXT: Hash: 1939 +# CHECK-NEXT: Flags: 0x0 +# CHECK-NEXT: Index: 2 +# CHECK-NEXT: Name: v3 +# CHECK-NEXT: } +# CHECK-NEXT: } +# CHECK-NEXT: Dependency { +# CHECK-NEXT: Version: 1 +# CHECK-NEXT: Count: 1 +# CHECK-NEXT: FileName: verneed2.so.0 +# CHECK-NEXT: Entry { +# CHECK-NEXT: Hash: 1937 +# CHECK-NEXT: Flags: 0x0 +# CHECK-NEXT: Index: 4 +# CHECK-NEXT: Name: v1 +# CHECK-NEXT: } +# CHECK-NEXT: } +# CHECK-NEXT: } + +.globl _start +_start: +call f1@plt +call f2@plt +call g1@plt diff --git a/test/ELF/version-script-err.s b/test/ELF/version-script-err.s new file mode 100644 index 000000000000..15b69e98505b --- /dev/null +++ b/test/ELF/version-script-err.s @@ -0,0 +1,10 @@ +// REQUIRES: x86 + +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: not ld.lld -shared %t.o -o %t.so --version-script %p/Inputs/version-script-err.script 2>&1 | FileCheck %s +// CHECK: ; expected, but got } + +// RUN: echo "\"" > %terr1.script +// RUN: not ld.lld --version-script %terr1.script -shared %t.o -o %t.so 2>&1 | \ +// RUN: FileCheck -check-prefix=ERR1 %s +// ERR1: unclosed quote diff --git a/test/ELF/version-script-extern.s b/test/ELF/version-script-extern.s new file mode 100644 index 000000000000..439653487bc0 --- /dev/null +++ b/test/ELF/version-script-extern.s @@ -0,0 +1,97 @@ +# REQUIRES: shell + +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: echo "LIBSAMPLE_1.0 { \ +# RUN: global: \ +# RUN: extern "C++" { \ +# RUN: \"foo(int)\"; \ +# RUN: \"zed(int)\"; \ +# RUN: }; \ +# RUN: }; \ +# RUN: LIBSAMPLE_2.0 { \ +# RUN: global: \ +# RUN: extern "C++" { \ +# RUN: \"bar(int)\"; \ +# RUN: }; \ +# RUN: }; " > %t.script +# RUN: ld.lld --version-script %t.script -shared %t.o -o %t.so +# RUN: llvm-readobj -V -dyn-symbols %t.so | FileCheck --check-prefix=DSO %s + +# DSO: DynamicSymbols [ +# DSO-NEXT: Symbol { +# DSO-NEXT: Name: @ +# DSO-NEXT: Value: 0x0 +# DSO-NEXT: Size: 0 +# DSO-NEXT: Binding: Local +# DSO-NEXT: Type: None +# DSO-NEXT: Other: 0 +# DSO-NEXT: Section: Undefined +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Name: _Z3bari@@LIBSAMPLE_2.0 +# DSO-NEXT: Value: 0x1001 +# DSO-NEXT: Size: 0 +# DSO-NEXT: Binding: Global +# DSO-NEXT: Type: Function +# DSO-NEXT: Other: 0 +# DSO-NEXT: Section: .text +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Name: _Z3fooi@@LIBSAMPLE_1.0 +# DSO-NEXT: Value: 0x1000 +# DSO-NEXT: Size: 0 +# DSO-NEXT: Binding: Global +# DSO-NEXT: Type: Function +# DSO-NEXT: Other: 0 +# DSO-NEXT: Section: .text +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Name: _Z3zedi@@LIBSAMPLE_1.0 +# DSO-NEXT: Value: 0x1002 +# DSO-NEXT: Size: 0 +# DSO-NEXT: Binding: Global (0x1) +# DSO-NEXT: Type: Function (0x2) +# DSO-NEXT: Other: 0 +# DSO-NEXT: Section: .text (0x6) +# DSO-NEXT: } +# DSO-NEXT: ] +# DSO-NEXT: Version symbols { +# DSO-NEXT: Section Name: .gnu.version +# DSO-NEXT: Address: 0x228 +# DSO-NEXT: Offset: 0x228 +# DSO-NEXT: Link: 1 +# DSO-NEXT: Symbols [ +# DSO-NEXT: Symbol { +# DSO-NEXT: Version: 0 +# DSO-NEXT: Name: @ +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Version: 3 +# DSO-NEXT: Name: _Z3bari@@LIBSAMPLE_2.0 +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Version: 2 +# DSO-NEXT: Name: _Z3fooi@@LIBSAMPLE_1.0 +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Version: 2 +# DSO-NEXT: Name: _Z3zedi@@LIBSAMPLE_1.0 +# DSO-NEXT: } +# DSO-NEXT: ] +# DSO-NEXT: } + +.text +.globl _Z3fooi +.type _Z3fooi,@function +_Z3fooi: +retq + +.globl _Z3bari +.type _Z3bari,@function +_Z3bari: +retq + +.globl _Z3zedi +.type _Z3zedi,@function +_Z3zedi: +retq diff --git a/test/ELF/version-script-noundef.s b/test/ELF/version-script-noundef.s new file mode 100644 index 000000000000..4a251d6172da --- /dev/null +++ b/test/ELF/version-script-noundef.s @@ -0,0 +1,22 @@ +# REQUIRES: x86 + +# RUN: echo "VERSION_1.0{ \ +# RUN: global: bar; \ +# RUN: };" > %t.script +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: not ld.lld --version-script %t.script -shared --no-undefined-version \ +# RUN: %t.o -o %t.so 2>&1 | FileCheck -check-prefix=ERR1 %s +# ERR1: version script assignment of VERSION_1.0 to symbol bar failed: symbol not defined + +# RUN: echo "VERSION_1.0{ \ +# RUN: global: und; \ +# RUN: };" > %t2.script +# RUN: not ld.lld --version-script %t2.script -shared --no-undefined-version \ +# RUN: %t.o -o %t.so 2>&1 | FileCheck -check-prefix=ERR2 %s +# ERR2: version script assignment of VERSION_1.0 to symbol und failed: symbol not defined + +.text +.globl foo +.type foo,@function +foo: +callq und@PLT diff --git a/test/ELF/version-script.s b/test/ELF/version-script.s new file mode 100644 index 000000000000..ba9c95a96fc3 --- /dev/null +++ b/test/ELF/version-script.s @@ -0,0 +1,274 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o +# RUN: ld.lld -shared %t2.o -soname shared -o %t2.so + +# RUN: echo "{ global: foo1; foo3; local: *; };" > %t.script +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: ld.lld --version-script %t.script -shared %t.o %t2.so -o %t.so +# RUN: llvm-readobj -dyn-symbols %t.so | FileCheck --check-prefix=DSO %s + +# RUN: echo "# comment" > %t3.script +# RUN: echo "{ local: *; # comment" >> %t3.script +# RUN: echo -n "}; # comment" >> %t3.script +# RUN: ld.lld --version-script %t3.script -shared %t.o %t2.so -o %t3.so +# RUN: llvm-readobj -dyn-symbols %t3.so | FileCheck --check-prefix=DSO2 %s + +# --version-script filters --dynamic-list. +# RUN: echo "{ foo1; foo2; };" > %t.list +# RUN: ld.lld --version-script %t.script --dynamic-list %t.list %t.o %t2.so -o %t +# RUN: llvm-readobj -dyn-symbols %t | FileCheck --check-prefix=EXE %s + +# RUN: echo "VERSION_1.0{ \ +# RUN: global: foo1; \ +# RUN: local: *; }; \ +# RUN: VERSION_2.0{ \ +# RUN: global: foo3; \ +# RUN: local: *; }; " > %t4.script +# RUN: ld.lld --version-script %t4.script -shared %t.o %t2.so -o %t4.so +# RUN: llvm-readobj -dyn-symbols %t4.so | FileCheck --check-prefix=VERDSO %s + +# RUN: echo "VERSION_1.0{ \ +# RUN: global: foo1; \ +# RUN: local: *; }; \ +# RUN: { \ +# RUN: global: foo3; \ +# RUN: local: *; }; " > %t5.script +# RUN: not ld.lld --version-script %t5.script -shared %t.o %t2.so -o %t5.so 2>&1 | \ +# RUN: FileCheck -check-prefix=ERR %s +# ERR: anonymous version definition is used in combination with other version definitions + +# RUN: echo "{ \ +# RUN: global: foo1; \ +# RUN: local: *; }; \ +# RUN: VERSION_2.0 { \ +# RUN: global: foo3; \ +# RUN: local: *; }; " > %t5.script +# RUN: not ld.lld --version-script %t5.script -shared %t.o %t2.so -o %t5.so 2>&1 | \ +# RUN: FileCheck -check-prefix=ERR %s + +# RUN: echo "VERSION_1.0{ \ +# RUN: global: foo1; \ +# RUN: local: *; }; \ +# RUN: VERSION_2.0 { \ +# RUN: global: foo1; \ +# RUN: local: *; }; " > %t6.script +# RUN: ld.lld --version-script %t6.script -shared %t.o %t2.so -o %t6.so 2>&1 | \ +# RUN: FileCheck -check-prefix=WARN2 %s +# WARN2: duplicate symbol foo1 in version script + +# RUN: ld.lld --version-script %t.script --dynamic-list %t.list %t.o %t2.so -o %t2 +# RUN: llvm-readobj %t2 > /dev/null + +# DSO: DynamicSymbols [ +# DSO-NEXT: Symbol { +# DSO-NEXT: Name: @ (0) +# DSO-NEXT: Value: 0x0 +# DSO-NEXT: Size: 0 +# DSO-NEXT: Binding: Local (0x0) +# DSO-NEXT: Type: None (0x0) +# DSO-NEXT: Other: 0 +# DSO-NEXT: Section: Undefined (0x0) +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Name: bar@ (1) +# DSO-NEXT: Value: 0x0 +# DSO-NEXT: Size: 0 +# DSO-NEXT: Binding: Global (0x1) +# DSO-NEXT: Type: Function (0x2) +# DSO-NEXT: Other: 0 +# DSO-NEXT: Section: Undefined (0x0) +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Name: foo1@ (5) +# DSO-NEXT: Value: 0x1000 +# DSO-NEXT: Size: 0 +# DSO-NEXT: Binding: Global (0x1) +# DSO-NEXT: Type: None (0x0) +# DSO-NEXT: Other: 0 +# DSO-NEXT: Section: .text +# DSO-NEXT: } +# DSO-NEXT: Symbol { +# DSO-NEXT: Name: foo3@ (10) +# DSO-NEXT: Value: 0x1007 +# DSO-NEXT: Size: 0 +# DSO-NEXT: Binding: Global (0x1) +# DSO-NEXT: Type: None (0x0) +# DSO-NEXT: Other: 0 +# DSO-NEXT: Section: .text +# DSO-NEXT: } +# DSO-NEXT: ] + +# DSO2: DynamicSymbols [ +# DSO2-NEXT: Symbol { +# DSO2-NEXT: Name: @ (0) +# DSO2-NEXT: Value: 0x0 +# DSO2-NEXT: Size: 0 +# DSO2-NEXT: Binding: Local (0x0) +# DSO2-NEXT: Type: None (0x0) +# DSO2-NEXT: Other: 0 +# DSO2-NEXT: Section: Undefined (0x0) +# DSO2-NEXT: } +# DSO2-NEXT: Symbol { +# DSO2-NEXT: Name: bar@ (1) +# DSO2-NEXT: Value: 0x0 +# DSO2-NEXT: Size: 0 +# DSO2-NEXT: Binding: Global (0x1) +# DSO2-NEXT: Type: Function (0x2) +# DSO2-NEXT: Other: 0 +# DSO2-NEXT: Section: Undefined (0x0) +# DSO2-NEXT: } +# DSO2-NEXT: ] + +# EXE: DynamicSymbols [ +# EXE-NEXT: Symbol { +# EXE-NEXT: Name: @ (0) +# EXE-NEXT: Value: 0x0 +# EXE-NEXT: Size: 0 +# EXE-NEXT: Binding: Local (0x0) +# EXE-NEXT: Type: None (0x0) +# EXE-NEXT: Other: 0 +# EXE-NEXT: Section: Undefined (0x0) +# EXE-NEXT: } +# EXE-NEXT: Symbol { +# EXE-NEXT: Name: bar@ (1) +# EXE-NEXT: Value: 0x0 +# EXE-NEXT: Size: 0 +# EXE-NEXT: Binding: Global (0x1) +# EXE-NEXT: Type: Function (0x2) +# EXE-NEXT: Other: 0 +# EXE-NEXT: Section: Undefined (0x0) +# EXE-NEXT: } +# EXE-NEXT: Symbol { +# EXE-NEXT: Name: foo1@ (5) +# EXE-NEXT: Value: 0x11000 +# EXE-NEXT: Size: 0 +# EXE-NEXT: Binding: Global (0x1) +# EXE-NEXT: Type: None (0x0) +# EXE-NEXT: Other: 0 +# EXE-NEXT: Section: .text +# EXE-NEXT: } +# EXE-NEXT: ] + +# VERDSO: DynamicSymbols [ +# VERDSO-NEXT: Symbol { +# VERDSO-NEXT: Name: @ +# VERDSO-NEXT: Value: 0x0 +# VERDSO-NEXT: Size: 0 +# VERDSO-NEXT: Binding: Local +# VERDSO-NEXT: Type: None +# VERDSO-NEXT: Other: 0 +# VERDSO-NEXT: Section: Undefined +# VERDSO-NEXT: } +# VERDSO-NEXT: Symbol { +# VERDSO-NEXT: Name: bar@ +# VERDSO-NEXT: Value: 0x0 +# VERDSO-NEXT: Size: 0 +# VERDSO-NEXT: Binding: Global +# VERDSO-NEXT: Type: Function +# VERDSO-NEXT: Other: 0 +# VERDSO-NEXT: Section: Undefined +# VERDSO-NEXT: } +# VERDSO-NEXT: Symbol { +# VERDSO-NEXT: Name: foo1@@VERSION_1.0 +# VERDSO-NEXT: Value: 0x1000 +# VERDSO-NEXT: Size: 0 +# VERDSO-NEXT: Binding: Global +# VERDSO-NEXT: Type: None +# VERDSO-NEXT: Other: 0 +# VERDSO-NEXT: Section: .text +# VERDSO-NEXT: } +# VERDSO-NEXT: Symbol { +# VERDSO-NEXT: Name: foo3@@VERSION_2.0 +# VERDSO-NEXT: Value: 0x1007 +# VERDSO-NEXT: Size: 0 +# VERDSO-NEXT: Binding: Global +# VERDSO-NEXT: Type: None +# VERDSO-NEXT: Other: 0 +# VERDSO-NEXT: Section: .text +# VERDSO-NEXT: } +# VERDSO-NEXT: ] + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: ld.lld -shared %t.o %t2.so -o %t.so +# RUN: llvm-readobj -dyn-symbols %t.so | FileCheck --check-prefix=ALL %s + +# RUN: echo "{ global: foo1; foo3; };" > %t2.script +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: ld.lld --version-script %t2.script -shared %t.o %t2.so -o %t.so +# RUN: llvm-readobj -dyn-symbols %t.so | FileCheck --check-prefix=ALL %s + +# ALL: DynamicSymbols [ +# ALL-NEXT: Symbol { +# ALL-NEXT: Name: @ +# ALL-NEXT: Value: 0x0 +# ALL-NEXT: Size: 0 +# ALL-NEXT: Binding: Local +# ALL-NEXT: Type: None +# ALL-NEXT: Other: 0 +# ALL-NEXT: Section: Undefined +# ALL-NEXT: } +# ALL-NEXT: Symbol { +# ALL-NEXT: Name: _start@ +# ALL-NEXT: Value: +# ALL-NEXT: Size: 0 +# ALL-NEXT: Binding: Global +# ALL-NEXT: Type: None +# ALL-NEXT: Other: 0 +# ALL-NEXT: Section: .text +# ALL-NEXT: } +# ALL-NEXT: Symbol { +# ALL-NEXT: Name: bar@ +# ALL-NEXT: Value: +# ALL-NEXT: Size: 0 +# ALL-NEXT: Binding: Global +# ALL-NEXT: Type: Function +# ALL-NEXT: Other: 0 +# ALL-NEXT: Section: Undefined +# ALL-NEXT: } +# ALL-NEXT: Symbol { +# ALL-NEXT: Name: foo1@ +# ALL-NEXT: Value: +# ALL-NEXT: Size: 0 +# ALL-NEXT: Binding: Global +# ALL-NEXT: Type: None +# ALL-NEXT: Other: 0 +# ALL-NEXT: Section: .text +# ALL-NEXT: } +# ALL-NEXT: Symbol { +# ALL-NEXT: Name: foo2@ +# ALL-NEXT: Value: +# ALL-NEXT: Size: 0 +# ALL-NEXT: Binding: Global +# ALL-NEXT: Type: None +# ALL-NEXT: Other: 0 +# ALL-NEXT: Section: .text +# ALL-NEXT: } +# ALL-NEXT: Symbol { +# ALL-NEXT: Name: foo3@ +# ALL-NEXT: Value: +# ALL-NEXT: Size: 0 +# ALL-NEXT: Binding: Global +# ALL-NEXT: Type: None +# ALL-NEXT: Other: 0 +# ALL-NEXT: Section: .text +# ALL-NEXT: } +# ALL-NEXT: ] + +.globl foo1 +foo1: + call bar@PLT + ret + +.globl foo2 +foo2: + ret + +.globl foo3 +foo3: + call foo2@PLT + ret + +.globl _start +_start: + ret diff --git a/test/ELF/version-undef-sym.s b/test/ELF/version-undef-sym.s new file mode 100644 index 000000000000..20e92e61f647 --- /dev/null +++ b/test/ELF/version-undef-sym.s @@ -0,0 +1,42 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: llvm-readobj --dyn-symbols %p/Inputs/version-undef-sym.so | FileCheck %s + + +// Inputs/version-undef-sym.so consists of the assembly file +// +// .global bar +// bar: +// .weak abc1 +// .weak abc2 +// .weak abc3 +// .weak abc4 +// .weak abc5 +// +// linked into a shared library with the version script +// +// VER_1 { +// global: +// bar; +// }; +// +// Assuming we can reproduce the desired property (a few undefined symbols +// before bar) we should create it with lld itself once it supports that. + + +// Show that the input .so has undefined symbols before bar. That is what would +// get our version parsing out of sync. + +// CHECK: Section: Undefined +// CHECK: Section: Undefined +// CHECK: Section: Undefined +// CHECK: Section: Undefined +// CHECK: Section: Undefined +// CHECK: Name: bar + +// But now we can successfully find bar. +// RUN: ld.lld %t.o %p/Inputs/version-undef-sym.so -o %t.exe + + .global _start +_start: + call bar@plt diff --git a/test/ELF/version-use.s b/test/ELF/version-use.s new file mode 100644 index 000000000000..7ef12bc04536 --- /dev/null +++ b/test/ELF/version-use.s @@ -0,0 +1,9 @@ +// REQUIRES: x86 +// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux +// RUN: ld.lld %t.o %p/Inputs/version-use.so -o %t.so -shared -z defs +// RUN: llvm-readobj -s %t.so | FileCheck %s + + + call bar@PLT + +// CHECK-NOT: SHT_GNU_versym diff --git a/test/ELF/version-wildcard.test b/test/ELF/version-wildcard.test new file mode 100644 index 000000000000..80cb9cadf159 --- /dev/null +++ b/test/ELF/version-wildcard.test @@ -0,0 +1,114 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: echo "VERSION_1.0{ \ +# RUN: global: foo*; \ +# RUN: local: *; };" > %t.script +# RUN: ld.lld --version-script %t.script -shared %t.o -o %t.so +# RUN: llvm-readobj -dyn-symbols %t.so | FileCheck %s + +# CHECK: DynamicSymbols [ +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: @ +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Local +# CHECK-NEXT: Type: None +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Undefined +# CHECK-NEXT: } +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: foo1@@VERSION_1.0 +# CHECK-NEXT: Value: 0x1000 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Global +# CHECK-NEXT: Type: None +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: .text +# CHECK-NEXT: } +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: foo2@@VERSION_1.0 +# CHECK-NEXT: Value: 0x1001 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Global +# CHECK-NEXT: Type: None +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: .text +# CHECK-NEXT: } +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: foo3@@VERSION_1.0 +# CHECK-NEXT: Value: 0x1007 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Global +# CHECK-NEXT: Type: None +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: .text +# CHECK-NEXT: } +# CHECK-NEXT: ] + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: echo "VERSION_1.0{ \ +# RUN: global: foo2; \ +# RUN: local: *; }; \ +# RUN: VERSION_2.0{ \ +# RUN: global: foo*; \ +# RUN: }; " > %t2.script +# RUN: ld.lld --version-script %t2.script -shared %t.o -o %t2.so +# RUN: llvm-readobj -dyn-symbols %t2.so | FileCheck --check-prefix=MIX %s + +# MIX: DynamicSymbols [ +# MIX-NEXT: Symbol { +# MIX-NEXT: Name: @ +# MIX-NEXT: Value: 0x0 +# MIX-NEXT: Size: 0 +# MIX-NEXT: Binding: Local +# MIX-NEXT: Type: None +# MIX-NEXT: Other: 0 +# MIX-NEXT: Section: Undefined +# MIX-NEXT: } +# MIX-NEXT: Symbol { +# MIX-NEXT: Name: foo1@@VERSION_2.0 +# MIX-NEXT: Value: 0x1000 +# MIX-NEXT: Size: 0 +# MIX-NEXT: Binding: Global +# MIX-NEXT: Type: None +# MIX-NEXT: Other: 0 +# MIX-NEXT: Section: .text +# MIX-NEXT: } +# MIX-NEXT: Symbol { +# MIX-NEXT: Name: foo2@@VERSION_1.0 +# MIX-NEXT: Value: 0x1001 +# MIX-NEXT: Size: 0 +# MIX-NEXT: Binding: Global +# MIX-NEXT: Type: None +# MIX-NEXT: Other: 0 +# MIX-NEXT: Section: .text +# MIX-NEXT: } +# MIX-NEXT: Symbol { +# MIX-NEXT: Name: foo3@@VERSION_2.0 +# MIX-NEXT: Value: 0x1007 +# MIX-NEXT: Size: 0 +# MIX-NEXT: Binding: Global +# MIX-NEXT: Type: None +# MIX-NEXT: Other: 0 +# MIX-NEXT: Section: .text +# MIX-NEXT: } +# MIX-NEXT: ] + +.globl foo1 +foo1: + ret + +.globl foo2 +foo2: + call foo1@PLT + ret + +.globl foo3 +foo3: + call foo2@PLT + ret + +.globl _start +_start: + ret diff --git a/test/ELF/visibility.s b/test/ELF/visibility.s index d76ed0793eb1..2043894d3d3d 100644 --- a/test/ELF/visibility.s +++ b/test/ELF/visibility.s @@ -20,7 +20,9 @@ // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 2 +// CHECK-NEXT: Other [ (0x2) +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] // CHECK-NEXT: Section: .text // CHECK-NEXT: } // CHECK-NEXT: Symbol { @@ -29,7 +31,9 @@ // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 1 +// CHECK-NEXT: Other [ (0x1) +// CHECK-NEXT: STV_INTERNAL +// CHECK-NEXT: ] // CHECK-NEXT: Section: .text // CHECK-NEXT: } // CHECK-NEXT: Symbol { @@ -38,10 +42,23 @@ // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 2 +// CHECK-NEXT: Other [ (0x2) +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] // CHECK-NEXT: Section: .text // CHECK-NEXT: } // CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: _DYNAMIC +// CHECK-NEXT: Value: +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other [ (0x2) +// CHECK-NEXT: STV_HIDDEN +// CHECK-NEXT: ] +// CHECK-NEXT: Section: .dynamic +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { // CHECK-NEXT: Name: default // CHECK-NEXT: Value: // CHECK-NEXT: Size: 0 @@ -56,7 +73,9 @@ // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Global // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 3 +// CHECK-NEXT: Other [ (0x3) +// CHECK-NEXT: STV_PROTECTED +// CHECK-NEXT: ] // CHECK-NEXT: Section: .text // CHECK-NEXT: } // CHECK-NEXT: ] @@ -86,7 +105,9 @@ // CHECK-NEXT: Size: 0 // CHECK-NEXT: Binding: Global // CHECK-NEXT: Type: None -// CHECK-NEXT: Other: 3 +// CHECK-NEXT: Other [ (0x3) +// CHECK-NEXT: STV_PROTECTED +// CHECK-NEXT: ] // CHECK-NEXT: Section: .text // CHECK-NEXT: } // CHECK-NEXT: ] diff --git a/test/ELF/warn-common.s b/test/ELF/warn-common.s new file mode 100644 index 000000000000..783a9ab77b56 --- /dev/null +++ b/test/ELF/warn-common.s @@ -0,0 +1,25 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/warn-common.s -o %t2.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/warn-common2.s -o %t3.o + +## Report multiple commons if warn-common is specified +# RUN: ld.lld --warn-common %t1.o %t2.o -o %t.out 2>&1 | FileCheck %s --check-prefix=WARN +# WARN: multiple common of arr + +## no-warn-common is ignored +# RUN: ld.lld --no-warn-common %t1.o %t2.o -o %t.out +# RUN: llvm-readobj %t.out > /dev/null + +## Report if common is overridden +# RUN: ld.lld --warn-common %t1.o %t3.o -o %t.out 2>&1 | FileCheck %s --check-prefix=OVER +# OVER: common arr is overridden + +## Report if common is overridden, but in different order +# RUN: ld.lld --warn-common %t3.o %t1.o -o %t.out 2>&1 | FileCheck %s --check-prefix=OVER + +.globl _start +_start: + +.type arr,@object +.comm arr,4,4 diff --git a/test/ELF/weak-undef-hidden.s b/test/ELF/weak-undef-hidden.s new file mode 100644 index 000000000000..70b951bf0596 --- /dev/null +++ b/test/ELF/weak-undef-hidden.s @@ -0,0 +1,29 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: ld.lld %t.o -o %t.so -shared +// RUN: llvm-readobj -r -s -section-data %t.so | FileCheck %s + +.data +.weak g +.hidden g +.quad g + +// CHECK: Name: .data +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: 8 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 1 +// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 00000000 00000000 +// CHECK-NEXT: ) + +// CHECK: Relocations [ +// CHECK-NEXT: ] diff --git a/test/ELF/weak-undef-shared.s b/test/ELF/weak-undef-shared.s new file mode 100644 index 000000000000..862a08632e26 --- /dev/null +++ b/test/ELF/weak-undef-shared.s @@ -0,0 +1,19 @@ +// REQUIRES: x86 +// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux +// RUN: llvm-mc %p/Inputs/shared.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux +// RUN: ld.lld %t2.o -o %t2.so -shared +// RUN: ld.lld %t.o %t2.so -o %t.exe +// RUN: llvm-readobj -t %t.exe | FileCheck %s + +// CHECK: Name: bar +// CHECK-NEXT: Value: 0x11020 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Weak +// CHECK-NEXT: Type: Function +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: Undefined + +.global _start +_start: + .weak bar + .quad bar diff --git a/test/ELF/weak-undef.s b/test/ELF/weak-undef.s new file mode 100644 index 000000000000..02555535927e --- /dev/null +++ b/test/ELF/weak-undef.s @@ -0,0 +1,21 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: ld.lld %t.o -o %t -pie +# RUN: llvm-readobj -dyn-symbols %t | FileCheck %s + +# CHECK: DynamicSymbols [ +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: @ (0) +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Local (0x0) +# CHECK-NEXT: Type: None (0x0) +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Undefined (0x0) +# CHECK-NEXT: } +# CHECK-NEXT: ] + +.weak foo + +.globl _start +_start: diff --git a/test/ELF/whole-archive.s b/test/ELF/whole-archive.s index 0a6b30fd171e..c65f116965f7 100644 --- a/test/ELF/whole-archive.s +++ b/test/ELF/whole-archive.s @@ -30,5 +30,11 @@ // RUN: ld.lld -o %t3 %t.o --whole-archive %t.a --no-whole-archive // RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=ADDED %s -.globl _start; +// --whole-archive should also work with thin archives +// RUN: rm -f %tthin.a +// RUN: llvm-ar --format=gnu rcsT %tthin.a %ta.o +// RUN: ld.lld -o %t3 %t.o --whole-archive %tthin.a +// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=ADDED %s + +.globl _start _start: diff --git a/test/ELF/wildcards.s b/test/ELF/wildcards.s new file mode 100644 index 000000000000..2fe0f881bf46 --- /dev/null +++ b/test/ELF/wildcards.s @@ -0,0 +1,80 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t + +## Default case: abc and abx included in text. +# RUN: echo "SECTIONS { \ +# RUN: .text : { *(.abc .abx) } }" > %t.script +# RUN: ld.lld -o %t.out --script %t.script %t +# RUN: llvm-objdump -section-headers %t.out | \ +# RUN: FileCheck -check-prefix=SEC-DEFAULT %s +# SEC-DEFAULT: Sections: +# SEC-DEFAULT-NEXT: Idx Name Size Address Type +# SEC-DEFAULT-NEXT: 0 00000000 0000000000000000 +# SEC-DEFAULT-NEXT: 1 .text 00000008 0000000000000120 TEXT DATA +# SEC-DEFAULT-NEXT: 2 .abcd 00000004 0000000000000128 TEXT DATA +# SEC-DEFAULT-NEXT: 3 .ad 00000004 000000000000012c TEXT DATA +# SEC-DEFAULT-NEXT: 4 .ag 00000004 0000000000000130 TEXT DATA +# SEC-DEFAULT-NEXT: 5 .symtab 00000030 0000000000000000 +# SEC-DEFAULT-NEXT: 6 .shstrtab 0000002f 0000000000000000 +# SEC-DEFAULT-NEXT: 7 .strtab 00000008 0000000000000000 + +## Now replace the symbol with '?' and check that results are the same. +# RUN: echo "SECTIONS { \ +# RUN: .text : { *(.abc .ab?) } }" > %t.script +# RUN: ld.lld -o %t.out --script %t.script %t +# RUN: llvm-objdump -section-headers %t.out | \ +# RUN: FileCheck -check-prefix=SEC-DEFAULT %s + +## Now see how replacing '?' with '*' will consume whole abcd. +# RUN: echo "SECTIONS { \ +# RUN: .text : { *(.abc .ab*) } }" > %t.script +# RUN: ld.lld -o %t.out --script %t.script %t +# RUN: llvm-objdump -section-headers %t.out | \ +# RUN: FileCheck -check-prefix=SEC-ALL %s +# SEC-ALL: Sections: +# SEC-ALL-NEXT: Idx Name Size Address Type +# SEC-ALL-NEXT: 0 00000000 0000000000000000 +# SEC-ALL-NEXT: 1 .text 0000000c 0000000000000120 TEXT DATA +# SEC-ALL-NEXT: 2 .ad 00000004 000000000000012c TEXT DATA +# SEC-ALL-NEXT: 3 .ag 00000004 0000000000000130 TEXT DATA +# SEC-ALL-NEXT: 4 .symtab 00000030 0000000000000000 +# SEC-ALL-NEXT: 5 .shstrtab 00000029 0000000000000000 +# SEC-ALL-NEXT: 6 .strtab 00000008 0000000000000000 + +## All sections started with .a are merged. +# RUN: echo "SECTIONS { \ +# RUN: .text : { *(.a*) } }" > %t.script +# RUN: ld.lld -o %t.out --script %t.script %t +# RUN: llvm-objdump -section-headers %t.out | \ +# RUN: FileCheck -check-prefix=SEC-NO %s +# SEC-NO: Sections: +# SEC-NO-NEXT: Idx Name Size Address Type +# SEC-NO-NEXT: 0 00000000 0000000000000000 +# SEC-NO-NEXT: 1 .text 00000014 0000000000000120 TEXT DATA +# SEC-NO-NEXT: 2 .symtab 00000030 0000000000000000 +# SEC-NO-NEXT: 3 .shstrtab 00000021 0000000000000000 +# SEC-NO-NEXT: 4 .strtab 00000008 0000000000000000 + +.text +.section .abc,"ax",@progbits +.long 0 + +.text +.section .abx,"ax",@progbits +.long 0 + +.text +.section .abcd,"ax",@progbits +.long 0 + +.text +.section .ad,"ax",@progbits +.long 0 + +.text +.section .ag,"ax",@progbits +.long 0 + + +.globl _start +_start: diff --git a/test/ELF/writable-merge.s b/test/ELF/writable-merge.s index dd7b8538e57a..431cb6282d91 100644 --- a/test/ELF/writable-merge.s +++ b/test/ELF/writable-merge.s @@ -1,6 +1,6 @@ // REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux // RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s -// CHECK: Writable SHF_MERGE sections are not supported +// CHECK: writable SHF_MERGE section is not supported - .section .foo,"awM",@progbits,4 +.section .foo,"awM",@progbits,4 diff --git a/test/ELF/x86-64-dyn-rel-error.s b/test/ELF/x86-64-dyn-rel-error.s new file mode 100644 index 000000000000..c814fbeb1d9a --- /dev/null +++ b/test/ELF/x86-64-dyn-rel-error.s @@ -0,0 +1,12 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/shared.s -o %t2.o +// RUN: ld.lld %t2.o -shared -o %t2.so +// RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck %s + + .global _start +_start: + .data + .long bar + +// CHECK: R_X86_64_32 cannot be used against shared object; recompile with -fPIC. diff --git a/test/ELF/x86-64-dyn-rel-error2.s b/test/ELF/x86-64-dyn-rel-error2.s new file mode 100644 index 000000000000..c1d3da3ae2ae --- /dev/null +++ b/test/ELF/x86-64-dyn-rel-error2.s @@ -0,0 +1,12 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/shared.s -o %t2.o +// RUN: ld.lld %t2.o -shared -o %t2.so +// RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck %s + + .global _start +_start: + .data + .long bar - . + +// CHECK: R_X86_64_PC32 cannot be used against shared object; recompile with -fPIC. diff --git a/test/ELF/x86-64-rela.s b/test/ELF/x86-64-rela.s new file mode 100644 index 000000000000..41bdd76de4ca --- /dev/null +++ b/test/ELF/x86-64-rela.s @@ -0,0 +1,11 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: ld.lld %t.o -o %t.so -shared +// RUN: llvm-readobj -dynamic-table %t.so | FileCheck %s +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux-gnux32 %s -o %t.o +// RUN: ld.lld %t.o -o %t.so -shared +// RUN: llvm-readobj -dynamic-table %t.so | FileCheck %s + + call foo@plt + +// CHECK: 0x{{0+}}14 PLTREL{{ +}}RELA diff --git a/test/ELF/x86-64-relax-offset.s b/test/ELF/x86-64-relax-offset.s new file mode 100644 index 000000000000..a7c7ce6f6271 --- /dev/null +++ b/test/ELF/x86-64-relax-offset.s @@ -0,0 +1,13 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -relax-relocations -triple=x86_64-pc-linux %s \ +// RUN: -o %t.o +// RUN: llvm-mc -filetype=obj -relax-relocations -triple=x86_64-pc-linux \ +// RUN: %p/Inputs/x86-64-relax-offset.s -o %t2.o +// RUN: ld.lld %t2.o %t.o -o %t.so -shared +// RUN: llvm-objdump -d %t.so | FileCheck %s + + mov foo@gotpcrel(%rip), %rax + nop + +// CHECK: 1004: {{.*}} leaq -11(%rip), %rax +// CHECK-NEXT: 100b: {{.*}} nop diff --git a/test/ELF/x86-64-reloc-32-error.s b/test/ELF/x86-64-reloc-32-error.s deleted file mode 100644 index b5d476bcf082..000000000000 --- a/test/ELF/x86-64-reloc-32-error.s +++ /dev/null @@ -1,8 +0,0 @@ -// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/abs.s -o %tabs -// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t -// RUN: not ld.lld -shared %tabs %t -o %t2 2>&1 | FileCheck %s -// REQUIRES: x86 - - movl $big, %edx - -#CHECK: R_X86_64_32 out of range diff --git a/test/ELF/x86-64-reloc-32-fpic.s b/test/ELF/x86-64-reloc-32-fpic.s new file mode 100644 index 000000000000..0a0f1a09fda8 --- /dev/null +++ b/test/ELF/x86-64-reloc-32-fpic.s @@ -0,0 +1,7 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s +# CHECK: relocation R_X86_64_32 cannot be used against shared object; recompile with -fPIC. + +.data +.long _shared diff --git a/test/ELF/x86-64-reloc-32S-error.s b/test/ELF/x86-64-reloc-32S-error.s deleted file mode 100644 index aa19c2c32e93..000000000000 --- a/test/ELF/x86-64-reloc-32S-error.s +++ /dev/null @@ -1,7 +0,0 @@ -// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t -// RUN: not ld.lld -shared %t -o %t2 2>&1 | FileCheck %s -// REQUIRES: x86 - - movq _start - 0x1000000000000, %rdx - -#CHECK: R_X86_64_32S out of range diff --git a/test/ELF/x86-64-reloc-error.s b/test/ELF/x86-64-reloc-error.s new file mode 100644 index 000000000000..9b7e17de793b --- /dev/null +++ b/test/ELF/x86-64-reloc-error.s @@ -0,0 +1,10 @@ +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/x86-64-reloc-error.s -o %tabs +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t +// RUN: not ld.lld -shared %tabs %t -o %t2 2>&1 | FileCheck %s +// REQUIRES: x86 + + movl $big, %edx + movq $foo - 0x1000000000000, %rdx + +# CHECK: R_X86_64_32 out of range +# CHECK: R_X86_64_32S out of range diff --git a/test/ELF/x86-64-reloc-pc32-fpic.s b/test/ELF/x86-64-reloc-pc32-fpic.s new file mode 100644 index 000000000000..ed9121583c18 --- /dev/null +++ b/test/ELF/x86-64-reloc-pc32-fpic.s @@ -0,0 +1,7 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s +# CHECK: relocation R_X86_64_PC32 cannot be used against shared object; recompile with -fPIC. + +.data +call _shared diff --git a/test/ELF/x86-64-reloc-range.s b/test/ELF/x86-64-reloc-range.s new file mode 100644 index 000000000000..8319eaafa0ce --- /dev/null +++ b/test/ELF/x86-64-reloc-range.s @@ -0,0 +1,13 @@ +// RUN: llvm-mc %s -o %t.o -triple x86_64-pc-linux -filetype=obj +// RUN: not ld.lld %t.o -o %t.so -shared 2>&1 | FileCheck %s + +// CHECK: relocation R_X86_64_PC32 out of range +// CHECK-NOT: relocation + + lea foo(%rip), %rax + lea foo(%rip), %rax + + .hidden foo + .bss + .zero 0x7fffe007 +foo: diff --git a/test/ELF/x86-64-tls-gd-got.s b/test/ELF/x86-64-tls-gd-got.s new file mode 100644 index 000000000000..f86c3aa14f08 --- /dev/null +++ b/test/ELF/x86-64-tls-gd-got.s @@ -0,0 +1,19 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/x86-64-tls-gd-got.s -o %t2.o +# RUN: ld.lld %t1.o %t2.o -o %t +# RUN: llvm-objdump -d %t | FileCheck %s + + .globl _start +_start: + .byte 0x66 + leaq bar@tlsgd(%rip), %rdi + .byte 0x66 + rex64 + call *__tls_get_addr@GOTPCREL(%rip) + ret + +// CHECK: _start: +// CHECK-NEXT: movq %fs:0, %rax +// CHECK-NEXT: leaq -4(%rax), %rax +// CHECK-NEXT: retq diff --git a/test/ELF/x86-64-tls-gd-local.s b/test/ELF/x86-64-tls-gd-local.s new file mode 100644 index 000000000000..843b891be56b --- /dev/null +++ b/test/ELF/x86-64-tls-gd-local.s @@ -0,0 +1,52 @@ +// REQUIRES: x86 +// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux +// RUN: ld.lld %t.o -o %t.so -shared +// RUN: llvm-readobj -r -s -section-data %t.so | FileCheck %s + + .byte 0x66 + leaq foo@tlsgd(%rip), %rdi + .value 0x6666 + rex64 + call __tls_get_addr@PLT + + .byte 0x66 + leaq bar@tlsgd(%rip), %rdi + .value 0x6666 + rex64 + call __tls_get_addr@PLT + + .section .tbss,"awT",@nobits + + .hidden foo + .globl foo +foo: + .zero 4 + + .hidden bar + .globl bar +bar: + .zero 4 + + +// CHECK: Name: .got +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC (0x2) +// CHECK-NEXT: SHF_WRITE (0x1) +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x20D0 +// CHECK-NEXT: Offset: 0x20D0 +// CHECK-NEXT: Size: 32 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 8 +// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 00000000 00000000 00000000 00000000 |................| +// CHECK-NEXT: 0010: 00000000 00000000 04000000 00000000 |................| +// CHECK-NEXT: ) + +// CHECK: Section ({{.*}}) .rela.dyn { +// CHECK-NEXT: 0x20D0 R_X86_64_DTPMOD64 - 0x0 +// CHECK-NEXT: 0x20E0 R_X86_64_DTPMOD64 - 0x0 +// CHECK-NEXT: } diff --git a/test/ELF/x86-64-tls-pie.s b/test/ELF/x86-64-tls-pie.s new file mode 100644 index 000000000000..5ef0f54f435d --- /dev/null +++ b/test/ELF/x86-64-tls-pie.s @@ -0,0 +1,26 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-cloudabi %s -o %t1.o +# RUN: ld.lld -pie %t1.o -o %t +# RUN: llvm-readobj -r %t | FileCheck %s + +# Bug 27174: R_X86_64_TPOFF32 and R_X86_64_GOTTPOFF relocations should +# be eliminated when building a PIE executable, as the static TLS layout +# is fixed. +# +# CHECK: Relocations [ +# CHECK-NEXT: ] + + .globl _start +_start: + movq %fs:0, %rax + movl $3, i@TPOFF(%rax) + + movq %fs:0, %rdx + movq i@GOTTPOFF(%rip), %rcx + movl $3, (%rdx,%rcx) + + .section .tbss.i,"awT",@nobits + .globl i +i: + .long 0 + .size i, 4 diff --git a/test/ELF/zdefs.s b/test/ELF/zdefs.s new file mode 100644 index 000000000000..410da1812db9 --- /dev/null +++ b/test/ELF/zdefs.s @@ -0,0 +1,7 @@ +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: ld.lld -shared %t.o -o %t1.so + +# RUN: not ld.lld -z defs -shared %t.o -o %t1.so 2>&1 | FileCheck -check-prefix=ERR %s +# ERR: undefined symbol: foo + +callq foo@PLT diff --git a/test/LinkerScript/expr-precedence.test b/test/LinkerScript/expr-precedence.test deleted file mode 100644 index 5170e34ba4b3..000000000000 --- a/test/LinkerScript/expr-precedence.test +++ /dev/null @@ -1,34 +0,0 @@ -/* - RUN: linker-script-test %s | FileCheck %s -*/ -SECTIONS { - . = foo >= bar + 1 ? bar : 1- - - -1; -} - -/* -CHECK: kw_sections: SECTIONS -CHECK: l_brace: { -CHECK: identifier: . -CHECK: equal: = -CHECK: identifier: foo -CHECK: greaterequal: >= -CHECK: identifier: bar -CHECK: plus: + -CHECK: number: 1 -CHECK: question: ? -CHECK: identifier: bar -CHECK: colon: : -CHECK: number: 1 -CHECK: minus: - -CHECK: minus: - -CHECK: minus: - -CHECK: minus: - -CHECK: number: 1 -CHECK: semicolon: ; -CHECK: r_brace: } -CHECK: eof: -CHECK: SECTIONS -CHECK: { -CHECK: . = (foo >= (bar + 1)) ? bar : (1 - (-(-(-1)))) -CHECK: } -*/ diff --git a/test/LinkerScript/extern-bad-symbol.test b/test/LinkerScript/extern-bad-symbol.test deleted file mode 100644 index 279a7cc20567..000000000000 --- a/test/LinkerScript/extern-bad-symbol.test +++ /dev/null @@ -1,22 +0,0 @@ -/* - RUN: linker-script-test %s 2> %t | FileCheck %s - RUN: FileCheck -input-file %t -check-prefix=CHECK-ERR %s -*/ - - -EXTERN(a b 3) -/* -CHECK-ERR: [[@LINE-2]]:12: error: expected symbol in EXTERN. -CHECK-ERR-NEXT: {{^EXTERN\(a b 3\)}} -CHECK-ERR-NEXT: {{^ \^}} -*/ - -/* -CHECK: kw_extern: EXTERN -CHECK: l_paren: ( -CHECK: identifier: a -CHECK: identifier: b -CHECK: number: 3 -CHECK: r_paren: ) -CHECK: eof: -*/ diff --git a/test/LinkerScript/extern-empty.test b/test/LinkerScript/extern-empty.test deleted file mode 100644 index a5e1ece084d9..000000000000 --- a/test/LinkerScript/extern-empty.test +++ /dev/null @@ -1,19 +0,0 @@ -/* - RUN: linker-script-test %s 2> %t | FileCheck %s - RUN: FileCheck -input-file %t -check-prefix=CHECK-ERR %s -*/ - - -EXTERN() -/* -CHECK-ERR: [[@LINE-2]]:8: error: expected one or more symbols in EXTERN. -CHECK-ERR-NEXT: {{^EXTERN()}} -CHECK-ERR-NEXT: {{^ \^}} -*/ - -/* -CHECK: kw_extern: EXTERN -CHECK: l_paren: ( -CHECK: r_paren: ) -CHECK: eof: -*/ diff --git a/test/LinkerScript/extern-valid.test b/test/LinkerScript/extern-valid.test deleted file mode 100644 index 764b4668a34f..000000000000 --- a/test/LinkerScript/extern-valid.test +++ /dev/null @@ -1,29 +0,0 @@ -/* - RUN: linker-script-test %s | FileCheck %s -*/ - -EXTERN(a) -EXTERN(a b) -EXTERN(_foo _bar _baz) - -/* -CHECK: kw_extern: EXTERN -CHECK: l_paren: ( -CHECK: identifier: a -CHECK: r_paren: ) -CHECK: kw_extern: EXTERN -CHECK: l_paren: ( -CHECK: identifier: a -CHECK: identifier: b -CHECK: r_paren: ) -CHECK: kw_extern: EXTERN -CHECK: l_paren: ( -CHECK: identifier: _foo -CHECK: identifier: _bar -CHECK: identifier: _baz -CHECK: r_paren: ) -CHECK: eof: -CHECK: EXTERN(a) -CHECK: EXTERN(a b) -CHECK: EXTERN(_foo _bar _baz) -*/ diff --git a/test/LinkerScript/incomplete-ternary.test b/test/LinkerScript/incomplete-ternary.test deleted file mode 100644 index fae30537d2de..000000000000 --- a/test/LinkerScript/incomplete-ternary.test +++ /dev/null @@ -1,25 +0,0 @@ -/* - RUN: linker-script-test %s 2> %t | FileCheck %s - RUN: FileCheck -input-file %t -check-prefix=CHECK-ERR %s -*/ -SECTIONS { - . = foo ? bar; -/* -CHECK-ERR: [[@LINE-2]]:18: error: expected : -CHECK-ERR-NEXT: {{^ \. = foo \? bar;}} -CHECK-ERR-NEXT: {{^ \^}} -*/ -} - -/* -CHECK: kw_sections: SECTIONS -CHECK: l_brace: { -CHECK: identifier: . -CHECK: equal: = -CHECK: identifier: foo -CHECK: question: ? -CHECK: identifier: bar -CHECK: semicolon: ; -CHECK: r_brace: } -CHECK: eof: -*/ diff --git a/test/LinkerScript/libname-err-1.test b/test/LinkerScript/libname-err-1.test deleted file mode 100644 index 451a469336bd..000000000000 --- a/test/LinkerScript/libname-err-1.test +++ /dev/null @@ -1,11 +0,0 @@ -/* RUN: linker-script-test %s 2>&1 | FileCheck %s -*/ - -OUTPUT_ARCH(i386:x86_64) -OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") -GROUP( -l### ) -ENTRY(init) - -/* -CHECK: libname-err-1.test:6:10: error: expected ) -*/ diff --git a/test/LinkerScript/libname-err-2.test b/test/LinkerScript/libname-err-2.test deleted file mode 100644 index f1d96d718151..000000000000 --- a/test/LinkerScript/libname-err-2.test +++ /dev/null @@ -1,11 +0,0 @@ -/* RUN: linker-script-test %s 2>&1 | FileCheck %s -*/ - -OUTPUT_ARCH(i386:x86_64) -OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") -GROUP( -l ) -ENTRY(init) - -/* -CHECK: libname-err-2.test:6:10: error: expected ) -*/ diff --git a/test/LinkerScript/linker-script-outputformat.test b/test/LinkerScript/linker-script-outputformat.test deleted file mode 100644 index b47bb38ad8d8..000000000000 --- a/test/LinkerScript/linker-script-outputformat.test +++ /dev/null @@ -1,12 +0,0 @@ -/* RUN: linker-script-test %s | FileCheck %s -*/ - -OUTPUT_FORMAT(elf64-x86-64) - -/* -CHECK: kw_output_format: OUTPUT_FORMAT -CHECK: l_paren: ( -CHECK: identifier: elf64-x86-64 -CHECK: r_paren: ) -CHECK: OUTPUT_FORMAT("elf64-x86-64") -*/ diff --git a/test/LinkerScript/linker-script.test b/test/LinkerScript/linker-script.test deleted file mode 100644 index 421493666e84..000000000000 --- a/test/LinkerScript/linker-script.test +++ /dev/null @@ -1,46 +0,0 @@ -/* RUN: linker-script-test %s | FileCheck %s -*/ - -OUTPUT_ARCH(i386:x86_64) -OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") -OUTPUT("/out/foo") -GROUP ( /lib/x86_64-linux-gnu/libc.so.6 /usr/lib/x86_64-linux-gnu/libc_nonshared.a AS_NEEDED ( /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ) -lm -l:libgcc.a ) -ENTRY(init) - -/* -CHECK: kw_output_arch: OUTPUT_ARCH -CHECK: l_paren: ( -CHECK: identifier: i386:x86_64 -CHECK: r_paren: ) -CHECK: kw_output_format: OUTPUT_FORMAT -CHECK: l_paren: ( -CHECK: identifier: elf64-x86-64 -CHECK: comma: , -CHECK: identifier: elf64-x86-64 -CHECK: comma: , -CHECK: identifier: elf64-x86-64 -CHECK: r_paren: ) -CHECK: kw_output: OUTPUT -CHECK: l_paren: ( -CHECK: identifier: /out/foo -CHECK: r_paren: ) -CHECK: kw_group: GROUP -CHECK: l_paren: ( -CHECK: identifier: /lib/x86_64-linux-gnu/libc.so.6 -CHECK: identifier: /usr/lib/x86_64-linux-gnu/libc_nonshared.a -CHECK: kw_as_needed: AS_NEEDED -CHECK: l_paren: ( -CHECK: identifier: /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 -CHECK: r_paren: ) -CHECK: libname: m -CHECK: libname: :libgcc.a -CHECK: r_paren: ) -CHECK: kw_entry: ENTRY -CHECK: l_paren: ( -CHECK: identifier: init -CHECK: r_paren: ) -CHECK: eof: -CHECK: OUTPUT_FORMAT("elf64-x86-64","elf64-x86-64","elf64-x86-64") -CHECK: GROUP(/lib/x86_64-linux-gnu/libc.so.6 /usr/lib/x86_64-linux-gnu/libc_nonshared.a AS_NEEDED(/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2) -lm -l:libgcc.a) -CHECK: ENTRY(init) -*/ diff --git a/test/LinkerScript/memory-empty.test b/test/LinkerScript/memory-empty.test deleted file mode 100644 index b71022afdff3..000000000000 --- a/test/LinkerScript/memory-empty.test +++ /dev/null @@ -1,17 +0,0 @@ -/* - RUN: linker-script-test %s | FileCheck %s -*/ - -MEMORY -{ -} - -/* -CHECK: kw_memory: MEMORY -CHECK: l_brace: { -CHECK: r_brace: } -CHECK: eof: -CHECK: MEMORY -CHECK: { -CHECK: } -*/ diff --git a/test/LinkerScript/memory-missing-attrs.test b/test/LinkerScript/memory-missing-attrs.test deleted file mode 100644 index fbbf38b76514..000000000000 --- a/test/LinkerScript/memory-missing-attrs.test +++ /dev/null @@ -1,32 +0,0 @@ -/* - RUN: linker-script-test %s 2> %t | FileCheck %s - RUN: FileCheck -input-file %t -check-prefix=CHECK-ERR %s -*/ - -MEMORY -{ - ram () : ORIGIN = 0x20000000, LENGTH = 128M -/* -CHECK-ERR: [[@LINE-2]]:8: error: Expected memory attribute string. -CHECK-ERR-NEXT: {{^ ram \(\) : ORIGIN = 0x20000000, LENGTH = 128M}} -CHECK-ERR-NEXT: {{^ \^}} -*/ -} - -/* -CHECK: kw_memory: MEMORY -CHECK: l_brace: { -CHECK: identifier: ram -CHECK: l_paren: ( -CHECK: r_paren: ) -CHECK: colon: : -CHECK: kw_origin: ORIGIN -CHECK: equal: = -CHECK: number: 0x20000000 -CHECK: comma: , -CHECK: kw_length: LENGTH -CHECK: equal: = -CHECK: number: 128M -CHECK: r_brace: } -CHECK: eof: -*/ diff --git a/test/LinkerScript/memory-missing-length.test b/test/LinkerScript/memory-missing-length.test deleted file mode 100644 index f317c9a26788..000000000000 --- a/test/LinkerScript/memory-missing-length.test +++ /dev/null @@ -1,29 +0,0 @@ -/* - RUN: linker-script-test %s 2> %t | FileCheck %s - RUN: FileCheck -input-file %t -check-prefix=CHECK-ERR %s -*/ - -MEMORY -{ - ram (rwx) : ORIGIN = 0x20000000, -} -/* -CHECK-ERR: [[@LINE-2]]:1: error: expected LENGTH -CHECK-ERR-NEXT: {{^}}} -CHECK-ERR-NEXT: {{^\^}} -*/ - -/* -CHECK: kw_memory: MEMORY -CHECK: l_brace: { -CHECK: identifier: ram -CHECK: l_paren: ( -CHECK: identifier: rwx -CHECK: r_paren: ) -CHECK: colon: : -CHECK: kw_origin: ORIGIN -CHECK: equal: = -CHECK: number: 0x20000000 -CHECK: r_brace: } -CHECK: eof: -*/ diff --git a/test/LinkerScript/memory-missing-name.test b/test/LinkerScript/memory-missing-name.test deleted file mode 100644 index 46597d4351d3..000000000000 --- a/test/LinkerScript/memory-missing-name.test +++ /dev/null @@ -1,31 +0,0 @@ -/* - RUN: linker-script-test %s 2> %t | FileCheck %s - RUN: FileCheck -input-file %t -check-prefix=CHECK-ERR %s -*/ - -MEMORY -{ - (rwx) : ORIGIN = 0x20000000, LENGTH = 128M -/* -CHECK-ERR: [[@LINE-2]]:3: error: expected memory block definition. -CHECK-ERR-NEXT: {{^ \(rwx\) : ORIGIN = 0x20000000, LENGTH = 128M}} -CHECK-ERR-NEXT: {{^ \^}} -*/ -} - -/* -CHECK: kw_memory: MEMORY -CHECK: l_brace: { -CHECK: l_paren: ( -CHECK: r_paren: ) -CHECK: colon: : -CHECK: kw_origin: ORIGIN -CHECK: equal: = -CHECK: number: 0x20000000 -CHECK: comma: , -CHECK: kw_length: LENGTH -CHECK: equal: = -CHECK: number: 128M -CHECK: r_brace: } -CHECK: eof: -*/ diff --git a/test/LinkerScript/memory-missing-origin.test b/test/LinkerScript/memory-missing-origin.test deleted file mode 100644 index 50a64d17d6c5..000000000000 --- a/test/LinkerScript/memory-missing-origin.test +++ /dev/null @@ -1,30 +0,0 @@ -/* - RUN: linker-script-test %s 2> %t | FileCheck %s - RUN: FileCheck -input-file %t -check-prefix=CHECK-ERR %s -*/ - -MEMORY -{ - ram (rwx) : LENGTH = 128M -/* -CHECK-ERR: [[@LINE-2]]:15: error: expected ORIGIN -CHECK-ERR-NEXT: {{^ ram \(rwx\) : LENGTH = 128M}} -CHECK-ERR-NEXT: {{^ \^}} -*/ - -} - -/* -CHECK: kw_memory: MEMORY -CHECK: l_brace: { -CHECK: identifier: ram -CHECK: l_paren: ( -CHECK: identifier: rwx -CHECK: r_paren: ) -CHECK: colon: : -CHECK: kw_length: LENGTH -CHECK: equal: = -CHECK: number: 128M -CHECK: r_brace: } -CHECK: eof: -*/ diff --git a/test/LinkerScript/memory-valid.test b/test/LinkerScript/memory-valid.test deleted file mode 100644 index 7a0e906c5fb5..000000000000 --- a/test/LinkerScript/memory-valid.test +++ /dev/null @@ -1,56 +0,0 @@ -/* - RUN: linker-script-test %s | FileCheck %s -*/ - -MEMORY -{ - ram (rwx) : ORIGIN = 0x20000000, LENGTH = 96K - rom (rx) : org = 0x0, len = 256K - boot : o = 0x1000000, l = 0x5f00 -} - -/* -CHECK: kw_memory: MEMORY -CHECK: l_brace: { -CHECK: identifier: ram -CHECK: l_paren: ( -CHECK: identifier: rwx -CHECK: r_paren: ) -CHECK: colon: : -CHECK: kw_origin: ORIGIN -CHECK: equal: = -CHECK: number: 0x20000000 -CHECK: comma: , -CHECK: kw_length: LENGTH -CHECK: equal: = -CHECK: number: 96K -CHECK: identifier: rom -CHECK: l_paren: ( -CHECK: identifier: rx -CHECK: r_paren: ) -CHECK: colon: : -CHECK: kw_origin: org -CHECK: equal: = -CHECK: number: 0x0 -CHECK: comma: , -CHECK: kw_length: len -CHECK: equal: = -CHECK: number: 256K -CHECK: identifier: boot -CHECK: colon: : -CHECK: kw_origin: o -CHECK: equal: = -CHECK: number: 0x1000000 -CHECK: comma: , -CHECK: kw_length: l -CHECK: equal: = -CHECK: number: 0x5f00 -CHECK: r_brace: } -CHECK: eof: -CHECK: MEMORY -CHECK: { -CHECK: ram (rwx) : ORIGIN = 536870912, LENGTH = 98304 -CHECK: rom (rx) : ORIGIN = 0, LENGTH = 262144 -CHECK: boot : ORIGIN = 16777216, LENGTH = 24320 -CHECK: } -*/ diff --git a/test/LinkerScript/missing-entry-symbol.test b/test/LinkerScript/missing-entry-symbol.test deleted file mode 100644 index 54e8f75c90a4..000000000000 --- a/test/LinkerScript/missing-entry-symbol.test +++ /dev/null @@ -1,21 +0,0 @@ -/* - RUN: linker-script-test %s 2> %t | FileCheck %s - RUN: FileCheck -input-file %t -check-prefix=CHECK-ERR %s -*/ -SECTIONS { - ENTRY() -/* -CHECK-ERR: [[@LINE-2]]:11: error: expected identifier in ENTRY -CHECK-ERR-NEXT: {{^ ENTRY()}} -CHECK-ERR-NEXT: {{^ \^}} -*/ -} - -/* -CHECK: l_brace: { -CHECK: kw_entry: ENTRY -CHECK: l_paren: ( -CHECK: r_paren: ) -CHECK: r_brace: } -CHECK: eof: -*/ diff --git a/test/LinkerScript/missing-input-file-name.test b/test/LinkerScript/missing-input-file-name.test deleted file mode 100644 index c4218ccef321..000000000000 --- a/test/LinkerScript/missing-input-file-name.test +++ /dev/null @@ -1,25 +0,0 @@ -/* - RUN: linker-script-test %s 2> %t | FileCheck %s - RUN: FileCheck -input-file %t -check-prefix=CHECK-ERR %s -*/ -SECTIONS { - .text : { ()} -/* -CHECK-ERR: [[@LINE-2]]:15: error: expected symbol assignment or input file name. -CHECK-ERR-NEXT: {{^ \.text : { \(\)}}} -CHECK-ERR-NEXT: {{^ \^}} -*/ -} - -/* -CHECK: kw_sections: SECTIONS -CHECK: l_brace: { -CHECK: identifier: .text -CHECK: colon: : -CHECK: l_brace: { -CHECK: l_paren: ( -CHECK: r_paren: ) -CHECK: r_brace: } -CHECK: r_brace: } -CHECK: eof: -*/ diff --git a/test/LinkerScript/missing-input-sections.test b/test/LinkerScript/missing-input-sections.test deleted file mode 100644 index 5db93444b1a9..000000000000 --- a/test/LinkerScript/missing-input-sections.test +++ /dev/null @@ -1,27 +0,0 @@ -/* - RUN: linker-script-test %s 2> %t | FileCheck %s - RUN: FileCheck -input-file %t -check-prefix=CHECK-ERR %s -*/ -SECTIONS { - .text : { *(+)} -/* -CHECK-ERR: [[@LINE-2]]:16: error: expected ) -CHECK-ERR-NEXT: {{^ \.text : { \*\(\+\)}}} -CHECK-ERR-NEXT: {{^ \^}} -*/ -} - -/* -CHECK: kw_sections: SECTIONS -CHECK: l_brace: { -CHECK: identifier: .text -CHECK: colon: : -CHECK: l_brace: { -CHECK: star: * -CHECK: l_paren: ( -CHECK: plus: + -CHECK: r_paren: ) -CHECK: r_brace: } -CHECK: r_brace: } -CHECK: eof: -*/ diff --git a/test/LinkerScript/missing-operand.test b/test/LinkerScript/missing-operand.test deleted file mode 100644 index cfa87bf40768..000000000000 --- a/test/LinkerScript/missing-operand.test +++ /dev/null @@ -1,24 +0,0 @@ -/* - RUN: linker-script-test %s 2> %t | FileCheck %s - RUN: FileCheck -check-prefix=CHECK-ERR -input-file %t %s -*/ -SECTIONS { - . = foo / ; -/* -CHECK-ERR: [[@LINE-2]]:15: error: expected symbol, number, minus, tilde or left parenthesis. -CHECK-ERR-NEXT: {{^ . = foo / ;}} -CHECK-ERR-NEXT: {{^ \^}} -*/ -} - -/* -CHECK: kw_sections: SECTIONS -CHECK: l_brace: { -CHECK: identifier: . -CHECK: equal: = -CHECK: identifier: foo -CHECK: slash: / -CHECK: semicolon: ; -CHECK: r_brace: } -CHECK: eof: - */ diff --git a/test/LinkerScript/missing-output-section-name.test b/test/LinkerScript/missing-output-section-name.test deleted file mode 100644 index 79792982b619..000000000000 --- a/test/LinkerScript/missing-output-section-name.test +++ /dev/null @@ -1,25 +0,0 @@ -/* - RUN: linker-script-test %s 2> %t | FileCheck %s - RUN: FileCheck -input-file %t -check-prefix=CHECK-ERR %s -*/ -SECTIONS { - : { *()} -/* -CHECK-ERR: [[@LINE-2]]:5: error: expected symbol assignment, entry, overlay or output section name -CHECK-ERR-NEXT: {{^ : { \*\(\)}}} -CHECK-ERR-NEXT: {{^ \^}} -*/ -} - -/* -CHECK: kw_sections: SECTIONS -CHECK: l_brace: { -CHECK: colon: : -CHECK: l_brace: { -CHECK: star: * -CHECK: l_paren: ( -CHECK: r_paren: ) -CHECK: r_brace: } -CHECK: r_brace: } -CHECK: eof: -*/ diff --git a/test/LinkerScript/missing-symbol.test b/test/LinkerScript/missing-symbol.test deleted file mode 100644 index 4e8777ef40b9..000000000000 --- a/test/LinkerScript/missing-symbol.test +++ /dev/null @@ -1,24 +0,0 @@ -/* - RUN: linker-script-test %s 2> %t | FileCheck %s - RUN: FileCheck -input-file %t -check-prefix=CHECK-ERR %s -*/ -SECTIONS { - = foo + bar; -/* -CHECK-ERR: [[@LINE-2]]:5: error: expected symbol assignment, entry, overlay or output section name. -CHECK-ERR-NEXT: {{^ = foo \+ bar;}} -CHECK-ERR-NEXT: {{^ \^}} -*/ -} - -/* -CHECK: kw_sections: SECTIONS -CHECK: l_brace: { -CHECK: equal: = -CHECK: identifier: foo -CHECK: plus: + -CHECK: identifier: bar -CHECK: semicolon: ; -CHECK: r_brace: } -CHECK: eof: -*/ diff --git a/test/LinkerScript/phdrs-sections.test b/test/LinkerScript/phdrs-sections.test deleted file mode 100644 index 872b7999cb7e..000000000000 --- a/test/LinkerScript/phdrs-sections.test +++ /dev/null @@ -1,29 +0,0 @@ -/* - Test PHDR parsing and section -> phdr mapping. - RUN: linker-script-test %s | FileCheck %s -*/ - -PHDRS -{ - ph_text PT_LOAD FLAGS (0x1 | 0x4); - ph_data PT_LOAD FLAGS (0x2 | 0x4); -} - -SECTIONS -{ - .init : {} : ph_text -} - -/* -CHECK: PHDRS -CHECK: { -CHECK: ph_text 1 FLAGS (5); -CHECK: ph_data 1 FLAGS (6); -CHECK: } -CHECK: SECTIONS -CHECK: { -CHECK: .init : -CHECK: { -CHECK: } : ph_text -CHECK: } -*/ diff --git a/test/LinkerScript/sections.test b/test/LinkerScript/sections.test deleted file mode 100644 index 67f8288badaa..000000000000 --- a/test/LinkerScript/sections.test +++ /dev/null @@ -1,624 +0,0 @@ -/* - This test exercises parsing typical commands found in GNU ld linker scripts. - RUN: linker-script-test %s | FileCheck %s -*/ - -SEARCH_DIR("/usr/x86_64-linux-gnu/lib64"); SEARCH_DIR("=/usr/local/lib/x86_64-linux-gnu"); -SECTIONS -{ - PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x400000)); . = SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS; - .interp : { *(.interp) } - .note.gnu.build-id : { *(.note.gnu.build-id) } - .hash : { *(.hash) } - .rela.dyn : - { - *(.rela.init) - *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) - *(.rela.fini) - *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) - } - .rela.plt : - { - *(.rela.plt) - PROVIDE_HIDDEN (__rela_iplt_start = .); - *(.rela.iplt) - PROVIDE_HIDDEN (__rela_iplt_end = .); - } - .init : - { - FILL (0x90909090) - KEEP (*(SORT_NONE(.init))) - } =0x909090909090909090909090 - PROVIDE (__etext = .); - .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } - .exception_ranges : ONLY_IF_RO { *(.exception_ranges - .exception_ranges*) } - . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); - /* Exception handling */ - .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } - .ctors : - { - KEEP (*crtbegin.o(.ctors)) - KEEP (*crtbegin?.o(.ctors)) - KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - } - .dtors : - { - KEEP (*crtbegin.o(.dtors)) - KEEP (*crtbegin?.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - } - . = DATA_SEGMENT_RELRO_END (SIZEOF (.got.plt) >= 24 ? 24 : 0, .); - .got.plt : { *(.got.plt) *(.igot.plt) } - .lrodata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) : - { - *(.lrodata .lrodata.* .gnu.linkonce.lr.*) - } - .ldata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) : - { - *(.ldata .ldata.* .gnu.linkonce.l.*) - . = ALIGN(. != 0 ? 64 / 8 : 1); - } - . = ALIGN(64 / 8); - _end = .; PROVIDE (end = .); - . = DATA_SEGMENT_END (.); - /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } -} - -/* -CHECK: kw_search_dir: SEARCH_DIR -CHECK: l_paren: ( -CHECK: identifier: /usr/x86_64-linux-gnu/lib64 -CHECK: r_paren: ) -CHECK: semicolon: ; -CHECK: kw_search_dir: SEARCH_DIR -CHECK: l_paren: ( -CHECK: identifier: =/usr/local/lib/x86_64-linux-gnu -CHECK: r_paren: ) -CHECK: semicolon: ; -CHECK: kw_sections: SECTIONS -CHECK: l_brace: { -CHECK: kw_provide: PROVIDE -CHECK: l_paren: ( -CHECK: identifier: __executable_start -CHECK: equal: = -CHECK: identifier: SEGMENT_START -CHECK: l_paren: ( -CHECK: identifier: text-segment -CHECK: comma: , -CHECK: number: 0x400000 -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: semicolon: ; -CHECK: identifier: . -CHECK: equal: = -CHECK: identifier: SEGMENT_START -CHECK: l_paren: ( -CHECK: identifier: text-segment -CHECK: comma: , -CHECK: number: 0x400000 -CHECK: r_paren: ) -CHECK: plus: + -CHECK: identifier: SIZEOF_HEADERS -CHECK: semicolon: ; -CHECK: identifier: .interp -CHECK: colon: : -CHECK: l_brace: { -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .interp -CHECK: r_paren: ) -CHECK: r_brace: } -CHECK: identifier: .note.gnu.build-id -CHECK: colon: : -CHECK: l_brace: { -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .note.gnu.build-id -CHECK: r_paren: ) -CHECK: r_brace: } -CHECK: identifier: .hash -CHECK: colon: : -CHECK: l_brace: { -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .hash -CHECK: r_paren: ) -CHECK: r_brace: } -CHECK: identifier: .rela.dyn -CHECK: colon: : -CHECK: l_brace: { -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .rela.init -CHECK: r_paren: ) -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .rela.text -CHECK: identifier: .rela.text.* -CHECK: identifier: .rela.gnu.linkonce.t.* -CHECK: r_paren: ) -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .rela.fini -CHECK: r_paren: ) -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .rela.rodata -CHECK: identifier: .rela.rodata.* -CHECK: identifier: .rela.gnu.linkonce.r.* -CHECK: r_paren: ) -CHECK: r_brace: } -CHECK: identifier: .rela.plt -CHECK: colon: : -CHECK: l_brace: { -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .rela.plt -CHECK: r_paren: ) -CHECK: kw_provide_hidden: PROVIDE_HIDDEN -CHECK: l_paren: ( -CHECK: identifier: __rela_iplt_start -CHECK: equal: = -CHECK: identifier: . -CHECK: r_paren: ) -CHECK: semicolon: ; -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .rela.iplt -CHECK: r_paren: ) -CHECK: kw_provide_hidden: PROVIDE_HIDDEN -CHECK: l_paren: ( -CHECK: identifier: __rela_iplt_end -CHECK: equal: = -CHECK: identifier: . -CHECK: r_paren: ) -CHECK: semicolon: ; -CHECK: r_brace: } -CHECK: identifier: .init -CHECK: colon: : -CHECK: l_brace: { -CHECK: kw_fill: FILL -CHECK: l_paren: ( -CHECK: number: 0x90909090 -CHECK: r_paren: ) -CHECK: kw_keep: KEEP -CHECK: l_paren: ( -CHECK: star: * -CHECK: l_paren: ( -CHECK: kw_sort_none: SORT_NONE -CHECK: l_paren: ( -CHECK: identifier: .init -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: r_brace: } -CHECK: kw_provide: PROVIDE -CHECK: l_paren: ( -CHECK: identifier: __etext -CHECK: equal: = -CHECK: identifier: . -CHECK: r_paren: ) -CHECK: semicolon: ; -CHECK: identifier: .eh_frame -CHECK: colon: : -CHECK: kw_only_if_ro: ONLY_IF_RO -CHECK: l_brace: { -CHECK: kw_keep: KEEP -CHECK: l_paren: ( -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .eh_frame -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: r_brace: } -CHECK: identifier: .exception_ranges -CHECK: colon: : -CHECK: kw_only_if_ro: ONLY_IF_RO -CHECK: l_brace: { -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .exception_ranges -CHECK: identifier: .exception_ranges* -CHECK: r_paren: ) -CHECK: r_brace: } -CHECK: identifier: . -CHECK: equal: = -CHECK: kw_align: ALIGN -CHECK: l_paren: ( -CHECK: identifier: CONSTANT -CHECK: l_paren: ( -CHECK: identifier: MAXPAGESIZE -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: minus: - -CHECK: l_paren: ( -CHECK: l_paren: ( -CHECK: identifier: CONSTANT -CHECK: l_paren: ( -CHECK: identifier: MAXPAGESIZE -CHECK: r_paren: ) -CHECK: minus: - -CHECK: identifier: . -CHECK: r_paren: ) -CHECK: amp: & -CHECK: l_paren: ( -CHECK: identifier: CONSTANT -CHECK: l_paren: ( -CHECK: identifier: MAXPAGESIZE -CHECK: r_paren: ) -CHECK: minus: - -CHECK: number: 1 -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: semicolon: ; -CHECK: identifier: . -CHECK: equal: = -CHECK: identifier: DATA_SEGMENT_ALIGN -CHECK: l_paren: ( -CHECK: identifier: CONSTANT -CHECK: l_paren: ( -CHECK: identifier: MAXPAGESIZE -CHECK: r_paren: ) -CHECK: comma: , -CHECK: identifier: CONSTANT -CHECK: l_paren: ( -CHECK: identifier: COMMONPAGESIZE -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: semicolon: ; -CHECK: identifier: .eh_frame -CHECK: colon: : -CHECK: kw_only_if_rw: ONLY_IF_RW -CHECK: l_brace: { -CHECK: kw_keep: KEEP -CHECK: l_paren: ( -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .eh_frame -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: r_brace: } -CHECK: identifier: .ctors -CHECK: colon: : -CHECK: l_brace: { -CHECK: kw_keep: KEEP -CHECK: l_paren: ( -CHECK: identifier: *crtbegin.o -CHECK: l_paren: ( -CHECK: identifier: .ctors -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: kw_keep: KEEP -CHECK: l_paren: ( -CHECK: identifier: *crtbegin?.o -CHECK: l_paren: ( -CHECK: identifier: .ctors -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: kw_keep: KEEP -CHECK: l_paren: ( -CHECK: star: * -CHECK: l_paren: ( -CHECK: kw_exclude_file: EXCLUDE_FILE -CHECK: l_paren: ( -CHECK: identifier: *crtend.o -CHECK: identifier: *crtend?.o -CHECK: r_paren: ) -CHECK: identifier: .ctors -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: kw_keep: KEEP -CHECK: l_paren: ( -CHECK: star: * -CHECK: l_paren: ( -CHECK: kw_sort_by_name: SORT -CHECK: l_paren: ( -CHECK: identifier: .ctors.* -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: kw_keep: KEEP -CHECK: l_paren: ( -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .ctors -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: r_brace: } -CHECK: identifier: .dtors -CHECK: colon: : -CHECK: l_brace: { -CHECK: kw_keep: KEEP -CHECK: l_paren: ( -CHECK: identifier: *crtbegin.o -CHECK: l_paren: ( -CHECK: identifier: .dtors -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: kw_keep: KEEP -CHECK: l_paren: ( -CHECK: identifier: *crtbegin?.o -CHECK: l_paren: ( -CHECK: identifier: .dtors -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: kw_keep: KEEP -CHECK: l_paren: ( -CHECK: star: * -CHECK: l_paren: ( -CHECK: kw_exclude_file: EXCLUDE_FILE -CHECK: l_paren: ( -CHECK: identifier: *crtend.o -CHECK: identifier: *crtend?.o -CHECK: r_paren: ) -CHECK: identifier: .dtors -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: kw_keep: KEEP -CHECK: l_paren: ( -CHECK: star: * -CHECK: l_paren: ( -CHECK: kw_sort_by_name: SORT -CHECK: l_paren: ( -CHECK: identifier: .dtors.* -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: kw_keep: KEEP -CHECK: l_paren: ( -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .dtors -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: r_brace: } -CHECK: identifier: . -CHECK: equal: = -CHECK: identifier: DATA_SEGMENT_RELRO_END -CHECK: l_paren: ( -CHECK: identifier: SIZEOF -CHECK: l_paren: ( -CHECK: identifier: .got.plt -CHECK: r_paren: ) -CHECK: greaterequal: >= -CHECK: number: 24 -CHECK: question: ? -CHECK: number: 24 -CHECK: colon: : -CHECK: number: 0 -CHECK: comma: , -CHECK: identifier: . -CHECK: r_paren: ) -CHECK: semicolon: ; -CHECK: identifier: .got.plt -CHECK: colon: : -CHECK: l_brace: { -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .got.plt -CHECK: r_paren: ) -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .igot.plt -CHECK: r_paren: ) -CHECK: r_brace: } -CHECK: identifier: .lrodata -CHECK: kw_align: ALIGN -CHECK: l_paren: ( -CHECK: identifier: CONSTANT -CHECK: l_paren: ( -CHECK: identifier: MAXPAGESIZE -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: plus: + -CHECK: l_paren: ( -CHECK: identifier: . -CHECK: amp: & -CHECK: l_paren: ( -CHECK: identifier: CONSTANT -CHECK: l_paren: ( -CHECK: identifier: MAXPAGESIZE -CHECK: r_paren: ) -CHECK: minus: - -CHECK: number: 1 -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: colon: : -CHECK: l_brace: { -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .lrodata -CHECK: identifier: .lrodata.* -CHECK: identifier: .gnu.linkonce.lr.* -CHECK: r_paren: ) -CHECK: r_brace: } -CHECK: identifier: .ldata -CHECK: kw_align: ALIGN -CHECK: l_paren: ( -CHECK: identifier: CONSTANT -CHECK: l_paren: ( -CHECK: identifier: MAXPAGESIZE -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: plus: + -CHECK: l_paren: ( -CHECK: identifier: . -CHECK: amp: & -CHECK: l_paren: ( -CHECK: identifier: CONSTANT -CHECK: l_paren: ( -CHECK: identifier: MAXPAGESIZE -CHECK: r_paren: ) -CHECK: minus: - -CHECK: number: 1 -CHECK: r_paren: ) -CHECK: r_paren: ) -CHECK: colon: : -CHECK: l_brace: { -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .ldata -CHECK: identifier: .ldata.* -CHECK: identifier: .gnu.linkonce.l.* -CHECK: r_paren: ) -CHECK: identifier: . -CHECK: equal: = -CHECK: kw_align: ALIGN -CHECK: l_paren: ( -CHECK: identifier: . -CHECK: exclaimequal: != -CHECK: number: 0 -CHECK: question: ? -CHECK: number: 64 -CHECK: slash: / -CHECK: number: 8 -CHECK: colon: : -CHECK: number: 1 -CHECK: r_paren: ) -CHECK: semicolon: ; -CHECK: r_brace: } -CHECK: identifier: . -CHECK: equal: = -CHECK: kw_align: ALIGN -CHECK: l_paren: ( -CHECK: number: 64 -CHECK: slash: / -CHECK: number: 8 -CHECK: r_paren: ) -CHECK: semicolon: ; -CHECK: identifier: _end -CHECK: equal: = -CHECK: identifier: . -CHECK: semicolon: ; -CHECK: kw_provide: PROVIDE -CHECK: l_paren: ( -CHECK: identifier: end -CHECK: equal: = -CHECK: identifier: . -CHECK: r_paren: ) -CHECK: semicolon: ; -CHECK: identifier: . -CHECK: equal: = -CHECK: identifier: DATA_SEGMENT_END -CHECK: l_paren: ( -CHECK: identifier: . -CHECK: r_paren: ) -CHECK: semicolon: ; -CHECK: kw_discard: /DISCARD/ -CHECK: colon: : -CHECK: l_brace: { -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .note.GNU-stack -CHECK: r_paren: ) -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .gnu_debuglink -CHECK: r_paren: ) -CHECK: star: * -CHECK: l_paren: ( -CHECK: identifier: .gnu.lto_* -CHECK: r_paren: ) -CHECK: r_brace: } -CHECK: r_brace: } -CHECK: eof: -CHECK: SEARCH_DIR("/usr/x86_64-linux-gnu/lib64") -CHECK: SEARCH_DIR("=/usr/local/lib/x86_64-linux-gnu") -CHECK: SECTIONS -CHECK: { -CHECK: PROVIDE(__executable_start = SEGMENT_START(text-segment, 4194304)) -CHECK: . = (SEGMENT_START(text-segment, 4194304) + SIZEOF_HEADERS) -CHECK: .interp : -CHECK: { -CHECK: *(.interp) -CHECK: } -CHECK: .note.gnu.build-id : -CHECK: { -CHECK: *(.note.gnu.build-id) -CHECK: } -CHECK: .hash : -CHECK: { -CHECK: *(.hash) -CHECK: } -CHECK: .rela.dyn : -CHECK: { -CHECK: *(.rela.init) -CHECK: *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) -CHECK: *(.rela.fini) -CHECK: *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) -CHECK: } -CHECK: .rela.plt : -CHECK: { -CHECK: *(.rela.plt) -CHECK: PROVIDE_HIDDEN(__rela_iplt_start = .) -CHECK: *(.rela.iplt) -CHECK: PROVIDE_HIDDEN(__rela_iplt_end = .) -CHECK: } -CHECK: .init : -CHECK: { -CHECK: FILL(0x90909090) -CHECK: KEEP(*(SORT_NONE(.init))) -CHECK: } =0x909090909090909090909090 -CHECK: PROVIDE(__etext = .) -CHECK: .eh_frame : -CHECK: ONLY_IF_RO { -CHECK: KEEP(*(.eh_frame)) -CHECK: } -CHECK: .exception_ranges : -CHECK: ONLY_IF_RO { -CHECK: *(.exception_ranges .exception_ranges*) -CHECK: } -CHECK: . = (ALIGN(CONSTANT(MAXPAGESIZE)) - ((CONSTANT(MAXPAGESIZE) - .) & (CONSTANT(MAXPAGESIZE) - 1))) -CHECK: . = DATA_SEGMENT_ALIGN(CONSTANT(MAXPAGESIZE), CONSTANT(COMMONPAGESIZE)) -CHECK: .eh_frame : -CHECK: ONLY_IF_RW { -CHECK: KEEP(*(.eh_frame)) -CHECK: } -CHECK: .ctors : -CHECK: { -CHECK: KEEP(*crtbegin.o(.ctors)) -CHECK: KEEP(*crtbegin?.o(.ctors)) -CHECK: KEEP(*(EXCLUDE_FILE(*crtend.o *crtend?.o ) .ctors)) -CHECK: KEEP(*(SORT_BY_NAME(.ctors.*))) -CHECK: KEEP(*(.ctors)) -CHECK: } -CHECK: .dtors : -CHECK: { -CHECK: KEEP(*crtbegin.o(.dtors)) -CHECK: KEEP(*crtbegin?.o(.dtors)) -CHECK: KEEP(*(EXCLUDE_FILE(*crtend.o *crtend?.o ) .dtors)) -CHECK: KEEP(*(SORT_BY_NAME(.dtors.*))) -CHECK: KEEP(*(.dtors)) -CHECK: } -CHECK: . = DATA_SEGMENT_RELRO_END((SIZEOF(.got.plt) >= 24) ? 24 : 0, .) -CHECK: .got.plt : -CHECK: { -CHECK: *(.got.plt) -CHECK: *(.igot.plt) -CHECK: } -CHECK: .lrodata (ALIGN(CONSTANT(MAXPAGESIZE)) + (. & (CONSTANT(MAXPAGESIZE) - 1))) : -CHECK: { -CHECK: *(.lrodata .lrodata.* .gnu.linkonce.lr.*) -CHECK: } -CHECK: .ldata (ALIGN(CONSTANT(MAXPAGESIZE)) + (. & (CONSTANT(MAXPAGESIZE) - 1))) : -CHECK: { -CHECK: *(.ldata .ldata.* .gnu.linkonce.l.*) -CHECK: . = ALIGN((. != 0) ? (64 / 8) : 1) -CHECK: } -CHECK: . = ALIGN((64 / 8)) -CHECK: _end = . -CHECK: PROVIDE(end = .) -CHECK: . = DATA_SEGMENT_END(.) -CHECK: : -CHECK: { -CHECK: *(.note.GNU-stack) -CHECK: *(.gnu_debuglink) -CHECK: *(.gnu.lto_*) -CHECK: } -CHECK: } -*/ diff --git a/test/Unit/lit.site.cfg.in b/test/Unit/lit.site.cfg.in index 74c5eca91153..c2f3054a2d59 100644 --- a/test/Unit/lit.site.cfg.in +++ b/test/Unit/lit.site.cfg.in @@ -1,5 +1,5 @@ -## Autogenerated by LLVM/lld configuration. -# Do not edit! +@LIT_SITE_CFG_IN_HEADER@ + config.llvm_src_root = "@LLVM_SOURCE_DIR@" config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" diff --git a/test/core/Inputs/archive-basic.objtxt b/test/core/Inputs/archive-basic.objtxt deleted file mode 100644 index ecfdacd0b6dd..000000000000 --- a/test/core/Inputs/archive-basic.objtxt +++ /dev/null @@ -1,21 +0,0 @@ ---- !archive -members: - - name: bar.o - content: !native - defined-atoms: - - name: bar - scope: global - type: code - - - name: bar2 - type: code - - - name: baz.o - content: !native - defined-atoms: - - name: baz - scope: global - type: code - - - name: baz2 - type: code diff --git a/test/core/Inputs/archive-chain.objtxt b/test/core/Inputs/archive-chain.objtxt deleted file mode 100644 index d3cc17137c18..000000000000 --- a/test/core/Inputs/archive-chain.objtxt +++ /dev/null @@ -1,24 +0,0 @@ ---- !archive -members: - - name: bar1.o - content: !native - defined-atoms: - - name: bar1 - scope: global - type: code - - - name: bar1b - type: code - - undefined-atoms: - - name: baz1 - - - name: bar2.o - content: !native - defined-atoms: - - name: bar2 - scope: global - type: code - - - name: bar2b - type: code diff --git a/test/core/Inputs/archive-chain2.objtxt b/test/core/Inputs/archive-chain2.objtxt deleted file mode 100644 index aed6b1b959e1..000000000000 --- a/test/core/Inputs/archive-chain2.objtxt +++ /dev/null @@ -1,21 +0,0 @@ ---- !archive -members: - - name: baz1.o - content: !native - defined-atoms: - - name: baz1 - scope: global - type: code - - - name: baz1b - type: code - - - name: baz2.o - content: !native - defined-atoms: - - name: baz2 - scope: global - type: code - - - name: baz2b - type: code diff --git a/test/core/Inputs/archive-tentdef-search.objtxt b/test/core/Inputs/archive-tentdef-search.objtxt deleted file mode 100644 index 70219aac7a6d..000000000000 --- a/test/core/Inputs/archive-tentdef-search.objtxt +++ /dev/null @@ -1,11 +0,0 @@ ---- !archive -members: - - name: bar.o - content: !native - defined-atoms: - - name: bar - scope: global - type: data - - - name: bar2 - type: data diff --git a/test/core/Inputs/associates.objtxt b/test/core/Inputs/associates.objtxt deleted file mode 100644 index 29d028c27edc..000000000000 --- a/test/core/Inputs/associates.objtxt +++ /dev/null @@ -1,8 +0,0 @@ -defined-atoms: - - name: f1 - merge: as-weak - scope: global - references: - - kind: associate - target: f2 - - name: f2 diff --git a/test/core/Inputs/auto-hide-coalesce.objtxt b/test/core/Inputs/auto-hide-coalesce.objtxt deleted file mode 100644 index d82d0f41c4f4..000000000000 --- a/test/core/Inputs/auto-hide-coalesce.objtxt +++ /dev/null @@ -1,20 +0,0 @@ -defined-atoms: - - name: _inlineFunc1 - scope: global - type: code - merge: as-weak - - - name: _inlineFunc2 - scope: global - type: code - merge: as-addressed-weak - - - name: _inlineFunc3 - scope: global - type: code - merge: as-weak - - - name: _inlineFunc4 - scope: global - type: code - merge: as-addressed-weak diff --git a/test/core/Inputs/code-model-attributes.objtxt b/test/core/Inputs/code-model-attributes.objtxt deleted file mode 100644 index 7c01a0d57f36..000000000000 --- a/test/core/Inputs/code-model-attributes.objtxt +++ /dev/null @@ -1,4 +0,0 @@ ---- -defined-atoms: - - name: _none - code-model: none diff --git a/test/core/Inputs/code-model-attributes2.objtxt b/test/core/Inputs/code-model-attributes2.objtxt deleted file mode 100644 index 92df88c7b0ea..000000000000 --- a/test/core/Inputs/code-model-attributes2.objtxt +++ /dev/null @@ -1,4 +0,0 @@ ---- -defined-atoms: - - name: _mips_pic - code-model: mips-pic diff --git a/test/core/Inputs/code-model-attributes3.objtxt b/test/core/Inputs/code-model-attributes3.objtxt deleted file mode 100644 index 8f2ced14f10c..000000000000 --- a/test/core/Inputs/code-model-attributes3.objtxt +++ /dev/null @@ -1,4 +0,0 @@ ---- -defined-atoms: - - name: _mips_micro - code-model: mips-micro diff --git a/test/core/Inputs/code-model-attributes4.objtxt b/test/core/Inputs/code-model-attributes4.objtxt deleted file mode 100644 index 160c9a00c3da..000000000000 --- a/test/core/Inputs/code-model-attributes4.objtxt +++ /dev/null @@ -1,4 +0,0 @@ ---- -defined-atoms: - - name: _mips_micro_pic - code-model: mips-micro-pic diff --git a/test/core/Inputs/code-model-attributes5.objtxt b/test/core/Inputs/code-model-attributes5.objtxt deleted file mode 100644 index 99bdb54e09bb..000000000000 --- a/test/core/Inputs/code-model-attributes5.objtxt +++ /dev/null @@ -1,4 +0,0 @@ ---- -defined-atoms: - - name: _mips_16 - code-model: mips-16 diff --git a/test/core/Inputs/constants-coalesce.objtxt b/test/core/Inputs/constants-coalesce.objtxt deleted file mode 100644 index ea3436f9ee28..000000000000 --- a/test/core/Inputs/constants-coalesce.objtxt +++ /dev/null @@ -1,9 +0,0 @@ ---- -defined-atoms: - - ref-name: L1 - type: constant - content: [ 01, 02 ] - - ref-name: L2 - type: constant - merge: by-content - content: [ 01, 02, 03, 04 ] diff --git a/test/core/Inputs/constants-coalesce2.objtxt b/test/core/Inputs/constants-coalesce2.objtxt deleted file mode 100644 index c8f10f414f87..000000000000 --- a/test/core/Inputs/constants-coalesce2.objtxt +++ /dev/null @@ -1,10 +0,0 @@ ---- -defined-atoms: - - ref-name: L2 - type: constant - merge: by-content - content: [ 01, 23, 45, 67, 89, AB, CD, EF ] - - ref-name: L3 - type: constant - merge: by-content - content: [ 01, 02, 03 ] diff --git a/test/core/Inputs/cstring-coalesce.objtxt b/test/core/Inputs/cstring-coalesce.objtxt deleted file mode 100644 index d2e6327cf20c..000000000000 --- a/test/core/Inputs/cstring-coalesce.objtxt +++ /dev/null @@ -1,6 +0,0 @@ ---- -defined-atoms: - - ref-name: L2 - type: c-string - merge: by-content - content: [ 68, 65, 6c, 6c, 6f, 00 ] diff --git a/test/core/Inputs/cstring-coalesce2.objtxt b/test/core/Inputs/cstring-coalesce2.objtxt deleted file mode 100644 index 76dedf7cf3bd..000000000000 --- a/test/core/Inputs/cstring-coalesce2.objtxt +++ /dev/null @@ -1,6 +0,0 @@ ---- -defined-atoms: - - ref-name: L2 - type: c-string - merge: by-content - content: [ 74, 68, 65, 72, 65, 00 ] diff --git a/test/core/Inputs/custom-section-coalesce.objtxt b/test/core/Inputs/custom-section-coalesce.objtxt deleted file mode 100644 index de3efe339aae..000000000000 --- a/test/core/Inputs/custom-section-coalesce.objtxt +++ /dev/null @@ -1,15 +0,0 @@ ---- -defined-atoms: - - ref-name: L1 - type: constant - merge: by-content - content: [ 01, 02, 03, 04 ] - section-choice: custom-required - section-name: .mysection - - - ref-name: L2 - type: constant - merge: by-content - content: [ 01, 02, 03, 04 ] - section-choice: custom-required - section-name: .mysection2 diff --git a/test/core/Inputs/custom-section-coalesce2.objtxt b/test/core/Inputs/custom-section-coalesce2.objtxt deleted file mode 100644 index 3e8356f0c7ee..000000000000 --- a/test/core/Inputs/custom-section-coalesce2.objtxt +++ /dev/null @@ -1,13 +0,0 @@ ---- -defined-atoms: - - ref-name: L1 - type: constant - merge: by-content - content: [ 05, 06, 07, 08 ] - section-choice: custom-required - section-name: .mysection - - - ref-name: L2 - type: constant - merge: by-content - content: [ 01, 02, 03, 04 ] diff --git a/test/core/Inputs/dead-strip-attributes.objtxt b/test/core/Inputs/dead-strip-attributes.objtxt deleted file mode 100644 index 06a71485dcd5..000000000000 --- a/test/core/Inputs/dead-strip-attributes.objtxt +++ /dev/null @@ -1,4 +0,0 @@ ---- -defined-atoms: - - name: _foo2 - dead-strip: never diff --git a/test/core/Inputs/dead-strip-attributes2.objtxt b/test/core/Inputs/dead-strip-attributes2.objtxt deleted file mode 100644 index 3dd55c46cd92..000000000000 --- a/test/core/Inputs/dead-strip-attributes2.objtxt +++ /dev/null @@ -1,4 +0,0 @@ ---- -defined-atoms: - - name: _foo3 - dead-strip: always diff --git a/test/core/Inputs/dead-strip-basic.objtxt b/test/core/Inputs/dead-strip-basic.objtxt deleted file mode 100644 index 05cb81bbcf94..000000000000 --- a/test/core/Inputs/dead-strip-basic.objtxt +++ /dev/null @@ -1,9 +0,0 @@ ---- -defined-atoms: - - name: mydead2 - scope: global - type: data - - - name: bar - scope: global - type: data diff --git a/test/core/Inputs/dead-strip-basic2.objtxt b/test/core/Inputs/dead-strip-basic2.objtxt deleted file mode 100644 index 6b0b01aef642..000000000000 --- a/test/core/Inputs/dead-strip-basic2.objtxt +++ /dev/null @@ -1,8 +0,0 @@ ---- -defined-atoms: - - name: baz - scope: global - type: code - - - name: mydead3 - type: code diff --git a/test/core/Inputs/dead-strip-globals.objtxt b/test/core/Inputs/dead-strip-globals.objtxt deleted file mode 100644 index fbf2ba6d1da3..000000000000 --- a/test/core/Inputs/dead-strip-globals.objtxt +++ /dev/null @@ -1,9 +0,0 @@ ---- -defined-atoms: - - name: myglobal2 - scope: global - type: data - - - name: bar - scope: hidden - type: data diff --git a/test/core/Inputs/dead-strip-globals2.objtxt b/test/core/Inputs/dead-strip-globals2.objtxt deleted file mode 100644 index a314bbe5ae41..000000000000 --- a/test/core/Inputs/dead-strip-globals2.objtxt +++ /dev/null @@ -1,8 +0,0 @@ ---- -defined-atoms: - - name: baz - scope: hidden - type: code - - - name: mydead - type: code diff --git a/test/core/Inputs/error-duplicate-absolutes.objtxt b/test/core/Inputs/error-duplicate-absolutes.objtxt deleted file mode 100644 index 2b99aa37848a..000000000000 --- a/test/core/Inputs/error-duplicate-absolutes.objtxt +++ /dev/null @@ -1,5 +0,0 @@ ---- -absolute-atoms: - - name: absatom - value: 0 - scope: global diff --git a/test/core/Inputs/gnulinkonce-rearrange-resolve.objtxt b/test/core/Inputs/gnulinkonce-rearrange-resolve.objtxt deleted file mode 100644 index e1fa42a24a52..000000000000 --- a/test/core/Inputs/gnulinkonce-rearrange-resolve.objtxt +++ /dev/null @@ -1,26 +0,0 @@ ---- -defined-atoms: - - name: g1 - scope: global - type: gnu-linkonce - references: - - kind: group-child - target: f1 - - kind: group-child - target: f2 - - kind: group-child - target: g1 - - kind: group-child - target: d1 - - name: f1 - scope: global - type: code - - name: f2 - scope: global - type: code - - name: g1 - scope: global - type: code - - name: d1 - scope: global - type: data diff --git a/test/core/Inputs/gnulinkonce-remaining-undef.objtxt b/test/core/Inputs/gnulinkonce-remaining-undef.objtxt deleted file mode 100644 index 02903a6b7bc5..000000000000 --- a/test/core/Inputs/gnulinkonce-remaining-undef.objtxt +++ /dev/null @@ -1,34 +0,0 @@ ---- -defined-atoms: - - name: anotherfunction - scope: global - type: data - - name: f1 - scope: global - type: code - - name: f2 - scope: global - type: code - - name: f3 - scope: global - type: code - - name: g1 - scope: global - type: code - - name: d1 - scope: global - type: data - - name: g1 - scope: global - type: gnu-linkonce - references: - - kind: group-child - target: f1 - - kind: group-child - target: f2 - - kind: group-child - target: f3 - - kind: group-child - target: g1 - - kind: group-child - target: d1 diff --git a/test/core/Inputs/gnulinkonce-remaining-undef2.objtxt b/test/core/Inputs/gnulinkonce-remaining-undef2.objtxt deleted file mode 100644 index 4991476c621c..000000000000 --- a/test/core/Inputs/gnulinkonce-remaining-undef2.objtxt +++ /dev/null @@ -1,4 +0,0 @@ ---- -undefined-atoms: - - name: f3 - can-be-null: never diff --git a/test/core/Inputs/gnulinkonce-resolve.objtxt b/test/core/Inputs/gnulinkonce-resolve.objtxt deleted file mode 100644 index f4beb37fee2a..000000000000 --- a/test/core/Inputs/gnulinkonce-resolve.objtxt +++ /dev/null @@ -1,25 +0,0 @@ -defined-atoms: - - name: f1 - scope: global - type: code - - name: f2 - scope: global - type: code - - name: g1 - scope: global - type: code - - name: d1 - scope: global - type: data - - name: g1 - scope: global - type: gnu-linkonce - references: - - kind: group-child - target: f1 - - kind: group-child - target: f2 - - kind: group-child - target: g1 - - kind: group-child - target: d1 diff --git a/test/core/Inputs/gnulinkonce-simple.objtxt b/test/core/Inputs/gnulinkonce-simple.objtxt deleted file mode 100644 index 807f0d35802b..000000000000 --- a/test/core/Inputs/gnulinkonce-simple.objtxt +++ /dev/null @@ -1,4 +0,0 @@ ---- -undefined-atoms: - - name: f1 - can-be-null: never diff --git a/test/core/Inputs/inline-coalesce.objtxt b/test/core/Inputs/inline-coalesce.objtxt deleted file mode 100644 index 2eddee647c14..000000000000 --- a/test/core/Inputs/inline-coalesce.objtxt +++ /dev/null @@ -1,6 +0,0 @@ ---- -defined-atoms: - - name: _inlineFunc - scope: global - type: code - merge: as-weak diff --git a/test/core/Inputs/inline-coalesce2.objtxt b/test/core/Inputs/inline-coalesce2.objtxt deleted file mode 100644 index 2eddee647c14..000000000000 --- a/test/core/Inputs/inline-coalesce2.objtxt +++ /dev/null @@ -1,6 +0,0 @@ ---- -defined-atoms: - - name: _inlineFunc - scope: global - type: code - merge: as-weak diff --git a/test/core/Inputs/multiple-def-error.objtxt b/test/core/Inputs/multiple-def-error.objtxt deleted file mode 100644 index 8a1dcdb9c37f..000000000000 --- a/test/core/Inputs/multiple-def-error.objtxt +++ /dev/null @@ -1,5 +0,0 @@ ---- -defined-atoms: - - name: _foo - scope: global - type: data diff --git a/test/core/Inputs/sectiongroup-deadstrip.objtxt b/test/core/Inputs/sectiongroup-deadstrip.objtxt deleted file mode 100644 index 392f7ee96898..000000000000 --- a/test/core/Inputs/sectiongroup-deadstrip.objtxt +++ /dev/null @@ -1,3 +0,0 @@ -undefined-atoms: - - name: f1 - can-be-null: never diff --git a/test/core/Inputs/sectiongroup-gnulinkonce-error.objtxt b/test/core/Inputs/sectiongroup-gnulinkonce-error.objtxt deleted file mode 100644 index a365d37b66b5..000000000000 --- a/test/core/Inputs/sectiongroup-gnulinkonce-error.objtxt +++ /dev/null @@ -1,26 +0,0 @@ ---- -defined-atoms: - - name: f1 - scope: global - type: code - - name: f2 - scope: global - type: code - - name: g1 - scope: global - type: code - - name: d1 - scope: global - type: data - - name: g1 - scope: global - type: gnu-linkonce - references: - - kind: group-child - target: f1 - - kind: group-child - target: f2 - - kind: group-child - target: g1 - - kind: group-child - target: d1 diff --git a/test/core/Inputs/sectiongroup-rearrange-resolve.objtxt b/test/core/Inputs/sectiongroup-rearrange-resolve.objtxt deleted file mode 100644 index bcefee646ef4..000000000000 --- a/test/core/Inputs/sectiongroup-rearrange-resolve.objtxt +++ /dev/null @@ -1,25 +0,0 @@ -defined-atoms: - - name: g1 - scope: global - type: group-comdat - references: - - kind: group-child - target: f1 - - kind: group-child - target: f2 - - kind: group-child - target: g1 - - kind: group-child - target: d1 - - name: f1 - scope: global - type: code - - name: f2 - scope: global - type: code - - name: g1 - scope: global - type: code - - name: d1 - scope: global - type: data diff --git a/test/core/Inputs/sectiongroup-remaining-undef.objtxt b/test/core/Inputs/sectiongroup-remaining-undef.objtxt deleted file mode 100644 index 07c7af5dc67c..000000000000 --- a/test/core/Inputs/sectiongroup-remaining-undef.objtxt +++ /dev/null @@ -1,34 +0,0 @@ ---- -defined-atoms: - - name: anotherfunction - scope: global - type: data - - name: f1 - scope: global - type: code - - name: f2 - scope: global - type: code - - name: f3 - scope: global - type: code - - name: g1 - scope: global - type: code - - name: d1 - scope: global - type: data - - name: g1 - scope: global - type: group-comdat - references: - - kind: group-child - target: f1 - - kind: group-child - target: f2 - - kind: group-child - target: f3 - - kind: group-child - target: g1 - - kind: group-child - target: d1 diff --git a/test/core/Inputs/sectiongroup-remaining-undef2.objtxt b/test/core/Inputs/sectiongroup-remaining-undef2.objtxt deleted file mode 100644 index 4991476c621c..000000000000 --- a/test/core/Inputs/sectiongroup-remaining-undef2.objtxt +++ /dev/null @@ -1,4 +0,0 @@ ---- -undefined-atoms: - - name: f3 - can-be-null: never diff --git a/test/core/Inputs/sectiongroup-resolve.objtxt b/test/core/Inputs/sectiongroup-resolve.objtxt deleted file mode 100644 index a047ad33fe9c..000000000000 --- a/test/core/Inputs/sectiongroup-resolve.objtxt +++ /dev/null @@ -1,26 +0,0 @@ ---- -defined-atoms: - - name: f1 - scope: global - type: code - - name: f2 - scope: global - type: code - - name: g1 - scope: global - type: code - - name: d1 - scope: global - type: data - - name: g1 - scope: global - type: group-comdat - references: - - kind: group-child - target: f1 - - kind: group-child - target: f2 - - kind: group-child - target: g1 - - kind: group-child - target: d1 diff --git a/test/core/Inputs/sectiongroup-simple.objtxt b/test/core/Inputs/sectiongroup-simple.objtxt deleted file mode 100644 index 807f0d35802b..000000000000 --- a/test/core/Inputs/sectiongroup-simple.objtxt +++ /dev/null @@ -1,4 +0,0 @@ ---- -undefined-atoms: - - name: f1 - can-be-null: never diff --git a/test/core/Inputs/shared-library-coalesce.objtxt b/test/core/Inputs/shared-library-coalesce.objtxt deleted file mode 100644 index 57cdfe662d4c..000000000000 --- a/test/core/Inputs/shared-library-coalesce.objtxt +++ /dev/null @@ -1,28 +0,0 @@ ---- -shared-library-atoms: - - name: foo2 - load-name: libc.so - - - name: foo3 - load-name: libc.so - - - name: bar2 - load-name: libc.so - can-be-null: at-runtime - - - name: bar3 - load-name: libc.so - can-be-null: at-runtime - - - name: mismatchNull1 - load-name: libc.so - - - name: mismatchNull2 - load-name: libc.so - can-be-null: at-runtime - - - name: mismatchload1 - load-name: libb.so - - - name: mismatchload2 - load-name: liba.so diff --git a/test/core/Inputs/tent-merge.objtxt b/test/core/Inputs/tent-merge.objtxt deleted file mode 100644 index 90db8fd1f446..000000000000 --- a/test/core/Inputs/tent-merge.objtxt +++ /dev/null @@ -1,6 +0,0 @@ ---- -defined-atoms: - - name: _foo - scope: global - type: data - content: [ 00, 00, 00, 00 ] diff --git a/test/core/Inputs/undef-coalesce-error.objtxt b/test/core/Inputs/undef-coalesce-error.objtxt deleted file mode 100644 index f493f00bdf1a..000000000000 --- a/test/core/Inputs/undef-coalesce-error.objtxt +++ /dev/null @@ -1,8 +0,0 @@ ---- -defined-atoms: - - name: bar - type: code - -undefined-atoms: - - name: malloc - - name: myfunc diff --git a/test/core/Inputs/undef-coalesce-error2.objtxt b/test/core/Inputs/undef-coalesce-error2.objtxt deleted file mode 100644 index 88d736fc2111..000000000000 --- a/test/core/Inputs/undef-coalesce-error2.objtxt +++ /dev/null @@ -1,8 +0,0 @@ ---- -defined-atoms: - - name: myfunc - scope: global - type: code - -undefined-atoms: - - name: free diff --git a/test/core/Inputs/undef-coalesce.objtxt b/test/core/Inputs/undef-coalesce.objtxt deleted file mode 100644 index f493f00bdf1a..000000000000 --- a/test/core/Inputs/undef-coalesce.objtxt +++ /dev/null @@ -1,8 +0,0 @@ ---- -defined-atoms: - - name: bar - type: code - -undefined-atoms: - - name: malloc - - name: myfunc diff --git a/test/core/Inputs/undef-coalesce2.objtxt b/test/core/Inputs/undef-coalesce2.objtxt deleted file mode 100644 index 88d736fc2111..000000000000 --- a/test/core/Inputs/undef-coalesce2.objtxt +++ /dev/null @@ -1,8 +0,0 @@ ---- -defined-atoms: - - name: myfunc - scope: global - type: code - -undefined-atoms: - - name: free diff --git a/test/core/Inputs/undef-fallback.objtxt b/test/core/Inputs/undef-fallback.objtxt deleted file mode 100644 index c392731805cd..000000000000 --- a/test/core/Inputs/undef-fallback.objtxt +++ /dev/null @@ -1,7 +0,0 @@ -defined-atoms: - - name: fallback1 - -undefined-atoms: - - name: def1 - fallback: - name: fallback3 diff --git a/test/core/Inputs/undef-weak-coalesce.objtxt b/test/core/Inputs/undef-weak-coalesce.objtxt deleted file mode 100644 index 7a5e20fad097..000000000000 --- a/test/core/Inputs/undef-weak-coalesce.objtxt +++ /dev/null @@ -1,20 +0,0 @@ ---- -undefined-atoms: - - name: bar1 - can-be-null: never - - name: bar2 - can-be-null: at-runtime - - name: bar3 - can-be-null: at-buildtime - - name: bar4 - can-be-null: at-runtime - - name: bar5 - can-be-null: at-buildtime - - name: bar6 - can-be-null: never - - name: bar7 - can-be-null: at-buildtime - - name: bar8 - can-be-null: never - - name: bar9 - can-be-null: at-runtime diff --git a/test/core/Inputs/weak-coalesce.objtxt b/test/core/Inputs/weak-coalesce.objtxt deleted file mode 100644 index 8a1dcdb9c37f..000000000000 --- a/test/core/Inputs/weak-coalesce.objtxt +++ /dev/null @@ -1,5 +0,0 @@ ---- -defined-atoms: - - name: _foo - scope: global - type: data diff --git a/test/core/Inputs/weak-coalesce2.objtxt b/test/core/Inputs/weak-coalesce2.objtxt deleted file mode 100644 index 1039b309f8a4..000000000000 --- a/test/core/Inputs/weak-coalesce2.objtxt +++ /dev/null @@ -1,6 +0,0 @@ ---- -defined-atoms: - - name: _foo - merge: as-weak - scope: global - type: data diff --git a/test/core/absolute-basic.objtxt b/test/core/absolute-basic.objtxt deleted file mode 100644 index edfbe8629b0d..000000000000 --- a/test/core/absolute-basic.objtxt +++ /dev/null @@ -1,23 +0,0 @@ -# RUN: lld -core --dead-strip %s | FileCheck %s - -# -# Test that absolute symbols are parsed and preserved -# - ---- -absolute-atoms: - - name: putchar - value: 0xFFFF0040 - - - name: reset - value: 0xFFFF0080 - -... - - -# CHECK: absolute-atoms: -# CHECK: name: putchar -# CHECK: value: 0x00000000FFFF0040 -# CHECK: name: reset -# CHECK: value: 0x00000000FFFF0080 -# CHECK: ... diff --git a/test/core/absolute-local.objtxt b/test/core/absolute-local.objtxt deleted file mode 100644 index 1ba4c7f04326..000000000000 --- a/test/core/absolute-local.objtxt +++ /dev/null @@ -1,25 +0,0 @@ -# RUN: lld -core %s | FileCheck %s - -# -# Test that absolute symbols with local scope do not cause name conflict -# ---- -absolute-atoms: - - name: putchar - ref-name: pc1 - value: 0xFFFF0040 - scope: static - - - name: putchar - ref-name: pc2 - value: 0xFFFF0040 - scope: static -... - -# CHECK: --- -# CHECK: absolute-atoms: -# CHECK: - name: putchar -# CHECK: value: 0x00000000FFFF0040 -# CHECK: - name: putchar -# CHECK: value: 0x00000000FFFF0040 -# CHECK: ... diff --git a/test/core/archive-basic.objtxt b/test/core/archive-basic.objtxt deleted file mode 100644 index 205e0a5034e5..000000000000 --- a/test/core/archive-basic.objtxt +++ /dev/null @@ -1,23 +0,0 @@ -# RUN: lld -core %s %p/Inputs/archive-basic.objtxt | FileCheck %s - -# -# Tests archives in YAML. Tests that an undefined in a regular file will load -# all atoms in select archive members. -# - ---- !native -defined-atoms: - - name: foo - type: code - -undefined-atoms: - - name: bar - -... - -# CHECK: name: foo -# CHECK-NOT: undefined-atoms: -# CHECK: name: bar -# CHECK: name: bar2 -# CHECK-NOT: name: baz -# CHECK: ... diff --git a/test/core/archive-chain.objtxt b/test/core/archive-chain.objtxt deleted file mode 100644 index 35417f0bdb68..000000000000 --- a/test/core/archive-chain.objtxt +++ /dev/null @@ -1,23 +0,0 @@ -# RUN: lld -core %s %p/Inputs/archive-chain.objtxt %p/Inputs/archive-chain2.objtxt | FileCheck %s - -# -# Tests that an undefine in one archive can force a load from another archive. -# - ---- !native -defined-atoms: - - name: foo - type: code - -undefined-atoms: - - name: bar1 -... - -# CHECK: name: foo -# CHECK: name: bar1 -# CHECK: name: bar1b -# CHECK-NOT: name: bar2 -# CHECK: name: baz1 -# CHECK: name: baz1b -# CHECK-NOT: name: baz2 -# CHECK: ... diff --git a/test/core/archive-tentdef-search.objtxt b/test/core/archive-tentdef-search.objtxt deleted file mode 100644 index 230ab0bfd0de..000000000000 --- a/test/core/archive-tentdef-search.objtxt +++ /dev/null @@ -1,30 +0,0 @@ -# RUN: lld -core %s %p/Inputs/archive-tentdef-search.objtxt | FileCheck -check-prefix=CHK1 %s -# RUN: lld -core --commons-search-archives %s %p/Inputs/archive-tentdef-search.objtxt | FileCheck -check-prefix=CHK2 %s - -# -# Tests that -commons-search-archives cause core linker to look for overrides -# of tentative definition in archives, and that not using that option -# does not search. -# - ---- !native -defined-atoms: - - name: foo - type: code - - - name: bar - scope: global - type: zero-fill - merge: as-tentative -... - -# CHK1: name: foo -# CHK1: name: bar -# CHK1: merge: as-tentative -# CHK1: ... - -# CHK2: name: foo -# CHK2: name: bar -# CHK2-NOT: merge: as-tentative -# CHK2: name: bar2 -# CHK2: ... diff --git a/test/core/associates.objtxt b/test/core/associates.objtxt deleted file mode 100644 index 5c711c97f9fa..000000000000 --- a/test/core/associates.objtxt +++ /dev/null @@ -1,21 +0,0 @@ -# RUN: lld -core %s %p/Inputs/associates.objtxt | FileCheck %s - ---- -defined-atoms: - - name: f1 - merge: as-weak - scope: global - references: - - kind: associate - target: f2 - - name: f2 -... - -# CHECK: defined-atoms: -# CHECK: - name: f1 -# CHECK: scope: global -# CHECK: references: -# CHECK: - kind: associate -# CHECK: target: f2 -# CHECK: - name: f2 -# CHECK-NOT: - name: f2 diff --git a/test/core/auto-hide-coalesce.objtxt b/test/core/auto-hide-coalesce.objtxt deleted file mode 100644 index 63c54951150e..000000000000 --- a/test/core/auto-hide-coalesce.objtxt +++ /dev/null @@ -1,39 +0,0 @@ -# RUN: lld -core %s %p/Inputs/auto-hide-coalesce.objtxt | FileCheck %s - -# -# Tests auto-hide bit during coalescing -# - ---- -defined-atoms: - - name: _inlineFunc1 - scope: global - type: code - merge: as-weak - - - name: _inlineFunc2 - scope: global - type: code - merge: as-weak - - - name: _inlineFunc3 - scope: global - type: code - merge: as-addressed-weak - - - name: _inlineFunc4 - scope: global - type: code - merge: as-addressed-weak -... - - -# CHECK: name: _inlineFunc1 -# CHECK: merge: as-weak -# CHECK: name: _inlineFunc3 -# CHECK: merge: as-addressed-weak -# CHECK: name: _inlineFunc4 -# CHECK: merge: as-addressed-weak -# CHECK: name: _inlineFunc2 -# CHECK: merge: as-addressed-weak -# CHECK: ... diff --git a/test/core/code-model-attributes.objtxt b/test/core/code-model-attributes.objtxt deleted file mode 100644 index 9bb4a01bd1a7..000000000000 --- a/test/core/code-model-attributes.objtxt +++ /dev/null @@ -1,33 +0,0 @@ -# RUN: lld -core %s %p/Inputs/code-model-attributes.objtxt \ -# RUN: %p/Inputs/code-model-attributes2.objtxt \ -# RUN: %p/Inputs/code-model-attributes3.objtxt \ -# RUN: %p/Inputs/code-model-attributes4.objtxt \ -# RUN: %p/Inputs/code-model-attributes5.objtxt | FileCheck %s -# -# Test that code model attributes are preserved -# - ---- -defined-atoms: - - name: _def -... - -# CHECK: name: _def -# CHECK-NOT: code-model: mips-pic -# CHECK-NOT: code-model: mips-micro -# CHECK-NOT: code-model: mips-micro-pic -# CHECK-NOT: code-model: mips-16 -# CHECK: name: _none -# CHECK-NOT: code-model: mips-pic -# CHECK-NOT: code-model: mips-micro -# CHECK-NOT: code-model: mips-micro-pic -# CHECK-NOT: code-model: mips-16 -# CHECK: name: _mips_pic -# CHECK: code-model: mips-pic -# CHECK: name: _mips_micro -# CHECK: code-model: mips-micro -# CHECK: name: _mips_micro_pic -# CHECK: code-model: mips-micro-pic -# CHECK: name: _mips_16 -# CHECK: code-model: mips-16 -# CHECK: ... diff --git a/test/core/constants-coalesce.objtxt b/test/core/constants-coalesce.objtxt deleted file mode 100644 index 1a9f1013e6ec..000000000000 --- a/test/core/constants-coalesce.objtxt +++ /dev/null @@ -1,42 +0,0 @@ -# RUN: lld -core %s %p/Inputs/constants-coalesce.objtxt \ -# RUN: %p/Inputs/constants-coalesce2.objtxt | FileCheck %s - -# -# Test that duplicate merge-by-content anonymous constants are coalesced -# and non-mergable duplicate constants are not coalesced. -# - ---- -defined-atoms: - - ref-name: L4-byte - type: constant - merge: by-content - content: [ 01, 02, 03, 04 ] - - - ref-name: L8-byte - type: constant - merge: by-content - content: [ 01, 23, 45, 67, 89, AB, CD, EF ] - - - ref-name: L1 - type: constant - content: [ 01, 02 ] -... - -# CHECK-NOT: name: -# CHECK: type: constant -# CHECK: content: [ 01, 02, 03, 04 ] -# CHECK: merge: by-content -# CHECK: type: constant -# CHECK: content: [ 01, 23, 45, 67, 89, AB, CD, EF ] -# CHECK: merge: by-content -# CHECK: type: constant -# CHECK: content: [ 01, 02 ] -# CHECK: type: constant -# CHECK: content: [ 01, 02 ] -# CHECK: type: constant -# CHECK: content: [ 01, 02, 03 ] -# CHECK: merge: by-content -# CHECK: ... - - diff --git a/test/core/cstring-coalesce.objtxt b/test/core/cstring-coalesce.objtxt deleted file mode 100644 index 4d32c00daf82..000000000000 --- a/test/core/cstring-coalesce.objtxt +++ /dev/null @@ -1,29 +0,0 @@ -# RUN: lld -core %s | FileCheck %s - -# -# Test that duplicate c-strings are coalesced -# - ---- -defined-atoms: - - ref-name: L0 - type: c-string - merge: by-content - content: [ 68, 65, 6c, 6c, 6f, 00 ] - - - ref-name: L1 - type: c-string - merge: by-content - content: [ 74, 68, 65, 72, 65, 00 ] -... - -# CHECK-NOT: name: -# CHECK: type: c-string -# CHECK: content: [ 68, 65, 6C, 6C, 6F, 00 ] -# CHECK: merge: by-content -# CHECK: type: c-string -# CHECK: content: [ 74, 68, 65, 72, 65, 00 ] -# CHECK: merge: by-content -# CHECK: ... - - diff --git a/test/core/custom-section-coalesce.objtxt b/test/core/custom-section-coalesce.objtxt deleted file mode 100644 index fcf04845a7dd..000000000000 --- a/test/core/custom-section-coalesce.objtxt +++ /dev/null @@ -1,50 +0,0 @@ -# RUN: lld -core %s %p/Inputs/custom-section-coalesce.objtxt \ -# RUN: %p/Inputs/custom-section-coalesce2.objtxt | FileCheck %s - -# -# Test that custom sections are preserved when duplicate merge-by-content -# constants are coalesced. -# - ---- -defined-atoms: - - ref-name: L1 - type: constant - merge: by-content - content: [ 01, 02, 03, 04 ] - section-choice: custom-required - section-name: .mysection - - - ref-name: L2 - type: constant - merge: by-content - content: [ 05, 06, 07, 08 ] - section-choice: custom-required - section-name: .mysection - - - ref-name: L3 - type: constant - merge: by-content - content: [ 01, 02, 03, 04 ] -... - - -# CHECK:defined-atoms: -# CHECK: - type: constant -# CHECK: content: [ 01, 02, 03, 04 ] -# CHECK: merge: by-content -# CHECK: section-choice: custom-required -# CHECK: section-name: .mysection -# CHECK: - type: constant -# CHECK: content: [ 05, 06, 07, 08 ] -# CHECK: merge: by-content -# CHECK: section-choice: custom-required -# CHECK: section-name: .mysection -# CHECK: - type: constant -# CHECK: content: [ 01, 02, 03, 04 ] -# CHECK: merge: by-content -# CHECK: - type: constant -# CHECK: content: [ 01, 02, 03, 04 ] -# CHECK: merge: by-content -# CHECK: section-choice: custom-required -# CHECK: section-name: .mysection2 diff --git a/test/core/custom-section.objtxt b/test/core/custom-section.objtxt deleted file mode 100644 index ce305e9af38e..000000000000 --- a/test/core/custom-section.objtxt +++ /dev/null @@ -1,34 +0,0 @@ -# RUN: lld -core %s | FileCheck %s - -# -# Test that custom sections are preserved -# - ---- -defined-atoms: - - name: _foo1 - scope: global - section-choice: content - - - name: _foo2 - scope: global - section-choice: custom - section-name: __foozle - - - name: _foo3 - scope: global - section-choice: custom-required - section-name: __boozle - -... - - -# CHECK: name: _foo1 -# CHECK-NOT: section-name: -# CHECK: name: _foo2 -# CHECK: section-choice: custom -# CHECK: section-name: __foozle -# CHECK: name: _foo3 -# CHECK: section-choice: custom-required -# CHECK: section-name: __boozle -# CHECK: ... diff --git a/test/core/dead-strip-attributes.objtxt b/test/core/dead-strip-attributes.objtxt deleted file mode 100644 index 2a1c97627d2b..000000000000 --- a/test/core/dead-strip-attributes.objtxt +++ /dev/null @@ -1,22 +0,0 @@ -# RUN: lld -core %s %p/Inputs/dead-strip-attributes.objtxt \ -# RUN: %p/Inputs/dead-strip-attributes2.objtxt | FileCheck %s - -# -# Test that dead strip attributes are preserved -# - ---- -defined-atoms: - - name: _foo1 - dead-strip: normal -... - - -# CHECK: name: _foo1 -# CHECK-NOT: dead-strip: never -# CHECK-NOT: dead-strip: always -# CHECK: name: _foo2 -# CHECK: dead-strip: never -# CHECK: name: _foo3 -# CHECK: dead-strip: always -# CHECK: ... diff --git a/test/core/dead-strip-basic.objtxt b/test/core/dead-strip-basic.objtxt deleted file mode 100644 index 1607ea9e5b89..000000000000 --- a/test/core/dead-strip-basic.objtxt +++ /dev/null @@ -1,45 +0,0 @@ -# RUN: lld -core --dead-strip %s %p/Inputs/dead-strip-basic.objtxt %p/Inputs/dead-strip-basic2.objtxt | FileCheck -check-prefix=CHK1 %s -# RUN: lld -core %s %p/Inputs/dead-strip-basic.objtxt %p/Inputs/dead-strip-basic2.objtxt | FileCheck -check-prefix=CHK2 %s - -# -# Test that -dead-strip removes unreachable code and data -# and that not using that option leaves them. -# - ---- -defined-atoms: - - name: entry - dead-strip: never - references: - - offset: 1 - kind: pcrel32 - target: bar - - offset: 6 - kind: pcrel32 - target: baz - - - name: mydead1 - scope: global - -undefined-atoms: - - name: bar - - - name: baz -... - - -# CHK1: name: entry -# CHK1-NOT: name: mydead1 -# CHK1: name: bar -# CHK1-NOT: name: mydead2 -# CHK1: name: baz -# CHK1-NOT: name: mydead3 -# CHK1: ... - -# CHK2: name: entry -# CHK2: name: mydead1 -# CHK2: name: mydead2 -# CHK2: name: bar -# CHK2: name: baz -# CHK2: name: mydead3 -# CHK2: ... diff --git a/test/core/dead-strip-globals.objtxt b/test/core/dead-strip-globals.objtxt deleted file mode 100644 index e4b11b16f690..000000000000 --- a/test/core/dead-strip-globals.objtxt +++ /dev/null @@ -1,43 +0,0 @@ -# RUN: lld -core --dead-strip --keep-globals %s %p/Inputs/dead-strip-globals.objtxt %p/Inputs/dead-strip-globals2.objtxt | FileCheck -check-prefix=CHK1 %s -# RUN: lld -core --dead-strip %s %p/Inputs/dead-strip-globals.objtxt %p/Inputs/dead-strip-globals2.objtxt | FileCheck -check-prefix=CHK2 %s - -# -# Test that -keep-globals prevents -dead-strip from removing globals. -# - ---- -defined-atoms: - - name: entry - dead-strip: never - references: - - offset: 1 - kind: pcrel32 - target: bar - - offset: 6 - kind: pcrel32 - target: baz - - - name: myglobal1 - scope: global - -undefined-atoms: - - name: bar - - name: baz -... - - -# CHK1: name: entry -# CHK1: name: myglobal1 -# CHK1: name: myglobal2 -# CHK1: name: bar -# CHK1: name: baz -# CHK1-NOT: name: mydead -# CHK1: ... - -# CHK2: name: entry -# CHK2-NOT: name: myglobal1 -# CHK2-NOT: name: myglobal2 -# CHK2: name: bar -# CHK2: name: baz -# CHK2-NOT: name: mydead -# CHK2: ... diff --git a/test/core/dead-strip-reverse.objtxt b/test/core/dead-strip-reverse.objtxt deleted file mode 100644 index f471bebcdf4e..000000000000 --- a/test/core/dead-strip-reverse.objtxt +++ /dev/null @@ -1,25 +0,0 @@ -# RUN: lld -core --dead-strip %s | FileCheck -check-prefix=CHECK1 %s -# RUN: lld -core %s | FileCheck -check-prefix=CHECK2 %s - ---- -defined-atoms: - - name: entry - dead-strip: never - scope: global - references: - - kind: layout-after - offset: 0 - target: def - - name: def - scope: global - - name: dead - scope: global -... - -# CHECK1: name: entry -# CHECK1: name: def -# CHECK1-NOT: name: dead - -# CHECK2: name: entry -# CHECK2: name: def -# CHECK2: name: dead diff --git a/test/core/error-atom-attribute.objtxt b/test/core/error-atom-attribute.objtxt deleted file mode 100644 index 6643aba29eea..000000000000 --- a/test/core/error-atom-attribute.objtxt +++ /dev/null @@ -1,19 +0,0 @@ -# RUN: not lld -core %s 2> %t.err -# RUN: FileCheck %s < %t.err - -# -# Test that unknown atom attribute produces a readable error. -# - ---- -defined-atoms: - - name: entry - scope: hidden - foobar: true - dead-strip: never - -... - - -# CHECK: error: unknown key 'foobar' -# CHECK: foobar diff --git a/test/core/error-atom-content-byte-value.objtxt b/test/core/error-atom-content-byte-value.objtxt deleted file mode 100644 index 6e675576461a..000000000000 --- a/test/core/error-atom-content-byte-value.objtxt +++ /dev/null @@ -1,18 +0,0 @@ -# RUN: not lld -core %s 2> %t.err -# RUN: FileCheck %s < %t.err - -# -# Test that an invalid hex byte produces a readable error. -# - ---- -defined-atoms: - - name: entry - scope: hidden - content: [ A5, 00, 4G, 1F ] - -... - - -# CHECK: error: invalid two-digit-hex number -# CHECK: 4G diff --git a/test/core/error-atom-content-bytes.objtxt b/test/core/error-atom-content-bytes.objtxt deleted file mode 100644 index a8a82b2b45e1..000000000000 --- a/test/core/error-atom-content-bytes.objtxt +++ /dev/null @@ -1,19 +0,0 @@ -# RUN: not lld -core %s 2> %t.err -# RUN: FileCheck %s < %t.err - -# -# Test that an out of range byte value produces a readable error. -# - ---- -defined-atoms: - - name: entry - scope: hidden - content: [ A5, 1234, 00, 4F ] - -... - - -# CHECK: error: out of range two-digit-hex number -# CHECK: 1234 - diff --git a/test/core/error-atom-type.objtxt b/test/core/error-atom-type.objtxt deleted file mode 100644 index b0943f8e2749..000000000000 --- a/test/core/error-atom-type.objtxt +++ /dev/null @@ -1,19 +0,0 @@ -# RUN: not lld -core %s 2> %t.err -# RUN: FileCheck %s < %t.err - -# -# Test that an unknown content type produces a readable error. -# - ---- -defined-atoms: - - name: entry - scope: hidden - type: superluminal - dead-strip: never - -... - - -# CHECK: error: unknown enumerated scalar -# CHECK: superluminal diff --git a/test/core/error-atom-undefined-wrong-attribue.objtxt b/test/core/error-atom-undefined-wrong-attribue.objtxt deleted file mode 100644 index 5cdd8519c804..000000000000 --- a/test/core/error-atom-undefined-wrong-attribue.objtxt +++ /dev/null @@ -1,17 +0,0 @@ -# RUN: not lld -core %s 2> %t.err -# RUN: FileCheck %s < %t.err - -# -# Test that a defined attribute on an undefined atom produces a readable error. -# - ---- -undefined-atoms: - - name: foo - type: code - -... - - -# CHECK: error: unknown key 'type' - diff --git a/test/core/error-duplicate-absolutes.objtxt b/test/core/error-duplicate-absolutes.objtxt deleted file mode 100644 index 513a2f494485..000000000000 --- a/test/core/error-duplicate-absolutes.objtxt +++ /dev/null @@ -1,19 +0,0 @@ -# RUN: not lld -core %s %p/Inputs/error-duplicate-absolutes.objtxt 2> %t.err -# RUN: FileCheck %s < %t.err - -# -# Test that duplicate absolute atoms produces a readable error. -# - ---- -absolute-atoms: - - name: absatom - value: 0 - scope: global -undefined-atoms: - - name: undefatom -... - - -# CHECK: SymbolTable: error while merging absatom -# CHECK: LLVM ERROR: duplicate symbol error diff --git a/test/core/error-file-attribute.objtxt b/test/core/error-file-attribute.objtxt deleted file mode 100644 index d8393dc5e400..000000000000 --- a/test/core/error-file-attribute.objtxt +++ /dev/null @@ -1,17 +0,0 @@ -# RUN: not lld -core %s 2> %t.err -# RUN: FileCheck %s < %t.err - -# -# Test that unknown file attribute produces a readable error. -# - ---- -aardvark: true -defined-atoms: - - name: entry - scope: hidden - -... - - -# CHECK: error: unknown key 'aardvark' diff --git a/test/core/error-fixup-attribute.objtxt b/test/core/error-fixup-attribute.objtxt deleted file mode 100644 index 025783a04427..000000000000 --- a/test/core/error-fixup-attribute.objtxt +++ /dev/null @@ -1,21 +0,0 @@ -# RUN: not lld -core %s 2> %t.err -# RUN: FileCheck %s < %t.err - -# -# Test that unknown fixup attribute produces a readable error. -# - ---- -defined-atoms: - - name: entry - scope: hidden - references: - - offset: 3 - kind: pcrel32 - weasel: bar - addend: 100 - -... - - -# CHECK: error: unknown key 'weasel' diff --git a/test/core/error-fixup-target.objtxt b/test/core/error-fixup-target.objtxt deleted file mode 100644 index 0e20d1636f50..000000000000 --- a/test/core/error-fixup-target.objtxt +++ /dev/null @@ -1,26 +0,0 @@ -# RUN: not lld -core %s 2> %t.err -# RUN: FileCheck %s < %t.err - -# -# Test that unbindable target name produces a readable error. -# - ---- -defined-atoms: - - name: entry - scope: hidden - references: - - offset: 3 - kind: pcrel32 - target: bar - - offset: 5 - kind: pcrel32 - target: baz - -undefined-atoms: - - name: bar - -... - - -# CHECK: error: no such atom name: baz diff --git a/test/core/fixups-addend.objtxt b/test/core/fixups-addend.objtxt deleted file mode 100644 index d976150459c9..000000000000 --- a/test/core/fixups-addend.objtxt +++ /dev/null @@ -1,50 +0,0 @@ -# RUN: lld -core %s | FileCheck %s - -# -# Test addends in references -# - ---- -defined-atoms: - - name: foo - type: code - content: [ 48, 8D, 3D, 00, 00, 00, 00, - 48, 8D, 3D, 00, 00, 00, 00 ] - references: - - offset: 3 - kind: pcrel32 - target: bar - addend: 100 - - offset: 10 - kind: pcrel32 - target: bar - addend: -50 - - - name: func - type: code - content: [ 48, 8D, 3D, 00, 00, 00, 00, - 48, 8D, 3D, 00, 00, 00, 00 ] - references: - - offset: 3 - kind: pcrel32 - target: bar - addend: 8000000000 - - offset: 10 - kind: pcrel32 - target: bar - addend: -50 - -undefined-atoms: - - name: bar - - -... - -# CHECK: name: foo -# CHECK: references: -# CHECK: addend: 100 -# CHECK: addend: -50 -# CHECK: name: func -# CHECK: references: -# CHECK: addend: 8000000000 -# CHECK: addend: -50 diff --git a/test/core/fixups-dup-named.objtxt b/test/core/fixups-dup-named.objtxt deleted file mode 100644 index 1c57cd73bf09..000000000000 --- a/test/core/fixups-dup-named.objtxt +++ /dev/null @@ -1,31 +0,0 @@ -# RUN: lld -core %s | FileCheck %s - -# -# Test references referencing multiple atoms that have the same name -# - ---- -defined-atoms: - - name: foo - type: code - content: [ E8, 00, 00, 00, 00, E8, 00, 00, 00, 00 ] - references: - - offset: 1 - kind: pcrel32 - target: bar_1 - - offset: 6 - kind: pcrel32 - target: bar_2 - - - name: bar - ref-name: bar_1 - scope: static - - - name: bar - ref-name: bar_2 - scope: static - - -... - -# CHECK: ... diff --git a/test/core/fixups-named.objtxt b/test/core/fixups-named.objtxt deleted file mode 100644 index 1427a9b705d1..000000000000 --- a/test/core/fixups-named.objtxt +++ /dev/null @@ -1,36 +0,0 @@ -# RUN: lld -core %s | FileCheck %s - -# -# Test references to simple named atoms -# - ---- -defined-atoms: - - name: foo - type: code - content: [ E8, 00, 00, 00, 00, - E8, 00, 00, 00, 00 ] - references: - - offset: 1 - kind: pcrel32 - target: bar - - offset: 6 - kind: pcrel32 - target: baz - - - name: baz - scope: static - type: code - -undefined-atoms: - - name: bar - - -... - -# CHECK: name: foo -# CHECK: references: -# CHECK: target: bar -# CHECK: target: baz -# CHECK: ... - diff --git a/test/core/fixups-unnamed.objtxt b/test/core/fixups-unnamed.objtxt deleted file mode 100644 index 88afb6a447a2..000000000000 --- a/test/core/fixups-unnamed.objtxt +++ /dev/null @@ -1,40 +0,0 @@ -# RUN: lld -core %s | FileCheck %s - -# -# Test references to unnamed atoms -# - ---- -defined-atoms: - - name: foo - type: code - content: [ 48, 8D, 3D, 00, 00, 00, 00, - 48, 8D, 3D, 00, 00, 00, 00 ] - references: - - offset: 3 - kind: pcrel32 - target: LC1 - - offset: 10 - kind: pcrel32 - target: LC2 - - - - ref-name: LC1 - type: c-string - merge: by-content - content: [ 68, 65, 6c, 6c, 6f, 00 ] - - - ref-name: LC2 - type: c-string - merge: by-content - content: [ 74, 68, 65, 72, 65, 00 ] - - -... - -# CHECK: name: foo -# CHECK: references: -# CHECK: offset: 3 -# CHECK: offset: 10 -# CHECK: ref-name: -# CHECK: ref-name: diff --git a/test/core/gnulinkonce-rearrange-resolve.objtxt b/test/core/gnulinkonce-rearrange-resolve.objtxt deleted file mode 100644 index b3df078d2314..000000000000 --- a/test/core/gnulinkonce-rearrange-resolve.objtxt +++ /dev/null @@ -1,53 +0,0 @@ -# RUN: lld -core %s %p/Inputs/gnulinkonce-rearrange-resolve.objtxt | FileCheck %s - -# -# Test that gnu linkonce sections are parsed and the first section selected for symbol -# resolution -# - ---- -defined-atoms: - - name: g1 - scope: global - type: gnu-linkonce - references: - - kind: group-child - target: f1 - - kind: group-child - target: f2 - - kind: group-child - target: g1 - - kind: group-child - target: d1 - - name: f1 - scope: global - type: code - - name: f2 - scope: global - type: code - - name: g1 - scope: global - type: code - - name: d1 - scope: global - type: data -... - -# CHECK: defined-atoms: -# CHECK: - name: g1 -# CHECK: ref-name: [[PARENT:[a-zA-Z\.0-9_]+]] -# CHECK: type: gnu-linkonce -# CHECK: references: -# CHECK: - kind: group-child -# CHECK: target: f1 -# CHECK: - kind: group-child -# CHECK: target: f2 -# CHECK: - kind: group-child -# CHECK: target: [[CHILD:[a-zA-Z\.0-9_]+]] -# CHECK: - kind: group-child -# CHECK: target: d1 -# CHECK: - name: f1 -# CHECK: - name: f2 -# CHECK: - name: g1 -# CHECK: ref-name: [[CHILD]] -# CHECK: - name: d1 diff --git a/test/core/gnulinkonce-remaining-undef.objtxt b/test/core/gnulinkonce-remaining-undef.objtxt deleted file mode 100644 index 5fe0ab55b5c0..000000000000 --- a/test/core/gnulinkonce-remaining-undef.objtxt +++ /dev/null @@ -1,43 +0,0 @@ -# RUN: lld -core %s %p/Inputs/gnulinkonce-remaining-undef.objtxt \ -# RUN: %p/Inputs/gnulinkonce-remaining-undef2.objtxt | FileCheck %s - -# -# Test that gnu linkonce sections are parsed and the first section selected for -# symbol resolution. The second file which has the same gnu linkonce section has -# a unresolved undefined symbol. lets make sure that the symbol is kept around -# in the final link and remains undefined. -# - ---- -defined-atoms: - - name: f1 - scope: global - type: code - - name: f2 - scope: global - type: code - - name: g1 - scope: global - type: code - - name: d1 - scope: global - type: data - - name: g1 - scope: global - type: gnu-linkonce - references: - - kind: group-child - target: f1 - - kind: group-child - target: f2 - - kind: group-child - target: g1 - - kind: group-child - target: d1 -... - -#CHECK: - name: anotherfunction -#CHECK: scope: global -#CHECK: type: data -#CHECK: undefined-atoms: -#CHECK: - name: f3 diff --git a/test/core/gnulinkonce-resolve.objtxt b/test/core/gnulinkonce-resolve.objtxt deleted file mode 100644 index e926c39bd0e1..000000000000 --- a/test/core/gnulinkonce-resolve.objtxt +++ /dev/null @@ -1,63 +0,0 @@ -# RUN: lld -core %s %p/Inputs/gnulinkonce-resolve.objtxt | FileCheck %s - -# -# Test that gnu linkonce sections are parsed and the first section selected for symbol -# resolution -# - ---- -defined-atoms: - - name: f1 - scope: global - type: code - - name: f2 - scope: global - type: code - - name: g1 - scope: global - type: code - - name: d1 - scope: global - type: data - - name: g1 - scope: global - type: gnu-linkonce - references: - - kind: group-child - target: f1 - - kind: group-child - target: f2 - - kind: group-child - target: g1 - - kind: group-child - target: d1 -... - -#CHECK: defined-atoms: -#CHECK: - name: g1 -#CHECK: ref-name: [[PARENT:[a-zA-Z\.0-9_]+]] -#CHECK: scope: global -#CHECK: type: gnu-linkonce -#CHECK: references: -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: f1 -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: f2 -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: [[GCHILD:[a-zA-Z\.0-9_]+]] -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: d1 -#CHECK: - name: f1 -#CHECK: scope: global -#CHECK: - name: f2 -#CHECK: scope: global -#CHECK: - name: g1 -#CHECK: ref-name: [[GCHILD]] -#CHECK: scope: global -#CHECK: - name: d1 -#CHECK: scope: global -#CHECK: type: data diff --git a/test/core/gnulinkonce-simple.objtxt b/test/core/gnulinkonce-simple.objtxt deleted file mode 100644 index 0576e5f75d7f..000000000000 --- a/test/core/gnulinkonce-simple.objtxt +++ /dev/null @@ -1,76 +0,0 @@ -# RUN: lld -core %s %p/Inputs/gnulinkonce-simple.objtxt | FileCheck %s - -# -# Test that gnu linkonce sections are parsed properly when there is a reference to a -# atom from outside the gnu linkonce section. -# - ---- -defined-atoms: - - name: f1 - scope: global - type: code - references: - - kind: layout-after - target: anotherfunction - - name: f2 - scope: global - type: code - - name: g1 - scope: global - type: code - - name: d1 - scope: global - type: data - - name: g1 - scope: global - type: gnu-linkonce - references: - - kind: group-child - target: f1 - - kind: group-child - target: f2 - - kind: group-child - target: d1 - - kind: group-child - target: g1 - - name: anotherfunction - scope: global - type: data -... - -#CHECK: defined-atoms: -#CHECK: - name: g1 -#CHECK: ref-name: [[PARENT:[a-zA-Z\.0-9_]+]] -#CHECK: scope: global -#CHECK: type: gnu-linkonce -#CHECK: references: -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: f1 -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: f2 -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: d1 -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: [[GCHILD:[a-zA-Z\.0-9_]+]] -#CHECK: - name: f1 -#CHECK: scope: global -#CHECK: references: -#CHECK: - kind: layout-after -#CHECK: offset: 0 -#CHECK: target: anotherfunction -#CHECK: - name: f2 -#CHECK: scope: global -#CHECK: - name: d1 -#CHECK: scope: global -#CHECK: type: data -#CHECK: - name: g1 -#CHECK: ref-name: [[GCHILD]] -#CHECK: scope: global -#CHECK: - name: anotherfunction -#CHECK: scope: global -#CHECK: type: data diff --git a/test/core/inline-coalesce.objtxt b/test/core/inline-coalesce.objtxt deleted file mode 100644 index 5ddc9b2624b5..000000000000 --- a/test/core/inline-coalesce.objtxt +++ /dev/null @@ -1,19 +0,0 @@ -# RUN: lld -core %s %p/Inputs/inline-coalesce.objtxt %p/Inputs/inline-coalesce2.objtxt | FileCheck %s - -# -# Test that non-inlined inlined functions are silently coalesced -# - ---- -defined-atoms: - - name: _inlineFunc - scope: global - type: code - merge: as-weak -... - - -# CHECK: name: _inlineFunc -# CHECK: merge: as-weak -# CHECK-NOT: name: _inlineFunc -# CHECK: ... diff --git a/test/core/multiple-def-error.objtxt b/test/core/multiple-def-error.objtxt deleted file mode 100644 index 5765814e53ee..000000000000 --- a/test/core/multiple-def-error.objtxt +++ /dev/null @@ -1,14 +0,0 @@ -# RUN: not lld -core %s %p/Inputs/multiple-def-error.objtxt 2>&1 | FileCheck %s - -# -# Test that multiple definitions cause an error -# - -# CHECK: duplicate symbol - ---- -defined-atoms: - - name: _foo - scope: global - type: data -... diff --git a/test/core/permissions.objtxt b/test/core/permissions.objtxt deleted file mode 100644 index af33ea65c455..000000000000 --- a/test/core/permissions.objtxt +++ /dev/null @@ -1,57 +0,0 @@ -# RUN: lld -core %s | FileCheck %s - -# -# Test permissions for known content types are implicit, but can be overridden. -# ---- -defined-atoms: - - name: one - type: code - - - name: two - type: data - permissions: rw- - - - name: three - type: const-data - - - name: four - type: unknown - - - name: oddCode - type: code - permissions: rwx - - - name: oddData - type: data - permissions: rwx - - - name: oddConstData - type: const-data - permissions: rw- - - - name: oddUnknown - type: unknown - permissions: rw- - -... - -# CHECK: --- -# CHECK: defined-atoms: -# CHECK: - name: one -# CHECK-NOT: permissions: -# CHECK: - name: two -# CHECK-NOT: permissions: -# CHECK: - name: three -# CHECK-NOT: permissions: -# CHECK: - name: four -# CHECK-NOT: permissions: -# CHECK: - name: oddCode -# CHECK: permissions: rwx -# CHECK: - name: oddData -# CHECK: permissions: rwx -# CHECK: - name: oddConstData -# CHECK: permissions: rw- -# CHECK: - name: oddUnknown -# CHECK: permissions: rw- -# CHECK: ... diff --git a/test/core/sectiongroup-deadstrip.objtxt b/test/core/sectiongroup-deadstrip.objtxt deleted file mode 100644 index 5055c6e06b69..000000000000 --- a/test/core/sectiongroup-deadstrip.objtxt +++ /dev/null @@ -1,84 +0,0 @@ -# Test for section group members be preserved even if there is a -# reference to only one functions in the group. -# RUN: lld -core --dead-strip %s %p/Inputs/sectiongroup-deadstrip.objtxt | FileCheck %s - -# -# Test that section groups are parsed properly when there is a reference to a -# group atom from outside a group. -# - ---- -defined-atoms: - - name: entry - dead-strip: never - references: - - offset: 1 - kind: pcrel32 - target: d1 - - name: f1 - scope: global - type: code - references: - - kind: layout-after - target: anotherfunction - - name: f2 - scope: global - type: code - - name: g1 - scope: global - type: code - - name: d1 - scope: global - type: data - - name: g1 - scope: global - type: group-comdat - references: - - kind: group-child - target: f1 - - kind: group-child - target: f2 - - kind: group-child - target: d1 - - kind: group-child - target: g1 - - name: anotherfunction - scope: global - type: data -... - -#CHECK: defined-atoms: -#CHECK: - name: g1 -#CHECK: ref-name: [[PARENT:[a-zA-Z\.0-9_]+]] -#CHECK: scope: global -#CHECK: type: group-comdat -#CHECK: references: -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: f1 -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: f2 -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: d1 -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: [[GCHILD:[a-zA-Z\.0-9_]+]] -#CHECK: - name: f1 -#CHECK: scope: global -#CHECK: references: -#CHECK: - kind: layout-after -#CHECK: offset: 0 -#CHECK: target: anotherfunction -#CHECK: - name: f2 -#CHECK: scope: global -#CHECK: - name: d1 -#CHECK: scope: global -#CHECK: type: data -#CHECK: - name: g1 -#CHECK: ref-name: [[GCHILD]] -#CHECK: scope: global -#CHECK: - name: anotherfunction -#CHECK: scope: global -#CHECK: type: data diff --git a/test/core/sectiongroup-gnulinkonce-error.objtxt b/test/core/sectiongroup-gnulinkonce-error.objtxt deleted file mode 100644 index 1b8617067839..000000000000 --- a/test/core/sectiongroup-gnulinkonce-error.objtxt +++ /dev/null @@ -1,38 +0,0 @@ -# RUN: not lld -core %s %p/Inputs/sectiongroup-gnulinkonce-error.objtxt 2>&1 | FileCheck %s - -# -# Test that section groups/gnu linkonce sections are parsed and a merge error -# is displayed at the time of symbol resolution. -# - ---- -defined-atoms: - - name: f1 - scope: global - type: code - - name: f2 - scope: global - type: code - - name: g1 - scope: global - type: code - - name: d1 - scope: global - type: data - - name: g1 - scope: global - type: group-comdat - references: - - kind: group-child - target: f1 - - kind: group-child - target: f2 - - kind: group-child - target: g1 - - kind: group-child - target: d1 -... - -#CHECK: SymbolTable: error while merging g1 -#CHECK: LLVM ERROR: duplicate symbol error - diff --git a/test/core/sectiongroup-rearrange-resolve.objtxt b/test/core/sectiongroup-rearrange-resolve.objtxt deleted file mode 100644 index f191113718df..000000000000 --- a/test/core/sectiongroup-rearrange-resolve.objtxt +++ /dev/null @@ -1,53 +0,0 @@ -# RUN: lld -core %s %p/Inputs/sectiongroup-rearrange-resolve.objtxt | FileCheck %s - -# -# Test that section groups are parsed and the first group selected for symbol -# resolution -# - ---- -defined-atoms: - - name: g1 - scope: global - type: group-comdat - references: - - kind: group-child - target: f1 - - kind: group-child - target: f2 - - kind: group-child - target: g1 - - kind: group-child - target: d1 - - name: f1 - scope: global - type: code - - name: f2 - scope: global - type: code - - name: g1 - scope: global - type: code - - name: d1 - scope: global - type: data -... - -# CHECK: defined-atoms: -# CHECK: - name: g1 -# CHECK: ref-name: [[PARENT:[a-zA-Z\.0-9_]+]] -# CHECK: type: group-comdat -# CHECK: references: -# CHECK: - kind: group-child -# CHECK: target: f1 -# CHECK: - kind: group-child -# CHECK: target: f2 -# CHECK: - kind: group-child -# CHECK: target: [[CHILD:[a-zA-Z\.0-9_]+]] -# CHECK: - kind: group-child -# CHECK: target: d1 -# CHECK: - name: f1 -# CHECK: - name: f2 -# CHECK: - name: g1 -# CHECK: ref-name: [[CHILD]] -# CHECK: - name: d1 diff --git a/test/core/sectiongroup-remaining-undef.objtxt b/test/core/sectiongroup-remaining-undef.objtxt deleted file mode 100644 index 0a292040a354..000000000000 --- a/test/core/sectiongroup-remaining-undef.objtxt +++ /dev/null @@ -1,42 +0,0 @@ -# RUN: lld -core %s %p/Inputs/sectiongroup-remaining-undef.objtxt %p/Inputs/sectiongroup-remaining-undef2.objtxt | FileCheck %s - -# -# Test that section groups are parsed and the first group selected for symbol -# resolution. The second file which has the same group has a unresolved -# undefined symbol. lets make sure that the symbol is kept around in the final -# link and remains undefined. -# - ---- -defined-atoms: - - name: f1 - scope: global - type: code - - name: f2 - scope: global - type: code - - name: g1 - scope: global - type: code - - name: d1 - scope: global - type: data - - name: g1 - scope: global - type: group-comdat - references: - - kind: group-child - target: f1 - - kind: group-child - target: f2 - - kind: group-child - target: g1 - - kind: group-child - target: d1 -... - -#CHECK: - name: anotherfunction -#CHECK: scope: global -#CHECK: type: data -#CHECK: undefined-atoms: -#CHECK: - name: f3 diff --git a/test/core/sectiongroup-resolve.objtxt b/test/core/sectiongroup-resolve.objtxt deleted file mode 100644 index 52197dbb4e91..000000000000 --- a/test/core/sectiongroup-resolve.objtxt +++ /dev/null @@ -1,64 +0,0 @@ -# RUN: lld -core %s | FileCheck %s - -# -# Test that section groups are parsed and the first group selected for symbol -# resolution -# - ---- -defined-atoms: - - name: f1 - scope: global - type: code - - name: f2 - scope: global - type: code - - name: g1 - scope: global - type: code - - name: d1 - scope: global - type: data - - name: g1 - scope: global - type: group-comdat - references: - - kind: group-child - target: f1 - - kind: group-child - target: f2 - - kind: group-child - target: g1 - - kind: group-child - target: d1 -... - -#CHECK: defined-atoms: -#CHECK: - name: g1 -#CHECK: ref-name: [[PARENT:[a-zA-Z\.0-9_]+]] -#CHECK: scope: global -#CHECK: type: group-comdat -#CHECK: references: -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: f1 -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: f2 -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: [[GCHILD:[a-zA-Z\.0-9_]+]] -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: d1 -#CHECK: - name: f1 -#CHECK: scope: global -#CHECK: - name: f2 -#CHECK: scope: global -#CHECK: - name: g1 -#CHECK: ref-name: [[GCHILD]] -#CHECK: scope: global -#CHECK: - name: d1 -#CHECK: scope: global -#CHECK: type: data -#CHECK: ... diff --git a/test/core/sectiongroup-simple.objtxt b/test/core/sectiongroup-simple.objtxt deleted file mode 100644 index d81b1a1b313c..000000000000 --- a/test/core/sectiongroup-simple.objtxt +++ /dev/null @@ -1,76 +0,0 @@ -# RUN: lld -core %s | FileCheck %s - -# -# Test that section groups are parsed properly when there is a reference to a -# group atom from outside a group. -# - ---- -defined-atoms: - - name: f1 - scope: global - type: code - references: - - kind: layout-after - target: anotherfunction - - name: f2 - scope: global - type: code - - name: g1 - scope: global - type: code - - name: d1 - scope: global - type: data - - name: g1 - scope: global - type: group-comdat - references: - - kind: group-child - target: f1 - - kind: group-child - target: f2 - - kind: group-child - target: d1 - - kind: group-child - target: g1 - - name: anotherfunction - scope: global - type: data -... - -#CHECK: defined-atoms: -#CHECK: - name: g1 -#CHECK: ref-name: [[PARENT:[a-zA-Z\.0-9_]+]] -#CHECK: scope: global -#CHECK: type: group-comdat -#CHECK: references: -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: f1 -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: f2 -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: d1 -#CHECK: - kind: group-child -#CHECK: offset: 0 -#CHECK: target: [[GCHILD:[a-zA-Z\.0-9_]+]] -#CHECK: - name: f1 -#CHECK: scope: global -#CHECK: references: -#CHECK: - kind: layout-after -#CHECK: offset: 0 -#CHECK: target: anotherfunction -#CHECK: - name: f2 -#CHECK: scope: global -#CHECK: - name: d1 -#CHECK: scope: global -#CHECK: type: data -#CHECK: - name: g1 -#CHECK: ref-name: [[GCHILD]] -#CHECK: scope: global -#CHECK: - name: anotherfunction -#CHECK: scope: global -#CHECK: type: data diff --git a/test/core/shared-library-basic.objtxt b/test/core/shared-library-basic.objtxt deleted file mode 100644 index 61445e7431fd..000000000000 --- a/test/core/shared-library-basic.objtxt +++ /dev/null @@ -1,40 +0,0 @@ -# RUN: lld -core %s | FileCheck %s - -# -# Test that shared-library symbols are parsed and preserved -# - ---- -shared-library-atoms: - - name: malloc - load-name: libc.so - type: code - size: 0 - - - name: free - load-name: libc.so - - - name: fast_malloc - load-name: libc.so - can-be-null: at-runtime - - - name: stdout - load-name: libc.so - type: data - size: 8 - -... - -# CHECK: shared-library-atoms: -# CHECK: name: malloc -# CHECK: load-name: libc.so -# CHECK: name: free -# CHECK: load-name: libc.so -# CHECK: name: fast_malloc -# CHECK: load-name: libc.so -# CHECK: can-be-null: at-runtime -# CHECK: name: stdout -# CHECK: load-name: libc.so -# CHECK: type: data -# CHECK: size: 8 -# CHECK: ... diff --git a/test/core/shared-library-coalesce.objtxt b/test/core/shared-library-coalesce.objtxt deleted file mode 100644 index 1cd25d18f881..000000000000 --- a/test/core/shared-library-coalesce.objtxt +++ /dev/null @@ -1,55 +0,0 @@ -# RUN: lld -core %s %p/Inputs/shared-library-coalesce.objtxt | FileCheck %s - -# -# Test that shared library symbols preserve their attributes and merge properly -# - ---- -shared-library-atoms: - - name: foo1 - load-name: libc.so - - - name: foo2 - load-name: libc.so - - - name: bar1 - load-name: libc.so - can-be-null: at-runtime - - - name: bar2 - load-name: libc.so - can-be-null: at-runtime - - - name: mismatchNull1 - load-name: libc.so - can-be-null: at-runtime - - - name: mismatchNull2 - load-name: libc.so - - - name: mismatchload1 - load-name: liba.so - - - name: mismatchload2 - load-name: libb.so - -... - -# CHECK: name: foo1 -# CHECK: name: foo2 -# CHECK: name: bar1 -# CHECK: can-be-null: at-runtime -# CHECK: name: bar2 -# CHECK: can-be-null: at-runtime -# CHECK: name: mismatchNull1 -# CHECK: can-be-null: at-runtime -# CHECK: name: mismatchNull2 -# CHECK-NOT: can-be-null: at-runtime -# CHECK: name: mismatchload1 -# CHECK: load-name: liba.so -# CHECK: name: mismatchload2 -# CHECK: load-name: libb.so -# CHECK: name: foo3 -# CHECK: name: bar3 -# CHECK: can-be-null: at-runtime -# CHECK: ... diff --git a/test/core/tent-merge.objtxt b/test/core/tent-merge.objtxt deleted file mode 100644 index 8997be2833b1..000000000000 --- a/test/core/tent-merge.objtxt +++ /dev/null @@ -1,19 +0,0 @@ -# RUN: lld -core %s %p/Inputs/tent-merge.objtxt | FileCheck %s - -# -# Test that a tentative definition and a regular global are merged into -# one regular global -# - ---- -defined-atoms: - - name: _foo - merge: as-tentative - scope: global - type: zero-fill - size: 4 -... - - -# CHECK: name: _foo -# CHECK-NOT: merge: as-tentative diff --git a/test/core/undef-coalesce-error.objtxt b/test/core/undef-coalesce-error.objtxt deleted file mode 100644 index f0ad8d8555ab..000000000000 --- a/test/core/undef-coalesce-error.objtxt +++ /dev/null @@ -1,31 +0,0 @@ -# RUN: not lld -core --undefines-are-errors %s %p/Inputs/undef-coalesce-error.objtxt %p/Inputs/undef-coalesce-error2.objtxt 2> %t.err -# RUN: FileCheck -check-prefix=CHECKERR %s < %t.err -# RUN: lld -core %s %p/Inputs/undef-coalesce-error.objtxt %p/Inputs/undef-coalesce-error2.objtxt | FileCheck %s - -# -# Test that -undefines-are-errors triggers and error -# and that not using that option results in undefined atoms. -# - ---- -defined-atoms: - - name: foo - type: code - -undefined-atoms: - - name: malloc - - name: free -... - -# CHECKERR: free -# CHECKERR: malloc -# CHECKERR: symbol(s) not found - -# CHECK: defined-atoms: -# CHECK: name: foo -# CHECK: name: bar -# CHECK: name: myfunc -# CHECK: undefined-atoms: -# CHECK: name: malloc -# CHECK: name: free -# CHECK: ... diff --git a/test/core/undef-coalesce.objtxt b/test/core/undef-coalesce.objtxt deleted file mode 100644 index b0ea2b928977..000000000000 --- a/test/core/undef-coalesce.objtxt +++ /dev/null @@ -1,26 +0,0 @@ -# RUN: lld -core %s %p/Inputs/undef-coalesce.objtxt %p/Inputs/undef-coalesce2.objtxt | FileCheck %s - -# -# Test that undefined symbols are coalesced with other undefined symbols -# and definitions override them. -# - ---- -defined-atoms: - - name: foo - type: code - -undefined-atoms: - - name: malloc - - name: free -... - -# CHECK: defined-atoms: -# CHECK: name: foo -# CHECK: name: bar -# CHECK: name: myfunc -# CHECK: scope: global -# CHECK: undefined-atoms: -# CHECK: name: malloc -# CHECK: name: free -# CHECK: ... diff --git a/test/core/undef-fallback.objtxt b/test/core/undef-fallback.objtxt deleted file mode 100644 index aef7b6d7c26f..000000000000 --- a/test/core/undef-fallback.objtxt +++ /dev/null @@ -1,29 +0,0 @@ -# RUN: lld -core %p/undef-fallback.objtxt %p/Inputs/undef-fallback.objtxt | FileCheck %s - -# Test that fallback atoms can be parsed by YAML reader and processed by the -# core linker. - ---- -defined-atoms: - - name: def1 - scope: global - -undefined-atoms: - - name: undef1 - fallback: - name: fallback1 - - name: undef2 - fallback: - name: fallback2 -... - -# CHECK: defined-atoms: -# CHECK-NEXT: - name: def1 -# CHECK-NEXT: scope: global -# CHECK-NEXT: - name: fallback1 -# CHECK-NEXT: ref-name: fallback1 -# CHECK-NEXT: undefined-atoms: -# CHECK-NEXT: - name: fallback1 -# CHECK-NEXT: - name: fallback2 - -# CHECK-NOT: - name: fallback3 diff --git a/test/core/undef-weak-coalesce.objtxt b/test/core/undef-weak-coalesce.objtxt deleted file mode 100644 index d46a05cb95cf..000000000000 --- a/test/core/undef-weak-coalesce.objtxt +++ /dev/null @@ -1,52 +0,0 @@ -# RUN: lld -core %s %p/Inputs/undef-weak-coalesce.objtxt| FileCheck %s - -# -# Test that undefined symbols preserve their attributes and merge properly -# - ---- -undefined-atoms: - - name: regular_func - can-be-null: never - - name: weak_import_func - can-be-null: at-runtime - - name: weak_func - can-be-null: at-buildtime - - name: bar1 - can-be-null: never - - name: bar2 - can-be-null: at-runtime - - name: bar3 - can-be-null: at-buildtime - - name: bar4 - can-be-null: never - - name: bar5 - can-be-null: at-runtime - - name: bar6 - can-be-null: at-buildtime - - name: bar7 - can-be-null: never - - name: bar8 - can-be-null: at-runtime - - name: bar9 - can-be-null: at-buildtime -... - -# CHECK: - name: regular_func -# CHECK-NEXT: - name: weak_import_func -# CHECK-NEXT: can-be-null: at-runtime -# CHECK-NEXT: - name: weak_func -# CHECK-NEXT: can-be-null: at-buildtime -# CHECK-NEXT: - name: bar1 -# CHECK-NEXT: - name: bar2 -# CHECK-NEXT: can-be-null: at-runtime -# CHECK-NEXT: - name: bar3 -# CHECK-NEXT: can-be-null: at-buildtime -# CHECK-NEXT: - name: bar4 -# CHECK-NEXT: - name: bar5 -# CHECK-NEXT: can-be-null: at-runtime -# CHECK-NEXT: - name: bar7 -# CHECK-NEXT: - name: bar6 -# CHECK-NEXT: - name: bar8 -# CHECK-NEXT: - name: bar9 -# CHECK-NEXT: can-be-null: at-runtime diff --git a/test/core/weak-coalesce.objtxt b/test/core/weak-coalesce.objtxt deleted file mode 100644 index e92aedeb4f15..000000000000 --- a/test/core/weak-coalesce.objtxt +++ /dev/null @@ -1,16 +0,0 @@ -# RUN: lld -core %s %p/Inputs/weak-coalesce.objtxt \ -# RUN: %p/Inputs/weak-coalesce2.objtxt | FileCheck %s - ---- -defined-atoms: - - name: _foo - merge: as-weak - scope: global - type: data -... - - -# CHECK: name: _foo -# CHECK-NOT: merge: as-weak -# CHECK-NOT: name: _foo -# CHECK: ... diff --git a/test/darwin/cmdline-objc_gc.objtxt b/test/darwin/cmdline-objc_gc.objtxt new file mode 100644 index 000000000000..b5225a1d184e --- /dev/null +++ b/test/darwin/cmdline-objc_gc.objtxt @@ -0,0 +1,15 @@ +# RUN: not lld -flavor darwin -arch x86_64 -objc_gc %s 2>&1 | FileCheck %s +# +# Test that the -objc_gc is rejected. +# + +# CHECK: error: -objc_gc is not supported + +--- !native +defined-atoms: + - name: _main + type: code + scope: global + content: [ 0x90 ] + +... diff --git a/test/darwin/cmdline-objc_gc_compaction.objtxt b/test/darwin/cmdline-objc_gc_compaction.objtxt new file mode 100644 index 000000000000..acf7183d95eb --- /dev/null +++ b/test/darwin/cmdline-objc_gc_compaction.objtxt @@ -0,0 +1,15 @@ +# RUN: not lld -flavor darwin -arch x86_64 -objc_gc_compaction %s 2>&1 | FileCheck %s +# +# Test that the -objc_gc_compaction is rejected. +# + +# CHECK: error: -objc_gc_compaction is not supported + +--- !native +defined-atoms: + - name: _main + type: code + scope: global + content: [ 0x90 ] + +... diff --git a/test/darwin/cmdline-objc_gc_only.objtxt b/test/darwin/cmdline-objc_gc_only.objtxt new file mode 100644 index 000000000000..db1cef94ea59 --- /dev/null +++ b/test/darwin/cmdline-objc_gc_only.objtxt @@ -0,0 +1,15 @@ +# RUN: not lld -flavor darwin -arch x86_64 -objc_gc_only %s 2>&1 | FileCheck %s +# +# Test that the -objc_gc_only is rejected. +# + +# CHECK: error: -objc_gc_only is not supported + +--- !native +defined-atoms: + - name: _main + type: code + scope: global + content: [ 0x90 ] + +... diff --git a/test/lit.cfg b/test/lit.cfg index d8794039f152..5ff4fc4edcf2 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -177,6 +177,9 @@ for pattern in tool_patterns: tool_path = llvm_tools_dir + '/' + tool_name config.substitutions.append((pattern, tool_pipe + tool_path)) +# Add site-specific substitutions. +config.substitutions.append( ('%python', config.python_executable) ) + ### # When running under valgrind, we mangle '-vg' onto the end of the triple so we @@ -185,9 +188,13 @@ if lit_config.useValgrind: config.target_triple += '-vg' # Shell execution -if platform.system() not in ['Windows'] or lit_config.getBashPath() != '': +if execute_external: config.available_features.add('shell') +# zlib compression library +if config.have_zlib == "1": + config.available_features.add("zlib") + # Running on Darwin OS if platform.system() in ['Darwin']: config.available_features.add('system-linker-mach-o') @@ -196,6 +203,10 @@ if platform.system() in ['Darwin']: if platform.system() in ['FreeBSD', 'Linux']: config.available_features.add('system-linker-elf') +# Set if host-cxxabi's demangler can handle target's symbols. +if platform.system() not in ['Windows']: + config.available_features.add('demangler') + # llvm-config knows whether it is compiled with asserts (and) # whether we are operating in release/debug mode. import subprocess diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in index 0eeb889d1b20..5293f24c1251 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -1,5 +1,5 @@ -## Autogenerated by LLVM/lld configuration. -# Do not edit! +@LIT_SITE_CFG_IN_HEADER@ + config.llvm_src_root = "@LLVM_SOURCE_DIR@" config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" @@ -8,6 +8,7 @@ config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" config.lld_obj_root = "@LLD_BINARY_DIR@" config.target_triple = "@TARGET_TRIPLE@" config.python_executable = "@PYTHON_EXECUTABLE@" +config.have_zlib = "@HAVE_LIBZ@" # Support substitution of the tools and libs dirs with user parameters. This is # used when we can't determine the tool dir at configuration time. diff --git a/test/mach-o/Inputs/no-version-min-load-command-object.yaml b/test/mach-o/Inputs/no-version-min-load-command-object.yaml new file mode 100644 index 000000000000..35f83c6fd087 --- /dev/null +++ b/test/mach-o/Inputs/no-version-min-load-command-object.yaml @@ -0,0 +1,22 @@ + +# This object file has no version min and so will prevent any -r link from emitting +# a version min. + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + address: 0x0000000000000000 + content: [ 0x00, 0x00, 0x00, 0x00 ] +global-symbols: + - name: _main2 + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000000 +... diff --git a/test/mach-o/Inputs/swift-version-1.yaml b/test/mach-o/Inputs/swift-version-1.yaml new file mode 100644 index 000000000000..1337d7a13245 --- /dev/null +++ b/test/mach-o/Inputs/swift-version-1.yaml @@ -0,0 +1,18 @@ +# RUN: not lld -flavor darwin -arch x86_64 -r %s %p/Inputs/hello-world-x86_64.yaml 2>&1 | FileCheck %s + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +compat-version: 0.0 +current-version: 0.0 +has-UUID: false +OS: unknown +sections: + - segment: __DATA + section: __objc_imageinfo + type: S_REGULAR + attributes: [ S_ATTR_NO_DEAD_STRIP ] + address: 0x0000000000000100 + content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 ] +... diff --git a/test/mach-o/arm-interworking-movw.yaml b/test/mach-o/arm-interworking-movw.yaml index 7e4a2e00ae6e..0423ed644576 100644 --- a/test/mach-o/arm-interworking-movw.yaml +++ b/test/mach-o/arm-interworking-movw.yaml @@ -2,7 +2,7 @@ # RUN: lld -flavor darwin -arch armv7 -r -print_atoms %s -o %t | FileCheck %s # RUN: lld -flavor darwin -arch armv7 -dylib -print_atoms %t -o %t2 \ # RUN: %p/Inputs/libSystem.yaml -sectalign __TEXT __text 0x1000 | FileCheck %s -# RUN: llvm-objdump -d -macho %t2 | FileCheck -check-prefix=CODE %s +# RUN: llvm-objdump -d -macho -no-symbolic-operands %t2 | FileCheck -check-prefix=CODE %s # # Test thumb and arm branches round trip through -r. # Test movw/movt pairs have low bit set properly for thumb vs arm. @@ -330,7 +330,7 @@ local-symbols: # CODE-NEXT: movt r0, #0 # CODE-NEXT: movw r1, #1 # CODE-NEXT: movt r1, #0 -# CODE-NEXT: movw r2, _a2 +# CODE-NEXT: movw r2, #4174 # CODE-NEXT: movt r2, #0 # CODE-NEXT: movw r3, #42 # CODE-NEXT: movt r3, #0 @@ -341,7 +341,7 @@ local-symbols: # CODE-NEXT: movt r0, #0 # CODE-NEXT: movw r1, #65495 # CODE-NEXT: movt r1, #65535 -# CODE-NEXT: movw r2, _a2 +# CODE-NEXT: movw r2, #4174 # CODE-NEXT: movt r2, #0 # CODE-NEXT: movw r3, #0 # CODE-NEXT: movt r3, #0 diff --git a/test/mach-o/arm64-relocs-errors-delta64-offset.yaml b/test/mach-o/arm64-relocs-errors-delta64-offset.yaml index 09c596124893..08e41bc65fff 100644 --- a/test/mach-o/arm64-relocs-errors-delta64-offset.yaml +++ b/test/mach-o/arm64-relocs-errors-delta64-offset.yaml @@ -24,7 +24,7 @@ sections: section: __data type: S_REGULAR attributes: [ ] - alignment: 3 + alignment: 8 address: 0x000000000001C348 content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, diff --git a/test/mach-o/data-in-code-load-command.yaml b/test/mach-o/data-in-code-load-command.yaml new file mode 100644 index 000000000000..604592afcd3f --- /dev/null +++ b/test/mach-o/data-in-code-load-command.yaml @@ -0,0 +1,35 @@ +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml && llvm-objdump -private-headers %t | FileCheck %s +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -static -data_in_code_info && llvm-objdump -private-headers %t | FileCheck %s +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -no_data_in_code_info && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_DATA_IN_CODE_INFO +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -static -data_in_code_info -no_data_in_code_info && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_DATA_IN_CODE_INFO +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -static && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_DATA_IN_CODE_INFO +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -r && llvm-objdump -private-headers %t | FileCheck %s +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -r -data_in_code_info && llvm-objdump -private-headers %t | FileCheck %s +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -r -no_data_in_code_info && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_DATA_IN_CODE_INFO + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + address: 0x0000000000000000 + content: [ 0x00, 0x00, 0x00, 0x00 ] +global-symbols: + - name: _main + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000000 +... + +# CHECK: Load command {{[0-9]*}} +# CHECK: cmd LC_DATA_IN_CODE +# CHECK: cmdsize 16 +# CHECK: dataoff +# CHECK: datasize + +# NO_DATA_IN_CODE_INFO-NOT: LC_DATA_IN_CODE diff --git a/test/mach-o/dead-strip-globals.yaml b/test/mach-o/dead-strip-globals.yaml new file mode 100644 index 000000000000..df5ff73aa441 --- /dev/null +++ b/test/mach-o/dead-strip-globals.yaml @@ -0,0 +1,27 @@ +# RUN: lld -flavor darwin -arch x86_64 -dead_strip -export_dynamic %s -dylib %p/Inputs/libSystem.yaml -o %t.dylib -print_atoms | FileCheck -check-prefix=CHECK1 %s +# RUN: lld -flavor darwin -arch x86_64 -export_dynamic -dead_strip %s -dylib %p/Inputs/libSystem.yaml -o %t.dylib -print_atoms | FileCheck -check-prefix=CHECK1 %s +# RUN: lld -flavor darwin -arch x86_64 -dead_strip %s -dylib %p/Inputs/libSystem.yaml -o %t2.dylib -print_atoms | FileCheck -check-prefix=CHECK2 %s + +# +# Test that -export_dynamic -dead-strip from removing globals. +# + +--- +defined-atoms: + - name: def + scope: global + dead-strip: never + - name: dead + scope: global +shared-library-atoms: + - name: dyld_stub_binder + load-name: /usr/lib/libSystem.B.dylib + type: unknown +... + +# CHECK1: name: def +# CHECK1: name: dead + +# CHECK2: name: def +# CHECK2-NOT: name: dead + diff --git a/test/mach-o/dependency_info.yaml b/test/mach-o/dependency_info.yaml index dcce4381dfd3..2ec59b8afebb 100644 --- a/test/mach-o/dependency_info.yaml +++ b/test/mach-o/dependency_info.yaml @@ -1,8 +1,3 @@ -# XFAIL: win32 -# This test fails on Windows because the linker would use '\' instead -# of '/' as a path separator when concatenating path components. -# So the output from the linker would be different. - # Test -dependency_info option # # RUN: lld -flavor darwin -arch x86_64 -test_file_usage \ @@ -14,11 +9,11 @@ # RUN: -F/Custom/Frameworks \ # RUN: -framework Bar \ # RUN: -framework Foo -# RUN: python %p/Inputs/DependencyDump.py %t.info | FileCheck %s +# RUN: %python %p/Inputs/DependencyDump.py %t.info | FileCheck %s # CHECK: linker-vers: lld -# CHECK: input-file: /Custom/Frameworks/Bar.framework/Bar -# CHECK: not-found: /Custom/Frameworks/Foo.framework/Foo -# CHECK: input-file: /System/Library/Frameworks/Foo.framework/Foo +# CHECK: input-file: /Custom/Frameworks{{[/\\]}}Bar.framework{{[/\\]}}Bar +# CHECK: not-found: /Custom/Frameworks{{[/\\]}}Foo.framework{{[/\\]}}Foo +# CHECK: input-file: /System/Library/Frameworks{{[/\\]}}Foo.framework{{[/\\]}}Foo # CHECK: output-file: a.out diff --git a/test/mach-o/do-not-emit-unwind-fde-arm64.yaml b/test/mach-o/do-not-emit-unwind-fde-arm64.yaml index d306419bc5f9..70f76b5246f1 100644 --- a/test/mach-o/do-not-emit-unwind-fde-arm64.yaml +++ b/test/mach-o/do-not-emit-unwind-fde-arm64.yaml @@ -74,7 +74,7 @@ sections: address: 0x0000000000000050 content: [ 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x7A, 0x50, 0x4C, 0x52, 0x00, 0x01, 0x78, - 0x1E, 0x0B, 0x00, 0xED, 0xFF, 0xFF, 0xFF, 0xFF, + 0x1E, 0x07, 0x00, 0x9D, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x10, 0x0C, 0x1F, 0x00, 0x24, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x88, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, @@ -142,8 +142,8 @@ page-size: 0x00000000 # CHECK: - ref-name: L{{[0-9]*}} # CHECK: type: unwind-cfi # CHECK: content: [ 1C, 00, 00, 00, 00, 00, 00, 00, 01, 7A, 50, 4C, -# CHECK: 52, 00, 01, 78, 1E, 0B, 00, ED, FF, FF, FF, FF, -# CHECK: FF, FF, FF, 00, 10, 0C, 1F, 00 ] +# CHECK: 52, 00, 01, 78, 1E, 07, 00, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, +# CHECK: {{..}}, {{..}}, {{..}}, 00, 10, 0C, 1F, 00 ] # CHECK: - type: unwind-cfi # CHECK: content: [ 24, 00, 00, 00, 24, 00, 00, 00, {{..}}, {{..}}, {{..}}, {{..}}, # CHECK: {{..}}, {{..}}, {{..}}, {{..}}, 20, 00, 00, 00, 00, 00, 00, 00, @@ -197,7 +197,7 @@ page-size: 0x00000000 # CODE: Contents of section __eh_frame: # This is the CIE: # CODE-NEXT: {{[0-9abcdef]*}} 1c000000 00000000 017a504c 52000178 -# CODE-NEXT: {{[0-9abcdef]*}} 1e0b00ed ffffffff ffffff00 100c1f00 +# CODE-NEXT: {{[0-9abcdef]*}} 1e0700bd ffffffff ffffff00 100c1f00 # This is the FDE: # CODE-NEXT: {{[0-9abcdef]*}} 24000000 24000000 a8ffffff ffffffff # This is the important offset for FDE->func ^~~~~~~~ ~~~~~~~~ diff --git a/test/mach-o/dso_handle.yaml b/test/mach-o/dso_handle.yaml index d39d2c230806..400e2c899c90 100644 --- a/test/mach-o/dso_handle.yaml +++ b/test/mach-o/dso_handle.yaml @@ -28,7 +28,7 @@ sections: section: __data type: S_REGULAR attributes: [ ] - alignment: 3 + alignment: 8 address: 0x0000000000000008 content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] relocations: diff --git a/test/mach-o/eh-frame-relocs-arm64.yaml b/test/mach-o/eh-frame-relocs-arm64.yaml new file mode 100644 index 000000000000..6681ded79498 --- /dev/null +++ b/test/mach-o/eh-frame-relocs-arm64.yaml @@ -0,0 +1,318 @@ +# RUN: lld -flavor darwin -arch arm64 -r -print_atoms %s -o %t | FileCheck %s +# RUN: lld -flavor darwin -arch arm64 -r -print_atoms %t -o %t2 | FileCheck %s +# RUN: llvm-objdump -r -s -section="__eh_frame" -macho %t | FileCheck -check-prefix=CODE %s +# RUN: llvm-objdump -r -s -section="__eh_frame" -macho %t2 | FileCheck -check-prefix=CODE %s + + +--- !mach-o +arch: arm64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +compat-version: 0.0 +current-version: 0.0 +has-UUID: false +OS: unknown +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + alignment: 4 + address: 0x0000000000000000 + content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xC0, 0x03, 0x5F, 0xD6, 0xC0, 0x03, 0x5F, 0xD6, + 0xC0, 0x03, 0x5F, 0xD6 ] + - segment: __TEXT + section: __gcc_except_tab + type: S_REGULAR + attributes: [ ] + address: 0x0000000000000014 + content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] + - segment: __DATA + section: __data + type: S_REGULAR + attributes: [ ] + address: 0x000000000000001C + content: [ 0x00, 0x00, 0x00, 0x00 ] + - segment: __LD + section: __compact_unwind + type: S_REGULAR + attributes: [ ] + alignment: 8 + address: 0x0000000000000020 + content: [ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] + relocations: + - offset: 0x00000020 + type: ARM64_RELOC_UNSIGNED + length: 3 + pc-rel: false + extern: false + symbol: 1 + - offset: 0x00000000 + type: ARM64_RELOC_UNSIGNED + length: 3 + pc-rel: false + extern: false + symbol: 1 + - segment: __TEXT + section: __eh_frame + type: S_COALESCED + attributes: [ ] + alignment: 8 + address: 0x0000000000000060 + content: [ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x7A, 0x50, 0x4C, 0x52, 0x00, 0x01, 0x78, + 0x1E, 0x07, 0x9B, 0xED, 0xFF, 0xFF, 0xFF, 0x10, + 0x10, 0x0C, 0x1F, 0x00, 0x28, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0xDC, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0xCB, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0E, 0x10, 0x9E, + 0x01, 0x9D, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x7A, 0x50, 0x4C, 0x52, 0x00, 0x01, 0x78, + 0x1E, 0x07, 0x9B, 0xA9, 0xFF, 0xFF, 0xFF, 0x10, + 0x10, 0x0C, 0x1F, 0x00, 0x28, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x94, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x83, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0E, 0x10, 0x9E, + 0x01, 0x9D, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 ] + relocations: + - offset: 0x0000007D + type: ARM64_RELOC_SUBTRACTOR + length: 3 + pc-rel: false + extern: true + symbol: 6 + - offset: 0x0000007D + type: ARM64_RELOC_UNSIGNED + length: 3 + pc-rel: false + extern: true + symbol: 3 + - offset: 0x0000006C + type: ARM64_RELOC_SUBTRACTOR + length: 3 + pc-rel: false + extern: true + symbol: 6 + - offset: 0x0000006C + type: ARM64_RELOC_UNSIGNED + length: 3 + pc-rel: false + extern: true + symbol: 8 + - offset: 0x0000005B + type: ARM64_RELOC_POINTER_TO_GOT + length: 2 + pc-rel: true + extern: true + symbol: 10 + - offset: 0x00000035 + type: ARM64_RELOC_SUBTRACTOR + length: 3 + pc-rel: false + extern: true + symbol: 6 + - offset: 0x00000035 + type: ARM64_RELOC_UNSIGNED + length: 3 + pc-rel: false + extern: true + symbol: 2 + - offset: 0x00000024 + type: ARM64_RELOC_SUBTRACTOR + length: 3 + pc-rel: false + extern: true + symbol: 6 + - offset: 0x00000024 + type: ARM64_RELOC_UNSIGNED + length: 3 + pc-rel: false + extern: true + symbol: 7 + - offset: 0x00000013 + type: ARM64_RELOC_POINTER_TO_GOT + length: 2 + pc-rel: true + extern: true + symbol: 9 +local-symbols: + - name: ltmp0 + type: N_SECT + sect: 1 + value: 0x0000000000000000 + - name: ltmp1 + type: N_SECT + sect: 2 + value: 0x0000000000000014 + - name: _bar1 + type: N_SECT + sect: 2 + value: 0x0000000000000014 + - name: _bar2 + type: N_SECT + sect: 2 + value: 0x0000000000000018 + - name: ltmp12 + type: N_SECT + sect: 3 + value: 0x000000000000001C + - name: ltmp13 + type: N_SECT + sect: 4 + value: 0x0000000000000020 + - name: ltmp16 + type: N_SECT + sect: 5 + value: 0x0000000000000060 +global-symbols: + - name: __Z3fooi + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000008 + - name: __Z4foo2i + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x000000000000000C + - name: __gxx_personality_v0 + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000000 + - name: __gxx_personality_v1 + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000004 + - name: _main + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000010 + - name: _someData + type: N_SECT + scope: [ N_EXT ] + sect: 3 + value: 0x000000000000001C +page-size: 0x00000000 +... + +# CHECK: --- !native +# CHECK: path: '' +# CHECK: defined-atoms: +# CHECK: - ref-name: L000 +# CHECK: type: unwind-cfi +# CHECK: content: [ 18, 00, 00, 00, 00, 00, 00, 00, 03, 7A, 50, 4C, +# CHECK: 52, 00, 01, 78, 1E, 07, 9B, {{..}}, {{..}}, {{..}}, {{..}}, 10, +# CHECK: 10, 0C, 1F, 00 ] +# CHECK: alignment: 8 +# CHECK: references: +# CHECK: - kind: unwindCIEToPersonalityFunction +# CHECK: offset: 19 +# CHECK: target: __gxx_personality_v0 +# CHECK: - type: unwind-cfi +# CHECK: content: [ 28, 00, 00, 00, 20, 00, 00, 00, {{..}}, {{..}}, {{..}}, {{..}}, +# CHECK: {{..}}, {{..}}, {{..}}, {{..}}, 04, 00, 00, 00, 00, 00, 00, 00, +# CHECK: 08, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, 0E, 10, 9E, +# CHECK: 01, 9D, 02, 00, 00, 00, 00, 00 ] +# CHECK: alignment: 4 mod 8 +# CHECK: references: +# CHECK: - kind: negDelta32 +# CHECK: offset: 4 +# CHECK: target: L000 +# CHECK: - kind: unwindFDEToFunction +# CHECK: offset: 8 +# CHECK: target: __Z3fooi +# CHECK: - kind: unwindFDEToFunction +# CHECK: offset: 25 +# CHECK: target: _bar1 +# CHECK: - ref-name: L001 +# CHECK: type: unwind-cfi +# CHECK: content: [ 18, 00, 00, 00, 00, 00, 00, 00, 03, 7A, 50, 4C, +# CHECK: 52, 00, 01, 78, 1E, 07, 9B, {{..}}, {{..}}, {{..}}, {{..}}, 10, +# CHECK: 10, 0C, 1F, 00 ] +# CHECK: alignment: 8 +# CHECK: references: +# CHECK: - kind: unwindCIEToPersonalityFunction +# CHECK: offset: 19 +# CHECK: target: __gxx_personality_v1 +# CHECK: - type: unwind-cfi +# CHECK: content: [ 28, 00, 00, 00, 20, 00, 00, 00, {{..}}, {{..}}, {{..}}, {{..}}, +# CHECK: {{..}}, {{..}}, {{..}}, {{..}}, 04, 00, 00, 00, 00, 00, 00, 00, +# CHECK: 08, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, 0E, 10, 9E, +# CHECK: 01, 9D, 02, 00, 00, 00, 00, 00 ] +# CHECK: alignment: 4 mod 8 +# CHECK: references: +# CHECK: - kind: negDelta32 +# CHECK: offset: 4 +# CHECK: target: L001 +# CHECK: - kind: unwindFDEToFunction +# CHECK: offset: 8 +# CHECK: target: __Z4foo2i +# CHECK: - kind: unwindFDEToFunction +# CHECK: offset: 25 +# CHECK: target: _bar2 +# CHECK: - name: _bar1 +# CHECK: type: unwind-lsda +# CHECK: content: [ 00, 00, 00, 00 ] +# CHECK: - name: _bar2 +# CHECK: type: unwind-lsda +# CHECK: content: [ 00, 00, 00, 00 ] +# CHECK: - name: _someData +# CHECK: scope: global +# CHECK: type: data +# CHECK: content: [ 00, 00, 00, 00 ] +# CHECK: - name: __gxx_personality_v0 +# CHECK: scope: global +# CHECK: content: [ 00, 00, 00, 00 ] +# CHECK: alignment: 4 +# CHECK: - name: __gxx_personality_v1 +# CHECK: scope: global +# CHECK: content: [ 00, 00, 00, 00 ] +# CHECK: alignment: 4 +# CHECK: - name: __Z3fooi +# CHECK: scope: global +# CHECK: content: [ C0, 03, 5F, D6 ] +# CHECK: alignment: 4 +# CHECK: - name: __Z4foo2i +# CHECK: scope: global +# CHECK: content: [ C0, 03, 5F, D6 ] +# CHECK: alignment: 4 +# CHECK: - name: _main +# CHECK: scope: global +# CHECK: content: [ C0, 03, 5F, D6 ] +# CHECK: alignment: 4 +# CHECK: ... + +# # Make sure we don't have any relocations in the __eh_frame section +# CODE-NOT: RELOCATION RECORDS FOR [__eh_frame] + +# Also make sure the reloc for the CIE->personality function is the +# correct offset +# It should be the offset from the fixup location back to the address +# of the function we are referencing +# CODE: Contents of section __eh_frame: +# This is the CIE: +# CODE-NEXT: {{[0-9abcdef]*}} 18000000 00000000 037a504c 52000178 +# CODE-NEXT: {{[0-9abcdef]*}} 1e079bd1 ffffff10 100c1f00 28000000 +# This is the important offset for CIE->pfunc +# ^~~~~~~~~ +# Then we have an FDE starting from 28000000 above +# CODE-NEXT: {{[0-9abcdef]*}} 20000000 c8ffffff ffffffff 04000000 +# CODE-NEXT: {{[0-9abcdef]*}} 00000000 08c3ffff ffffffff ff0e109e +# And a new CIE starts at this 00000018 right below here +# CODE-NEXT: {{[0-9abcdef]*}} 019d0200 00000000 18000000 00000000 +# CODE-NEXT: {{[0-9abcdef]*}} 037a504c 52000178 1e079b8d ffffff10 +# This is the important offset for its CIE->pfunc ^~~~~~~~~ \ No newline at end of file diff --git a/test/mach-o/error-simulator-vs-macosx.yaml b/test/mach-o/error-simulator-vs-macosx.yaml new file mode 100644 index 000000000000..bd62db39fccb --- /dev/null +++ b/test/mach-o/error-simulator-vs-macosx.yaml @@ -0,0 +1,30 @@ +# RUN: lld -flavor darwin -arch i386 -macosx_version_min 10.8 %s %p/Inputs/hello-world-x86.yaml -o %t && llvm-nm -m %t | FileCheck %s +# RUN: not lld -flavor darwin -arch i386 -ios_simulator_version_min 5.0 %s %p/Inputs/hello-world-x86.yaml -o %t 2>&1 | FileCheck %s --check-prefix=ERROR +# +# Test that i386 can link with a macos version but gives an error with a simululator version. +# + +--- !mach-o +arch: x86 +OS: Mac OS X +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + address: 0x0000000000000000 + content: [ 0x90 ] +global-symbols: + - name: _main + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000000 +... + +# CHECK: {{[0-9a-f]+}} (__TEXT,__text) external _main +# CHECK: (undefined) external dyld_stub_binder (from libSystem) + +# ERROR: cannot be linked due to incompatible operating systems diff --git a/test/mach-o/function-starts-load-command.yaml b/test/mach-o/function-starts-load-command.yaml new file mode 100644 index 000000000000..9f251898f6e0 --- /dev/null +++ b/test/mach-o/function-starts-load-command.yaml @@ -0,0 +1,32 @@ +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml && llvm-objdump -private-headers %t | FileCheck %s +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -static -function_starts && llvm-objdump -private-headers %t | FileCheck %s +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -no_function_starts && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_FUNCTION_STARTS +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -static -function_starts -no_function_starts && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_FUNCTION_STARTS +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -static && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_FUNCTION_STARTS + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + address: 0x0000000000000000 + content: [ 0x00, 0x00, 0x00, 0x00 ] +global-symbols: + - name: _main + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000000 +... + +# CHECK: Load command {{[0-9]*}} +# CHECK: cmd LC_FUNCTION_STARTS +# CHECK: cmdsize 16 +# CHECK: dataoff +# CHECK: datasize + +# NO_FUNCTION_STARTS-NOT: LC_FUNCTION_STARTS diff --git a/test/mach-o/hello-world-x86_64.yaml b/test/mach-o/hello-world-x86_64.yaml index 340ceefbe7cb..8803c4476c39 100644 --- a/test/mach-o/hello-world-x86_64.yaml +++ b/test/mach-o/hello-world-x86_64.yaml @@ -54,7 +54,7 @@ sections: section: __compact_unwind type: S_REGULAR attributes: [ ] - alignment: 3 + alignment: 8 address: 0x0000000000000028 content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, @@ -71,7 +71,7 @@ sections: section: __eh_frame type: S_COALESCED attributes: [ ] - alignment: 3 + alignment: 8 address: 0x0000000000000048 content: [ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x7A, 0x52, 0x00, 0x01, 0x78, 0x10, 0x01, @@ -116,4 +116,5 @@ undefined-symbols: # CHECK: (undefined) external ___stdoutp (from libSystem) # CHECK: (undefined) external _fprintf (from libSystem) # CHECK: (undefined) external dyld_stub_binder (from libSystem) +# CHECK: {{[0-9a-f]+}} (__TEXT,__text) [referenced dynamically] external __mh_execute_header # CHECK: {{[0-9a-f]+}} (__TEXT,__text) external _main diff --git a/test/mach-o/interposing-section.yaml b/test/mach-o/interposing-section.yaml index 76e33904d113..4f6bafc200fb 100644 --- a/test/mach-o/interposing-section.yaml +++ b/test/mach-o/interposing-section.yaml @@ -31,7 +31,7 @@ sections: section: __interpose type: S_INTERPOSING attributes: [ ] - alignment: 3 + alignment: 8 address: 0x0000000000000010 content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] diff --git a/test/mach-o/lazy-bind-x86_64.yaml b/test/mach-o/lazy-bind-x86_64.yaml index 1b4699feed35..ee3e2278b15b 100644 --- a/test/mach-o/lazy-bind-x86_64.yaml +++ b/test/mach-o/lazy-bind-x86_64.yaml @@ -83,6 +83,17 @@ undefined-symbols: # CHECK-HELPERS: 68 10 00 00 00 pushq $16 # CHECK-HELPERS: 68 20 00 00 00 pushq $32 +# Make sure the stub helper is correctly aligned +# CHECK-DYLIBS: sectname __stub_helper +# CHECK-DYLIBS-NEXT: segname __TEXT +# CHECK-DYLIBS-NEXT: addr +# CHECK-DYLIBS-NEXT: size +# CHECK-DYLIBS-NEXT: offset +# CHECK-DYLIBS-NEXT: align 2^2 (4) + +# Make sure the __nl_symbol_ptr section is used instea of __got as this is x86_64 +# CHECK-DYLIBS: sectname __nl_symbol_ptr +# CHECK-DYLIBS-NEXT: segname __DATA # CHECK-DYLIBS: cmd LC_LOAD_DYLIB # CHECK-DYLIBS: name /usr/lib/libbar.dylib (offset 24) diff --git a/test/mach-o/mach_header-cpusubtype.yaml b/test/mach-o/mach_header-cpusubtype.yaml new file mode 100644 index 000000000000..fa9024f999db --- /dev/null +++ b/test/mach-o/mach_header-cpusubtype.yaml @@ -0,0 +1,34 @@ +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.4 %s %p/Inputs/hello-world-x86_64.yaml -o %t && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_LIB64 +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.5 %s %p/Inputs/hello-world-x86_64.yaml -o %t && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=LIB64 +# RUN: lld -flavor darwin -arch x86_64 -dylib -macosx_version_min 10.5 %s %p/Inputs/hello-world-x86_64.yaml -o %t && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=DYLIB + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +has-UUID: false +OS: unknown +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + address: 0x0000000000000000 + content: [ 0x00, 0x00 ] +global-symbols: + - name: _main + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000000 + - name: start + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000001 + +... + +# NO_LIB64: MH_MAGIC_64 X86_64 ALL 0x00 EXECUTE +# LIB64: MH_MAGIC_64 X86_64 ALL LIB64 EXECUTE +# DYLIB: MH_MAGIC_64 X86_64 ALL 0x00 DYLIB diff --git a/test/mach-o/mh_bundle_header.yaml b/test/mach-o/mh_bundle_header.yaml index 558df2ca2e95..e440141c5689 100644 --- a/test/mach-o/mh_bundle_header.yaml +++ b/test/mach-o/mh_bundle_header.yaml @@ -1,5 +1,5 @@ -# RUN: lld -flavor darwin -arch x86_64 %s -bundle -o %t %p/Inputs/libSystem.yaml -# RUN: llvm-nm -m -n %t | FileCheck %s +# RUN: lld -flavor darwin -arch x86_64 %s -bundle -o %t %p/Inputs/libSystem.yaml && llvm-nm -m -n %t | FileCheck %s +# RUN: lld -flavor darwin -arch x86_64 %s -bundle -dead_strip -o %t %p/Inputs/libSystem.yaml && llvm-nm -m -n %t | FileCheck %s # # Test that __mh_bundle_header symbol is available for bundles # @@ -19,7 +19,7 @@ sections: section: __data type: S_REGULAR attributes: [ ] - alignment: 3 + alignment: 8 address: 0x0000000000000008 content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] relocations: @@ -39,6 +39,7 @@ global-symbols: type: N_SECT scope: [ N_EXT ] sect: 1 + desc: [ N_NO_DEAD_STRIP ] value: 0x0000000000000000 undefined-symbols: - name: __mh_bundle_header @@ -49,5 +50,5 @@ undefined-symbols: ... -# CHECK_NOT: __mh_bundle_header +# CHECK: __mh_bundle_header # CHECK: _foo diff --git a/test/mach-o/mh_dylib_header.yaml b/test/mach-o/mh_dylib_header.yaml index 07429b30c943..96b67aacae21 100644 --- a/test/mach-o/mh_dylib_header.yaml +++ b/test/mach-o/mh_dylib_header.yaml @@ -19,7 +19,7 @@ sections: section: __data type: S_REGULAR attributes: [ ] - alignment: 3 + alignment: 8 address: 0x0000000000000008 content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] relocations: diff --git a/test/mach-o/objc-category-list-atom.yaml b/test/mach-o/objc-category-list-atom.yaml new file mode 100644 index 000000000000..e06117124190 --- /dev/null +++ b/test/mach-o/objc-category-list-atom.yaml @@ -0,0 +1,70 @@ +# RUN: lld -flavor darwin -arch x86_64 -r -print_atoms %s -o %t | FileCheck %s +# RUN: lld -flavor darwin -arch x86_64 -r -print_atoms %t -o %t2 | FileCheck %s + + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +compat-version: 0.0 +current-version: 0.0 +has-UUID: false +OS: unknown +sections: + - segment: __DATA + section: __objc_catlist + type: S_REGULAR + attributes: [ S_ATTR_NO_DEAD_STRIP ] + alignment: 8 + address: 0x00000000000003F8 + content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] + relocations: + - offset: 0x00000008 + type: X86_64_RELOC_UNSIGNED + length: 3 + pc-rel: false + extern: true + symbol: 0 + - offset: 0x00000000 + type: X86_64_RELOC_UNSIGNED + length: 3 + pc-rel: false + extern: true + symbol: 1 +undefined-symbols: + - name: __category1 + type: N_UNDF + scope: [ N_EXT ] + value: 0x0000000000000000 + - name: __category2 + type: N_UNDF + scope: [ N_EXT ] + value: 0x0000000000000000 +page-size: 0x00000000 +... + +# Make sure we atomize the category list section by pointer sized atoms. + +# CHECK: path: '' +# CHECK: defined-atoms: +# CHECK: - type: objc-category-list +# CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] +# CHECK: merge: by-content +# CHECK: alignment: 8 +# CHECK: references: +# CHECK: - kind: pointer64 +# CHECK: offset: 0 +# CHECK: target: __category2 +# CHECK: - type: objc-category-list +# CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] +# CHECK: merge: by-content +# CHECK: alignment: 8 +# CHECK: references: +# CHECK: - kind: pointer64 +# CHECK: offset: 0 +# CHECK: target: __category1 +# CHECK: undefined-atoms: +# CHECK: - name: __category1 +# CHECK: - name: __category2 +# CHECK: ... diff --git a/test/mach-o/objc-image-info-host-vs-simulator.yaml b/test/mach-o/objc-image-info-host-vs-simulator.yaml new file mode 100644 index 000000000000..f836a7423271 --- /dev/null +++ b/test/mach-o/objc-image-info-host-vs-simulator.yaml @@ -0,0 +1,23 @@ +# RUN: not lld -flavor darwin -arch x86_64 -r %s 2>&1 | FileCheck %s + +# The file is built for the host, but the objc image info flags are for +# the simulator. + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +compat-version: 0.0 +current-version: 0.0 +has-UUID: false +OS: unknown +sections: + - segment: __DATA + section: __objc_imageinfo + type: S_REGULAR + attributes: [ S_ATTR_NO_DEAD_STRIP ] + address: 0x0000000000000100 + content: [ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00 ] +... + +# CHECK: {{.*}} cannot be linked. It contains ObjC built for the simulator while we are linking a non-simulator target \ No newline at end of file diff --git a/test/mach-o/objc-image-info-invalid-size.yaml b/test/mach-o/objc-image-info-invalid-size.yaml new file mode 100644 index 000000000000..47fce886f2cc --- /dev/null +++ b/test/mach-o/objc-image-info-invalid-size.yaml @@ -0,0 +1,20 @@ +# RUN: not lld -flavor darwin -arch x86_64 -r %s 2>&1 | FileCheck %s + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +compat-version: 0.0 +current-version: 0.0 +has-UUID: false +OS: unknown +sections: + - segment: __DATA + section: __objc_imageinfo + type: S_REGULAR + attributes: [ S_ATTR_NO_DEAD_STRIP ] + address: 0x0000000000000100 + content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] +... + +# CHECK: error: __DATA/__objc_imageinfo in file {{.*}} should be 8 bytes in size \ No newline at end of file diff --git a/test/mach-o/objc-image-info-invalid-version.yaml b/test/mach-o/objc-image-info-invalid-version.yaml new file mode 100644 index 000000000000..04d62e9fb789 --- /dev/null +++ b/test/mach-o/objc-image-info-invalid-version.yaml @@ -0,0 +1,20 @@ +# RUN: not lld -flavor darwin -arch x86_64 -r %s 2>&1 | FileCheck %s + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +compat-version: 0.0 +current-version: 0.0 +has-UUID: false +OS: unknown +sections: + - segment: __DATA + section: __objc_imageinfo + type: S_REGULAR + attributes: [ S_ATTR_NO_DEAD_STRIP ] + address: 0x0000000000000100 + content: [ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 ] +... + +# CHECK: error: __DATA/__objc_imageinfo in file {{.*}} should have version=0 \ No newline at end of file diff --git a/test/mach-o/objc-image-info-mismatched-swift-version.yaml b/test/mach-o/objc-image-info-mismatched-swift-version.yaml new file mode 100644 index 000000000000..efb7c319285b --- /dev/null +++ b/test/mach-o/objc-image-info-mismatched-swift-version.yaml @@ -0,0 +1,20 @@ +# RUN: not lld -flavor darwin -arch x86_64 -r %s %p/Inputs/swift-version-1.yaml 2>&1 | FileCheck %s + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +compat-version: 0.0 +current-version: 0.0 +has-UUID: false +OS: unknown +sections: + - segment: __DATA + section: __objc_imageinfo + type: S_REGULAR + attributes: [ S_ATTR_NO_DEAD_STRIP ] + address: 0x0000000000000100 + content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00 ] +... + +# CHECK: different swift versions \ No newline at end of file diff --git a/test/mach-o/objc-image-info-pass-output.yaml b/test/mach-o/objc-image-info-pass-output.yaml new file mode 100644 index 000000000000..7fc95a846324 --- /dev/null +++ b/test/mach-o/objc-image-info-pass-output.yaml @@ -0,0 +1,30 @@ +# RUN: lld -flavor darwin -ios_simulator_version_min 5.0 -arch x86_64 -r %s -o %t -print_atoms | FileCheck %s + +# Make sure that we have an objc image info in the output. It should have +# been generated by the objc pass. + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +compat-version: 0.0 +current-version: 0.0 +has-UUID: false +OS: unknown +sections: + - segment: __DATA + section: __objc_imageinfo + type: S_REGULAR + attributes: [ S_ATTR_NO_DEAD_STRIP ] + address: 0x0000000000000100 + content: [ 0x00, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00 ] +... + +# CHECK: --- !native +# CHECK: path: '' +# CHECK: defined-atoms: +# CHECK: - scope: hidden +# CHECK: type: objc-image-info +# CHECK: content: [ 00, 00, 00, 00, 20, 02, 00, 00 ] +# CHECK: alignment: 4 +# CHECK: ... \ No newline at end of file diff --git a/test/mach-o/objc-image-info-simulator-vs-host.yaml b/test/mach-o/objc-image-info-simulator-vs-host.yaml new file mode 100644 index 000000000000..c4f9bd58f968 --- /dev/null +++ b/test/mach-o/objc-image-info-simulator-vs-host.yaml @@ -0,0 +1,23 @@ +# RUN: not lld -flavor darwin -ios_simulator_version_min 5.0 -arch x86_64 -r %s 2>&1 | FileCheck %s + +# The file is built for the simulator, but the objc image info flags are for +# the host. + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +compat-version: 0.0 +current-version: 0.0 +has-UUID: false +OS: unknown +sections: + - segment: __DATA + section: __objc_imageinfo + type: S_REGULAR + attributes: [ S_ATTR_NO_DEAD_STRIP ] + address: 0x0000000000000100 + content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] +... + +# CHECK: {{.*}} cannot be linked. It contains ObjC built for a non-simulator target while we are linking a simulator target \ No newline at end of file diff --git a/test/mach-o/objc-image-info-unsupported-gc.yaml b/test/mach-o/objc-image-info-unsupported-gc.yaml new file mode 100644 index 000000000000..9f98369a39cb --- /dev/null +++ b/test/mach-o/objc-image-info-unsupported-gc.yaml @@ -0,0 +1,20 @@ +# RUN: not lld -flavor darwin -arch x86_64 -r %s 2>&1 | FileCheck %s + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +compat-version: 0.0 +current-version: 0.0 +has-UUID: false +OS: unknown +sections: + - segment: __DATA + section: __objc_imageinfo + type: S_REGULAR + attributes: [ S_ATTR_NO_DEAD_STRIP ] + address: 0x0000000000000100 + content: [ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 ] +... + +# CHECK: error: __DATA/__objc_imageinfo in file {{.*}} uses GC. This is not supported \ No newline at end of file diff --git a/test/mach-o/objc_export_list.yaml b/test/mach-o/objc_export_list.yaml index 9eb0af77726e..e67a4c7ece75 100644 --- a/test/mach-o/objc_export_list.yaml +++ b/test/mach-o/objc_export_list.yaml @@ -15,7 +15,7 @@ sections: section: __objc_data type: S_REGULAR attributes: [ ] - alignment: 3 + alignment: 8 address: 0x0000000000000000 content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/test/mach-o/parse-cfstring32.yaml b/test/mach-o/parse-cfstring32.yaml index 657e733a779b..8e746f276664 100644 --- a/test/mach-o/parse-cfstring32.yaml +++ b/test/mach-o/parse-cfstring32.yaml @@ -21,7 +21,7 @@ sections: section: __cfstring type: S_REGULAR attributes: [ ] - alignment: 3 + alignment: 8 address: 0x0000000000000010 content: [ 0x00, 0x00, 0x00, 0x00, 0xC8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, diff --git a/test/mach-o/parse-compact-unwind64.yaml b/test/mach-o/parse-compact-unwind64.yaml index b61961a3d0b0..af8967476e16 100644 --- a/test/mach-o/parse-compact-unwind64.yaml +++ b/test/mach-o/parse-compact-unwind64.yaml @@ -23,7 +23,7 @@ sections: section: __compact_unwind type: S_REGULAR attributes: [ ] - alignment: 3 + alignment: 8 address: 0x0000000000000020 content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, diff --git a/test/mach-o/parse-data-relocs-x86_64.yaml b/test/mach-o/parse-data-relocs-x86_64.yaml index 6b05e26372b8..72a256ef1f02 100644 --- a/test/mach-o/parse-data-relocs-x86_64.yaml +++ b/test/mach-o/parse-data-relocs-x86_64.yaml @@ -76,6 +76,13 @@ sections: # Note the addend here is -16 because that is the offset from here back # to _d. 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, +# .quad . - _foo +# This is the pair X86_64_RELOC_SUBTRACTOR and X86_64_RELOC_UNSIGNED. +# The subtractor references _d which is the first nonlocal label in this +# section. The unsigned references _foo. +# Note the addend here is -16 because that is the offset from here back +# to _d. + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # .quad L1 # This is a X86_64_RELOC_UNSIGNED without extern set. # In this case, we encode the section number for L1 in the relocation, and @@ -95,132 +102,163 @@ sections: # section. The unsigned references _foo. # Note the addend here is -40 because that is the offset from here back # to _d. - 0xD8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xD0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, # .quad _foo + 4 - . # This is the pair X86_64_RELOC_SUBTRACTOR and X86_64_RELOC_UNSIGNED. # The subtractor references _d which is the first nonlocal label in this # section. The unsigned references _foo. -# Note the addend here is -44. It would have been -48 because that +# Note the addend here is -52. It would have been -56 because that # would take us from the address of this relocation back to _d. But as -# we also add 4 for the offset, we get -44. - 0xD4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, +# we also add 4 for the offset, we get -52. + 0xCC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, # .quad L1 - . # This is the pair X86_64_RELOC_SUBTRACTOR and X86_64_RELOC_UNSIGNED. # The subtractor references _d which is the first nonlocal label in this # section. The unsigned does not have extern set, so the relocation # number is the section number for L1. -# Note the addend here is -54. Of that, -56 would be the offset from +# Note the addend here is -62. Of that, -64 would be the offset from # this location from _d. The remaining 2 is the absolute address # of L1. - 0xCA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, # .long _foo - . # This is the pair X86_64_RELOC_SUBTRACTOR and X86_64_RELOC_UNSIGNED. # The subtractor references _d which is the first nonlocal label in this # section. The unsigned references _foo. -# Note the addend here is -64 because that is the offset from here back +# Note the addend here is -72 because that is the offset from here back +# to _d. + 0xB8, 0xFF, 0xFF, 0xFF, +# .long . - _foo +# This is the pair X86_64_RELOC_SUBTRACTOR and X86_64_RELOC_UNSIGNED. +# The subtractor references _d which is the first nonlocal label in this +# section. The unsigned references _foo. +# Note the addend here is -76 because that is the offset from here back # to _d. - 0xC0, 0xFF, 0xFF, 0xFF, + 0xB4, 0xFF, 0xFF, 0xFF, # .long _foo + 4 - . # This is the pair X86_64_RELOC_SUBTRACTOR and X86_64_RELOC_UNSIGNED. # The subtractor references _d which is the first nonlocal label in this # section. The unsigned references _foo. -# Note the addend here is -64. It would have been -68 because that +# Note the addend here is -76. It would have been -80 because that # would take us from the address of this relocation back to _d. But as -# we also add 4 for the offset, we get -64. - 0xC0, 0xFF, 0xFF, 0xFF, +# we also add 4 for the offset, we get -76. + 0xB4, 0xFF, 0xFF, 0xFF, # .long L1 - . # This is the pair X86_64_RELOC_SUBTRACTOR and X86_64_RELOC_UNSIGNED. # The subtractor references _d which is the first nonlocal label in this # section. The unsigned does not have extern set, so the relocation # number is the section number for L1. -# Note the addend here is -70. Of that, -72 would be the offset from +# Note the addend here is -82. Of that, -84 would be the offset from # this location from _d. The remaining 2 is the absolute address # of L1. - 0xBA, 0xFF, 0xFF, 0xFF ] + 0xAE, 0xFF, 0xFF, 0xFF ] relocations: - - offset: 0x00000048 + - offset: 0x00000054 type: X86_64_RELOC_SUBTRACTOR length: 2 pc-rel: false extern: true symbol: 2 - - offset: 0x00000048 + - offset: 0x00000054 type: X86_64_RELOC_UNSIGNED length: 2 pc-rel: false extern: false symbol: 2 - - offset: 0x00000044 + - offset: 0x00000050 type: X86_64_RELOC_SUBTRACTOR length: 2 pc-rel: false extern: true symbol: 2 - - offset: 0x00000044 + - offset: 0x00000050 type: X86_64_RELOC_UNSIGNED length: 2 pc-rel: false extern: true symbol: 0 - - offset: 0x00000040 + - offset: 0x0000004C + type: X86_64_RELOC_SUBTRACTOR + length: 2 + pc-rel: false + extern: true + symbol: 0 + - offset: 0x0000004C + type: X86_64_RELOC_UNSIGNED + length: 2 + pc-rel: false + extern: true + symbol: 2 + - offset: 0x00000048 type: X86_64_RELOC_SUBTRACTOR length: 2 pc-rel: false extern: true symbol: 2 - - offset: 0x00000040 + - offset: 0x00000048 type: X86_64_RELOC_UNSIGNED length: 2 pc-rel: false extern: true symbol: 0 - - offset: 0x00000038 + - offset: 0x00000040 type: X86_64_RELOC_SUBTRACTOR length: 3 pc-rel: false extern: true symbol: 2 - - offset: 0x00000038 + - offset: 0x00000040 type: X86_64_RELOC_UNSIGNED length: 3 pc-rel: false extern: false symbol: 2 - - offset: 0x00000030 + - offset: 0x00000038 type: X86_64_RELOC_SUBTRACTOR length: 3 pc-rel: false extern: true symbol: 2 - - offset: 0x00000030 + - offset: 0x00000038 type: X86_64_RELOC_UNSIGNED length: 3 pc-rel: false extern: true symbol: 0 - - offset: 0x00000028 + - offset: 0x00000030 type: X86_64_RELOC_SUBTRACTOR length: 3 pc-rel: false extern: true symbol: 2 - - offset: 0x00000028 + - offset: 0x00000030 type: X86_64_RELOC_UNSIGNED length: 3 pc-rel: false extern: true symbol: 0 + - offset: 0x00000028 + type: X86_64_RELOC_UNSIGNED + length: 3 + pc-rel: false + extern: false + symbol: 2 - offset: 0x00000020 type: X86_64_RELOC_UNSIGNED length: 3 pc-rel: false extern: false symbol: 2 + - offset: 0x00000018 + type: X86_64_RELOC_SUBTRACTOR + length: 3 + pc-rel: false + extern: true + symbol: 0 - offset: 0x00000018 type: X86_64_RELOC_UNSIGNED length: 3 pc-rel: false - extern: false + extern: true symbol: 2 - offset: 0x00000010 type: X86_64_RELOC_SUBTRACTOR @@ -266,12 +304,13 @@ page-size: 0x00000000 # CHECK:defined-atoms: # CHECK: - name: _d # CHECK: type: data -# CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00, 04, 00, 00, 00, -# CHECK: 00, 00, 00, 00, F0, FF, FF, FF, FF, FF, FF, FF, -# CHECK: {{..}}, {{..}}, 00, 00, 00, 00, 00, 00, {{..}}, {{..}}, 00, 00, -# CHECK: 00, 00, 00, 00, D8, FF, FF, FF, FF, FF, FF, FF, -# CHECK: D4, FF, FF, FF, FF, FF, FF, FF, {{..}}, {{..}}, {{..}}, {{..}}, -# CHECK: {{..}}, {{..}}, {{..}}, {{..}}, C0, FF, FF, FF, C0, FF, FF, FF, +# CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00, 04, 00, 00, 00, +# CHECK: 00, 00, 00, 00, F0, FF, FF, FF, FF, FF, FF, FF, +# CHECK: 18, 00, 00, 00, 00, 00, 00, 00, {{..}}, {{..}}, 00, 00, +# CHECK: 00, 00, 00, 00, {{..}}, {{..}}, 00, 00, 00, 00, 00, 00, +# CHECK: D0, FF, FF, FF, FF, FF, FF, FF, CC, FF, FF, FF, +# CHECK: FF, FF, FF, FF, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, +# CHECK: B8, FF, FF, FF, B4, FF, FF, FF, B4, FF, FF, FF, # CHECK: {{..}}, {{..}}, {{..}}, {{..}} ] # CHECK: dead-strip: never # CHECK: references: @@ -285,32 +324,38 @@ page-size: 0x00000000 # CHECK: - kind: delta64 # CHECK: offset: 16 # CHECK: target: _foo -# CHECK: - kind: pointer64Anon +# CHECK: - kind: negDelta64 # CHECK: offset: 24 -# CHECK: target: L003 +# CHECK: target: _foo # CHECK: - kind: pointer64Anon # CHECK: offset: 32 # CHECK: target: L003 +# CHECK: - kind: pointer64Anon +# CHECK: offset: 40 +# CHECK: target: L003 # CHECK: addend: 2 # CHECK: - kind: delta64 -# CHECK: offset: 40 +# CHECK: offset: 48 # CHECK: target: _foo # CHECK: - kind: delta64 -# CHECK: offset: 48 +# CHECK: offset: 56 # CHECK: target: _foo # CHECK: addend: 4 # CHECK: - kind: delta64Anon -# CHECK: offset: 56 +# CHECK: offset: 64 # CHECK: target: L003 # CHECK: - kind: delta32 -# CHECK: offset: 64 +# CHECK: offset: 72 +# CHECK: target: _foo +# CHECK: - kind: negDelta32 +# CHECK: offset: 76 # CHECK: target: _foo # CHECK: - kind: delta32 -# CHECK: offset: 68 +# CHECK: offset: 80 # CHECK: target: _foo # CHECK: addend: 4 # CHECK: - kind: delta32Anon -# CHECK: offset: 72 +# CHECK: offset: 84 # CHECK: target: L003 # CHECK: - name: _foo # CHECK: content: [ C3 ] @@ -323,4 +368,5 @@ page-size: 0x00000000 # CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] # CHECK: section-choice: custom-required # CHECK: section-name: __DATA/__custom +# CHECK: dead-strip: never diff --git a/test/mach-o/parse-data.yaml b/test/mach-o/parse-data.yaml index 61d77290d108..3b422e04cae7 100644 --- a/test/mach-o/parse-data.yaml +++ b/test/mach-o/parse-data.yaml @@ -22,7 +22,7 @@ sections: section: __data type: S_REGULAR attributes: [ ] - alignment: 3 + alignment: 8 address: 0x0000000000000000 content: [ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x11, 0x12, 0x13, 0x14, 0x21, 0x22, 0x23, 0x24, @@ -31,7 +31,7 @@ sections: section: __custom type: S_REGULAR attributes: [ ] - alignment: 3 + alignment: 8 address: 0x0000000000000018 content: [ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 ] - segment: __DATA diff --git a/test/mach-o/parse-eh-frame.yaml b/test/mach-o/parse-eh-frame.yaml index 69324800e991..6453474024bb 100644 --- a/test/mach-o/parse-eh-frame.yaml +++ b/test/mach-o/parse-eh-frame.yaml @@ -22,7 +22,7 @@ sections: section: __eh_frame type: S_COALESCED attributes: [ ] - alignment: 3 + alignment: 8 address: 0x0000000000000058 content: [ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x7A, 0x52, 0x00, 0x01, 0x78, 0x10, 0x01, diff --git a/test/mach-o/sdk-version-error.yaml b/test/mach-o/sdk-version-error.yaml new file mode 100644 index 000000000000..2607bb8e9c58 --- /dev/null +++ b/test/mach-o/sdk-version-error.yaml @@ -0,0 +1,22 @@ +# RUN: not lld -flavor darwin -arch x86_64 -sdk_version 10.blah %s -o %t 2>&1 | FileCheck %s --check-prefix=ERROR + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + address: 0x0000000000000000 + content: [ 0x00, 0x00, 0x00, 0x00 ] +global-symbols: + - name: _main + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000000 +... + +# ERROR: malformed sdkVersion value \ No newline at end of file diff --git a/test/mach-o/sectattrs.yaml b/test/mach-o/sectattrs.yaml new file mode 100644 index 000000000000..800ba55d1b3b --- /dev/null +++ b/test/mach-o/sectattrs.yaml @@ -0,0 +1,30 @@ +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -dylib \ +# RUN: %p/Inputs/libSystem.yaml -o %t \ +# RUN: && llvm-objdump -private-headers %t | FileCheck %s +# + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ ] + address: 0x0000000000000000 + content: [ 0x55, 0x48, 0x89, 0xE5, 0x8B, 0x05, 0x00, 0x00, + 0x00, 0x00, 0x03, 0x05, 0x00, 0x00, 0x00, 0x00, + 0x5D, 0xC3 ] +global-symbols: + - name: _get + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000000 + +... + + +# CHECK: PURE_INSTRUCTIONS SOME_INSTRUCTIONS + diff --git a/test/mach-o/seg-protection-arm64.yaml b/test/mach-o/seg-protection-arm64.yaml new file mode 100644 index 000000000000..f63b33ad2dc3 --- /dev/null +++ b/test/mach-o/seg-protection-arm64.yaml @@ -0,0 +1,78 @@ +# RUN: lld -flavor darwin -arch arm64 %s %p/Inputs/hello-world-arm64.yaml -o %t && llvm-objdump -private-headers %t | FileCheck %s + +--- !mach-o +arch: arm64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +has-UUID: false +OS: unknown +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + address: 0x0000000000000000 + content: [ 0x00, 0x00 ] +global-symbols: + - name: _main + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000000 + - name: start + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000001 + +... + +# CHECK: Load command 0 +# CHECK: cmd LC_SEGMENT_64 +# CHECK: cmdsize 72 +# CHECK: segname __PAGEZERO +# CHECK: vmaddr +# CHECK: vmsize +# CHECK: fileoff +# CHECK: filesize +# CHECK: maxprot --- +# CHECK: initprot --- +# CHECK: nsects 0 +# CHECK: flags (none) +# CHECK: Load command 1 +# CHECK: cmd LC_SEGMENT_64 +# CHECK: cmdsize 152 +# CHECK: segname __TEXT +# CHECK: vmaddr +# CHECK: vmsize +# CHECK: fileoff +# CHECK: filesize +# CHECK: maxprot r-x +# CHECK: initprot r-x +# CHECK: nsects 1 +# CHECK: flags (none) +# CHECK: Section +# CHECK: sectname __text +# CHECK: segname __TEXT +# CHECK: addr +# CHECK: size +# CHECK: offset +# CHECK: align 2^0 (1) +# CHECK: reloff 0 +# CHECK: nreloc 0 +# CHECK: type S_REGULAR +# CHECK: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS +# CHECK: reserved1 0 +# CHECK: reserved2 0 +# CHECK: Load command 2 +# CHECK: cmd LC_SEGMENT_64 +# CHECK: cmdsize 72 +# CHECK: segname __LINKEDIT +# CHECK: vmaddr +# CHECK: vmsize +# CHECK: fileoff +# CHECK: filesize +# CHECK: maxprot r-- +# CHECK: initprot r-- +# CHECK: nsects 0 +# CHECK: flags (none) diff --git a/test/mach-o/seg-protection-x86_64.yaml b/test/mach-o/seg-protection-x86_64.yaml new file mode 100644 index 000000000000..474f72f4c57f --- /dev/null +++ b/test/mach-o/seg-protection-x86_64.yaml @@ -0,0 +1,78 @@ +# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/hello-world-x86_64.yaml -o %t && llvm-objdump -private-headers %t | FileCheck %s + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +has-UUID: false +OS: unknown +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + address: 0x0000000000000000 + content: [ 0x00, 0x00 ] +global-symbols: + - name: _main + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000000 + - name: start + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000001 + +... + +# CHECK: Load command 0 +# CHECK: cmd LC_SEGMENT_64 +# CHECK: cmdsize 72 +# CHECK: segname __PAGEZERO +# CHECK: vmaddr +# CHECK: vmsize +# CHECK: fileoff +# CHECK: filesize +# CHECK: maxprot --- +# CHECK: initprot --- +# CHECK: nsects 0 +# CHECK: flags (none) +# CHECK: Load command 1 +# CHECK: cmd LC_SEGMENT_64 +# CHECK: cmdsize 152 +# CHECK: segname __TEXT +# CHECK: vmaddr +# CHECK: vmsize +# CHECK: fileoff +# CHECK: filesize +# CHECK: maxprot rwx +# CHECK: initprot r-x +# CHECK: nsects 1 +# CHECK: flags (none) +# CHECK: Section +# CHECK: sectname __text +# CHECK: segname __TEXT +# CHECK: addr +# CHECK: size +# CHECK: offset +# CHECK: align 2^0 (1) +# CHECK: reloff 0 +# CHECK: nreloc 0 +# CHECK: type S_REGULAR +# CHECK: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS +# CHECK: reserved1 0 +# CHECK: reserved2 0 +# CHECK: Load command 2 +# CHECK: cmd LC_SEGMENT_64 +# CHECK: cmdsize 72 +# CHECK: segname __LINKEDIT +# CHECK: vmaddr +# CHECK: vmsize +# CHECK: fileoff +# CHECK: filesize +# CHECK: maxprot rwx +# CHECK: initprot r-- +# CHECK: nsects 0 +# CHECK: flags (none) diff --git a/test/mach-o/source-version.yaml b/test/mach-o/source-version.yaml new file mode 100644 index 000000000000..169e97571357 --- /dev/null +++ b/test/mach-o/source-version.yaml @@ -0,0 +1,28 @@ +# RUN: not lld -flavor darwin -arch x86_64 -source_version 10.blah %s -o %t 2>&1 | FileCheck %s --check-prefix=ERROR +# RUN: lld -flavor darwin -arch x86_64 -source_version 10.1.2.3.4 %s -o %t -dylib %p/Inputs/libSystem.yaml && llvm-objdump -private-headers %t | FileCheck %s + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + address: 0x0000000000000000 + content: [ 0x00, 0x00, 0x00, 0x00 ] +global-symbols: + - name: _main + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000000 +... + +# ERROR: malformed source_version value + +# CHECK: Load command {{[0-9]*}} +# CHECK: cmd LC_SOURCE_VERSION +# CHECK: cmdsize 16 +# CHECK: version 10.1.2.3.4 \ No newline at end of file diff --git a/test/mach-o/subsections-via-symbols-default.yaml b/test/mach-o/subsections-via-symbols-default.yaml new file mode 100644 index 000000000000..93ddbc943f9a --- /dev/null +++ b/test/mach-o/subsections-via-symbols-default.yaml @@ -0,0 +1,28 @@ +# RUN: lld -flavor darwin -ios_simulator_version_min 5.0 -arch x86_64 -r %s -o %t +# RUN: llvm-readobj -file-headers %t | FileCheck %s + +# Make sure that we have an objc image info in the output. It should have +# been generated by the objc pass. + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +compat-version: 0.0 +current-version: 0.0 +has-UUID: false +OS: unknown +sections: + - segment: __DATA + section: __objc_imageinfo + type: S_REGULAR + attributes: [ S_ATTR_NO_DEAD_STRIP ] + address: 0x0000000000000100 + content: [ 0x00, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00 ] +... + +# The ObjC pass creates a new image info in a new MachoFile internal to the pass. +# Make sure that we still have MH_SUBSECTIONS_VIA_SYMBOLS in the output file, even +# though that file in the ObjCPass didn't get it set from being parsed. + +# CHECK: MH_SUBSECTIONS_VIA_SYMBOLS \ No newline at end of file diff --git a/test/mach-o/unwind-info-simple-arm64.yaml b/test/mach-o/unwind-info-simple-arm64.yaml index 8e87230e2833..2ef6dda8f3af 100644 --- a/test/mach-o/unwind-info-simple-arm64.yaml +++ b/test/mach-o/unwind-info-simple-arm64.yaml @@ -125,7 +125,7 @@ sections: section: __compact_unwind type: S_REGULAR attributes: [ ] - alignment: 3 + alignment: 8 address: 0x00000000000000A8 content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, diff --git a/test/mach-o/unwind-info-simple-x86_64.yaml b/test/mach-o/unwind-info-simple-x86_64.yaml index 1d2294a99678..7dfae1b71581 100644 --- a/test/mach-o/unwind-info-simple-x86_64.yaml +++ b/test/mach-o/unwind-info-simple-x86_64.yaml @@ -117,10 +117,6 @@ defined-atoms: - name: _main scope: global content: [ C3 ] - references: - - kind: branch32 - offset: 9 - target: __Z3barv - name: _needsDwarfButNoCompactUnwind scope: global content: [ C3 ] diff --git a/test/mach-o/version-min-load-command-object.yaml b/test/mach-o/version-min-load-command-object.yaml new file mode 100644 index 000000000000..33001cc6f715 --- /dev/null +++ b/test/mach-o/version-min-load-command-object.yaml @@ -0,0 +1,35 @@ +# RUN: lld -flavor darwin -arch x86_64 %s -o %t -r -macosx_version_min 10.8 && llvm-objdump -private-headers %t | FileCheck %s +# RUN: lld -flavor darwin -arch x86_64 %s -o %t -r && llvm-objdump -private-headers %t | FileCheck %s +# RUN: lld -flavor darwin -arch x86_64 %s -o %t -r %p/Inputs/no-version-min-load-command-object.yaml && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_VERSION_MIN + +# If we are emitting an object file, then we only emit a min version load command if the source object file(s) all have +# version(s) and either known platforms or contain min version load commands themselves. + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +min-os-version-kind: LC_VERSION_MIN_MACOSX +min-os-version: 10.8 +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + address: 0x0000000000000000 + content: [ 0x00, 0x00, 0x00, 0x00 ] +global-symbols: + - name: _main + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000000 +... + +# CHECK: Load command {{[0-9]*}} +# CHECK: cmd LC_VERSION_MIN_MACOSX +# CHECK: cmdsize 16 +# CHECK: version 10.8 +# CHECK: sdk n/a + +# NO_VERSION_MIN-NOT: LC_VERSION_MIN_MACOSX \ No newline at end of file diff --git a/test/mach-o/version-min-load-command.yaml b/test/mach-o/version-min-load-command.yaml new file mode 100644 index 000000000000..aa378a71fcf4 --- /dev/null +++ b/test/mach-o/version-min-load-command.yaml @@ -0,0 +1,43 @@ +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml && llvm-objdump -private-headers %t | FileCheck %s +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml 2>&1 | FileCheck %s --check-prefix=WARNING +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -static -version_load_command && llvm-objdump -private-headers %t | FileCheck %s +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -no_version_load_command && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_VERSION_MIN +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -static -version_load_command -no_version_load_command && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_VERSION_MIN +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -static && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_VERSION_MIN + +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 -sdk_version 10.9 %s -o %t -dylib %p/Inputs/libSystem.yaml && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=SDK_VERSION + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + address: 0x0000000000000000 + content: [ 0x00, 0x00, 0x00, 0x00 ] +global-symbols: + - name: _main + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000000 +... + +# CHECK: Load command {{[0-9]*}} +# CHECK: cmd LC_VERSION_MIN_MACOSX +# CHECK: cmdsize 16 +# CHECK: version 10.8 +# CHECK: sdk 10.8 + +# SDK_VERSION: Load command {{[0-9]*}} +# SDK_VERSION: cmd LC_VERSION_MIN_MACOSX +# SDK_VERSION: cmdsize 16 +# SDK_VERSION: version 10.8 +# SDK_VERSION: sdk 10.9 + +# WARNING: warning: -sdk_version is required when emitting min version load command. Setting sdk version to match provided min version + +# NO_VERSION_MIN-NOT: LC_VERSION_MIN_MACOSX diff --git a/test/old-elf/AArch64/Inputs/fn.c b/test/old-elf/AArch64/Inputs/fn.c deleted file mode 100644 index 54939a2426b2..000000000000 --- a/test/old-elf/AArch64/Inputs/fn.c +++ /dev/null @@ -1,4 +0,0 @@ -int fn() -{ - return 0; -} diff --git a/test/old-elf/AArch64/Inputs/fn.o b/test/old-elf/AArch64/Inputs/fn.o deleted file mode 100644 index 53e47ad37742..000000000000 Binary files a/test/old-elf/AArch64/Inputs/fn.o and /dev/null differ diff --git a/test/old-elf/AArch64/Inputs/general-dyn-tls-0.yaml b/test/old-elf/AArch64/Inputs/general-dyn-tls-0.yaml deleted file mode 100644 index e355a3d85cdf..000000000000 --- a/test/old-elf/AArch64/Inputs/general-dyn-tls-0.yaml +++ /dev/null @@ -1,64 +0,0 @@ ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_AARCH64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: FF4300D1E00F00B900040011E103002A48D03BD50801009108010091000100B9E10B00B9FF430091C0035FD6 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000014 - Symbol: var - Type: R_AARCH64_TLSLE_ADD_TPREL_HI12 - - Offset: 0x0000000000000018 - Symbol: var - Type: R_AARCH64_TLSLE_ADD_TPREL_LO12_NC - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .tbss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x0000000000000004 - Size: 4 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' -Symbols: - Local: -# - Name: test_tls.c -# Type: STT_FILE - - Name: '$d.1' - Section: .tbss - - Name: '$x.0' - Section: .text - - Name: .tbss - Type: STT_TLS - Section: .tbss - Global: - - Name: foo - Type: STT_FUNC - Section: .text - Size: 0x000000000000002C - - Name: var - Type: STT_TLS - Section: .tbss - Size: 0x0000000000000004 -... diff --git a/test/old-elf/AArch64/Inputs/initfini-option.c b/test/old-elf/AArch64/Inputs/initfini-option.c deleted file mode 100644 index 6021fb57ffa9..000000000000 --- a/test/old-elf/AArch64/Inputs/initfini-option.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -void init() { - printf("%s\n", __FUNCTION__); -} - -void fini() { - printf("%s\n", __FUNCTION__); -} - -int main() { -} diff --git a/test/old-elf/AArch64/Inputs/initfini-option.o b/test/old-elf/AArch64/Inputs/initfini-option.o deleted file mode 100644 index c75079b013fa..000000000000 Binary files a/test/old-elf/AArch64/Inputs/initfini-option.o and /dev/null differ diff --git a/test/old-elf/AArch64/Inputs/initfini.c b/test/old-elf/AArch64/Inputs/initfini.c deleted file mode 100644 index 8369d68a8dab..000000000000 --- a/test/old-elf/AArch64/Inputs/initfini.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -void __attribute__ ((constructor)) constructor() { - printf("%s\n", __FUNCTION__); -} - -void __attribute__ ((destructor)) destructor() { - printf("%s\n", __FUNCTION__); -} - -int main() { - return 0; -} diff --git a/test/old-elf/AArch64/Inputs/initfini.o b/test/old-elf/AArch64/Inputs/initfini.o deleted file mode 100644 index 030fe59878be..000000000000 Binary files a/test/old-elf/AArch64/Inputs/initfini.o and /dev/null differ diff --git a/test/old-elf/AArch64/Inputs/initial-exec-tls-1.yaml b/test/old-elf/AArch64/Inputs/initial-exec-tls-1.yaml deleted file mode 100644 index 2a6104a150ea..000000000000 --- a/test/old-elf/AArch64/Inputs/initial-exec-tls-1.yaml +++ /dev/null @@ -1,77 +0,0 @@ ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_AARCH64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .tbss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x0000000000000004 - Size: 16 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 00636C616E672076657273696F6E20332E372E302028687474703A2F2F6C6C766D2E6F72672F6769742F636C616E672E6769742065653461393664373236383264353237636635353336313135366235656531383662303964363138292028687474703A2F2F6C6C766D2E6F72672F6769742F6C6C766D2E67697420623065376165623639343236646331346637376466626535343533333536366664363866396466632900 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' -Symbols: - Local: - - Name: '$d.0' - Type: STT_TLS - Section: .tbss - - Name: '$d.1' - Section: .comment - - Name: .tbss - Type: STT_TLS - Section: .tbss - - Type: STT_SECTION - Section: .text - - Type: STT_SECTION - Section: .data - - Type: STT_SECTION - Section: .bss - - Type: STT_SECTION - Section: .comment - - Type: STT_SECTION - Section: .note.GNU-stack - Global: - - Name: e0 - Type: STT_TLS - Section: .tbss - Size: 0x0000000000000004 - - Name: e1 - Type: STT_TLS - Section: .tbss - Value: 0x0000000000000004 - Size: 0x0000000000000004 - - Name: e2 - Type: STT_TLS - Section: .tbss - Value: 0x0000000000000008 - Size: 0x0000000000000004 - - Name: e3 - Type: STT_TLS - Section: .tbss - Value: 0x000000000000000C - Size: 0x0000000000000004 -... diff --git a/test/old-elf/AArch64/Inputs/main.c b/test/old-elf/AArch64/Inputs/main.c deleted file mode 100644 index 0280c9127076..000000000000 --- a/test/old-elf/AArch64/Inputs/main.c +++ /dev/null @@ -1,4 +0,0 @@ -int main() { - fn(); - return 0; -} diff --git a/test/old-elf/AArch64/Inputs/main.o b/test/old-elf/AArch64/Inputs/main.o deleted file mode 100644 index 8c0f049da6a8..000000000000 Binary files a/test/old-elf/AArch64/Inputs/main.o and /dev/null differ diff --git a/test/old-elf/AArch64/Inputs/no-interp-section.c b/test/old-elf/AArch64/Inputs/no-interp-section.c deleted file mode 100644 index 3981c038ed33..000000000000 --- a/test/old-elf/AArch64/Inputs/no-interp-section.c +++ /dev/null @@ -1 +0,0 @@ -int c = 10; diff --git a/test/old-elf/AArch64/Inputs/no-interp-section.o b/test/old-elf/AArch64/Inputs/no-interp-section.o deleted file mode 100644 index 36b41fdbf782..000000000000 Binary files a/test/old-elf/AArch64/Inputs/no-interp-section.o and /dev/null differ diff --git a/test/old-elf/AArch64/Inputs/zerosizedsection.o b/test/old-elf/AArch64/Inputs/zerosizedsection.o deleted file mode 100644 index 10123fcef90d..000000000000 Binary files a/test/old-elf/AArch64/Inputs/zerosizedsection.o and /dev/null differ diff --git a/test/old-elf/AArch64/Inputs/zerosizedsection.s b/test/old-elf/AArch64/Inputs/zerosizedsection.s deleted file mode 100644 index 651ee3aab503..000000000000 --- a/test/old-elf/AArch64/Inputs/zerosizedsection.s +++ /dev/null @@ -1,3 +0,0 @@ -.text -.data -.word .text diff --git a/test/old-elf/AArch64/defsym.test b/test/old-elf/AArch64/defsym.test deleted file mode 100644 index f9864092ddc3..000000000000 --- a/test/old-elf/AArch64/defsym.test +++ /dev/null @@ -1,22 +0,0 @@ -RUN: lld -flavor old-gnu -target aarch64--linux-gnu --defsym=main=fn \ -RUN: --noinhibit-exec %p/Inputs/fn.o -o %t -RUN: llvm-readobj -symbols %t | FileCheck %s - -CHECK: Symbol { -CHECK: Name: main (1) -CHECK: Value: 0x4001A4 -CHECK: Size: 0 -CHECK: Binding: Global (0x1) -CHECK: Type: Function (0x2) -CHECK: Other: 0 -CHECK: Section: .text (0x5) -CHECK: } -CHECK: Symbol { -CHECK: Name: fn (11) -CHECK: Value: 0x4001A4 -CHECK: Size: 8 -CHECK: Binding: Global (0x1) -CHECK: Type: Function (0x2) -CHECK: Other: 0 -CHECK: Section: .text (0x5) -CHECK: } diff --git a/test/old-elf/AArch64/dontignorezerosize-sections.test b/test/old-elf/AArch64/dontignorezerosize-sections.test deleted file mode 100644 index 8f3b27702208..000000000000 --- a/test/old-elf/AArch64/dontignorezerosize-sections.test +++ /dev/null @@ -1,9 +0,0 @@ -# This tests that lld is not ignoring zero sized sections -RUN: lld -flavor old-gnu -target aarch64--linux-gnu %p/Inputs/zerosizedsection.o \ -RUN: --noinhibit-exec --output-filetype=yaml -o %t -RUN: FileCheck %s < %t - -CHECK: references: -CHECK: - kind: layout-after -CHECK: offset: 0 -CHECK: target: L000 diff --git a/test/old-elf/AArch64/dynamicvars.test b/test/old-elf/AArch64/dynamicvars.test deleted file mode 100644 index 80228f0cd4b2..000000000000 --- a/test/old-elf/AArch64/dynamicvars.test +++ /dev/null @@ -1,113 +0,0 @@ -# Tests that the dynamic variables created by the linker are set to the right -# values. - -# RUN: yaml2obj --format elf -docnum 1 %s -o %t.o -# RUN: lld -flavor old-gnu -target aarch64 -e main %t.o -o %t1 --noinhibit-exec -# RUN: llvm-readobj -sections -symbols %t1 | FileCheck %s - - -# CHECK: Name: .dynamic -# CHECK: Type: SHT_DYNAMIC -# CHECK: Address: [[TARGETA:[0xa-fA-f0-9]+]] -# CHECK: Name: .got.plt -# CHECK: Type: SHT_PROGBITS -# CHECK: Address: [[TARGETB:[0xa-fA-f0-9]+]] -# CHECK: Name: _DYNAMIC -# CHECK: Value: [[TARGETA]] -# CHECK: Section: .dynamic -# CHECK: Name: _GLOBAL_OFFSET_TABLE_ -# CHECK: Value: [[TARGETB]] -# CHECK: Section: .got.plt - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_AARCH64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - - Name: .text.startup - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: FD7BBFA900000090FD030091000000910000009400008052FD7BC1A8C0035FD6 - - Name: .rela.text.startup - Type: SHT_RELA - Flags: [ SHF_INFO_LINK ] - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text.startup - Relocations: - - Offset: 0x0000000000000004 - Symbol: .rodata.str1.8 - Type: R_AARCH64_ADR_PREL_PG_HI21 - - Offset: 0x000000000000000C - Symbol: .rodata.str1.8 - Type: R_AARCH64_ADD_ABS_LO12_NC - - Offset: 0x0000000000000010 - Symbol: puts - Type: R_AARCH64_CALL26 - - Name: .rodata.str1.8 - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000008 - Content: '7465737400000000' - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 004743433A2028474E552920342E392E33203230313530333234202870726572656C656173652900 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' -Symbols: - Local: - - Name: test.c - Type: STT_FILE - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .text.startup - Type: STT_SECTION - Section: .text.startup - - Name: '$x' - Section: .text.startup - - Name: .rodata.str1.8 - Type: STT_SECTION - Section: .rodata.str1.8 - - Name: '$d' - Section: .rodata.str1.8 - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - - Name: .comment - Type: STT_SECTION - Section: .comment - Global: - - Name: main - Type: STT_FUNC - Section: .text.startup - Size: 0x0000000000000020 - - Name: puts -... diff --git a/test/old-elf/AArch64/dynlib-nointerp-section.test b/test/old-elf/AArch64/dynlib-nointerp-section.test deleted file mode 100644 index c4f4edab61b1..000000000000 --- a/test/old-elf/AArch64/dynlib-nointerp-section.test +++ /dev/null @@ -1,5 +0,0 @@ -RUN: lld -flavor old-gnu -target aarch64--linux-gnu %p/Inputs/no-interp-section.o \ -RUN: -o %t -shared -RUN: llvm-objdump -section-headers %t | FileCheck %s - -CHECK-NOT: .interp diff --git a/test/old-elf/AArch64/general-dyn-tls-0.test b/test/old-elf/AArch64/general-dyn-tls-0.test deleted file mode 100644 index ae2af94d057d..000000000000 --- a/test/old-elf/AArch64/general-dyn-tls-0.test +++ /dev/null @@ -1,103 +0,0 @@ -# Check for correct offsets when handling relocations for general dynamic TLS -# access in executable binaries. -# -# The test case was generated from following code snippet: -# -# == test_tls.c == -# -# __thread int var; -# void foo (int x) { -# var = x + 1; -# } -# -# == test_main.c == -# #include -# -# extern __thread int var; -# extern void foo (int); -# -# int main () { -# foo (10); -# return var; -# } -# -# The objects are compiled with -fpic. - -#RUN: yaml2obj -format=elf %p/Inputs/general-dyn-tls-0.yaml -o=%t-t1.o -#RUN: yaml2obj -format=elf %s -o %t-t0.o -#RUN: lld -flavor old-gnu -target arm64 --noinhibit-exec -o %t.exe %t-t0.o %t-t1.o -#RUN: llvm-readobj -relocations %t.exe | FileCheck %s -check-prefix=CHECKRELOCATION -#RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -#CHECKRELOCATION: Relocations [ -#CHECKRELOCATION: .rela.dyn { -#CHECKRELOCATION: 0x401090 R_AARCH64_TLSDESC var 0x0 -#CHECKRELOCATION: } - -#CHECK: Contents of section .text: -#CHECK: 400250 a8c31fb8 40018052 0b000094 000000b0 ....@..R........ -# \_ adrp x0, 401000 <_DYNAMIC> (R_AARCH64_TLSDESC_ADR_PAGE21) -#CHECK-NEXT: 400260 014840f9 00400291 20003fd6 49d03bd5 .H@..@.. .?.I.;. -# \_ | | ldr x1, [x0,#144] (R_AARCH64_TLSDESC_LD64_LO12_NC) -# \_ | add x0, x0, #0x90 (R_AARCH64_TLSDESC_ADD_LO12_NC) -# \_ blr x1 (R_AARCH64_TLSDESC_CALL) - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_AARCH64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: FD7BBFA9FD030091FF4300D1E8031F2AA8C31FB8400180520000009400000090010040F90000009120003FD649D03BD5286960B8E003082ABF030091FD7BC1A8C0035FD6 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000018 - Symbol: foo - Type: R_AARCH64_CALL26 - - Offset: 0x000000000000001C - Symbol: var - Type: R_AARCH64_TLSDESC_ADR_PAGE21 - - Offset: 0x0000000000000020 - Symbol: var - Type: R_AARCH64_TLSDESC_LD64_LO12_NC - - Offset: 0x0000000000000024 - Symbol: var - Type: R_AARCH64_TLSDESC_ADD_LO12_NC - - Offset: 0x0000000000000028 - Symbol: var - Type: R_AARCH64_TLSDESC_CALL - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' -Symbols: - Local: - - Name: '$x.0' - Section: .text - Global: - - Name: foo - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x0000000000000044 - - Name: var - Type: STT_TLS diff --git a/test/old-elf/AArch64/initfini.test b/test/old-elf/AArch64/initfini.test deleted file mode 100644 index c5f385082edc..000000000000 --- a/test/old-elf/AArch64/initfini.test +++ /dev/null @@ -1,23 +0,0 @@ -# This tests the functionality that lld is able to read -# init_array/fini_array sections in the input ELF. This -# corresponds to the the .init_array/.fini_array sections -# in the output ELF. - -RUN: lld -flavor old-gnu -target aarch64--linux-gnu %p/Inputs/initfini.o \ -RUN: --noinhibit-exec --output-filetype=yaml -o %t -RUN: FileCheck %s < %t - -CHECK: type: data -CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] -CHECK: section-name: .init_array -CHECK: references: -CHECK: - kind: R_AARCH64_ABS64 -CHECK: offset: 0 -CHECK: target: constructor -CHECK: type: data -CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] -CHECK: section-name: .fini_array -CHECK: references: -CHECK: - kind: R_AARCH64_ABS64 -CHECK: offset: 0 -CHECK: target: destructor diff --git a/test/old-elf/AArch64/initial-exec-tls-0.test b/test/old-elf/AArch64/initial-exec-tls-0.test deleted file mode 100644 index 4cb5f9c7052a..000000000000 --- a/test/old-elf/AArch64/initial-exec-tls-0.test +++ /dev/null @@ -1,146 +0,0 @@ -# Check for initial executable TLS access across different modules. For -# this case compiler will emit R_AARCH64_TLSLD_ADR_PAGE21 and -# R_AARCH64_TLSLD_ADD_LO12_NC static relocations and linker should create -# a R_AARCH64_TLS_TPREL64 dynamic relocation for variable access. - -# The test case was generated from following code snippet: -# -# t1.c (initial-exec-tls-1.yaml) -# -# __thread int e0; -# __thread int e1; -# __thread int e2; -# __thread int e3; -# -# t0.c (initial-exec-tls-0.test) -# -# extern __thread int e0; -# extern __thread int e1; -# extern __thread int e2; -# extern __thread int e3; -# -# int main () -# { -# e0 = 1; -# e1 = 2; -# e1 = 3; -# e1 = 4; -# } - -#RUN: yaml2obj -format=elf %p/Inputs/initial-exec-tls-1.yaml -o=%t-t1.o -#RUN: yaml2obj -format=elf %s -o %t-t0.o -#RUN: lld -flavor old-gnu -target arm64 --noinhibit-exec -o %t.exe %t-t0.o %t-t1.o -#RUN: llvm-readobj -relocations %t.exe | FileCheck %s -check-prefix=CHECKRELOCATION -#RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -#CHECKRELOCATION: R_AARCH64_TLS_TPREL64 e0 0x0 -#CHECKRELOCATION: R_AARCH64_TLS_TPREL64 e1 0x0 -#CHECKRELOCATION: R_AARCH64_TLS_TPREL64 e2 0x0 -#CHECKRELOCATION: R_AARCH64_TLS_TPREL64 e3 0x0 - -#CHECK: Contents of section .text: -#CHECK-NEXT: 4002c0 ff4300d1 e8031f2a e9031e32 0a0000b0 .C.....*...2.... -# \_ adrp x10, 401000 (R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21) -#CHECK-NEXT: 4002d0 4a4940f9 4bd03bd5 ec030032 6c692ab8 JI@.K.;....2li*. -# \_ ldr x10, [x10,#144] (R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC) -#CHECK-NEXT: 4002e0 0a0000b0 4a4d40f9 ec031f32 6c692ab8 ....JM@....2li*. -# \_ | adrp x10, 401000 (R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21) -# \_ ldr x10, [x10,#152] (R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC) -#CHECK-NEXT: 4002f0 0a0000b0 4a5140f9 ec070032 6c692ab8 ....JQ@....2li*. -# \_ | adrp x10, 401000 (R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21) -# \_ ldr x10, [x10,#160] (R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC) -#CHECK-NEXT: 400300 0a0000b0 4a5540f9 ec031e32 6c692ab8 ....JU@....2li*. -# \_ | adrp x10, 401000 (R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21) -# \_ ldr x10, [x10,#168] (R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC) - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_AARCH64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: FF4300D1E8031F2AE9031E320A0000904A0140F94BD03BD5EC0300326C692AB80A0000904A0140F9EC031F326C692AB80A0000904A0140F9EC0700326C692AB80A0000904A0140F9EC031E326C692AB8E003082AE90F00B9FF430091C0035FD6 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x000000000000000C - Symbol: e0 - Type: R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 - - Offset: 0x0000000000000010 - Symbol: e0 - Type: R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC - - Offset: 0x0000000000000020 - Symbol: e1 - Type: R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 - - Offset: 0x0000000000000024 - Symbol: e1 - Type: R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC - - Offset: 0x0000000000000030 - Symbol: e2 - Type: R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 - - Offset: 0x0000000000000034 - Symbol: e2 - Type: R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC - - Offset: 0x0000000000000040 - Symbol: e3 - Type: R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 - - Offset: 0x0000000000000044 - Symbol: e3 - Type: R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 00636C616E672076657273696F6E20332E372E302028687474703A2F2F6C6C766D2E6F72672F6769742F636C616E672E6769742065653461393664373236383264353237636635353336313135366235656531383662303964363138292028687474703A2F2F6C6C766D2E6F72672F6769742F6C6C766D2E67697420623065376165623639343236646331346637376466626535343533333536366664363866396466632900 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' -Symbols: - Local: - - Name: '$d.1' - Section: .comment - - Name: '$x.0' - Section: .text - - Type: STT_SECTION - Section: .text - - Type: STT_SECTION - Section: .data - - Type: STT_SECTION - Section: .bss - - Type: STT_SECTION - Section: .comment - - Type: STT_SECTION - Section: .note.GNU-stack - Global: - - Name: e0 - Type: STT_TLS - - Name: e1 - Type: STT_TLS - - Name: e2 - Type: STT_TLS - - Name: e3 - Type: STT_TLS - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x0000000000000060 -... diff --git a/test/old-elf/AArch64/local-tls.test b/test/old-elf/AArch64/local-tls.test deleted file mode 100644 index f339ae20e154..000000000000 --- a/test/old-elf/AArch64/local-tls.test +++ /dev/null @@ -1,184 +0,0 @@ -# Check for correct offsets when handling relocations for local TLS -# access (R_AARCH64_TLSLE_ADD_TPREL_HI12, R_AARCH64_TLSLE_ADD_TPREL_LO12_NC) -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target arm64 --noinhibit-exec -o %t-exe %t-obj -# RUN: llvm-objdump -s -t %t-exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: 4001dc 48d03bd5 08010091 08610091 090140b9 H.;......a....@. -# \_ | | : -# \_ | add x8, x8, #0x0 (R_AARCH64_TLSLE_ADD_TPREL_HI12) -# \_ add x8, x8, #0x18 (R_AARCH64_TLSLE_ADD_TPREL_LO12_NC) -# CHECK-NEXT: 4001ec e003092a c0035fd6 48d03bd5 08010091 ...*.._.H.;..... -# \_ | : -# \_ add x8, x8, #0x0 (R_AARCH64_TLSLE_ADD_TPREL_HI12) -# CHECK-NEXT: 4001fc 08710091 090140b9 e003092a c0035fd6 .q....@....*.._. -# \_ add x8, x8, #0x1c (R_AARCH64_TLSLE_ADD_TPREL_LO12_NC) -# CHECK-NEXT: 40020c 48d03bd5 08010091 08410091 090140b9 H.;......A....@. -# \_ | | : -# \_ | add x8, x8, #0x0 (R_AARCH64_TLSLE_ADD_TPREL_HI12) -# \_ add x8, x8, #0x10 (R_AARCH64_TLSLE_ADD_TPREL_LO12_NC) -# CHECK-NEXT: 40021c e003092a c0035fd6 48d03bd5 08010091 ...*.._.H.;..... -# \_ | : -# \_ add x8, x8, #0x0 (R_AARCH64_TLSLE_ADD_TPREL_HI12) -# CHECK-NEXT: 40022c 08510091 090140b9 e003092a c0035fd6 .Q....@....*.._. -# \_ add x8, x8, #0x14 (R_AARCH64_TLSLE_ADD_TPREL_LO12_NC) - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_AARCH64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 48D03BD50801009108010091090140B9E003092AC0035FD648D03BD50801009108010091090140B9E003092AC0035FD648D03BD50801009108010091090140B9E003092AC0035FD648D03BD50801009108010091090140B9E003092AC0035FD6FD7BBFA9FD030091FF8300D1BFC31FB8E4FFFF97A0831FB8E8FFFF97A0431FB8ECFFFF97E01300B9F0FFFF970800009008010091E00F00B9E00308AAA1835FB8A2435FB8E31340B9E40F40B900000094E1031F2AE00B00B9E003012ABF030091FD7BC1A8C0035FD6 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000004 - Symbol: v1 - Type: R_AARCH64_TLSLE_ADD_TPREL_HI12 - - Offset: 0x0000000000000008 - Symbol: v1 - Type: R_AARCH64_TLSLE_ADD_TPREL_LO12_NC - - Offset: 0x000000000000001C - Symbol: v2 - Type: R_AARCH64_TLSLE_ADD_TPREL_HI12 - - Offset: 0x0000000000000020 - Symbol: v2 - Type: R_AARCH64_TLSLE_ADD_TPREL_LO12_NC - - Offset: 0x0000000000000034 - Symbol: v3 - Type: R_AARCH64_TLSLE_ADD_TPREL_HI12 - - Offset: 0x0000000000000038 - Symbol: v3 - Type: R_AARCH64_TLSLE_ADD_TPREL_LO12_NC - - Offset: 0x000000000000004C - Symbol: v4 - Type: R_AARCH64_TLSLE_ADD_TPREL_HI12 - - Offset: 0x0000000000000050 - Symbol: v4 - Type: R_AARCH64_TLSLE_ADD_TPREL_LO12_NC - - Offset: 0x000000000000008C - Symbol: .rodata.str1.1 - Type: R_AARCH64_ADR_PREL_PG_HI21 - - Offset: 0x0000000000000090 - Symbol: .rodata.str1.1 - Type: R_AARCH64_ADD_ABS_LO12_NC - - Offset: 0x00000000000000AC - Symbol: printf - Type: R_AARCH64_CALL26 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x0000000000000004 - Content: '0300000004000000' - - Name: .tbss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x0000000000000004 - Size: 8 - - Name: .rodata.str1.1 - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 25692025692025692025690A00 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' -Symbols: - Local: - - Name: '$d.1' - Type: STT_TLS - Section: .tdata - - Name: '$d.2' - Type: STT_TLS - Section: .tbss - - Name: '$d.3' - Section: .rodata.str1.1 - - Name: '$x.0' - Section: .text - - Name: v2 - Type: STT_TLS - Section: .tbss - Value: 0x0000000000000004 - Size: 0x0000000000000004 - - Name: v4 - Type: STT_TLS - Section: .tdata - Value: 0x0000000000000004 - Size: 0x0000000000000004 - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .tdata - Type: STT_SECTION - Section: .tdata - - Name: .tbss - Type: STT_SECTION - Section: .tbss - - Name: .rodata.str1.1 - Type: STT_SECTION - Section: .rodata.str1.1 - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - Global: - - Name: foo1 - Type: STT_FUNC - Section: .text - Size: 0x0000000000000018 - - Name: foo2 - Type: STT_FUNC - Section: .text - Value: 0x0000000000000018 - Size: 0x0000000000000018 - - Name: foo3 - Type: STT_FUNC - Section: .text - Value: 0x0000000000000030 - Size: 0x0000000000000018 - - Name: foo4 - Type: STT_FUNC - Section: .text - Value: 0x0000000000000048 - Size: 0x0000000000000018 - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000060 - Size: 0x0000000000000068 - - Name: v1 - Type: STT_TLS - Section: .tbss - Size: 0x0000000000000004 - - Name: v3 - Type: STT_TLS - Section: .tdata - Size: 0x0000000000000004 - - Name: printf -... diff --git a/test/old-elf/AArch64/rel-abs16-overflow.test b/test/old-elf/AArch64/rel-abs16-overflow.test deleted file mode 100644 index 06221c902bd7..000000000000 --- a/test/old-elf/AArch64/rel-abs16-overflow.test +++ /dev/null @@ -1,44 +0,0 @@ -# Check handling of R_AARCH64_ABS16 relocation overflow. -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: not lld -flavor old-gnu -target arm64 -o %t-exe %t-obj 2>&1 | FileCheck %s - -# CHECK: Relocation out of range in file {{.*}}: reference from data1+0 to data1+0 of type 259 (R_AARCH64_ABS16) - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_AARCH64 - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] -- Name: .data - Type: SHT_PROGBITS - Content: "0000000000000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rela.data - Type: SHT_RELA - Info: .data - AddressAlign: 8 - Relocations: - - Offset: 0 - Symbol: data1 - Type: R_AARCH64_ABS16 - Addend: 0 - -Symbols: - Global: - - Name: _start - Section: .text - Value: 0x0 - Size: 4 - - Name: data1 - Section: .data - Size: 4 diff --git a/test/old-elf/AArch64/rel-abs16.test b/test/old-elf/AArch64/rel-abs16.test deleted file mode 100644 index e6b817570eb4..000000000000 --- a/test/old-elf/AArch64/rel-abs16.test +++ /dev/null @@ -1,53 +0,0 @@ -# Check handling of R_AARCH64_ABS16 relocation. -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target arm64 -o %t-exe %t-obj -# RUN: llvm-objdump -s -t %t-exe | FileCheck %s - -# CHECK: Contents of section .data: -# CHECK-NEXT: 401060 60100000 00000000 `....... -# ^^ data1 - 0x400000 = 0x1060 -# CHECK: SYMBOL TABLE: -# CHECK: 00401060 g .data 00000004 data1 - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_AARCH64 - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] -- Name: .data - Type: SHT_PROGBITS - Content: "0000000000000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rela.data - Type: SHT_RELA - Info: .data - AddressAlign: 8 - Relocations: - - Offset: 0x0 - Symbol: data1 - Type: R_AARCH64_ABS16 - Addend: -4194304 - -Symbols: - Global: - - Name: _start - Section: .text - Value: 0x0 - Size: 4 - - Name: data1 - Section: .data - Size: 4 - - Name: data2 - Section: .data - Value: 0x4 - Size: 4 diff --git a/test/old-elf/AArch64/rel-abs32-overflow.test b/test/old-elf/AArch64/rel-abs32-overflow.test deleted file mode 100644 index 17154c6ddc82..000000000000 --- a/test/old-elf/AArch64/rel-abs32-overflow.test +++ /dev/null @@ -1,53 +0,0 @@ -# Check handling of R_AARCH64_ABS32 relocation overflow. -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: not lld -flavor old-gnu -target arm64 -o %t-exe %t-obj 2>&1 | FileCheck %s - -# CHECK-DAG: Relocation out of range in file {{.*}}: reference from data1+0 to data2+34359738369 of type 258 (R_AARCH64_ABS32) -# CHECK-DAG: Relocation out of range in file {{.*}}: reference from data2+0 to data1+34359738369 of type 258 (R_AARCH64_ABS32) - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_AARCH64 - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] -- Name: .data - Type: SHT_PROGBITS - Content: "0000000000000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rela.data - Type: SHT_RELA - Info: .data - AddressAlign: 8 - Relocations: - - Offset: 0x0 - Symbol: data2 - Type: R_AARCH64_ABS32 - Addend: 0x800000001 - - Offset: 0x4 - Symbol: data1 - Type: R_AARCH64_ABS32 - Addend: 0x800000001 - -Symbols: - Global: - - Name: _start - Section: .text - Value: 0x0 - Size: 4 - - Name: data1 - Section: .data - Size: 4 - - Name: data2 - Section: .data - Value: 0x4 - Size: 4 diff --git a/test/old-elf/AArch64/rel-abs32.test b/test/old-elf/AArch64/rel-abs32.test deleted file mode 100644 index 7faa662d3462..000000000000 --- a/test/old-elf/AArch64/rel-abs32.test +++ /dev/null @@ -1,59 +0,0 @@ -# Check handling of R_AARCH64_ABS32 relocation. -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target arm64 -o %t-exe %t-obj -# RUN: llvm-objdump -s -t %t-exe | FileCheck %s - -# CHECK: Contents of section .data: -# CHECK-NEXT: 401060 65104080 61104080 e.@.a.@. -# ^^ data2 + 0x80000001 = 0x80401069 -# ^^ data1 + 0x80000001 = 0x80401061 -# CHECK: SYMBOL TABLE: -# CHECK: 00401060 g .data 00000004 data1 -# CHECK: 00401064 g .data 00000004 data2 - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_AARCH64 - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] -- Name: .data - Type: SHT_PROGBITS - Content: "0000000000000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rela.data - Type: SHT_RELA - Info: .data - AddressAlign: 8 - Relocations: - - Offset: 0x0 - Symbol: data2 - Type: R_AARCH64_ABS32 - Addend: 0x80000001 - - Offset: 0x4 - Symbol: data1 - Type: R_AARCH64_ABS32 - Addend: 0x80000001 - -Symbols: - Global: - - Name: _start - Section: .text - Value: 0x0 - Size: 4 - - Name: data1 - Section: .data - Size: 4 - - Name: data2 - Section: .data - Value: 0x4 - Size: 4 diff --git a/test/old-elf/AArch64/rel-abs64.test b/test/old-elf/AArch64/rel-abs64.test deleted file mode 100644 index 0304584d121d..000000000000 --- a/test/old-elf/AArch64/rel-abs64.test +++ /dev/null @@ -1,59 +0,0 @@ -# Check handling of R_AARCH64_ABS64 relocation. -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target arm64 -o %t-exe %t-obj -# RUN: llvm-objdump -s -t %t-exe | FileCheck %s - -# CHECK: Contents of section .data: -# CHECK-NEXT: 401060 69104000 00000080 61104000 00000080 i.@.....a.@..... -# ^^ data2 + 0x8000000000000001 = 0x8000000000401069 -# ^^ data1 + 0x8000000000000001 = 0x8000000000401061 -# CHECK: SYMBOL TABLE: -# CHECK: 00401060 g .data 00000008 data1 -# CHECK: 00401068 g .data 00000008 data2 - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_AARCH64 - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] -- Name: .data - Type: SHT_PROGBITS - Content: "00000000000000000000000000000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rela.data - Type: SHT_RELA - Info: .data - AddressAlign: 8 - Relocations: - - Offset: 0x0 - Symbol: data2 - Type: R_AARCH64_ABS64 - Addend: -9223372036854775807 - - Offset: 0x8 - Symbol: data1 - Type: R_AARCH64_ABS64 - Addend: -9223372036854775807 - -Symbols: - Global: - - Name: _start - Section: .text - Value: 0x0 - Size: 4 - - Name: data1 - Section: .data - Size: 8 - - Name: data2 - Section: .data - Value: 0x8 - Size: 8 diff --git a/test/old-elf/AArch64/rel-adr_prel_lo21-overflow.test b/test/old-elf/AArch64/rel-adr_prel_lo21-overflow.test deleted file mode 100644 index 4f8e6b607bc7..000000000000 --- a/test/old-elf/AArch64/rel-adr_prel_lo21-overflow.test +++ /dev/null @@ -1,45 +0,0 @@ -# Check handling of R_AARCH64_ADR_PREL_PG_HI21 relocation. -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: not lld -flavor old-gnu -target arm64 -o %t-exe %t-obj - -# CHECK: Relocation out of range in file {{.*}}: reference from _start+0 to data1+1048577 of type 274 (R_AARCH64_ADR_PREL_LO21) - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_AARCH64 - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000090" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] - -- Name: .data - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rela.text - Type: SHT_RELA - Info: .text - AddressAlign: 8 - Relocations: - - Offset: 0x0 - Symbol: data1 - Type: R_AARCH64_ADR_PREL_LO21 - Addend: 0x100001 - -Symbols: - Global: - - Name: _start - Section: .text - Value: 0x0 - Size: 4 - - Name: data1 - Section: .data - Size: 8 diff --git a/test/old-elf/AArch64/rel-adr_prel_lo21.test b/test/old-elf/AArch64/rel-adr_prel_lo21.test deleted file mode 100644 index 36a9489c1aa4..000000000000 --- a/test/old-elf/AArch64/rel-adr_prel_lo21.test +++ /dev/null @@ -1,51 +0,0 @@ -# REQUIRES: arm64 - -# Check handling of R_AARCH64_ADR_PREL_LO21 relocation. -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target arm64 -o %t-exe %t-obj -# RUN: llvm-objdump -d -t %t-exe | FileCheck %s - -# CHECK: Disassembly of section .text: -# CHECK-NEXT: _start: -# CHECK-NEXT: 4001b0: 80 75 00 90 adrp x0, #15400960 -# CHECK: SYMBOL TABLE: -# CHECK: 00401060 g .data 00000004 data1 - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_AARCH64 - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000090" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] -- Name: .data - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rela.text - Type: SHT_RELA - Info: .text - AddressAlign: 8 - Relocations: - - Offset: 0x0 - Symbol: data1 - Type: R_AARCH64_ADR_PREL_LO21 - Addend: 0 - -Symbols: - Global: - - Name: _start - Section: .text - Value: 0x0 - Size: 4 - - Name: data1 - Section: .data - Size: 8 diff --git a/test/old-elf/AArch64/rel-adr_prel_pg_hi21-overflow.test b/test/old-elf/AArch64/rel-adr_prel_pg_hi21-overflow.test deleted file mode 100644 index f095f60e82a6..000000000000 --- a/test/old-elf/AArch64/rel-adr_prel_pg_hi21-overflow.test +++ /dev/null @@ -1,45 +0,0 @@ -# Check handling of R_AARCH64_ADR_PREL_PG_HI21 relocation overflow. -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: not lld -flavor old-gnu -target arm64 -o %t-exe %t-obj - -# CHECK-DAG: Relocation out of range in file {{.*}}: reference from _start+0 to data1+2147483649 of type 275 (R_AARCH64_ADR_PREL_PG_HI21) - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_AARCH64 - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000090" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] - -- Name: .data - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 4096 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rela.text - Type: SHT_RELA - Info: .text - AddressAlign: 8 - Relocations: - - Offset: 0x0 - Symbol: data1 - Type: R_AARCH64_ADR_PREL_PG_HI21 - Addend: 0x80000001 - -Symbols: - Global: - - Name: _start - Section: .text - Value: 0x0 - Size: 4 - - Name: data1 - Section: .data - Size: 8 diff --git a/test/old-elf/AArch64/rel-adr_prel_pg_hi21.test b/test/old-elf/AArch64/rel-adr_prel_pg_hi21.test deleted file mode 100644 index 36a20c2f6473..000000000000 --- a/test/old-elf/AArch64/rel-adr_prel_pg_hi21.test +++ /dev/null @@ -1,52 +0,0 @@ -# REQUIRES: arm64 - -# Check handling of R_AARCH64_ADR_PREL_PG_HI21 relocation. -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target arm64 -o %t-exe %t-obj -# RUN: llvm-objdump -d -t %t-exe | FileCheck %s - -# CHECK: Disassembly of section .text: -# CHECK-NEXT: _start: -# CHECK-NEXT: 4001b0: 00 00 00 d0 adrp x0, #8192 -# CHECK: SYMBOL TABLE: -# CHECK: 00402000 g .data 00000004 data1 - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_AARCH64 - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000090" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] - -- Name: .data - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 4096 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rela.text - Type: SHT_RELA - Info: .text - AddressAlign: 8 - Relocations: - - Offset: 0x0 - Symbol: data1 - Type: R_AARCH64_ADR_PREL_PG_HI21 - Addend: 0 - -Symbols: - Global: - - Name: _start - Section: .text - Value: 0x0 - Size: 4 - - Name: data1 - Section: .data - Size: 8 diff --git a/test/old-elf/AArch64/rel-bad.test b/test/old-elf/AArch64/rel-bad.test deleted file mode 100644 index 7d2ed192de56..000000000000 --- a/test/old-elf/AArch64/rel-bad.test +++ /dev/null @@ -1,44 +0,0 @@ -# Check handling of a bad relocation (in this case dynamic in a static object). -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: not lld -flavor old-gnu -target arm64 -o %t-exe %t-obj 2>&1 | FileCheck %s - -# CHECK: Unhandled reference type in file {{.*}}: reference from data1+4 to data1+0 of type 1024 (R_AARCH64_COPY) - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_AARCH64 - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] -- Name: .data - Type: SHT_PROGBITS - Content: "0000000000000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rela.data - Type: SHT_RELA - Info: .data - AddressAlign: 8 - Relocations: - - Offset: 0x4 - Symbol: data1 - Type: R_AARCH64_COPY - Addend: 0 - -Symbols: - Global: - - Name: _start - Section: .text - Value: 0x0 - Size: 4 - - Name: data1 - Section: .data - Size: 8 diff --git a/test/old-elf/AArch64/rel-prel16-overflow.test b/test/old-elf/AArch64/rel-prel16-overflow.test deleted file mode 100644 index ea08f9700ee4..000000000000 --- a/test/old-elf/AArch64/rel-prel16-overflow.test +++ /dev/null @@ -1,53 +0,0 @@ -# Check handling of R_AARCH64_PREL16 relocation overflow. -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: not lld -flavor old-gnu -target arm64 -o %t-exe %t-obj 2>&1 | FileCheck %s - -# CHECK: Relocation out of range in file {{.*}}: reference from data1+0 to data2+524289 of type 262 (R_AARCH64_PREL16) -# CHECK: Relocation out of range in file {{.*}}: reference from data2+0 to data1+524289 of type 262 (R_AARCH64_PREL16) - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_AARCH64 - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] -- Name: .data - Type: SHT_PROGBITS - Content: "0000000000000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rela.data - Type: SHT_RELA - Info: .data - AddressAlign: 8 - Relocations: - - Offset: 0x0 - Symbol: data2 - Type: R_AARCH64_PREL16 - Addend: 0x80001 - - Offset: 0x2 - Symbol: data1 - Type: R_AARCH64_PREL16 - Addend: 0x80001 - -Symbols: - Global: - - Name: _start - Section: .text - Value: 0x0 - Size: 4 - - Name: data1 - Section: .data - Size: 2 - - Name: data2 - Section: .data - Value: 0x2 - Size: 2 diff --git a/test/old-elf/AArch64/rel-prel16.test b/test/old-elf/AArch64/rel-prel16.test deleted file mode 100644 index 11e6028e253b..000000000000 --- a/test/old-elf/AArch64/rel-prel16.test +++ /dev/null @@ -1,59 +0,0 @@ -# Check handling of R_AARCH64_PREL16 relocation. -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target arm64 -o %t-exe %t-obj -# RUN: llvm-objdump -s -t %t-exe | FileCheck %s - -# CHECK: Contents of section .data: -# CHECK-NEXT: 401060 0380ff7f 00000000 ........ -# ^^ data2 - data1 + 0x8001 = 0x8003 -# ^^ data1 - data2 + 0x8001 = 0x7fff -# CHECK: SYMBOL TABLE: -# CHECK: 00401060 g .data 00000002 data1 -# CHECK: 00401062 g .data 00000006 data2 - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_AARCH64 - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] -- Name: .data - Type: SHT_PROGBITS - Content: "0000000000000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rela.data - Type: SHT_RELA - Info: .data - AddressAlign: 8 - Relocations: - - Offset: 0x0 - Symbol: data2 - Type: R_AARCH64_PREL16 - Addend: 0x8001 - - Offset: 0x2 - Symbol: data1 - Type: R_AARCH64_PREL16 - Addend: 0x8001 - -Symbols: - Global: - - Name: _start - Section: .text - Value: 0x0 - Size: 4 - - Name: data1 - Section: .data - Size: 2 - - Name: data2 - Section: .data - Value: 0x2 - Size: 2 diff --git a/test/old-elf/AArch64/rel-prel32-overflow.test b/test/old-elf/AArch64/rel-prel32-overflow.test deleted file mode 100644 index 513adad08efe..000000000000 --- a/test/old-elf/AArch64/rel-prel32-overflow.test +++ /dev/null @@ -1,53 +0,0 @@ -# Check handling of R_AARCH64_PREL32 relocation overflow. -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: not lld -flavor old-gnu -target arm64 -o %t-exe %t-obj 2>&1 | FileCheck %s - -# CHECK: Relocation out of range in file {{.*}}: reference from data1+0 to data2+34359738369 of type 261 (R_AARCH64_PREL32) -# CHECK: Relocation out of range in file {{.*}}: reference from data2+0 to data1+34359738369 of type 261 (R_AARCH64_PREL32) - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_AARCH64 - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] -- Name: .data - Type: SHT_PROGBITS - Content: "0000000000000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rela.data - Type: SHT_RELA - Info: .data - AddressAlign: 8 - Relocations: - - Offset: 0x0 - Symbol: data2 - Type: R_AARCH64_PREL32 - Addend: 0x800000001 - - Offset: 0x4 - Symbol: data1 - Type: R_AARCH64_PREL32 - Addend: 0x800000001 - -Symbols: - Global: - - Name: _start - Section: .text - Value: 0x0 - Size: 4 - - Name: data1 - Section: .data - Size: 4 - - Name: data2 - Section: .data - Value: 0x4 - Size: 4 diff --git a/test/old-elf/AArch64/rel-prel32.test b/test/old-elf/AArch64/rel-prel32.test deleted file mode 100644 index 0e178ba97f41..000000000000 --- a/test/old-elf/AArch64/rel-prel32.test +++ /dev/null @@ -1,59 +0,0 @@ -# Check handling of R_AARCH64_PREL32 relocation. -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target arm64 -o %t-exe %t-obj -# RUN: llvm-objdump -s -t %t-exe | FileCheck %s - -# CHECK: Contents of section .data: -# CHECK-NEXT: 401060 05000080 fdffff7f ........ -# ^^ data2 - data1 + 0x80000001 = 0x80000005 -# ^^ data1 - data2 + 0x80000001 = 0x7ffffffd -# CHECK: SYMBOL TABLE: -# CHECK: 00401060 g .data 00000004 data1 -# CHECK: 00401064 g .data 00000004 data2 - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_AARCH64 - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] -- Name: .data - Type: SHT_PROGBITS - Content: "0000000000000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rela.data - Type: SHT_RELA - Info: .data - AddressAlign: 8 - Relocations: - - Offset: 0x0 - Symbol: data2 - Type: R_AARCH64_PREL32 - Addend: 0x80000001 - - Offset: 0x4 - Symbol: data1 - Type: R_AARCH64_PREL32 - Addend: 0x80000001 - -Symbols: - Global: - - Name: _start - Section: .text - Value: 0x0 - Size: 4 - - Name: data1 - Section: .data - Size: 4 - - Name: data2 - Section: .data - Value: 0x4 - Size: 4 diff --git a/test/old-elf/AArch64/rel-prel64.test b/test/old-elf/AArch64/rel-prel64.test deleted file mode 100644 index 3a3eb8b90fc3..000000000000 --- a/test/old-elf/AArch64/rel-prel64.test +++ /dev/null @@ -1,59 +0,0 @@ -# Check handling of R_AARCH64_PREL64 relocation. -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target arm64 -o %t-exe %t-obj -# RUN: llvm-objdump -s -t %t-exe | FileCheck %s - -# CHECK: Contents of section .data: -# CHECK-NEXT: 401060 09000000 00000080 f9ffffff ffffff7f ................ -# ^^ data2 - data1 + 0x8000000000000001 = 0x8000000000000009 -# ^^ data1 - data2 + 0x8000000000000001 = 0x7ffffffffffffff9 -# CHECK: SYMBOL TABLE: -# CHECK: 00401060 g .data 00000008 data1 -# CHECK: 00401068 g .data 00000008 data2 - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_AARCH64 - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] -- Name: .data - Type: SHT_PROGBITS - Content: "00000000000000000000000000000000" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rela.data - Type: SHT_RELA - Info: .data - AddressAlign: 8 - Relocations: - - Offset: 0x0 - Symbol: data2 - Type: R_AARCH64_PREL64 - Addend: -9223372036854775807 - - Offset: 0x8 - Symbol: data1 - Type: R_AARCH64_PREL64 - Addend: -9223372036854775807 - -Symbols: - Global: - - Name: _start - Section: .text - Value: 0x0 - Size: 4 - - Name: data1 - Section: .data - Size: 8 - - Name: data2 - Section: .data - Value: 0x8 - Size: 8 diff --git a/test/old-elf/ARM/Inputs/fn.c b/test/old-elf/ARM/Inputs/fn.c deleted file mode 100644 index 37c897ebb7f2..000000000000 --- a/test/old-elf/ARM/Inputs/fn.c +++ /dev/null @@ -1 +0,0 @@ -int fn() { return 1; } diff --git a/test/old-elf/ARM/Inputs/libfn.so b/test/old-elf/ARM/Inputs/libfn.so deleted file mode 100755 index 51934714841b..000000000000 Binary files a/test/old-elf/ARM/Inputs/libfn.so and /dev/null differ diff --git a/test/old-elf/ARM/Inputs/libobj.so b/test/old-elf/ARM/Inputs/libobj.so deleted file mode 100755 index 85b3ae4ca3d1..000000000000 Binary files a/test/old-elf/ARM/Inputs/libobj.so and /dev/null differ diff --git a/test/old-elf/ARM/Inputs/obj.c b/test/old-elf/ARM/Inputs/obj.c deleted file mode 100644 index fb6a9f13f698..000000000000 --- a/test/old-elf/ARM/Inputs/obj.c +++ /dev/null @@ -1,4 +0,0 @@ -static struct S { -} s; - -struct S *const object = &s; diff --git a/test/old-elf/ARM/arm-symbols.test b/test/old-elf/ARM/arm-symbols.test deleted file mode 100644 index ddf3c80862a5..000000000000 --- a/test/old-elf/ARM/arm-symbols.test +++ /dev/null @@ -1,51 +0,0 @@ -# Check that symbols formed from ARM instructions are valid: -# 1. Symbol address. -# 2. Symbol content size. -# 3. Symbol content. - -# RUN: yaml2obj -format=elf %s > %t-a.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: -Bstatic --noinhibit-exec %t-a.o -o %t-a -# RUN: llvm-readobj -symbols %t-a | FileCheck -check-prefix=SYM-ADDR %s -# RUN: llvm-readobj -symbols %t-a | FileCheck -check-prefix=SYM-SIZE %s -# RUN: llvm-objdump -s -t %t-a | FileCheck -check-prefix=SYM-CONTENT %s - -# SYM-ADDR: Name: main (1) -# SYM-ADDR-NEXT: Value: 0x400074 - -# SYM-SIZE: Name: main (1) -# SYM-SIZE-NEXT: Value: 0x{{[0-9a-f]+}} -# SYM-SIZE-NEXT: Size: 28 - -# SYM-CONTENT: Contents of section .text: -# SYM-CONTENT-NEXT: 400074 04b02de5 00b08de2 0030a0e3 0300a0e1 ..-......0...... -# SYM-CONTENT-NEXT: 400084 00d04be2 04b09de4 1eff2fe1 ..K......./. - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 04B02DE500B08DE20030A0E30300A0E100D04BE204B09DE41EFF2FE1 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: main - Type: STT_FUNC - Section: .text -... diff --git a/test/old-elf/ARM/defsym.test b/test/old-elf/ARM/defsym.test deleted file mode 100644 index 7d4fa7fcd4dc..000000000000 --- a/test/old-elf/ARM/defsym.test +++ /dev/null @@ -1,50 +0,0 @@ -# Check that defined symbols are present in the generated executable - -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu --defsym=main=fn \ -# RUN: -Bstatic --noinhibit-exec %t-o.o -o %t -# RUN: llvm-readobj -symbols %t | FileCheck %s - -# CHECK: Name: main (1) -# CHECK-NEXT: Value: 0x400074 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Function (0x2) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: .text (0x1) -# CHECK: Name: fn (6) -# CHECK-NEXT: Value: 0x400074 -# CHECK-NEXT: Size: {{[0-9]+}} -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Function (0x2) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: .text (0x1) - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 04B02DE500B08DE20030A0E30300A0E100D04BE204B09DE41EFF2FE1 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: fn - Type: STT_FUNC - Section: .text -... diff --git a/test/old-elf/ARM/dynamic-symbols.test b/test/old-elf/ARM/dynamic-symbols.test deleted file mode 100644 index 13963be8e701..000000000000 --- a/test/old-elf/ARM/dynamic-symbols.test +++ /dev/null @@ -1,83 +0,0 @@ -# Check that proper dynamic symbols are present in the generated executable - -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: -Bstatic --noinhibit-exec %t-o.o -o %t -# RUN: llvm-readobj -symbols %t | FileCheck -check-prefix=STATIC %s - -# STATIC-NOT: Name: _GLOBAL_OFFSET_TABLE_ -# STATIC-NOT: Name: _DYNAMIC - -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: --noinhibit-exec %t-o.o -o %t -# RUN: llvm-readobj -symbols %t | FileCheck -check-prefix=EXEC-DYN %s - -# EXEC-DYN: Name: _GLOBAL_OFFSET_TABLE_ -# EXEC-DYN-NEXT: Value: 0x401000 -# EXEC-DYN-NEXT: Size: 0 -# EXEC-DYN-NEXT: Binding: Global (0x1) -# EXEC-DYN-NEXT: Type: Object (0x1) -# EXEC-DYN-NEXT: Other: 0 -# EXEC-DYN-NEXT: Section: Absolute (0xFFF1) -# EXEC-DYN: Name: _DYNAMIC -# EXEC-DYN-NEXT: Value: 0x400130 -# EXEC-DYN-NEXT: Size: 0 -# EXEC-DYN-NEXT: Binding: Global (0x1) -# EXEC-DYN-NEXT: Type: Object (0x1) -# EXEC-DYN-NEXT: Other: 0 -# EXEC-DYN-NEXT: Section: Absolute (0xFFF1) - -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: -shared --noinhibit-exec %t-o.o -o %t -# RUN: llvm-readobj -symbols %t | FileCheck -check-prefix=SHARED %s - -# SHARED: Name: _GLOBAL_OFFSET_TABLE_ -# SHARED-NEXT: Value: 0x401000 -# SHARED-NEXT: Size: 0 -# SHARED-NEXT: Binding: Global (0x1) -# SHARED-NEXT: Type: Object (0x1) -# SHARED-NEXT: Other: 0 -# SHARED-NEXT: Section: Absolute (0xFFF1) -# SHARED: Name: _DYNAMIC -# SHARED-NEXT: Value: 0x4000EC -# SHARED-NEXT: Size: 0 -# SHARED-NEXT: Binding: Global (0x1) -# SHARED-NEXT: Type: Object (0x1) -# SHARED-NEXT: Other: 0 -# SHARED-NEXT: Section: Absolute (0xFFF1) - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 04B02DE500B08DE20030A0E30300A0E100D04BE204B09DE41EFF2FE1 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - - Name: .got - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: 0000 -Symbols: - Global: - - Name: main - Type: STT_FUNC - Section: .text -... diff --git a/test/old-elf/ARM/entry-point.test b/test/old-elf/ARM/entry-point.test deleted file mode 100644 index 4cfee4aa6c7b..000000000000 --- a/test/old-elf/ARM/entry-point.test +++ /dev/null @@ -1,113 +0,0 @@ -# 1. Check entry point address for ARM code - should be even. -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-arm.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-arm.o -o %t-arm -# RUN: llvm-readobj -file-headers %t-arm | FileCheck -check-prefix=ARM-ENTRY %s -# -# ARM-ENTRY: Entry: 0x400074 - -# 2. Check entry point address for Thumb code - should be odd. -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-thm.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-thm.o -o %t-thm -# RUN: llvm-readobj -file-headers %t-thm | FileCheck -check-prefix=THM-ENTRY %s -# -# THM-ENTRY: Entry: 0x400075 - -# 3. Check wrong entry point address align for ARM code. -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-arm-wrong.o -# RUN: not lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-arm-wrong.o -o %t-arm-wrong 2> %t-error -# FileCheck -check-prefix=ARM-WRONG %s < %t-error -# -# ARM-WRONG: Two least bits must be zero for ARM entry point - -# arm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 04B02DE500B08DE20030A0E30300A0E100D04BE204B09DE41EFF2FE1 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: _start - Type: STT_FUNC - Section: .text - -# thm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AF00231846BD465DF8047B7047 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: _start - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - -# arm-wrong.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000006 - Content: 04B02DE500B08DE20030A0E30300A0E100D04BE204B09DE41EFF2FE1 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: _start - Type: STT_FUNC - Section: .text - Value: 0x0000000000000002 -... diff --git a/test/old-elf/ARM/exidx.test b/test/old-elf/ARM/exidx.test deleted file mode 100644 index a277cfcd09ae..000000000000 --- a/test/old-elf/ARM/exidx.test +++ /dev/null @@ -1,254 +0,0 @@ -# .ARM.exidx contents checking -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target arm-none-linux-eabi -static -o %t %t.o -# RUN: llvm-objdump -s -t -section-headers %t | FileCheck %s -# -# CHECK: Sections: -# CHECK: Idx Name Size Address Type -# CHECK: 2 .ARM.extab 0000000c 00000000004000b4 DATA -# CHECK: 3 .ARM.exidx 00000018 00000000004000c0 -# CHECK: Contents of section .text: -# CHECK: 4000a4 1846aff3 00801846 0837bd46 80bd00bf -# ^ -# 4000b0: bd80 pop {r7, pc} -# CHECK: Contents of section .ARM.extab: -# CHECK: 4000b4 01970181 b0b00884 00000000 -# CHECK: Contents of section .ARM.exidx: -# CHECK: 4000c0 b4ffff7f 08809780 bcffff7f 08809780 -# ^ offset to 400074 (__aeabi_unwind_cpp_pr0) -# CHECK: 4000d0 c4ffff7f e0ffff7f -# ^ ^ -# offset to 400094 (_start) handler at 4000B0 -# -# CHECK: SYMBOL TABLE: -# CHECK: 004000b4 .ARM.extab 00000000 $d.2 -# CHECK: 004000c0 .ARM.exidx 00000000 $d.1 -# CHECK: 00400074 g F .text 00000010 __aeabi_unwind_cpp_pr0 -# CHECK: 00400094 g F .text 00000020 _start - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AF00231846BD465DF8047B704780B400AF00231846BD465DF8047B704780B582B000AF3B1D1846FFF7FEFF3B1D1846FFF7FEFF18460837BD4680BD00BF - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x000000000000002A - Symbol: _ZN1AILi1EEC1Ev - Type: R_ARM_THM_CALL - - Offset: 0x0000000000000032 - Symbol: _ZN1AILi1EED1Ev - Type: R_ARM_THM_CALL - - Name: .ARM.extab - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: 01970181B0B0088400000000 - - Name: .ARM.exidx - Type: SHT_ARM_EXIDX - Flags: [ SHF_ALLOC, SHF_LINK_ORDER ] - Link: .text - AddressAlign: 0x0000000000000004 - Content: '000000000880978010000000088097802000000000000000' - - Name: .rel.ARM.exidx - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .ARM.exidx - Relocations: - - Offset: 0x0000000000000000 - Symbol: .text - Type: R_ARM_PREL31 - - Offset: 0x0000000000000000 - Symbol: __aeabi_unwind_cpp_pr0 - Type: R_ARM_NONE - - Offset: 0x0000000000000008 - Symbol: .text - Type: R_ARM_PREL31 - - Offset: 0x0000000000000010 - Symbol: .text - Type: R_ARM_PREL31 - - Offset: 0x0000000000000010 - Symbol: __aeabi_unwind_cpp_pr1 - Type: R_ARM_NONE - - Offset: 0x0000000000000014 - Symbol: .ARM.extab - Type: R_ARM_PREL31 - - Name: .text._ZN1AILi1EEC2Ev - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ] - AddressAlign: 0x0000000000000004 - Content: 80B582B000AF78600120FFF7FEFF7B6818460837BD4680BD - - Name: .rel.text._ZN1AILi1EEC2Ev - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text._ZN1AILi1EEC2Ev - Relocations: - - Offset: 0x000000000000000A - Symbol: f - Type: R_ARM_THM_CALL - - Name: .ARM.extab.text._ZN1AILi1EEC2Ev - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_GROUP ] - AddressAlign: 0x0000000000000004 - Content: 01970181B0B0088400000000 - - Name: .ARM.exidx.text._ZN1AILi1EEC2Ev - Type: SHT_ARM_EXIDX - Flags: [ SHF_ALLOC, SHF_LINK_ORDER, SHF_GROUP ] - Link: .text._ZN1AILi1EEC2Ev - AddressAlign: 0x0000000000000004 - Content: '0000000000000000' - - Name: .rel.ARM.exidx.text._ZN1AILi1EEC2Ev - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .ARM.exidx.text._ZN1AILi1EEC2Ev - Relocations: - - Offset: 0x0000000000000000 - Symbol: .text._ZN1AILi1EEC2Ev - Type: R_ARM_PREL31 - - Offset: 0x0000000000000000 - Symbol: __aeabi_unwind_cpp_pr1 - Type: R_ARM_NONE - - Offset: 0x0000000000000004 - Symbol: .ARM.extab.text._ZN1AILi1EEC2Ev - Type: R_ARM_PREL31 - - Name: .text._ZN1AILi1EED2Ev - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ] - AddressAlign: 0x0000000000000004 - Content: 80B582B000AF78604FF0FF30FFF7FEFF7B6818460837BD4680BD00BF - - Name: .rel.text._ZN1AILi1EED2Ev - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text._ZN1AILi1EED2Ev - Relocations: - - Offset: 0x000000000000000C - Symbol: f - Type: R_ARM_THM_CALL - - Name: .ARM.extab.text._ZN1AILi1EED2Ev - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_GROUP ] - AddressAlign: 0x0000000000000004 - Content: 01970181B0B0088400000000 - - Name: .ARM.exidx.text._ZN1AILi1EED2Ev - Type: SHT_ARM_EXIDX - Flags: [ SHF_ALLOC, SHF_LINK_ORDER, SHF_GROUP ] - Link: .text._ZN1AILi1EED2Ev - AddressAlign: 0x0000000000000004 - Content: '0000000000000000' - - Name: .rel.ARM.exidx.text._ZN1AILi1EED2Ev - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .ARM.exidx.text._ZN1AILi1EED2Ev - Relocations: - - Offset: 0x0000000000000000 - Symbol: .text._ZN1AILi1EED2Ev - Type: R_ARM_PREL31 - - Offset: 0x0000000000000000 - Symbol: __aeabi_unwind_cpp_pr1 - Type: R_ARM_NONE - - Offset: 0x0000000000000004 - Symbol: .ARM.extab.text._ZN1AILi1EED2Ev - Type: R_ARM_PREL31 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: '$t.1' - Section: .text - - Name: .ARM.extab - Type: STT_SECTION - Section: .ARM.extab - - Name: .ARM.exidx - Type: STT_SECTION - Section: .ARM.exidx - - Name: '$d.1' - Section: .ARM.exidx - - Name: '$d.2' - Section: .ARM.extab - - Name: .text._ZN1AILi1EEC2Ev - Type: STT_SECTION - Section: .text._ZN1AILi1EEC2Ev - - Name: '$t.2' - Section: .text._ZN1AILi1EEC2Ev - - Name: .ARM.extab.text._ZN1AILi1EEC2Ev - Type: STT_SECTION - Section: .ARM.extab.text._ZN1AILi1EEC2Ev - - Name: '$d.3' - Section: .ARM.extab.text._ZN1AILi1EEC2Ev - - Name: .ARM.exidx.text._ZN1AILi1EEC2Ev - Type: STT_SECTION - Section: .ARM.exidx.text._ZN1AILi1EEC2Ev - - Name: '$d.4' - Section: .ARM.exidx.text._ZN1AILi1EEC2Ev - - Name: .text._ZN1AILi1EED2Ev - Type: STT_SECTION - Section: .text._ZN1AILi1EED2Ev - - Name: '$t.3' - Section: .text._ZN1AILi1EED2Ev - - Name: .ARM.extab.text._ZN1AILi1EED2Ev - Type: STT_SECTION - Section: .ARM.extab.text._ZN1AILi1EED2Ev - - Name: '$d.5' - Section: .ARM.extab.text._ZN1AILi1EED2Ev - - Name: .ARM.exidx.text._ZN1AILi1EED2Ev - Type: STT_SECTION - Section: .ARM.exidx.text._ZN1AILi1EED2Ev - - Name: '$d.6' - Section: .ARM.exidx.text._ZN1AILi1EED2Ev - Global: - - Name: __aeabi_unwind_cpp_pr0 - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - Size: 0x0000000000000010 - - Name: __aeabi_unwind_cpp_pr1 - Type: STT_FUNC - Section: .text - Value: 0x0000000000000011 - Size: 0x0000000000000010 - - Name: _start - Type: STT_FUNC - Section: .text - Value: 0x0000000000000021 - Size: 0x000000000000001E - Weak: - - Name: _ZN1AILi1EEC1Ev - Type: STT_FUNC - Section: .text._ZN1AILi1EEC2Ev - Value: 0x0000000000000001 - Size: 0x0000000000000018 - - Name: _ZN1AILi1EED1Ev - Type: STT_FUNC - Section: .text._ZN1AILi1EED2Ev - Value: 0x0000000000000001 - Size: 0x000000000000001A - - Name: _ZN1AILi1EEC2Ev - Type: STT_FUNC - Section: .text._ZN1AILi1EEC2Ev - Value: 0x0000000000000001 - Size: 0x0000000000000018 - - Name: f - - Name: _ZN1AILi1EED2Ev - Type: STT_FUNC - Section: .text._ZN1AILi1EED2Ev - Value: 0x0000000000000001 - Size: 0x000000000000001A -... diff --git a/test/old-elf/ARM/header-flags.test b/test/old-elf/ARM/header-flags.test deleted file mode 100644 index 735d65225216..000000000000 --- a/test/old-elf/ARM/header-flags.test +++ /dev/null @@ -1,57 +0,0 @@ -# Various checks for header flags. - -# 1. Check header flags for statically linked executable with default options. -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t.o -o %t -# RUN: llvm-readobj -file-headers %t | FileCheck -check-prefix=STATIC-DEF %s -# -# STATIC-DEF: Flags {{.}} (0x5000400) -# ABI version 5 + hard float ^^ - -# 2. Check header flags for dynamically linked executable with default options. -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi \ -# RUN: --noinhibit-exec %t.o -o %t -# RUN: llvm-readobj -file-headers %t | FileCheck -check-prefix=EXEC-DYN-DEF %s -# -# EXEC-DYN-DEF: Flags {{.}} (0x5000400) -# ABI version 5 + hard float ^^ - -# 3. Check header flags for shared object with default options. -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -shared \ -# RUN: --noinhibit-exec %t.o -o %t -# RUN: llvm-readobj -file-headers %t | FileCheck -check-prefix=SHARED-DEF %s -# -# SHARED-DEF: Flags {{.}} (0x5000400) -# ABI version 5 + hard float ^^ - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 04B02DE500B08DE20030A0E30300A0E100D04BE204B09DE41EFF2FE1 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: main - Type: STT_FUNC - Section: .text -... diff --git a/test/old-elf/ARM/mapping-code-model.test b/test/old-elf/ARM/mapping-code-model.test deleted file mode 100644 index affa10b464f8..000000000000 --- a/test/old-elf/ARM/mapping-code-model.test +++ /dev/null @@ -1,160 +0,0 @@ -# Check that mapping symbols are treated as ARM or Thumb code properly. -# -# 1. ARM <=> Thumb generates both veneers. -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-a-arm.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-t-thm.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu --defsym=main=f_a \ -# RUN: -Bstatic --noinhibit-exec %t-a-arm.o %t-t-thm.o -o %t -# RUN: llvm-objdump -t %t | FileCheck -check-prefix=INTER %s - -# INTER: SYMBOL TABLE: -# INTER: {{[0-9a-f]+}} l F .text {{[0-9a-f]+}} __f_t_from_arm -# INTER: {{[0-9a-f]+}} l F .text {{[0-9a-f]+}} __f_a_from_thumb - -# 2. Thumb <=> Thumb doesn't generate veneers. -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-a-thm.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-t-thm.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu --defsym=main=f_t \ -# RUN: -Bstatic --noinhibit-exec %t-t-thm.o %t-a-thm.o -o %t -# RUN: llvm-objdump -t %t | FileCheck -check-prefix=THUMB %s - -# THUMB: SYMBOL TABLE: -# THUMB-NOT: {{[0-9a-f]+}} l F .text {{[0-9a-f]+}} __f_t_from_thumb -# THUMB-NOT: {{[0-9a-f]+}} l F .text {{[0-9a-f]+}} __f_a_from_thumb - -# f-a-arm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 00482DE904B08DE2FEFFFFEBFEFFFFEA0030A0E10300A0E10088BDE8 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000008 - Symbol: f_t - Type: R_ARM_CALL - - Offset: 0x000000000000000C - Symbol: f_t - Type: R_ARM_JUMP24 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Local: - - Name: '$a' - Section: .text - Size: 0x0000000000000002 - - Name: '$a.f_a' - Section: .text - Value: 0x0000000000000002 - Global: - - Name: f_a - Type: STT_FUNC - Section: .text - - Name: f_t - -# f-a-thm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AF00231846BD465DF8047B7047 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Local: - - Name: '$t' - Section: .text - Size: 0x0000000000000002 - - Name: '$t.f_a' - Section: .text - Value: 0x0000000000000002 - Global: - - Name: f_a - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - -# f-t-thm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B500AFFFF7FEFFFFF7FEBF0346184680BD00BF - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000004 - Symbol: f_a - Type: R_ARM_THM_CALL - - Offset: 0x0000000000000008 - Symbol: f_a - Type: R_ARM_THM_JUMP24 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Local: - - Name: '$t' - Section: .text - Size: 0x0000000000000002 - - Name: '$t.f_t' - Section: .text - Value: 0x0000000000000002 - Global: - - Name: f_t - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - - Name: f_a -... diff --git a/test/old-elf/ARM/mapping-symbols.test b/test/old-elf/ARM/mapping-symbols.test deleted file mode 100644 index c6a4b7afc50b..000000000000 --- a/test/old-elf/ARM/mapping-symbols.test +++ /dev/null @@ -1,122 +0,0 @@ -# Check that mapping symbols have zero size, local binding and none type. -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-a.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-t.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: -Bstatic --noinhibit-exec %t-a.o %t-t.o -o %t -# RUN: llvm-readobj -symbols %t | FileCheck %s - -# CHECK: Name: $a (1) -# CHECK-NEXT: Value: 0x{{[0-9a-f]+}} -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Local (0x0) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# -# CHECK: Name: $t (9) -# CHECK-NEXT: Value: 0x{{[0-9a-f]+}} -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Local (0x0) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# -# CHECK: Name: $d (24) -# CHECK-NEXT: Value: 0x{{[0-9a-f]+}} -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Local (0x0) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 - -# arm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 00482DE904B08DE2FEFFFFEB0030A0E10300A0E10088BDE8 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000008 - Symbol: _Z1fv - Type: R_ARM_CALL - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Local: - - Name: '$a' - Section: .text - Global: - - Name: main - Type: STT_FUNC - Section: .text - - Name: _Z1fv - -# thm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AF40F20003C0F200031B681846BD465DF8047B7047 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000004 - Symbol: _ZL1i - Type: R_ARM_THM_MOVW_ABS_NC - - Offset: 0x0000000000000008 - Symbol: _ZL1i - Type: R_ARM_THM_MOVT_ABS - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Size: 4 -Symbols: - Local: - - Name: _ZL1i - Type: STT_OBJECT - Section: .bss - Size: 0x0000000000000004 - - Name: '$d' - Section: .bss - - Name: '$t' - Section: .text - Global: - - Name: _Z1fv - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 -... diff --git a/test/old-elf/ARM/missing-symbol.test b/test/old-elf/ARM/missing-symbol.test deleted file mode 100644 index a0d3dd51e57b..000000000000 --- a/test/old-elf/ARM/missing-symbol.test +++ /dev/null @@ -1,38 +0,0 @@ -# Check that _MISSING_SYMBOL_ symbol is not resolved - -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-o.o -o %t 2>&1 | FileCheck %s - -# CHECK: Undefined symbol: {{.*}}: _MISSING_SYMBOL_ - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B483B000AF40F20003C0F200037B60002318460C37BD465DF8047B704700BF - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - - Name: _MISSING_SYMBOL_ -... diff --git a/test/old-elf/ARM/plt-dynamic.test b/test/old-elf/ARM/plt-dynamic.test deleted file mode 100644 index 905f628edb49..000000000000 --- a/test/old-elf/ARM/plt-dynamic.test +++ /dev/null @@ -1,200 +0,0 @@ -# Check that PLT entries are properly generated when link dynamically. -# -# 1. ARM code generates PLT entries. -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-arm.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: --noinhibit-exec %t-arm.o -lfn -L%p/Inputs -o %t -# RUN: llvm-objdump -s %t | FileCheck -check-prefix=ARM %s - -# ARM: Contents of section .rel.plt: -# ARM-NEXT: 400134 0c104000 16010000 -# GOT addr = 0x40100c ^^ -# ARM-NEXT: Contents of section .plt: -# ARM-NEXT: 40013c 04e02de5 04e09fe5 0ee08fe0 00f0bee5 -# ^ -- PLT0 -- -# ARM-NEXT: 40014c bc0e0000 00c68fe2 00ca8ce2 b4febce5 -# -- ^ ^ -- PLT_fn -- ^ -# ARM-NEXT: Contents of section .text: -# ARM-NEXT: 40015c {{[0-9a-f]+}} {{[0-9a-f]+}} f9ffffea -# b PLT_fn ^^ -# ARM: Contents of section .got.plt: -# ARM-NEXT: 401000 00000000 00000000 00000000 3c014000 -# PLT0 addr = 0x40013c ^^ - -# 2. Thumb code generates PLT entries with veneers. -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-thm.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: --noinhibit-exec %t-thm.o -lfn -L%p/Inputs -o %t -# RUN: llvm-objdump -s %t | FileCheck -check-prefix=THM %s - -# THM: Contents of section .rel.plt: -# THM-NEXT: 400134 0c104000 16010000 -# GOT addr = 0x40100c ^^ -# THM-NEXT: Contents of section .plt: -# THM-NEXT: 40013c 04e02de5 04e09fe5 0ee08fe0 00f0bee5 -# ^ -- PLT0 -- -# THM-NEXT: 40014c bc0e0000 78470000 00c68fe2 00ca8ce2 -# -- ^ veneer ^ ^ -- PLT_fn -- -# THM-NEXT: 40015c b0febce5 -# -- ^ -# THM: Contents of section .text: -# THM-NEXT: 400160 {{[0-9a-f]+}} fff7f4bf -# b PLT_fn ^^ - -# 3. Thumb code generates PLT entries without veneers when bl->blx is done. -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-thm.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: --noinhibit-exec %t-thm.o -lfn -L%p/Inputs -o %t -# RUN: llvm-objdump -s %t | FileCheck -check-prefix=THM-BLX %s - -# THM-BLX: Contents of section .rel.plt: -# THM-BLX-NEXT: 400134 0c104000 16010000 -# GOT addr = 0x40100c ^^ -# THM-BLX-NEXT: Contents of section .plt: -# THM-BLX-NEXT: 40013c 04e02de5 04e09fe5 0ee08fe0 00f0bee5 -# ^ -- PLT0 -- -# THM-BLX-NEXT: 40014c bc0e0000 00c68fe2 00ca8ce2 b4febce5 -# -- ^ ^ -- PLT_fn -- ^ -# THM-BLX: Contents of section .text: -# THM-BLX-NEXT: 40015c {{[0-9a-f]+}} fff7f6ef -# blx PLT_fn ^^ - -# Generation of mapping symbols. -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-arm.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: --noinhibit-exec %t-arm.o -lfn -L%p/Inputs -o %t-arm -# RUN: llvm-readobj -symbols %t-arm | FileCheck -check-prefix=ARM-MAPPING %s - -# ARM-MAPPING: Name: {{[$]?[a]?[.]?}}__PLT0 -# ARM-MAPPING: Name: {{[$]?[d]?[.]?}}__PLT0_d -# ARM-MAPPING: Name: {{[$]?[a]?[.]?}}__plt_fn - -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-thm.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: --noinhibit-exec %t-thm.o -lfn -L%p/Inputs -o %t-thm -# RUN: llvm-readobj -symbols %t-thm | FileCheck -check-prefix=THM-MAPPING %s - -# THM-MAPPING: Name: {{[$]?[a]?[.]?}}__PLT0 -# THM-MAPPING: Name: {{[$]?[d]?[.]?}}__PLT0_d -# THM-MAPPING: Name: {{[$]?[t]?[.]?}}__plt_from_thumb_fn -# THM-MAPPING: Name: {{[$]?[a]?[.]?}}__plt_fn - -# arm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 00482DE904B08DE2FEFFFFEA0030A0E10300A0E10088BDE8 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000008 - Symbol: fn - Type: R_ARM_JUMP24 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: main - Type: STT_FUNC - Section: .text - - Name: fn - -# thm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B500AFFFF7FEBF0346184680BD00BF - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000004 - Symbol: fn - Type: R_ARM_THM_JUMP24 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - - Name: fn - -# thm-c.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B500AFFFF7FEFF0346184680BD00BF - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000004 - Symbol: fn - Type: R_ARM_THM_CALL - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - - Name: fn -... diff --git a/test/old-elf/ARM/plt-ifunc-interwork.test b/test/old-elf/ARM/plt-ifunc-interwork.test deleted file mode 100644 index 29d8282edf26..000000000000 --- a/test/old-elf/ARM/plt-ifunc-interwork.test +++ /dev/null @@ -1,396 +0,0 @@ -# Check that PLT entries are properly generated for cases when -# referenced from both ARM and Thumb code. -# -# 1. ARM code generates PLT without transition veneer. -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-f1-arm.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: -Bstatic --noinhibit-exec %t-f1-arm.o -o %t -# RUN: llvm-objdump -s %t | FileCheck -check-prefix=ARM-ONE %s - -# ARM-ONE: Contents of section .plt: -# ARM-ONE-NEXT: 40007c 00c68fe2 00ca8ce2 7cffbce5 -# ^ regular veneer ^ -# Next line shows that .plt section ends. -# ARM-ONE-NEXT: Contents of section .text: - -# 2. Thumb code generates PLT with transition veneer. -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-f1-thm.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: -Bstatic --noinhibit-exec %t-f1-thm.o -o %t -# RUN: llvm-objdump -s %t | FileCheck -check-prefix=THM-ONE %s - -# THM-ONE: Contents of section .plt: -# THM-ONE-NEXT: 40007c 78470000 00c68fe2 00ca8ce2 78ffbce5 -# bx pc ^^ ^ regular veneer ^ -# Next line shows that .plt section ends. -# THM-ONE-NEXT: Contents of section .text: - -# 3. ARM + Thumb code generate same single PLT with transition veneer. -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-f1-arm.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-f1-thm-for-arm.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: -Bstatic --noinhibit-exec %t-f1-arm.o %t-f1-thm-for-arm.o -o %t -# RUN: llvm-objdump -s %t | FileCheck -check-prefix=THM-ONE %s - -# 4. Thumb + ARM code generate same single PLT with transition veneer. -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-f1-thm-for-arm.o -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-f1-arm.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: -Bstatic --noinhibit-exec %t-f1-thm-for-arm.o %t-f1-arm.o -o %t -# RUN: llvm-objdump -s %t | FileCheck -check-prefix=THM-ONE %s - -# 5. ARM + ARM code generate two PLTs without transition veneers. -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-f1-arm.o -# RUN: yaml2obj -format=elf -docnum 4 %s > %t-f2-arm.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: -Bstatic --noinhibit-exec %t-f1-arm.o %t-f2-arm.o -o %t -# RUN: llvm-objdump -s %t | FileCheck -check-prefix=ARM-TWO %s - -# ARM-TWO: Contents of section .plt: -# ARM-TWO-NEXT: 400084 00c68fe2 00ca8ce2 74ffbce5 00c68fe2 -# ^ regular veneer 1 ^ ^ -- -# ARM-TWO-NEXT: 400094 00ca8ce2 6cffbce5 -# --- regular veneer 2 ^ -# Next line shows that .plt section ends. -# ARM-TWO-NEXT: Contents of section .text: - -# 6. ARM + Thumb code generate two PLTs without and with transition veneer. -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-f1-arm.o -# RUN: yaml2obj -format=elf -docnum 5 %s > %t-f2-thm.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: -Bstatic --noinhibit-exec %t-f1-arm.o %t-f2-thm.o -o %t -# RUN: llvm-objdump -s %t | FileCheck -check-prefix=ARM-THM-TWO %s - -# ARM-THM-TWO: Contents of section .plt: -# ARM-THM-TWO-NEXT: 400084 00c68fe2 00ca8ce2 74ffbce5 78470000 -# ^ regular veneer 1 ^ ^^ bx pc 2 -# ARM-THM-TWO-NEXT: 400094 00c68fe2 00ca8ce2 68ffbce5 -# ^ regular veneer 2 ^ -# Next line shows that .plt section ends. -# ARM-THM-TWO-NEXT: Contents of section .text: - -# 7. Thumb + ARM code generate two PLTs with and without transition veneer. -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-f1-thm.o -# RUN: yaml2obj -format=elf -docnum 4 %s > %t-f2-arm.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: -Bstatic --noinhibit-exec %t-f1-thm.o %t-f2-arm.o -o %t -# RUN: llvm-objdump -s %t | FileCheck -check-prefix=THM-ARM-TWO %s - -# THM-ARM-TWO: Contents of section .plt: -# THM-ARM-TWO-NEXT: 400084 78470000 00c68fe2 00ca8ce2 70ffbce -# bx pc 1 ^^ ^ regular veneer 1 ^ -# THM-ARM-TWO-NEXT: 400094 00c68fe2 00ca8ce2 68ffbce5 -# ^ regular veneer 2 ^ -# Next line shows that .plt section ends. -# THM-ARM-TWO-NEXT: Contents of section .text: - -# 8. Thumb + Thumb code generate two PLTs with transition veneers. -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-f1-thm.o -# RUN: yaml2obj -format=elf -docnum 5 %s > %t-f2-thm.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: -Bstatic --noinhibit-exec %t-f1-thm.o %t-f2-thm.o -o %t -# RUN: llvm-objdump -s %t | FileCheck -check-prefix=THM-TWO %s - -# THM-TWO: Contents of section .plt: -# THM-TWO-NEXT: 400084 78470000 00c68fe2 00ca8ce2 70ffbce5 -# bx pc 1 ^^ ^ regular veneer 1 ^ -# THM-TWO-NEXT: 400094 78470000 00c68fe2 00ca8ce2 64ffbce5 -# bx pc 2 ^^ ^ regular veneer 2 ^ -# Next line shows that .plt section ends. -# THM-TWO-NEXT: Contents of section .text: - -# 9. Thumb code generates PLT without transition veneer when bl->blx is done. -# RUN: yaml2obj -format=elf -docnum 6 %s > %t-f1-thm-c.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: -Bstatic --noinhibit-exec %t-f1-thm-c.o -o %t -# RUN: llvm-objdump -s %t | FileCheck -check-prefix=THM-BL %s - -# THM-BL: Contents of section .plt: -# THM-BL-NEXT: 40007c 00c68fe2 00ca8ce2 7cffbce5 -# ^ regular veneer ^ -# Next line shows that .plt section ends. -# THM-BL-NEXT: Contents of section .text: - -# f1-arm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 04B02DE500B08DE2003000E3003040E30300A0E100D04BE204B09DE41EFF2FE100482DE904B08DE2FEFFFFEA0030A0E10300A0E10088BDE8 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000008 - Symbol: main - Type: R_ARM_MOVW_ABS_NC - - Offset: 0x000000000000000C - Symbol: main - Type: R_ARM_MOVT_ABS - - Offset: 0x0000000000000028 - Symbol: f1 - Type: R_ARM_JUMP24 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: f1 - Type: STT_GNU_IFUNC - Section: .text - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000020 - -# f1-thm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AF40F20003C0F200031846BD465DF8047B704700BF80B500AFFFF7FEBF0346184680BD00BF - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000004 - Symbol: main - Type: R_ARM_THM_MOVW_ABS_NC - - Offset: 0x0000000000000008 - Symbol: main - Type: R_ARM_THM_MOVT_ABS - - Offset: 0x000000000000001C - Symbol: f1 - Type: R_ARM_THM_JUMP24 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: f1 - Type: STT_GNU_IFUNC - Section: .text - Value: 0x0000000000000001 - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000019 - -# f1-thm-for-arm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B500AFFFF7FEBF0346184680BD00BF - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000004 - Symbol: f1 - Type: R_ARM_THM_JUMP24 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: f - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - - Name: f1 - -# f2-arm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 04B02DE500B08DE2003000E3003040E30300A0E100D04BE204B09DE41EFF2FE100482DE904B08DE2FEFFFFEA0030A0E10300A0E10088BDE8 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000008 - Symbol: f - Type: R_ARM_MOVW_ABS_NC - - Offset: 0x000000000000000C - Symbol: f - Type: R_ARM_MOVT_ABS - - Offset: 0x0000000000000028 - Symbol: f2 - Type: R_ARM_JUMP24 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: f2 - Type: STT_GNU_IFUNC - Section: .text - - Name: f - Type: STT_FUNC - Section: .text - Value: 0x0000000000000020 - -# f2-thm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AF40F20003C0F200031846BD465DF8047B704700BF80B500AFFFF7FEBF0346184680BD00BF - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000004 - Symbol: f - Type: R_ARM_THM_MOVW_ABS_NC - - Offset: 0x0000000000000008 - Symbol: f - Type: R_ARM_THM_MOVT_ABS - - Offset: 0x000000000000001C - Symbol: f2 - Type: R_ARM_THM_JUMP24 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: f2 - Type: STT_GNU_IFUNC - Section: .text - Value: 0x0000000000000001 - - Name: f - Type: STT_FUNC - Section: .text - Value: 0x0000000000000019 - -# f1-thm-c.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AF40F20003C0F200031846BD465DF8047B704700BF80B500AFFFF7FEFF0346184680BD00BF - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000004 - Symbol: main - Type: R_ARM_THM_MOVW_ABS_NC - - Offset: 0x0000000000000008 - Symbol: main - Type: R_ARM_THM_MOVT_ABS - - Offset: 0x000000000000001C - Symbol: f1 - Type: R_ARM_THM_CALL - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: f1 - Type: STT_GNU_IFUNC - Section: .text - Value: 0x0000000000000001 - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000019 -... diff --git a/test/old-elf/ARM/plt-ifunc-mapping.test b/test/old-elf/ARM/plt-ifunc-mapping.test deleted file mode 100644 index 8c6d23aec084..000000000000 --- a/test/old-elf/ARM/plt-ifunc-mapping.test +++ /dev/null @@ -1,109 +0,0 @@ -# Check that mapping symbols are properly generated for IFUNC PLT entries. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-arm.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-thm.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: -Bstatic --noinhibit-exec %t-arm.o %t-thm.o -o %t -# RUN: llvm-readobj -symbols %t | FileCheck %s - -# CHECK: Name: {{[$]?[a]?[.]?}}__plt_ifunc_f1 -# CHECK: Name: {{[$]?[t]?[.]?}}__plt_from_thumb_ifunc_f2 -# CHECK: Name: {{[$]?[a]?[.]?}}__plt_ifunc_f2 - -# arm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 04B02DE500B08DE2003000E3003040E30300A0E100D04BE204B09DE41EFF2FE100482DE904B08DE2FEFFFFEA0030A0E10300A0E10088BDE8 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000008 - Symbol: main - Type: R_ARM_MOVW_ABS_NC - - Offset: 0x000000000000000C - Symbol: main - Type: R_ARM_MOVT_ABS - - Offset: 0x0000000000000028 - Symbol: f1 - Type: R_ARM_JUMP24 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: f1 - Type: STT_GNU_IFUNC - Section: .text - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000020 - -# thm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AF40F20003C0F200031846BD465DF8047B704700BF80B500AFFFF7FEBF0346184680BD00BF - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000004 - Symbol: f - Type: R_ARM_THM_MOVW_ABS_NC - - Offset: 0x0000000000000008 - Symbol: f - Type: R_ARM_THM_MOVT_ABS - - Offset: 0x000000000000001C - Symbol: f2 - Type: R_ARM_THM_JUMP24 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: f2 - Type: STT_GNU_IFUNC - Section: .text - Value: 0x0000000000000001 - - Name: f - Type: STT_FUNC - Section: .text - Value: 0x0000000000000019 -... diff --git a/test/old-elf/ARM/rel-abs32.test b/test/old-elf/ARM/rel-abs32.test deleted file mode 100644 index 7dcf632f53d3..000000000000 --- a/test/old-elf/ARM/rel-abs32.test +++ /dev/null @@ -1,58 +0,0 @@ -# Check handling of R_ARM_ABS32 relocation. -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-o.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck %s - -# CHECK: Contents of section .data: -# CHECK-NEXT: 401000 84004000 -# data = 0x400084 ^^ -# data main addr content -# 0x400084 = 0x400074 + 0x10 -# CHECK: SYMBOL TABLE: -# CHECK: 00400074 g F .text {{[0-9a-f]+}} main -# CHECK: 00401000 g .data 00000004 data - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 04B02DE500B08DE20030A0E30300A0E100D04BE204B09DE41EFF2FE1 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '10000000' - - Name: .rel.data - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .data - Relocations: - - Offset: 0x0000000000000000 - Symbol: main - Type: R_ARM_ABS32 - Addend: 0 - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x000000000000001C - - Name: data - Type: STT_OBJECT - Section: .data - Size: 0x0000000000000004 -... diff --git a/test/old-elf/ARM/rel-arm-call.test b/test/old-elf/ARM/rel-arm-call.test deleted file mode 100644 index 64b789204286..000000000000 --- a/test/old-elf/ARM/rel-arm-call.test +++ /dev/null @@ -1,112 +0,0 @@ -# Check handling of R_ARM_CALL relocation. -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-o.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK: 400084 1eff2fe1 00482de9 04b08de2 f7ffffeb -# offset = -0x24 ^^ -# call site offset PC(arm) _Z1fv addr -# 0x400090 + (-0x24) + 0x8 = 0x400074 -# CHECK: SYMBOL TABLE: -# CHECK: 00400074 g F .text {{[0-9a-f]+}} _Z1fv -# CHECK: 00400088 g F .text {{[0-9a-f]+}} main - -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: not lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-o.o -o %t 2> %t-error -# RUN: FileCheck -check-prefix=OVERFLOW %s < %t-error - -# OVERFLOW: Relocation out of range {{.*}} (R_ARM_CALL) - -# good.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 04B02DE500B08DE200D04BE204B09DE41EFF2FE100482DE904B08DE2FEFFFFEB0030A0E30300A0E10088BDE8 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x000000000000001C - Symbol: _Z1fv - Type: R_ARM_CALL - Addend: 0 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: _Z1fv - Type: STT_FUNC - Section: .text - Size: 0x0000000000000014 - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000014 - Size: 0x0000000000000018 - -# overflow.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 04B02DE500B08DE200D04BE204B09DE41EFF2FE100482DE904B08DE2000080EB0030A0E30300A0E10088BDE8 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x000000000000001C - Symbol: _Z1fv - Type: R_ARM_CALL - Addend: 0 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: _Z1fv - Type: STT_FUNC - Section: .text - Size: 0x0000000000000014 - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000014 - Size: 0x0000000000000018 -... diff --git a/test/old-elf/ARM/rel-arm-jump24-veneer-b.test b/test/old-elf/ARM/rel-arm-jump24-veneer-b.test deleted file mode 100644 index 76e9523dbbe7..000000000000 --- a/test/old-elf/ARM/rel-arm-jump24-veneer-b.test +++ /dev/null @@ -1,122 +0,0 @@ -# Check veneer generation for R_ARM_JUMP24 relocation (B instruction call). - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-arm.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-thm.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-arm.o %t-thm.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=STATIC %s - -# STATIC: Contents of section .text: -# STATIC: 400074 010000ea -# Call from main: -# offset = 0x4 ^^ -# call site offset PC(arm) ___Z1fv_from_arm addr -# 0x400074 + 0x4 + 0x8 = 0x400080 -# -# Code of the veneer: -# STATIC: {{[0-9a-f]+}} {{[0-9a-f]+}} 04f01fe5 -# STATIC: 400084 79004000 -# ^^ call addr = 0x400079 -# call addr _Z1fv addr Thumb mode -# 0x400079 = 0x400078 | 0x1 -# -# STATIC: SYMBOL TABLE: -# STATIC: 00400080 l F .text {{[0-9a-f]+}} ___Z1fv_from_arm -# STATIC: 00400074 g F .text {{[0-9a-f]+}} main -# STATIC: 00400078 g F .text {{[0-9a-f]+}} _Z1fv - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-arm.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-thm.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi \ -# RUN: --noinhibit-exec %t-arm.o %t-thm.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=EXEC-DYN %s - -# EXEC-DYN: Contents of section .text: -# EXEC-DYN: 400114 010000ea -# Call from main: -# offset = 0x4 ^^ -# call site offset PC(arm) ___Z1fv_from_arm addr -# 0x400114 + 0x4 + 0x8 = 0x400120 -# -# Code of the veneer: -# EXEC-DYN: {{[0-9a-f]+}} {{[0-9a-f]+}} 04f01fe5 -# EXEC-DYN: 400124 19014000 -# call addr = 0x400119 ^^ -# call addr _Z1fv addr Thumb mode -# 0x400119 = 0x400118 | 0x1 -# -# EXEC-DYN: SYMBOL TABLE: -# EXEC-DYN: 00400120 l F .text {{[0-9a-f]+}} ___Z1fv_from_arm -# EXEC-DYN: 00400114 g F .text {{[0-9a-f]+}} main -# EXEC-DYN: 00400118 g F .text {{[0-9a-f]+}} _Z1fv - -# arm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: FEFFFFEA - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000000 - Symbol: _Z1fv - Type: R_ARM_JUMP24 - Addend: 0 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: main - Type: STT_FUNC - Section: .text - - Name: _Z1fv - -# thm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 4FF0000318467047 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: _Z1fv - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 -... diff --git a/test/old-elf/ARM/rel-arm-jump24-veneer-bl.test b/test/old-elf/ARM/rel-arm-jump24-veneer-bl.test deleted file mode 100644 index 300355fbb11c..000000000000 --- a/test/old-elf/ARM/rel-arm-jump24-veneer-bl.test +++ /dev/null @@ -1,120 +0,0 @@ -# Check veneer generation for R_ARM_JUMP24 relocation (BL instruction call). - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-arm.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-thm.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-arm.o %t-thm.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=STATIC %s - -# STATIC: Contents of section .text: -# STATIC: 400084 0400000b -# Call from main: -# offset = 0x10 ^^ -# call site offset PC(arm) ___Z1fv_from_arm addr -# 0x400084 + 0x10 + 0x8 = 0x40009c -# -# Code of the veneer: -# STATIC: 400094 {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} 95004000 -# call addr = 0x400095 ^^ -# call addr _Z1fv addr Thumb mode -# 0x400095 = 0x400094 | 0x1 -# -# STATIC: SYMBOL TABLE: -# STATIC: 0040009c l F .text {{[0-9a-f]+}} ___Z1fv_from_arm -# STATIC: 00400074 g F .text {{[0-9a-f]+}} main -# STATIC: 00400094 g F .text {{[0-9a-f]+}} _Z1fv - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-arm.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-thm.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi \ -# RUN: --noinhibit-exec %t-arm.o %t-thm.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=EXEC-DYN %s - -# EXEC-DYN: Contents of section .text: -# EXEC-DYN: 400124 0400000b -# Call from main: -# offset = 0x10 ^^ -# call site offset PC(arm) ___Z1fv_from_arm addr -# 0x400124 + 0x10 + 0x8 = 0x40013c -# -# Code of the veneer: -# EXEC-DYN: 400134 {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} 35014000 -# call addr = 0x400135 ^^ -# call addr _Z1fv addr Thumb mode -# 0x400135 = 0x400134 | 0x1 -# -# EXEC-DYN: SYMBOL TABLE: -# EXEC-DYN: 0040013c l F .text {{[0-9a-f]+}} ___Z1fv_from_arm -# EXEC-DYN: 00400114 g F .text {{[0-9a-f]+}} main -# EXEC-DYN: 00400134 g F .text {{[0-9a-f]+}} _Z1fv - -# arm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 00482DE904B08DE20030A0E3000053E3FEFFFF0B0030A0E30300A0E10088BDE8 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000010 - Symbol: _Z1fv - Type: R_ARM_JUMP24 - Addend: 0 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: main - Type: STT_FUNC - Section: .text - - Name: _Z1fv - -# thm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 4FF0000318467047 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: _Z1fv - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 -... diff --git a/test/old-elf/ARM/rel-arm-jump24.test b/test/old-elf/ARM/rel-arm-jump24.test deleted file mode 100644 index c0d8ccc8d386..000000000000 --- a/test/old-elf/ARM/rel-arm-jump24.test +++ /dev/null @@ -1,108 +0,0 @@ -# Check handling of R_ARM_JUMP24 relocation. -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-o.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK: 400094 04b08de2 f5ffffea 0030a0e1 0300a0e1 -# offset = -0x2C ^^ -# call site offset PC(arm) _Z1fv addr -# 0x400098 + (-0x2C) + 0x8 = 0x400074 -# CHECK: SYMBOL TABLE: -# CHECK: 00400074 g F .text {{[0-9a-f]+}} _Z1fv -# CHECK: 00400090 g F .text {{[0-9a-f]+}} main - -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: not lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-o.o -o %t 2> %t-error -# RUN: FileCheck -check-prefix=OVERFLOW %s < %t-error - -# OVERFLOW: Relocation out of range {{.*}} (R_ARM_JUMP24) - -# good.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 04B02DE500B08DE20030A0E30300A0E100D04BE204B09DE41EFF2FE100482DE904B08DE2FEFFFFEA0030A0E10300A0E10088BDE8 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000024 - Symbol: _Z1fv - Type: R_ARM_JUMP24 - Addend: 0 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: _Z1fv - Type: STT_FUNC - Section: .text - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x000000000000001C - -# overflow.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 04B02DE500B08DE20030A0E30300A0E100D04BE204B09DE41EFF2FE100482DE904B08DE2000080EA0030A0E10300A0E10088BDE8 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000024 - Symbol: _Z1fv - Type: R_ARM_JUMP24 - Addend: 0 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: _Z1fv - Type: STT_FUNC - Section: .text - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x000000000000001C -... diff --git a/test/old-elf/ARM/rel-arm-mov.test b/test/old-elf/ARM/rel-arm-mov.test deleted file mode 100644 index b492cc259060..000000000000 --- a/test/old-elf/ARM/rel-arm-mov.test +++ /dev/null @@ -1,64 +0,0 @@ -# Check handling of R_ARM_MOVW_ABS_NC and R_ARM_MOVT_ABS relocation pair. -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-o.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK: 400074 04b02de5 00b08de2 003001e3 403040e3 -# addrL = 0x1000 ^^ -# addrH = 0x40 ^^ -# addrH addrL _ZL5data1 addr -# (0x40 << 16) + 0x1000 = 0x401000 -# CHECK: SYMBOL TABLE: -# CHECK: 00401000 l .bss 00000004 _ZL5data1 -# CHECK: 00400074 g F .text {{[0-9a-f]+}} main - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 04B02DE500B08DE2003000E3003040E30A20A0E3002083E50030A0E30300A0E100D04BE204B09DE41EFF2FE1 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000008 - Symbol: _ZL5data1 - Type: R_ARM_MOVW_ABS_NC - Addend: 0 - - Offset: 0x000000000000000C - Symbol: _ZL5data1 - Type: R_ARM_MOVT_ABS - Addend: 0 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Size: 4 -Symbols: - Local: - - Name: _ZL5data1 - Type: STT_OBJECT - Section: .bss - Size: 0x0000000000000004 - Global: - - Name: main - Type: STT_FUNC - Section: .text -... diff --git a/test/old-elf/ARM/rel-arm-prel31.test b/test/old-elf/ARM/rel-arm-prel31.test deleted file mode 100644 index b07d5dd9fd75..000000000000 --- a/test/old-elf/ARM/rel-arm-prel31.test +++ /dev/null @@ -1,90 +0,0 @@ -# Check handling of R_ARM_PREL31 relocation. -# RUN: yaml2obj -format=elf -docnum=1 %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec --defsym=main=__gxx_personality_v0 %t-o.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck %s - -# CHECK: Contents of section .ARM.extab: -# CHECK: 4000a4 b1fffe7f -# CHECK: SYMBOL TABLE: -# CHECK: 00400054 g F .text {{[0-9a-f]+}} __gxx_personality_v0 - -# RUN: yaml2obj -format=elf -docnum=2 %s > %t-o.o -# RUN: not lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec --defsym=main=__gxx_personality_v0 %t-o.o -o %t 2> %t-error -# RUN: FileCheck -check-prefix=OVERFLOW %s < %t-error - -# OVERFLOW: Relocation out of range {{.*}} (R_ARM_PREL31) - -# good.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .ARM.extab - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x4 - Content: 0000FF7F84019701B0B0B008FFFF01080E2432003A040000 - - Name: .rel.ARM.extab - Type: SHT_REL - Link: .symtab - AddressAlign: 0x4 - Info: .ARM.extab - Relocations: - - Offset: 0 - Symbol: __gxx_personality_v0 - Type: R_ARM_PREL31 - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x4 - Content: 80B400AF00231846BD465DF8047B704780B582B000AF3B1D1846FFF7FEFFFFF7FEFFFFF7FEFF0420FFF7FEFF0346184601230360002240F20001C0F20001FFF7FEFF3B1D1846FFF7FEFFFFF7FEFF00BF -Symbols: - Local: - Global: - - Name: __gxx_personality_v0 - Type: STT_FUNC - Section: .text - Value: 0x1 - -# overflow.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .ARM.extab - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x4 - Content: 0000004084019701B0B0B008FFFF01080E2432003A040000 - - Name: .rel.ARM.extab - Type: SHT_REL - Link: .symtab - AddressAlign: 0x4 - Info: .ARM.extab - Relocations: - - Offset: 0 - Symbol: __gxx_personality_v0 - Type: R_ARM_PREL31 - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x4 - Content: 80B400AF00231846BD465DF8047B704780B582B000AF3B1D1846FFF7FEFFFFF7FEFFFFF7FEFF0420FFF7FEFF0346184601230360002240F20001C0F20001FFF7FEFF3B1D1846FFF7FEFFFFF7FEFF00BF -Symbols: - Local: - Global: - - Name: __gxx_personality_v0 - Type: STT_FUNC - Section: .text - Value: 0x1 -... diff --git a/test/old-elf/ARM/rel-arm-target1.test b/test/old-elf/ARM/rel-arm-target1.test deleted file mode 100644 index 064c68661875..000000000000 --- a/test/old-elf/ARM/rel-arm-target1.test +++ /dev/null @@ -1,114 +0,0 @@ -# Check handling of R_ARM_TARGET1 relocation. -# -# 1. R_ARM_TARGET1 is equal to R_ARM_ABS32 -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-abs32.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec --target1-abs %t-abs32.o -o %t-abs32 -# RUN: llvm-objdump -s -t %t-abs32 | FileCheck -check-prefix=CHECK-ABS32 %s -# -# CHECK-ABS32: Contents of section .data: -# CHECK-ABS32-NEXT: 401000 84004000 -# CHECK-ABS32: SYMBOL TABLE: -# CHECK-ABS32: 00400074 g F .text {{[0-9a-f]+}} main -# CHECK-ABS32: 00401000 g .data 00000004 data -# -# 2. R_ARM_TARGET1 is equal to R_ARM_REL32 -# Check handling of R_ARM_REL32 relocation. -# RUN: yaml2obj -format=elf %s -docnum 2 > %t-rel32.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec --target1-rel %t-rel32.o -o %t-rel32 -# RUN: llvm-objdump -s -t %t-rel32 | FileCheck -check-prefix=CHECK-REL32 %s -# -# CHECK-REL32: Contents of section .text: -# CHECK-REL32-NEXT: 400074 {{[0-9a-f]+}} 880fff00 -# CHECK-REL32: SYMBOL TABLE: -# CHECK-REL32: 00400074 g F .text {{[0-9a-f]+}} main -# CHECK-REL32: 00401000 g .bss {{[0-9a-f]+}} _myref - -# abs32.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 04B02DE500B08DE20030A0E30300A0E100D04BE204B09DE41EFF2FE1 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '10000000' - - Name: .rel.data - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .data - Relocations: - - Offset: 0x0000000000000000 - Symbol: main - Type: R_ARM_TARGET1 - Addend: 0 - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x000000000000001C - - Name: data - Type: STT_OBJECT - Section: .data - Size: 0x0000000000000004 -# rel32.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AF0000FF0000231846BD465DF8047B7047 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000004 - Symbol: _myref - Type: R_ARM_TARGET1 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 -Symbols: - Global: - - Name: _myref - Type: STT_OBJECT - Section: .bss - Size: 0x0000000000000004 - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - Size: 0x0000000000000014 -... diff --git a/test/old-elf/ARM/rel-arm-thm-interwork.test b/test/old-elf/ARM/rel-arm-thm-interwork.test deleted file mode 100644 index 3e0e30a614ee..000000000000 --- a/test/old-elf/ARM/rel-arm-thm-interwork.test +++ /dev/null @@ -1,121 +0,0 @@ -# Check ARM <=> Thumb interwork. -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-arm.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-thm.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-arm.o %t-thm.o -o %t - -# Check R_ARM_CALL veneer to call Thumb code -# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=ARM-CALL %s - -# ARM-CALL: Contents of section .text: -# ARM-CALL: 400074 00482de9 04b08de2 000000fa 0088bde8 -# offset = 0x0 ^^ -# call site offset PC(arm) _Z2f2v addr -# 0x40007C + 0x0 + 0x8 = 0x400084 -# ARM-CALL: SYMBOL TABLE: -# ARM-CALL: 00400074 g F .text {{[0-9a-f]+}} _Z1fv -# ARM-CALL: 00400084 g F .text {{[0-9a-f]+}} _Z2f2v -# ARM-CALL: 00400090 g F .text {{[0-9a-f]+}} main - -# Check R_ARM_THM_CALL veneer to call ARM code -# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=THM-CALL %s - -# THM-CALL: Contents of section .text: -# THM-CALL: 400094 00bffff7 eeef0023 184680bd -# offset = -0x24 ^^ -# call site aligned = Align(0x400096, 4) = 0x400094 -# call site aligned offset PC(thm) _Z1fv addr -# 0x400094 + (-0x24) + 0x4 = 0x400074 -# THM-CALL: SYMBOL TABLE: -# THM-CALL: 00400074 g F .text {{[0-9a-f]+}} _Z1fv -# THM-CALL: 00400084 g F .text {{[0-9a-f]+}} _Z2f2v -# THM-CALL: 00400090 g F .text {{[0-9a-f]+}} main - -# arm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 00482DE904B08DE2FEFFFFEB0088BDE8 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000008 - Symbol: _Z2f2v - Type: R_ARM_CALL - Addend: 0 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: _Z1fv - Type: STT_FUNC - Section: .text - Size: 0x0000000000000010 - - Name: _Z2f2v - -# thm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AFBD465DF8047B704780B500AF00BFFFF7FEFF0023184680BD - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000012 - Symbol: _Z1fv - Type: R_ARM_THM_CALL - Addend: 0 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: _Z2f2v - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - Size: 0x000000000000000C - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x000000000000000D - Size: 0x0000000000000010 - - Name: _Z1fv -... diff --git a/test/old-elf/ARM/rel-base-prel.test b/test/old-elf/ARM/rel-base-prel.test deleted file mode 100644 index 054ce58ff7b8..000000000000 --- a/test/old-elf/ARM/rel-base-prel.test +++ /dev/null @@ -1,61 +0,0 @@ -# Check handling of R_ARM_BASE_PREL relocation. -# It only works for _GLOBAL_OFFSET_TABLE_ symbol, and returns error -# for other cases. - -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-o.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck %s - -# CHECK: Contents of section .data: -# CHECK-NEXT: 401004 fcffffff -# offset = -0x4 ^^ -# addr site offset _GOT_ -# 0x401004 + (-0x4) = 0x401000 -# CHECK: SYMBOL TABLE: -# CHECK: 00401000 g *ABS* {{[0-9a-f]+}} _GLOBAL_OFFSET_TABLE_ - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AF00231846BD465DF8047B7047 - - Name: .got - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '00000000' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '00000000' - - Name: .rel.data - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .data - Relocations: - - Offset: 0x0000000000000000 - Symbol: _GLOBAL_OFFSET_TABLE_ - Type: R_ARM_BASE_PREL - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - - Name: _GLOBAL_OFFSET_TABLE_ -... diff --git a/test/old-elf/ARM/rel-copy.test b/test/old-elf/ARM/rel-copy.test deleted file mode 100644 index f181f72a2192..000000000000 --- a/test/old-elf/ARM/rel-copy.test +++ /dev/null @@ -1,60 +0,0 @@ -# Check handling of R_ARM_COPY relocation. -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi \ -# RUN: --noinhibit-exec %t-o.o -lobj -L%p/Inputs -o %t -# RUN: llvm-objdump -s -t %t | FileCheck %s -# RUN: llvm-readobj -relocations %t | FileCheck -check-prefix=READOBJ %s - -# CHECK: Contents of section .rel.dyn: -# CHECK-NEXT: 400138 00104000 14010000 -# addr = 0x401000 ^^ ^^ rel_type = 0x14 => R_ARM_COPY -# CHECK: SYMBOL TABLE: -# CHECK: 00401000 g .bss 00000004 object -# -# READOBJ: 0x401000 R_ARM_COPY object - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B483B000AF40F20003C0F200031B687B60002318460C37BD465DF8047B7047 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000006 - Symbol: object - Type: R_ARM_THM_MOVW_ABS_NC - - Offset: 0x000000000000000A - Symbol: object - Type: R_ARM_THM_MOVT_ABS - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Local: - - Name: '$t' - Section: .text - Global: - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - - Name: object -... diff --git a/test/old-elf/ARM/rel-glob-dat.test b/test/old-elf/ARM/rel-glob-dat.test deleted file mode 100644 index 34f50c5b0e3d..000000000000 --- a/test/old-elf/ARM/rel-glob-dat.test +++ /dev/null @@ -1,57 +0,0 @@ -# Check handling of R_ARM_GLOB_DAT relocation. - -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -shared \ -# RUN: --noinhibit-exec %t-o.o -lfn -L%p/Inputs -o %t -# RUN: llvm-readobj -relocations %t | FileCheck %s - -# CHECK: 0x401000 R_ARM_GLOB_DAT fn - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 00482DE904B08DE208D04DE224209FE502208FE020309FE5033092E708300BE508301BE533FF2FE10030A0E10300A0E104D04BE20088BDE82000000000000000 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000038 - Symbol: _GLOBAL_OFFSET_TABLE_ - Type: R_ARM_BASE_PREL - - Offset: 0x000000000000003C - Symbol: fn - Type: R_ARM_GOT_BREL - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Local: - - Name: '$a' - Section: .text - - Name: '$d' - Section: .text - Value: 0x0000000000000038 - Global: - - Name: f - Type: STT_FUNC - Section: .text - - Name: _GLOBAL_OFFSET_TABLE_ - - Name: fn -... diff --git a/test/old-elf/ARM/rel-got-brel.test b/test/old-elf/ARM/rel-got-brel.test deleted file mode 100644 index c8786d81127f..000000000000 --- a/test/old-elf/ARM/rel-got-brel.test +++ /dev/null @@ -1,63 +0,0 @@ -# Check handling of R_ARM_GOT_BREL relocation. - -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-o.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck %s - -# CHECK: Contents of section .got: -# CHECK-NEXT: 401000 75004000 81004000 -# f_thumb = 0x400075 ^^ ^^ main_thumb = 0x400081 -# CHECK: Contents of section .data: -# CHECK-NEXT: 401008 00000000 04000000 -# GOT[0] offset = 0x0 ^^ ^^ GOT[1] offset = 0x4 -# CHECK: SYMBOL TABLE: -# CHECK: 00400074 g F .text {{[0-9a-f]+}} f -# CHECK: 00400080 g F .text {{[0-9a-f]+}} main - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AFBD465DF8047B704780B400AF00231846BD465DF8047B7047 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '0000000000000000' - - Name: .rel.data - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .data - Relocations: - - Offset: 0x0000000000000000 - Symbol: f - Type: R_ARM_GOT_BREL - - Offset: 0x0000000000000004 - Symbol: main - Type: R_ARM_GOT_BREL - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: f - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x000000000000000D - - Name: _GLOBAL_OFFSET_TABLE_ -... diff --git a/test/old-elf/ARM/rel-group-relocs.test b/test/old-elf/ARM/rel-group-relocs.test deleted file mode 100644 index 16e82b3e4271..000000000000 --- a/test/old-elf/ARM/rel-group-relocs.test +++ /dev/null @@ -1,71 +0,0 @@ -# Check handling of group relocations (R_ARM_ALU_PC_G0_NC, R_ARM_ALU_PC_G1_NC, -# R_ARM_LDR_PC_G2). -# -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: -e plt_func %t-o.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK: 400074 00c68fe2 00ca8ce2 84ffbce5 -# Disassembly of section .text: -# plt_func: -# 400074: 00 c6 8f e2 add r12, pc, #0, #12 -# ^ after execution: r12=0x40007c -# 400078: 00 ca 8c e2 add r12, r12, #0, #20 -# ^ after execution: r12=0x40007C -# 40007c: 84 ff bc e5 ldr pc, [r12, #3972]! -# ^ referenced address is 0x401000, after execution pc=0x400074 -# CHECK: Contents of section .data: -# CHECK: 401000 74004000 -# ^ this value is written to pc after execution of comand 0x40007c -# ^ this address is referenced by command at 0x40007c -# CHECK: SYMBOL TABLE: -# CHECK: 00400074 g F .text 0000000c plt_func -# CHECK: 00401000 g .data 00000004 got_func - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x4 - Content: 00C08FE200C08CE200F0BCE5 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - Info: .text - AddressAlign: 0x4 - Relocations: - - Offset: 0 - Symbol: got_func - Type: R_ARM_ALU_PC_G0_NC - Addend: -8 - - Offset: 0x4 - Symbol: got_func - Type: R_ARM_ALU_PC_G1_NC - Addend: -4 - - Offset: 0x8 - Symbol: got_func - Type: R_ARM_LDR_PC_G2 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x4 - Content: 74004000 -Symbols: - Local: - Global: - - Name: plt_func - Type: STT_FUNC - Section: .text - Size: 0xC - - Name: got_func - Section: .data - Size: 0x4 -... diff --git a/test/old-elf/ARM/rel-ifunc.test b/test/old-elf/ARM/rel-ifunc.test deleted file mode 100644 index 7044534af1e3..000000000000 --- a/test/old-elf/ARM/rel-ifunc.test +++ /dev/null @@ -1,101 +0,0 @@ -# Check handling of IFUNC (gnu_indirect_function). -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: %t-o.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck %s - -# CHECK: Contents of section .rel.plt: -# CHECK: 400074 00104000 -# CHECK: Contents of section .plt: -# CHECK: 40007c 00c68fe2 00ca8ce2 7cffbce5 -# CHECK: Contents of section .text: -# CHECK: 4001a8 00482de9 04b08de2 d4ffffeb b0ffffeb -# ^ bl #-320 (to address 0x400080=__plt_ifunc_myfunc) -# CHECK: Contents of section .got.plt: -# CHECK: 401000 c0004000 -# CHECK: SYMBOL TABLE: -# CHECK: 004000c0 g .text 00000020 myfunc -# CHECK: 00400074 g *ABS* 00000000 __rel_iplt_start -# CHECK: 0040007c g *ABS* 00000000 __rel_iplt_end - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 04B02DE500B08DE20130A0E30300A0E100D04BE204B09DE41EFF2FE104B02DE500B08DE20230A0E30300A0E100D04BE204B09DE41EFF2FE104B02DE500B08DE2003000E3003040E30300A0E100D04BE204B09DE41EFF2FE100482DE904B08DE208D04DE208000BE508301BE533FF2FE10030A0E10300A0E104D04BE20088BDE800482DE904B08DE210D04DE2003000E3003040E308300BE5190000EA08301BE50C300BE50C301BE5003093E510300BE50C301BE5043093E57330EFE614300BE514301BE5A00053E30130A0030030A0137330EFE6000053E30600000A10301BE5003093E50300A0E1DAFFFFEB0020A0E110301BE5002083E508301BE5083083E208300BE508201BE5003000E3003040E3030052E1E0FFFF3A04D04BE20088BDE800482DE904B08DE2D4FFFFEBFEFFFFEB0030A0E30300A0E10088BDE8 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000040 - Symbol: myfunc1 - Type: R_ARM_MOVW_ABS_NC - - Offset: 0x0000000000000044 - Symbol: myfunc1 - Type: R_ARM_MOVT_ABS - - Offset: 0x000000000000008C - Symbol: __rel_iplt_start - Type: R_ARM_MOVW_ABS_NC - - Offset: 0x0000000000000090 - Symbol: __rel_iplt_start - Type: R_ARM_MOVT_ABS - - Offset: 0x0000000000000108 - Symbol: __rel_iplt_end - Type: R_ARM_MOVW_ABS_NC - - Offset: 0x000000000000010C - Symbol: __rel_iplt_end - Type: R_ARM_MOVT_ABS - - Offset: 0x000000000000012C - Symbol: myfunc - Type: R_ARM_CALL -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: '$a' - Section: .text - - Name: elf_ifunc_invoke - Type: STT_FUNC - Section: .text - Value: 0x0000000000000058 - Size: 0x0000000000000028 - - Name: apply_irel - Type: STT_FUNC - Section: .text - Value: 0x0000000000000080 - Size: 0x00000000000000A0 - Global: - - Name: myfunc1 - Type: STT_FUNC - Section: .text - Size: 0x000000000000001C - - Name: myfunc2 - Type: STT_FUNC - Section: .text - Value: 0x000000000000001C - Size: 0x000000000000001C - - Name: myfunc - Type: STT_GNU_IFUNC - Section: .text - Value: 0x0000000000000038 - Size: 0x0000000000000020 - - Name: _start - Type: STT_FUNC - Section: .text - Value: 0x0000000000000120 - Size: 0x000000000000001C - Weak: - - Name: __rel_iplt_start - - Name: __rel_iplt_end -... diff --git a/test/old-elf/ARM/rel-jump-slot.test b/test/old-elf/ARM/rel-jump-slot.test deleted file mode 100644 index 2a4f4eba8d84..000000000000 --- a/test/old-elf/ARM/rel-jump-slot.test +++ /dev/null @@ -1,50 +0,0 @@ -# Check handling of R_ARM_JUMP_SLOT relocation. - -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -shared \ -# RUN: --noinhibit-exec %t-o.o -lfn -L%p/Inputs -o %t -# RUN: llvm-readobj -relocations %t | FileCheck %s - -# CHECK: 0x40100C R_ARM_JUMP_SLOT fn 0x0 - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 00482DE904B08DE2FEFFFFEB0030A0E10300A0E10088BDE8 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000008 - Symbol: fn - Type: R_ARM_CALL - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Local: - - Name: '$a' - Section: .text - Global: - - Name: f - Type: STT_FUNC - Section: .text - - Name: fn -... diff --git a/test/old-elf/ARM/rel-rel32.test b/test/old-elf/ARM/rel-rel32.test deleted file mode 100644 index 9e5aab000523..000000000000 --- a/test/old-elf/ARM/rel-rel32.test +++ /dev/null @@ -1,56 +0,0 @@ -# Check handling of R_ARM_REL32 relocation. -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-o.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: 400074 {{[0-9a-f]+}} 880fff00 -# CHECK: SYMBOL TABLE: -# CHECK: 00400074 g F .text {{[0-9a-f]+}} main -# CHECK: 00401000 g .bss {{[0-9a-f]+}} _myref - ---- ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AF0000FF0000231846BD465DF8047B7047 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000004 - Symbol: _myref - Type: R_ARM_REL32 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 -Symbols: - Global: - - Name: _myref - Type: STT_OBJECT - Section: .bss - Size: 0x0000000000000004 - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - Size: 0x0000000000000014 -... diff --git a/test/old-elf/ARM/rel-thm-call.test b/test/old-elf/ARM/rel-thm-call.test deleted file mode 100644 index 7e7289a99768..000000000000 --- a/test/old-elf/ARM/rel-thm-call.test +++ /dev/null @@ -1,114 +0,0 @@ -# Check handling of R_ARM_THM_CALL relocation. -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-o.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK: 400084 fff7f6ff 00231846 80bd00bf -# ^^ offset = -0x14 -# call site offset PC(thm) _Z1fv addr -# 0x400084 + (-0x14) + 0x4 = 0x400074 -# CHECK: SYMBOL TABLE: -# CHECK: 00400074 g F .text {{[0-9a-f]+}} _Z1fv -# CHECK: 00400080 g F .text {{[0-9a-f]+}} main - -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: not lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-o.o -o %t 2> %t-error -# RUN: FileCheck -check-prefix=OVERFLOW %s < %t-error - -# OVERFLOW: Relocation out of range {{.*}} (R_ARM_THM_CALL) - -# good.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AFBD465DF8047B704780B500AFFFF7FEFF0023184680BD00BF - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000010 - Symbol: _Z1fv - Type: R_ARM_THM_CALL - Addend: 0 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: _Z1fv - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - Size: 0x000000000000000C - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x000000000000000D - Size: 0x000000000000000E - -# overflow.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AFBD465DF8047B704780B500AF00F400D00023184680BD00BF - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000010 - Symbol: _Z1fv - Type: R_ARM_THM_CALL - Addend: 0 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: _Z1fv - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - Size: 0x000000000000000C - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x000000000000000D - Size: 0x000000000000000E -... diff --git a/test/old-elf/ARM/rel-thm-jump11.test b/test/old-elf/ARM/rel-thm-jump11.test deleted file mode 100644 index e074b9ae1abf..000000000000 --- a/test/old-elf/ARM/rel-thm-jump11.test +++ /dev/null @@ -1,209 +0,0 @@ -# Check handling of R_ARM_THM_JUMP11 relocation. -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-o.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK: 4001a4 0021c7e7 -# CHECK: SYMBOL TABLE: -# CHECK: 00400138 g F .text 00000060 __gnu_h2f_internal -# CHECK: 004001a4 g F .text 00000004 __gnu_h2f_alternative - -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: not lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-o.o -o %t 2> %t-error -# RUN: FileCheck -check-prefix=OVERFLOW %s < %t-error - -# OVERFLOW: Relocation out of range {{.*}} (R_ARM_THM_JUMP11) - -# good.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 70B4020CC0F3C754FF2CC0F3160302F4004080B241D0002C08BF002B3BD0A4F17F0543F4000315F10E0FA8BF41F6FF7209DA15F1190FA3BFA4F166066FF07F42F2406FF07F4212EA03060CD001325208964208BF03EA42021344B3F1807F24BF5B08A4F17E0501B30F2D26DC15F1180F11DB15F10E0FB5BF4FF6F2710E35CFF6FF71AD02B7BF491BAAB2CB40002202EB5333034398B270BC70470029FBD040EA533370BC43F4FC407047102DDEDD6FEAD0336FEAC33398B2EDE740F4F84398B2E9E700BFC0F3842310B4A3F11F040029B4FA84F400F400424FEA541408BF0024C0F309002146140481B943B14203703302EBC35343EA04005DF8044B704760B1B0FA80F3153B98405B42EFE744EA40305DF8044B40F0FF40704720465DF8044B704700BF01216BE70121FEE7002167E70021FEE7 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x000000000000012A - Symbol: __gnu_h2f_internal - Type: R_ARM_THM_JUMP11 - - Offset: 0x0000000000000132 - Symbol: __gnu_h2f_internal - Type: R_ARM_THM_JUMP11 - - Name: .text.startup - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 0020FFF7FEBF00BF - - Name: .rel.text.startup - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text.startup - Relocations: - - Offset: 0x0000000000000002 - Symbol: __gnu_h2f_alternative - Type: R_ARM_THM_JUMP24 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Local: - - Name: '$t' - Section: .text - - Name: __gnu_f2h_internal - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - Size: 0x00000000000000C2 - Global: - - Name: __gnu_f2h_alternative - Type: STT_FUNC - Section: .text - Value: 0x000000000000012D - Size: 0x0000000000000004 - Visibility: STV_HIDDEN - - Name: __gnu_h2f_alternative - Type: STT_FUNC - Section: .text - Value: 0x0000000000000131 - Size: 0x0000000000000004 - Visibility: STV_HIDDEN - - Name: __gnu_h2f_ieee - Type: STT_FUNC - Section: .text - Value: 0x0000000000000129 - Size: 0x0000000000000004 - Visibility: STV_HIDDEN - - Name: main - Type: STT_FUNC - Section: .text.startup - Value: 0x0000000000000001 - Size: 0x0000000000000006 - - Name: __gnu_f2h_ieee - Type: STT_FUNC - Section: .text - Value: 0x0000000000000125 - Size: 0x0000000000000004 - Visibility: STV_HIDDEN - - Name: __gnu_h2f_internal - Type: STT_FUNC - Section: .text - Value: 0x00000000000000C5 - Size: 0x000000000000005E - Visibility: STV_HIDDEN - -# overflow.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 70B4020CC0F3C754FF2CC0F3160302F4004080B241D0002C08BF002B3BD0A4F17F0543F4000315F10E0FA8BF41F6FF7209DA15F1190FA3BFA4F166066FF07F42F2406FF07F4212EA03060CD001325208964208BF03EA42021344B3F1807F24BF5B08A4F17E0501B30F2D26DC15F1180F11DB15F10E0FB5BF4FF6F2710E35CFF6FF71AD02B7BF491BAAB2CB40002202EB5333034398B270BC70470029FBD040EA533370BC43F4FC407047102DDEDD6FEAD0336FEAC33398B2EDE740F4F84398B2E9E700BFC0F3842310B4A3F11F040029B4FA84F400F400424FEA541408BF0024C0F309002146140481B943B14203703302EBC35343EA04005DF8044B704760B1B0FA80F3153B98405B42EFE744EA40305DF8044B40F0FF40704720465DF8044B704700BF01216BE70121FEE7002167E7002100E4 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x000000000000012A - Symbol: __gnu_h2f_internal - Type: R_ARM_THM_JUMP11 - - Offset: 0x0000000000000132 - Symbol: __gnu_h2f_internal - Type: R_ARM_THM_JUMP11 - - Name: .text.startup - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 0020FFF7FEBF00BF - - Name: .rel.text.startup - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text.startup - Relocations: - - Offset: 0x0000000000000002 - Symbol: __gnu_h2f_alternative - Type: R_ARM_THM_JUMP24 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Local: - - Name: '$t' - Section: .text - - Name: __gnu_f2h_internal - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - Size: 0x00000000000000C2 - Global: - - Name: __gnu_f2h_alternative - Type: STT_FUNC - Section: .text - Value: 0x000000000000012D - Size: 0x0000000000000004 - Visibility: STV_HIDDEN - - Name: __gnu_h2f_alternative - Type: STT_FUNC - Section: .text - Value: 0x0000000000000131 - Size: 0x0000000000000004 - Visibility: STV_HIDDEN - - Name: __gnu_h2f_ieee - Type: STT_FUNC - Section: .text - Value: 0x0000000000000129 - Size: 0x0000000000000004 - Visibility: STV_HIDDEN - - Name: main - Type: STT_FUNC - Section: .text.startup - Value: 0x0000000000000001 - Size: 0x0000000000000006 - - Name: __gnu_f2h_ieee - Type: STT_FUNC - Section: .text - Value: 0x0000000000000125 - Size: 0x0000000000000004 - Visibility: STV_HIDDEN - - Name: __gnu_h2f_internal - Type: STT_FUNC - Section: .text - Value: 0x00000000000000C5 - Size: 0x000000000000005E - Visibility: STV_HIDDEN -... diff --git a/test/old-elf/ARM/rel-thm-jump24-veneer.test b/test/old-elf/ARM/rel-thm-jump24-veneer.test deleted file mode 100644 index 5893b53da84a..000000000000 --- a/test/old-elf/ARM/rel-thm-jump24-veneer.test +++ /dev/null @@ -1,120 +0,0 @@ -# Check veneer generation for R_ARM_THM_JUMP24 relocation (B instruction call). - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-arm.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-thm.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-arm.o %t-thm.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=STATIC %s - -# STATIC: Contents of section .text: -# STATIC: 400074 {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} 00f000b8 -# Call from main: -# offset = 0x0 ^^ -# call site offset PC(thm) ___Z1fv_from_thumb addr -# 0x400080 + 0x0 + 0x4 = 0x400084 -# -# Code of the veneer: -# STATIC: 400084 78470000 f9ffffea -# offset = -0x1C ^^ -# call site offset PC(arm) _Z1fv -# 0x400088 + (-0x1C) + 0x8 = 0x400074 -# -# STATIC: SYMBOL TABLE: -# STATIC: 00400084 l F .text {{[0-9a-f]+}} ___Z1fv_from_thumb -# STATIC: 00400074 g F .text {{[0-9a-f]+}} _Z1fv -# STATIC: 00400080 g F .text {{[0-9a-f]+}} main - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-arm.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-thm.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi \ -# RUN: --noinhibit-exec %t-arm.o %t-thm.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=EXEC-DYN %s - -# EXEC-DYN: Contents of section .text: -# EXEC-DYN: 400114 {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} 00f000b8 -# Call from main: -# offset = 0x0 ^^ -# call site offset PC(thm) ___Z1fv_from_thumb addr -# 0x400120 + 0x0 + 0x4 = 0x400124 -# -# Code of the veneer: -# EXEC-DYN: 400124 78470000 f9ffffea -# offset = -0x1C ^^ -# call site offset PC(arm) _Z1fv -# 0x400128 + (-0x1C) + 0x8 = 0x400114 -# -# EXEC-DYN: SYMBOL TABLE: -# EXEC-DYN: 00400124 l F .text {{[0-9a-f]+}} ___Z1fv_from_thumb -# EXEC-DYN: 00400114 g F .text {{[0-9a-f]+}} _Z1fv -# EXEC-DYN: 00400120 g F .text {{[0-9a-f]+}} main - -# arm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 0030A0E30300A0E11EFF2FE1 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: _Z1fv - Type: STT_FUNC - Section: .text - -# thm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: FFF7FEBF - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000000 - Symbol: _Z1fv - Type: R_ARM_THM_JUMP24 - Addend: 0 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - - Name: _Z1fv -... diff --git a/test/old-elf/ARM/rel-thm-jump24.test b/test/old-elf/ARM/rel-thm-jump24.test deleted file mode 100644 index b58bc053aca0..000000000000 --- a/test/old-elf/ARM/rel-thm-jump24.test +++ /dev/null @@ -1,110 +0,0 @@ -# Check handling of R_ARM_THM_JUMP24 relocation. -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-o.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK: 400084 80b500af fff7f4bf 03461846 80bd00bf -# ^^ offset = -0x18 -# call site offset PC(thm) _Z1fv addr -# 0x400088 + (-0x18) + 0x4 = 0x400074 -# CHECK: SYMBOL TABLE: -# CHECK: 00400074 g F .text {{[0-9a-f]+}} _Z1fv -# CHECK: 00400084 g F .text {{[0-9a-f]+}} main - -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: not lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-o.o -o %t 2> %t-error -# RUN: FileCheck -check-prefix=OVERFLOW %s < %t-error - -# OVERFLOW: Relocation out of range {{.*}} (R_ARM_THM_JUMP24) - -# good.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AF00231846BD465DF8047B704780B500AFFFF7FEBF0346184680BD00BF - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000014 - Symbol: _Z1fv - Type: R_ARM_THM_JUMP24 - Addend: 0 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: _Z1fv - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000011 - -# overflow.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AF00231846BD465DF8047B704780B500AF00F400900346184680BD00BF - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000014 - Symbol: _Z1fv - Type: R_ARM_THM_JUMP24 - Addend: 0 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: _Z1fv - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000011 -... diff --git a/test/old-elf/ARM/rel-thm-mov.test b/test/old-elf/ARM/rel-thm-mov.test deleted file mode 100644 index 5e2e134ce781..000000000000 --- a/test/old-elf/ARM/rel-thm-mov.test +++ /dev/null @@ -1,70 +0,0 @@ -# 1. Check handling of R_ARM_THM_MOVW_ABS_NC and R_THM_ARM_MOVT_ABS relocation pair. -# 2. Check that instructions are not cropped for symbols that address Thumb code. -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-o.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck %s -# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=INSN-CROP %s - -# CHECK: Contents of section .text: -# CHECK: 400074 {{[0-9a-f]+}} 41f20003 c0f24003 0a221a60 -# addrL = 0x1000 ^^ -# addrH = 0x40 ^^ -# addrH addrL _ZL5data1 addr -# (0x40 << 16) + 0x1000 = 0x401000 -# CHECK: SYMBOL TABLE: -# CHECK: 00401000 l .bss 00000004 _ZL5data1 -# CHECK: 00400074 g F .text {{[0-9a-f]+}} main -# -# INSN-CROP: Contents of section .text: -# INSN-CROP: 400074 80b400af - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AF40F20003C0F200030A221A6000231846BD465DF8047B7047 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000004 - Symbol: _ZL5data1 - Type: R_ARM_THM_MOVW_ABS_NC - Addend: 0 - - Offset: 0x0000000000000008 - Symbol: _ZL5data1 - Type: R_ARM_THM_MOVT_ABS - Addend: 0 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Size: 4 -Symbols: - Local: - - Name: _ZL5data1 - Type: STT_OBJECT - Section: .bss - Size: 0x0000000000000004 - Global: - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 -... diff --git a/test/old-elf/ARM/rel-tls-ie32.test b/test/old-elf/ARM/rel-tls-ie32.test deleted file mode 100644 index e05b262cd1bc..000000000000 --- a/test/old-elf/ARM/rel-tls-ie32.test +++ /dev/null @@ -1,125 +0,0 @@ -# Check handling of R_ARM_TLS_IE32 relocation. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-tls.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-tlsv.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-tls.o %t-tlsv.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=STATIC %s - -# STATIC: Contents of section .got: -# STATIC-NEXT: 401008 08000000 0c000000 -# tp_off(i) = 0x08 ^^ ^^ tp_off(j) = 0x0c -# tp_off(i) + sizeof(i) = tp_off(j) -# 0x08 + 0x04 = 0x0c -# STATIC: SYMBOL TABLE: -# STATIC: 00400094 g F .text {{[0-9a-f]+}} main -# STATIC: 00000000 g .tdata 00000004 i -# sizeof(i) = 0x04 ^^ -# STATIC: 00000004 g .tdata 00000004 j - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-tls.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-tlsv.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi \ -# RUN: --noinhibit-exec %t-tls.o %t-tlsv.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=EXEC-DYN %s - -# EXEC-DYN: Contents of section .rel.dyn: -# EXEC-DYN-NEXT: 400134 08104000 13000000 0c104000 13000000 -# addr(i) = 0x401008 ^^ ^^ addr(j) = 0x40100c -# EXEC-DYN: Contents of section .got: -# EXEC-DYN-NEXT: 401008 00000000 04000000 -# tls_off(i) = 0x00 ^^ ^^ tls_off(j) = 0x04 -# EXEC-DYN: SYMBOL TABLE: -# EXEC-DYN: 00400144 g F .text {{[0-9a-f]+}} main -# EXEC-DYN: 00000000 g .tdata 00000004 i -# EXEC-DYN: 00000004 g .tdata 00000004 j - -# tls.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AF0C4B7B441B681DEE702FD2580A4B7B441B681DEE701FCB581A44084B7B441B681DEE701FCB585B0013441846BD465DF8047B70472E000000260000001C000000 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000038 - Symbol: i - Type: R_ARM_TLS_IE32 - - Offset: 0x000000000000003C - Symbol: i - Type: R_ARM_TLS_IE32 - - Offset: 0x0000000000000040 - Symbol: j - Type: R_ARM_TLS_IE32 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - - Name: i - Type: STT_TLS - - Name: j - Type: STT_TLS - -# tlsv.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x0000000000000004 - Content: 05000000FBFFFFFF -Symbols: - Global: - - Name: i - Type: STT_TLS - Section: .tdata - Size: 0x0000000000000004 - - Name: j - Type: STT_TLS - Section: .tdata - Value: 0x0000000000000004 - Size: 0x0000000000000004 -... diff --git a/test/old-elf/ARM/rel-tls-le32.test b/test/old-elf/ARM/rel-tls-le32.test deleted file mode 100644 index eba4f950515b..000000000000 --- a/test/old-elf/ARM/rel-tls-le32.test +++ /dev/null @@ -1,73 +0,0 @@ -# Check handling of R_ARM_TLS_LE32 relocation. - -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-o.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=STATIC %s - -# STATIC: Contents of section .text: -# STATIC: 4000b4 {{[0-9a-f]+}} 08000000 -# tp_off = 0x000008 ^^ -# STATIC: SYMBOL TABLE: -# STATIC: 00400094 g F .text {{[0-9a-f]+}} main -# STATIC: 00000000 g .tdata 00000004 i - -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi \ -# RUN: --noinhibit-exec %t-o.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=EXEC-DYN %s - -# EXEC-DYN: Contents of section .text: -# EXEC-DYN: 400154 {{[0-9a-f]+}} 08000000 -# tp_off = 0x000008 ^^ -# EXEC-DYN: SYMBOL TABLE: -# EXEC-DYN: 00400134 g F .text {{[0-9a-f]+}} main -# EXEC-DYN: 00000000 g .tdata 00000004 i - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 04B02DE500B08DE2703F1DEE10209FE5023093E70300A0E100D04BE204B09DE41EFF2FE100000000 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000024 - Symbol: i - Type: R_ARM_TLS_LE32 - Addend: 0 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x0000000000000004 - Content: '05000000' -Symbols: - Global: - - Name: i - Type: STT_TLS - Section: .tdata - Size: 0x0000000000000004 - - Name: main - Type: STT_FUNC - Section: .text -... diff --git a/test/old-elf/ARM/rel-v4bx.test b/test/old-elf/ARM/rel-v4bx.test deleted file mode 100644 index d2d3a7772b47..000000000000 --- a/test/old-elf/ARM/rel-v4bx.test +++ /dev/null @@ -1,72 +0,0 @@ -# REQUIRES: arm - -# Check handling of R_ARM_V4BX relocation. -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi \ -# RUN: --noinhibit-exec %t-o.o -o %t -# RUN: llvm-objdump -d -triple=armv4t %t | FileCheck %s - -# CHECK: Disassembly of section .text: -# CHECK: main: -# The following instruction creates a RM_ARM_V4BX relocation that -# allows the linker to replace the bx instruction to a ARMv4 -# compatible one. Currently lld does not change it. -# CHECK: 400114: 1e ff 2f 01 bxeq lr - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 1EFF2F01 - - Name: .rel.text - Type: SHT_REL - Flags: [ SHF_INFO_LINK ] - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000000 - Symbol: '' - Type: R_ARM_V4BX - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - - Name: .ARM.attributes - Type: SHT_ARM_ATTRIBUTES - AddressAlign: 0x0000000000000001 - Content: 4115000000616561626900010B000000060208010901 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: '$a' - Section: .text - - Name: .ARM.attributes - Type: STT_SECTION - Section: .ARM.attributes - Global: - - Name: main - Type: STT_FUNC - Section: .text -... diff --git a/test/old-elf/ARM/thm-symbols.test b/test/old-elf/ARM/thm-symbols.test deleted file mode 100644 index 6377d1e3ef89..000000000000 --- a/test/old-elf/ARM/thm-symbols.test +++ /dev/null @@ -1,51 +0,0 @@ -# Check that symbols formed from Thumb instructions are valid: -# 1. Symbol address. -# 2. Symbol content size. -# 3. Symbol content. - -# RUN: yaml2obj -format=elf %s > %t-t.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu \ -# RUN: -Bstatic --noinhibit-exec %t-t.o -o %t-t -# RUN: llvm-readobj -symbols %t-t | FileCheck -check-prefix=SYM-ADDR %s -# RUN: llvm-readobj -symbols %t-t | FileCheck -check-prefix=SYM-SIZE %s -# RUN: llvm-objdump -s -t %t-t | FileCheck -check-prefix=SYM-CONTENT %s - -# SYM-ADDR: Name: main (1) -# SYM-ADDR-NEXT: Value: 0x400075 - -# SYM-SIZE: Name: main (1) -# SYM-SIZE-NEXT: Value: 0x{{[0-9a-f]+}} -# SYM-SIZE-NEXT: Size: 16 - -# SYM-CONTENT: Contents of section .text: -# SYM-CONTENT-NEXT: 400074 80b400af 00231846 bd465df8 047b7047 .....#.F.F]..{pG - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AF00231846BD465DF8047B7047 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 -... diff --git a/test/old-elf/ARM/two-got-for-symbol.test b/test/old-elf/ARM/two-got-for-symbol.test deleted file mode 100644 index e0420eff1918..000000000000 --- a/test/old-elf/ARM/two-got-for-symbol.test +++ /dev/null @@ -1,62 +0,0 @@ -# Check that two GOT entries containing R_ARM_JUMP_SLOT and -# R_ARM_GLOB_DAT may be present for the same symbol in the linked binary. - -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -shared \ -# RUN: --noinhibit-exec %t-o.o -lfn -L%p/Inputs -o %t -# RUN: llvm-readobj -relocations %t | FileCheck %s - -# CHECK: 0x401000 R_ARM_GLOB_DAT fn 0x0 -# CHECK: 0x401010 R_ARM_JUMP_SLOT fn 0x0 - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 10482DE908B08DE20CD04DE230209FE502208FE02C309FE5033092E710300BE5FEFFFFEB0040A0E110301BE533FF2FE10030A0E1033084E00300A0E108D04BE21088BDE82C00000000000000 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000020 - Symbol: fn - Type: R_ARM_CALL - - Offset: 0x0000000000000044 - Symbol: _GLOBAL_OFFSET_TABLE_ - Type: R_ARM_BASE_PREL - - Offset: 0x0000000000000048 - Symbol: fn - Type: R_ARM_GOT_BREL - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Local: - - Name: '$a' - Section: .text - - Name: '$d' - Section: .text - Value: 0x0000000000000044 - Global: - - Name: f - Type: STT_FUNC - Section: .text - - Name: fn - - Name: _GLOBAL_OFFSET_TABLE_ -... diff --git a/test/old-elf/ARM/undef-lazy-symbol.test b/test/old-elf/ARM/undef-lazy-symbol.test deleted file mode 100644 index 361c6482dabe..000000000000 --- a/test/old-elf/ARM/undef-lazy-symbol.test +++ /dev/null @@ -1,133 +0,0 @@ -# Check that _GLOBAL_OFFSET_TABLE_ symbol is resolved - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-got.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-got.o -o %t -# RUN: llvm-readobj -symbols %t | FileCheck -check-prefix=GOT %s - -# GOT: Name: _GLOBAL_OFFSET_TABLE_ (183) -# GOT-NEXT: Value: {{[0-9]+}} -# GOT-NEXT: Size: 0 -# GOT-NEXT: Binding: Global (0x1) -# GOT-NEXT: Type: Object (0x1) -# GOT-NEXT: Other: 0 -# GOT-NEXT: Section: Absolute (0xFFF1) - -# Check that __exidx_start/_end symbols are resolved - -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-exidx.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --defsym=main=fn --noinhibit-exec %t-exidx.o -o %t -# RUN: llvm-readobj -symbols %t | FileCheck -check-prefix=EXIDX %s - -# EXIDX: Name: __exidx_start (186) -# EXIDX-NEXT: Value: {{[0-9]+}} -# EXIDX-NEXT: Size: 0 -# EXIDX-NEXT: Binding: Global (0x1) -# EXIDX-NEXT: Type: Object (0x1) -# EXIDX-NEXT: Other: 0 -# EXIDX-NEXT: Section: Absolute (0xFFF1) -# -# EXIDX: Name: __exidx_end (200) -# EXIDX-NEXT: Value: {{[0-9]+}} -# EXIDX-NEXT: Size: 0 -# EXIDX-NEXT: Binding: Global (0x1) -# EXIDX-NEXT: Type: Object (0x1) -# EXIDX-NEXT: Other: 0 -# EXIDX-NEXT: Section: Absolute (0xFFF1) - -# Check that all symbols are resolved - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-got.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-exidx.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-got.o %t-exidx.o -o %t -# RUN: llvm-readobj -symbols %t | FileCheck -check-prefix=SYMS %s - -# SYMS: Name: _GLOBAL_OFFSET_TABLE_ (186) -# SYMS-NEXT: Value: {{[0-9]+}} -# SYMS-NEXT: Size: 0 -# SYMS-NEXT: Binding: Global (0x1) -# SYMS-NEXT: Type: Object (0x1) -# SYMS-NEXT: Other: 0 -# SYMS-NEXT: Section: Absolute (0xFFF1) -# -# SYMS: Name: __exidx_start (208) -# SYMS-NEXT: Value: {{[0-9]+}} -# SYMS-NEXT: Size: 0 -# SYMS-NEXT: Binding: Global (0x1) -# SYMS-NEXT: Type: Object (0x1) -# SYMS-NEXT: Other: 0 -# SYMS-NEXT: Section: Absolute (0xFFF1) -# -# SYMS: Name: __exidx_end (222) -# SYMS-NEXT: Value: {{[0-9]+}} -# SYMS-NEXT: Size: 0 -# SYMS-NEXT: Binding: Global (0x1) -# SYMS-NEXT: Type: Object (0x1) -# SYMS-NEXT: Other: 0 -# SYMS-NEXT: Section: Absolute (0xFFF1) - -# got.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B483B000AF40F20003C0F200037B60002318460C37BD465DF8047B704700BF - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - - Name: _GLOBAL_OFFSET_TABLE_ - -# exidx.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B483B000AF40F20003C0F200037B60002318460C37BD465DF8047B704700BF - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: fn - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - - Name: __exidx_start - - Name: __exidx_end -... diff --git a/test/old-elf/ARM/veneer-mapping.test b/test/old-elf/ARM/veneer-mapping.test deleted file mode 100644 index ccd93eea4fbd..000000000000 --- a/test/old-elf/ARM/veneer-mapping.test +++ /dev/null @@ -1,92 +0,0 @@ -# Check that mapping symbols are properly generated for veneers. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-arm.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-thm.o -# RUN: lld -flavor old-gnu -target arm-linux-gnu --defsym=main=fa \ -# RUN: -Bstatic --noinhibit-exec %t-arm.o %t-thm.o -o %t -# RUN: llvm-readobj -symbols %t | FileCheck %s - -# CHECK: Name: $a.__ft_from_arm -# CHECK: Name: $d.__ft_from_arm -# CHECK: Name: $t.__fa_from_thumb -# CHECK: Name: $a.__fa_from_thumb - -# arm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 00482DE904B08DE2FEFFFFEA0030A0E10300A0E10088BDE8 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000008 - Symbol: ft - Type: R_ARM_JUMP24 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: fa - Type: STT_FUNC - Section: .text - - Name: ft - -# thm.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B500AFFFF7FEBF0346184680BD00BF - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000004 - Symbol: fa - Type: R_ARM_THM_JUMP24 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Global: - - Name: ft - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - - Name: fa -... diff --git a/test/old-elf/ARM/weak-branch.test b/test/old-elf/ARM/weak-branch.test deleted file mode 100644 index 76c7a4d15b65..000000000000 --- a/test/old-elf/ARM/weak-branch.test +++ /dev/null @@ -1,221 +0,0 @@ -# Check weak references fixup. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-jmp11.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-jmp11.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=JMP11-CHECK %s - -# JMP11-CHECK: Contents of section .text: -# JMP11-CHECK: 400194 704700bf 01216be7 012100bf 002167e7 -# ^ NOP (thumb16) -# 40019c: 2101 movs r1, #1 -# 40019e: bf00 nop -# JMP11-CHECK: 4001a4 002100bf -# ^ NOP (thumb16) -# 4001a4: 2100 movs r1, #0 -# 4001a6: bf00 nop -# JMP11-CHECK: SYMBOL TABLE: -# JMP11-CHECK: 00000000 w *UND* 00000000 __gnu_h2f_internal - -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-thm-call.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-thm-call.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=THM-CALL-CHECK %s - -# THM-CALL-CHECK: Contents of section .text: -# THM-CALL-CHECK: 400064 80b500af fff7f4ff aff30080 03461846 -# ^ NOP.W -# 400068: f7ff fff4 bl 400054 -# 40006c: f3af 8000 nop.w -# 400070: 4603 mov r3, r0 ; return value has not been changed after weak fn call -# -# THM-CALL-CHECK: SYMBOL TABLE: -# THM-CALL-CHECK: 00000000 w *UND* 00000000 weak_fn - -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-arm-call.o -# RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ -# RUN: --noinhibit-exec %t-arm-call.o -o %t -# RUN: llvm-objdump -s -t %t | FileCheck -check-prefix=ARM-CALL-CHECK %s - -# ARM-CALL-CHECK: Contents of section .text: -# ARM-CALL-CHECK: 400074 04b08de2 f5ffffeb 00f020e3 0030a0e1 -# ^ NOP -# 400078: ebfffff5 bl 400054 -# 40007c: e320f000 nop {0} -# 400080: e1a03000 mov r3, r0 ; return value has not been changed after weak fn call -# -# ARM-CALL-CHECK: SYMBOL TABLE: -# ARM-CALL-CHECK: 00000000 w *UND* 00000000 weak_fn - -# jump11.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 70B4020CC0F3C754FF2CC0F3160302F4004080B241D0002C08BF002B3BD0A4F17F0543F4000315F10E0FA8BF41F6FF7209DA15F1190FA3BFA4F166066FF07F42F2406FF07F4212EA03060CD001325208964208BF03EA42021344B3F1807F24BF5B08A4F17E0501B30F2D26DC15F1180F11DB15F10E0FB5BF4FF6F2710E35CFF6FF71AD02B7BF491BAAB2CB40002202EB5333034398B270BC70470029FBD040EA533370BC43F4FC407047102DDEDD6FEAD0336FEAC33398B2EDE740F4F84398B2E9E700BFC0F3842310B4A3F11F040029B4FA84F400F400424FEA541408BF0024C0F309002146140481B943B14203703302EBC35343EA04005DF8044B704760B1B0FA80F3153B98405B42EFE744EA40305DF8044B40F0FF40704720465DF8044B704700BF01216BE70121FEE7002167E70021FEE7 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x000000000000012A - Symbol: __gnu_h2f_internal - Type: R_ARM_THM_JUMP11 - - Offset: 0x0000000000000132 - Symbol: __gnu_h2f_internal - Type: R_ARM_THM_JUMP11 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: '$t' - Section: .text - - Name: __gnu_f2h_internal - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - Size: 0x00000000000000C2 - Global: - - Name: __gnu_f2h_ieee - Type: STT_FUNC - Section: .text - Value: 0x0000000000000125 - Size: 0x0000000000000004 - Visibility: STV_HIDDEN - - Name: __gnu_h2f_ieee - Type: STT_FUNC - Section: .text - Value: 0x0000000000000129 - Size: 0x0000000000000004 - Visibility: STV_HIDDEN - - Name: __gnu_f2h_alternative - Type: STT_FUNC - Section: .text - Value: 0x000000000000012D - Size: 0x0000000000000004 - Visibility: STV_HIDDEN - - Name: __gnu_h2f_alternative - Type: STT_FUNC - Section: .text - Value: 0x0000000000000131 - Size: 0x0000000000000004 - Visibility: STV_HIDDEN - Weak: - - Name: __gnu_h2f_internal -# thm-call.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 80B400AF01231846BD465DF8047B704780B500AFFFF7FEFFFFF7FEFF0346184680BD00BF - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000014 - Symbol: my_fn - Type: R_ARM_THM_CALL - - Offset: 0x0000000000000018 - Symbol: weak_fn - Type: R_ARM_THM_CALL -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: '$t' - Section: .text - Global: - - Name: my_fn - Type: STT_FUNC - Section: .text - Value: 0x0000000000000001 - Size: 0x0000000000000010 - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000011 - Size: 0x0000000000000012 - Weak: - - Name: weak_fn -# arm-call.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 04B02DE500B08DE20130A0E30300A0E100D04BE204B09DE41EFF2FE100482DE904B08DE2FEFFFFEBFEFFFFEB0030A0E10300A0E10088BDE8 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: .text - Relocations: - - Offset: 0x0000000000000024 - Symbol: my_fn - Type: R_ARM_CALL - - Offset: 0x0000000000000028 - Symbol: weak_fn - Type: R_ARM_CALL -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: '$a' - Section: .text - Global: - - Name: my_fn - Type: STT_FUNC - Section: .text - Size: 0x000000000000001C - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x000000000000001C - Size: 0x000000000000001C - Weak: - - Name: weak_fn -... diff --git a/test/old-elf/Hexagon/Inputs/dynobj-data.c b/test/old-elf/Hexagon/Inputs/dynobj-data.c deleted file mode 100644 index 0f4ea9b80526..000000000000 --- a/test/old-elf/Hexagon/Inputs/dynobj-data.c +++ /dev/null @@ -1,3 +0,0 @@ -int d = 10; - -int fn() { return d; } diff --git a/test/old-elf/Hexagon/Inputs/dynobj-data.o b/test/old-elf/Hexagon/Inputs/dynobj-data.o deleted file mode 100644 index 13d283cd0eff..000000000000 Binary files a/test/old-elf/Hexagon/Inputs/dynobj-data.o and /dev/null differ diff --git a/test/old-elf/Hexagon/Inputs/dynobj.c b/test/old-elf/Hexagon/Inputs/dynobj.c deleted file mode 100644 index f17fdadd6945..000000000000 --- a/test/old-elf/Hexagon/Inputs/dynobj.c +++ /dev/null @@ -1,26 +0,0 @@ -extern int shankar; -static int a; -static int b; -int c; -int fn2() { - return 0; -} - -int fn1() { - return 0; -} - -int fn() { - a = 10; - b = 20; - c = 10; - shankar = 20; - return 0; -} - -int fn3() { - fn(); - fn1(); - fn2(); - return 0; -} diff --git a/test/old-elf/Hexagon/Inputs/dynobj.o b/test/old-elf/Hexagon/Inputs/dynobj.o deleted file mode 100644 index 6c184f2edd60..000000000000 Binary files a/test/old-elf/Hexagon/Inputs/dynobj.o and /dev/null differ diff --git a/test/old-elf/Hexagon/Inputs/got-plt-order.c b/test/old-elf/Hexagon/Inputs/got-plt-order.c deleted file mode 100644 index 621f670ef7c5..000000000000 --- a/test/old-elf/Hexagon/Inputs/got-plt-order.c +++ /dev/null @@ -1,6 +0,0 @@ -int c = 10; -int fn() { c = 20; return 0; } - -int fn1() { - return fn(); -} diff --git a/test/old-elf/Hexagon/Inputs/got-plt-order.o b/test/old-elf/Hexagon/Inputs/got-plt-order.o deleted file mode 100644 index e97678b739bd..000000000000 Binary files a/test/old-elf/Hexagon/Inputs/got-plt-order.o and /dev/null differ diff --git a/test/old-elf/Hexagon/Inputs/libMaxAlignment.a b/test/old-elf/Hexagon/Inputs/libMaxAlignment.a deleted file mode 100644 index cc5461a09ae4..000000000000 Binary files a/test/old-elf/Hexagon/Inputs/libMaxAlignment.a and /dev/null differ diff --git a/test/old-elf/Hexagon/Inputs/sda-base.o b/test/old-elf/Hexagon/Inputs/sda-base.o deleted file mode 100644 index 410a3d47d320..000000000000 Binary files a/test/old-elf/Hexagon/Inputs/sda-base.o and /dev/null differ diff --git a/test/old-elf/Hexagon/Inputs/sdata1.c b/test/old-elf/Hexagon/Inputs/sdata1.c deleted file mode 100644 index 77c2a54c36a1..000000000000 --- a/test/old-elf/Hexagon/Inputs/sdata1.c +++ /dev/null @@ -1,3 +0,0 @@ -static int a = 0; - -int b = 10; diff --git a/test/old-elf/Hexagon/Inputs/sdata1.o b/test/old-elf/Hexagon/Inputs/sdata1.o deleted file mode 100644 index bf908fed27e9..000000000000 Binary files a/test/old-elf/Hexagon/Inputs/sdata1.o and /dev/null differ diff --git a/test/old-elf/Hexagon/Inputs/sdata2.c b/test/old-elf/Hexagon/Inputs/sdata2.c deleted file mode 100644 index 96b37271d773..000000000000 --- a/test/old-elf/Hexagon/Inputs/sdata2.c +++ /dev/null @@ -1,6 +0,0 @@ -int sdata1 = 10; -int sdata2 = 20; -int sdata3 = 30; - -int sbss1 = 0; - diff --git a/test/old-elf/Hexagon/Inputs/sdata2.o b/test/old-elf/Hexagon/Inputs/sdata2.o deleted file mode 100644 index e4ec810866e5..000000000000 Binary files a/test/old-elf/Hexagon/Inputs/sdata2.o and /dev/null differ diff --git a/test/old-elf/Hexagon/Inputs/use-shared.hexagon b/test/old-elf/Hexagon/Inputs/use-shared.hexagon deleted file mode 100644 index 9e5ffb42d36a..000000000000 Binary files a/test/old-elf/Hexagon/Inputs/use-shared.hexagon and /dev/null differ diff --git a/test/old-elf/Hexagon/dynlib-data.test b/test/old-elf/Hexagon/dynlib-data.test deleted file mode 100644 index 2da312b54d43..000000000000 --- a/test/old-elf/Hexagon/dynlib-data.test +++ /dev/null @@ -1,9 +0,0 @@ -RUN: lld -flavor old-gnu -target hexagon %p/Inputs/dynobj-data.o \ -RUN: -o %t --noinhibit-exec -shared -RUN: llvm-objdump -s %t > %t1 -RUN: FileCheck -check-prefix=CHECKRELOCS %s < %t1 - -CHECKRELOCS: Contents of section .text: -CHECKRELOCS: 00f8 01c09da0 01d89da1 3c400000 18c4496a ........<@....Ij -CHECKRELOCS: 0108 ff7fff0f 00ff9897 00c08091 38c09d91 ............8... -CHECKRELOCS: 0118 1ec01e96 .... diff --git a/test/old-elf/Hexagon/dynlib-gotoff.test b/test/old-elf/Hexagon/dynlib-gotoff.test deleted file mode 100644 index f31d23bc5ebc..000000000000 --- a/test/old-elf/Hexagon/dynlib-gotoff.test +++ /dev/null @@ -1,128 +0,0 @@ -# This tests GOT's and PLT's for dynamic libraries for Hexagon -RUN: lld -flavor old-gnu -target hexagon %p/Inputs/dynobj.o \ -RUN: -o %t --output-filetype=yaml -shared --noinhibit-exec -RUN: FileCheck -check-prefix=CHECKGOTPLT %s < %t - - - name: .PLT0 -CHECKGOTPLT: type: stub -CHECKGOTPLT: content: [ 00, 40, 00, 00, 1C, C0, 49, 6A, 0E, 42, 9C, E2, -CHECKGOTPLT: 4F, 40, 9C, 91, 3C, C0, 9C, 91, 0E, 42, 0E, 8C, -CHECKGOTPLT: 00, C0, 9C, 52 ] -CHECKGOTPLT: alignment: 16 -CHECKGOTPLT: section-name: .plt -CHECKGOTPLT: references: -CHECKGOTPLT: - kind: R_HEX_B32_PCREL_X -CHECKGOTPLT: offset: 0 - target: __got0 -CHECKGOTPLT: - kind: R_HEX_6_PCREL_X -CHECKGOTPLT: offset: 4 - target: __got0 -CHECKGOTPLT: addend: 4 - - name: __plt_fn -CHECKGOTPLT: type: stub -CHECKGOTPLT: content: [ 00, 40, 00, 00, 0E, C0, 49, 6A, 1C, C0, 8E, 91, -CHECKGOTPLT: 00, C0, 9C, 52 ] -CHECKGOTPLT: alignment: 16 -CHECKGOTPLT: section-name: .plt -CHECKGOTPLT: references: -CHECKGOTPLT: - kind: R_HEX_B32_PCREL_X -CHECKGOTPLT: offset: 0 - target: __got_fn -CHECKGOTPLT: - kind: R_HEX_6_PCREL_X -CHECKGOTPLT: offset: 4 - target: __got_fn -CHECKGOTPLT: addend: 4 - - name: __plt_fn1 -CHECKGOTPLT: type: stub -CHECKGOTPLT: content: [ 00, 40, 00, 00, 0E, C0, 49, 6A, 1C, C0, 8E, 91, -CHECKGOTPLT: 00, C0, 9C, 52 ] -CHECKGOTPLT: alignment: 16 -CHECKGOTPLT: section-name: .plt -CHECKGOTPLT: references: -CHECKGOTPLT: - kind: R_HEX_B32_PCREL_X -CHECKGOTPLT: offset: 0 - target: __got_fn1 -CHECKGOTPLT: - kind: R_HEX_6_PCREL_X -CHECKGOTPLT: offset: 4 - target: __got_fn1 -CHECKGOTPLT: addend: 4 - - name: __plt_fn2 -CHECKGOTPLT: type: stub -CHECKGOTPLT: content: [ 00, 40, 00, 00, 0E, C0, 49, 6A, 1C, C0, 8E, 91, -CHECKGOTPLT: 00, C0, 9C, 52 ] -CHECKGOTPLT: alignment: 16 -CHECKGOTPLT: section-name: .plt -CHECKGOTPLT: references: -CHECKGOTPLT: - kind: R_HEX_B32_PCREL_X -CHECKGOTPLT: offset: 0 - target: __got_fn2 -CHECKGOTPLT: - kind: R_HEX_6_PCREL_X -CHECKGOTPLT: offset: 4 - target: __got_fn2 -CHECKGOTPLT: addend: 4 - - name: __got0 -CHECKGOTPLT: type: got -CHECKGOTPLT: content: [ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, -CHECKGOTPLT: 00, 00, 00, 00 ] -CHECKGOTPLT: alignment: 8 -CHECKGOTPLT: section-name: .got.plt -CHECKGOTPLT: permissions: rw- - - name: __got_c -CHECKGOTPLT: type: got -CHECKGOTPLT: content: [ 00, 00, 00, 00 ] -CHECKGOTPLT: alignment: 4 -CHECKGOTPLT: section-name: .got -CHECKGOTPLT: permissions: rw- -CHECKGOTPLT: references: -CHECKGOTPLT: - kind: R_HEX_GLOB_DAT -CHECKGOTPLT: offset: 0 -CHECKGOTPLT: target: c - - name: __got_shankar -CHECKGOTPLT: type: got -CHECKGOTPLT: content: [ 00, 00, 00, 00 ] -CHECKGOTPLT: alignment: 4 -CHECKGOTPLT: section-name: .got -CHECKGOTPLT: permissions: rw- -CHECKGOTPLT: references: -CHECKGOTPLT: - kind: R_HEX_GLOB_DAT -CHECKGOTPLT: offset: 0 -CHECKGOTPLT: target: shankar - - name: __got_fn -CHECKGOTPLT: type: got -CHECKGOTPLT: content: [ 00, 00, 00, 00 ] -CHECKGOTPLT: alignment: 4 -CHECKGOTPLT: section-name: .got.plt -CHECKGOTPLT: permissions: rw- -CHECKGOTPLT: references: -CHECKGOTPLT: - kind: R_HEX_JMP_SLOT -CHECKGOTPLT: offset: 0 -CHECKGOTPLT: target: fn -CHECKGOTPLT: - kind: R_HEX_32 -CHECKGOTPLT: offset: 0 - target: .PLT0 - - name: __got_fn1 -CHECKGOTPLT: type: got -CHECKGOTPLT: content: [ 00, 00, 00, 00 ] -CHECKGOTPLT: alignment: 4 -CHECKGOTPLT: section-name: .got.plt -CHECKGOTPLT: permissions: rw- -CHECKGOTPLT: references: -CHECKGOTPLT: - kind: R_HEX_JMP_SLOT -CHECKGOTPLT: offset: 0 -CHECKGOTPLT: target: fn1 -CHECKGOTPLT: - kind: R_HEX_32 -CHECKGOTPLT: offset: 0 - target: .PLT0 - - name: __got_fn2 -CHECKGOTPLT: type: got -CHECKGOTPLT: content: [ 00, 00, 00, 00 ] -CHECKGOTPLT: alignment: 4 -CHECKGOTPLT: section-name: .got.plt -CHECKGOTPLT: permissions: rw- -CHECKGOTPLT: references: -CHECKGOTPLT: - kind: R_HEX_JMP_SLOT -CHECKGOTPLT: offset: 0 -CHECKGOTPLT: target: fn2 -CHECKGOTPLT: - kind: R_HEX_32 -CHECKGOTPLT: offset: 0 - target: .PLT0 diff --git a/test/old-elf/Hexagon/dynlib-hash.test b/test/old-elf/Hexagon/dynlib-hash.test deleted file mode 100644 index e26368120970..000000000000 --- a/test/old-elf/Hexagon/dynlib-hash.test +++ /dev/null @@ -1,9 +0,0 @@ -RUN: lld -flavor old-gnu -target hexagon %p/Inputs/dynobj.o \ -RUN: -o %t --noinhibit-exec -shared -RUN: llvm-objdump -s %t > %t1 -RUN: FileCheck -check-prefix=CHECKHASH %s < %t1 - -CHECKHASH: Contents of section .hash: -CHECKHASH: 0094 03000000 07000000 06000000 01000000 -CHECKHASH: 00a4 04000000 00000000 00000000 00000000 -CHECKHASH: 00b4 00000000 03000000 02000000 05000000 diff --git a/test/old-elf/Hexagon/dynlib-rela.test b/test/old-elf/Hexagon/dynlib-rela.test deleted file mode 100644 index 86e38ede6280..000000000000 --- a/test/old-elf/Hexagon/dynlib-rela.test +++ /dev/null @@ -1,9 +0,0 @@ -# Tests that the relocation sections have the right alignment. -RUN: lld -flavor old-gnu -target hexagon %p/Inputs/use-shared.hexagon -shared -o %t1 -RUN: llvm-readobj -sections %t1 > %t2 -RUN: FileCheck -check-prefix=SECTIONS %s < %t2 - -SECTIONS: Section { -SECTIONS: Name: .rela.plt (23) -SECTIONS: AddressAlignment: 4 -SECTIONS: } diff --git a/test/old-elf/Hexagon/dynlib-syms.test b/test/old-elf/Hexagon/dynlib-syms.test deleted file mode 100644 index 08f8930bb205..000000000000 --- a/test/old-elf/Hexagon/dynlib-syms.test +++ /dev/null @@ -1,7 +0,0 @@ -RUN: lld -flavor old-gnu -target hexagon %p/Inputs/dynobj.o \ -RUN: -o %t --noinhibit-exec -shared -RUN: llvm-nm -n -M %t > %t1 -RUN: FileCheck -check-prefix=CHECKSYMS %s < %t1 - -CHECKSYMS: 0000025c A _DYNAMIC -CHECKSYMS: 00001008 A _GLOBAL_OFFSET_TABLE_ diff --git a/test/old-elf/Hexagon/dynlib.test b/test/old-elf/Hexagon/dynlib.test deleted file mode 100644 index 9e591ed06075..000000000000 --- a/test/old-elf/Hexagon/dynlib.test +++ /dev/null @@ -1,36 +0,0 @@ -RUN: lld -flavor old-gnu -target hexagon %p/Inputs/use-shared.hexagon -shared -o %t1 -RUN: llvm-readobj -dyn-symbols %t1 > %t2 -RUN: FileCheck -check-prefix=DYNSYMS %s < %t2 -RUN: llvm-readobj -program-headers %t1 | FileCheck %s - -DYNSYMS: DynamicSymbols [ -DYNSYMS: Symbol { -DYNSYMS: Name: fn2 -DYNSYMS-NEXT: Value: -DYNSYMS-NEXT: Size: -DYNSYMS-NEXT: Binding: Global -DYNSYMS-NEXT: Type: Function -DYNSYMS-NEXT: Other: -DYNSYMS-NEXT: Section: .text -DYNSYMS: } -DYNSYMS: Symbol { -DYNSYMS: Name: fn1 -DYNSYMS-NEXT: Value: -DYNSYMS-NEXT: Size: -DYNSYMS-NEXT: Binding: Global -DYNSYMS-NEXT: Type: Function -DYNSYMS-NEXT: Other: -DYNSYMS-NEXT: Section: .text -DYNSYMS: } -DYNSYMS: Symbol { -DYNSYMS: Name: fn3 -DYNSYMS-NEXT: Value: -DYNSYMS-NEXT: Size: -DYNSYMS-NEXT: Binding: Global -DYNSYMS-NEXT: Type: Function -DYNSYMS-NEXT: Other: -DYNSYMS-NEXT: Section: .text -DYNSYMS-NEXT: } -DYNSYMS-NEXT: ] - -CHECK-NOT: PT_PHDR diff --git a/test/old-elf/Hexagon/hexagon-got-plt-order.test b/test/old-elf/Hexagon/hexagon-got-plt-order.test deleted file mode 100644 index e2d37d1f6440..000000000000 --- a/test/old-elf/Hexagon/hexagon-got-plt-order.test +++ /dev/null @@ -1,5 +0,0 @@ -RUN: lld -flavor old-gnu -target hexagon %p/Inputs/got-plt-order.o -o %t -shared -RUN: llvm-objdump -section-headers %t | FileCheck %s - -CHECK: .got -CHECK-NEXT: .got.plt diff --git a/test/old-elf/Hexagon/hexagon-plt-setup.test b/test/old-elf/Hexagon/hexagon-plt-setup.test deleted file mode 100644 index 51d8bd6a6b71..000000000000 --- a/test/old-elf/Hexagon/hexagon-plt-setup.test +++ /dev/null @@ -1,12 +0,0 @@ -RUN: lld -flavor old-gnu -target hexagon %p/Inputs/use-shared.hexagon \ -RUN: --output-filetype=yaml --noinhibit-exec -o %t2 -RUN: FileCheck %s < %t2 - -CHECK: - name: fn3 -CHECK: references: -CHECK: - kind: R_HEX_B22_PCREL -CHECK: offset: 4 - target: -CHECK: - kind: R_HEX_B22_PCREL -CHECK: offset: 8 - target: diff --git a/test/old-elf/Hexagon/maxalignment.test b/test/old-elf/Hexagon/maxalignment.test deleted file mode 100644 index 15a2bf3d80be..000000000000 --- a/test/old-elf/Hexagon/maxalignment.test +++ /dev/null @@ -1,8 +0,0 @@ -# This tests that we lld is able to get the contentType properly for archives -# when they intermittently get loaded at an address whose alignment is 2 - -RUN: lld -flavor old-gnu -target hexagon --whole-archive %p/Inputs/libMaxAlignment.a \ -RUN: --noinhibit-exec -static -o %t -RUN: llvm-nm %t | FileCheck %s - -CHECK: {{[0-9a-f]+}} D a diff --git a/test/old-elf/Hexagon/rela-order.test b/test/old-elf/Hexagon/rela-order.test deleted file mode 100644 index 777b923fd737..000000000000 --- a/test/old-elf/Hexagon/rela-order.test +++ /dev/null @@ -1,9 +0,0 @@ -RUN: lld -flavor old-gnu -target hexagon %p/Inputs/dynobj.o -shared \ -RUN: --noinhibit-exec -o %t -RUN: llvm-objdump -section-headers %t | FileCheck %s - -CHECK: .dynsym -CHECK-NEXT: .dynstr -CHECK-NEXT: .rela.dyn -CHECK-NEXT: .rela.plt -CHECK-NEXT: .plt diff --git a/test/old-elf/Hexagon/sda-base.test b/test/old-elf/Hexagon/sda-base.test deleted file mode 100644 index cfcafbce8377..000000000000 --- a/test/old-elf/Hexagon/sda-base.test +++ /dev/null @@ -1,4 +0,0 @@ -RUN: lld -flavor old-gnu -target hexagon %p/Inputs/sda-base.o -o %t1 --noinhibit-exec -RUN: llvm-nm -n %t1 | FileCheck %s -check-prefix=sdabase - -sdabase: 00002000 A _SDA_BASE_ diff --git a/test/old-elf/Hexagon/zerofillquick-sdata.test b/test/old-elf/Hexagon/zerofillquick-sdata.test deleted file mode 100644 index 1b932fe6e7b1..000000000000 --- a/test/old-elf/Hexagon/zerofillquick-sdata.test +++ /dev/null @@ -1,18 +0,0 @@ -# This tests that a typeZeroFillFast atom is associated with a section that has -# the correct memory size. - -RUN: lld -flavor old-gnu -target hexagon %p/Inputs/sdata1.o %p/Inputs/sdata2.o \ -RUN: -o %t --noinhibit-exec -static -RUN: llvm-readobj -sections %t | FileCheck -check-prefix=CHECKSECTIONSANDSIZE %s - -CHECKSECTIONSANDSIZE: Section { -CHECKSECTIONSANDSIZE: Name: .sdata (13) -CHECKSECTIONSANDSIZE: Address: 0x1000 -CHECKSECTIONSANDSIZE: Offset: 0x1000 -CHECKSECTIONSANDSIZE: Size: 24 -CHECKSECTIONSANDSIZE: } -CHECKSECTIONSANDSIZE: Section { -CHECKSECTIONSANDSIZE: Name: .bss (20) -CHECKSECTIONSANDSIZE: Address: 0x1018 -CHECKSECTIONSANDSIZE: Offset: 0x1018 -CHECKSECTIONSANDSIZE: } diff --git a/test/old-elf/Inputs/abs-test.i386 b/test/old-elf/Inputs/abs-test.i386 deleted file mode 100644 index 8556c24da551..000000000000 Binary files a/test/old-elf/Inputs/abs-test.i386 and /dev/null differ diff --git a/test/old-elf/Inputs/allowduplicates.objtxt b/test/old-elf/Inputs/allowduplicates.objtxt deleted file mode 100644 index 9b8ba8902aba..000000000000 --- a/test/old-elf/Inputs/allowduplicates.objtxt +++ /dev/null @@ -1,12 +0,0 @@ -defined-atoms: - - name: .text - alignment: 16 - section-choice: custom-required - section-name: .text - - name: main - scope: global - content: [ B8, 00, 00, 00, 00, C7, 44, 24, FC, 00, 00, 00, - 00, C3 ] - alignment: 16 - section-choice: custom-required - section-name: .text diff --git a/test/old-elf/Inputs/bar.o.x86-64 b/test/old-elf/Inputs/bar.o.x86-64 deleted file mode 100644 index 467485f0bb96..000000000000 Binary files a/test/old-elf/Inputs/bar.o.x86-64 and /dev/null differ diff --git a/test/old-elf/Inputs/branch-test.hexagon b/test/old-elf/Inputs/branch-test.hexagon deleted file mode 100644 index 1ffb47228e32..000000000000 Binary files a/test/old-elf/Inputs/branch-test.hexagon and /dev/null differ diff --git a/test/old-elf/Inputs/branch-test.ppc b/test/old-elf/Inputs/branch-test.ppc deleted file mode 100644 index 4698941e7503..000000000000 Binary files a/test/old-elf/Inputs/branch-test.ppc and /dev/null differ diff --git a/test/old-elf/Inputs/consecutive-weak-defs.o.yaml b/test/old-elf/Inputs/consecutive-weak-defs.o.yaml deleted file mode 100644 index cbd9c665b6d5..000000000000 --- a/test/old-elf/Inputs/consecutive-weak-defs.o.yaml +++ /dev/null @@ -1,65 +0,0 @@ ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 554889E5E8000000005DC3554889E5B8640000005DC3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000005 - Symbol: my_weak_func - Type: R_X86_64_PC32 - Addend: -4 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Global: - - Name: my_func - Type: STT_FUNC - Section: .text - Size: 0x000000000000000B - Weak: - - Name: my_weak_func - Type: STT_FUNC - Section: .text - Value: 0x000000000000000B - Size: 0x000000000000000B - - Name: my_weak_func2 - Type: STT_FUNC - Section: .text - Value: 0x000000000000000B - Size: 0x000000000000000B - - Name: my_weak_func3 - Type: STT_FUNC - Section: .text - Value: 0x000000000000000B - Size: 0x000000000000000B -... diff --git a/test/old-elf/Inputs/constants-merge.x86-64 b/test/old-elf/Inputs/constants-merge.x86-64 deleted file mode 100644 index 0087eb8f8cb5..000000000000 Binary files a/test/old-elf/Inputs/constants-merge.x86-64 and /dev/null differ diff --git a/test/old-elf/Inputs/constdata.x86-64 b/test/old-elf/Inputs/constdata.x86-64 deleted file mode 100644 index d877a5535357..000000000000 Binary files a/test/old-elf/Inputs/constdata.x86-64 and /dev/null differ diff --git a/test/old-elf/Inputs/foo.o.x86-64 b/test/old-elf/Inputs/foo.o.x86-64 deleted file mode 100644 index 72a89eefa8ed..000000000000 Binary files a/test/old-elf/Inputs/foo.o.x86-64 and /dev/null differ diff --git a/test/old-elf/Inputs/globalconst.c b/test/old-elf/Inputs/globalconst.c deleted file mode 100644 index 08395a88e7ca..000000000000 --- a/test/old-elf/Inputs/globalconst.c +++ /dev/null @@ -1,2 +0,0 @@ -/* compile the code with -fmerge-all-constants */ -const char mystr[] = "foobar"; diff --git a/test/old-elf/Inputs/globalconst.o.x86-64 b/test/old-elf/Inputs/globalconst.o.x86-64 deleted file mode 100644 index d8e266e76334..000000000000 Binary files a/test/old-elf/Inputs/globalconst.o.x86-64 and /dev/null differ diff --git a/test/old-elf/Inputs/gotpcrel.S b/test/old-elf/Inputs/gotpcrel.S deleted file mode 100644 index 300675f59612..000000000000 --- a/test/old-elf/Inputs/gotpcrel.S +++ /dev/null @@ -1,11 +0,0 @@ - .text - .globl main - .align 16, 0x90 - .type main,@function -main: # @main - movq blah@GOTPCREL(%rip), %rax - movq main@GOTPCREL(%rip), %rax - ret - - .weak blah - .type blah,@function diff --git a/test/old-elf/Inputs/gotpcrel.x86-64 b/test/old-elf/Inputs/gotpcrel.x86-64 deleted file mode 100644 index f9c61d0edf15..000000000000 Binary files a/test/old-elf/Inputs/gotpcrel.x86-64 and /dev/null differ diff --git a/test/old-elf/Inputs/group-cmd-search-1.ls b/test/old-elf/Inputs/group-cmd-search-1.ls deleted file mode 100644 index 965369309a20..000000000000 --- a/test/old-elf/Inputs/group-cmd-search-1.ls +++ /dev/null @@ -1 +0,0 @@ -GROUP ( shared.so-x86-64 ) diff --git a/test/old-elf/Inputs/group-cmd-search-2.ls b/test/old-elf/Inputs/group-cmd-search-2.ls deleted file mode 100644 index f1eee6a35efa..000000000000 --- a/test/old-elf/Inputs/group-cmd-search-2.ls +++ /dev/null @@ -1 +0,0 @@ -GROUP ( /shared.so-x86-64 ) diff --git a/test/old-elf/Inputs/group-cmd-search-3.ls b/test/old-elf/Inputs/group-cmd-search-3.ls deleted file mode 100644 index 83ce0ca62fb1..000000000000 --- a/test/old-elf/Inputs/group-cmd-search-3.ls +++ /dev/null @@ -1 +0,0 @@ -GROUP ( -l:shared.so-x86-64 -lfnarchive ) diff --git a/test/old-elf/Inputs/ifunc.S b/test/old-elf/Inputs/ifunc.S deleted file mode 100644 index 0ac1f5a5b0bb..000000000000 --- a/test/old-elf/Inputs/ifunc.S +++ /dev/null @@ -1,21 +0,0 @@ - .text - .globl hey; - .type hey, @function; -hey: - .type hey, @gnu_indirect_function; - leaq __hey_1(%rip), %rax - ret - - .text - .type __hey_1, @function; - .globl __hey_1; -__hey_1: - movq $42, %rax - ret - - .text - .type plt, @function; - .globl plt; -plt: - call hey@PLT - ret diff --git a/test/old-elf/Inputs/ifunc.cpp b/test/old-elf/Inputs/ifunc.cpp deleted file mode 100644 index 2e520277d36c..000000000000 --- a/test/old-elf/Inputs/ifunc.cpp +++ /dev/null @@ -1,3 +0,0 @@ -extern "C" int hey(); - -int main() { return hey(); } diff --git a/test/old-elf/Inputs/ifunc.cpp.x86-64 b/test/old-elf/Inputs/ifunc.cpp.x86-64 deleted file mode 100644 index 20c812cabd2c..000000000000 Binary files a/test/old-elf/Inputs/ifunc.cpp.x86-64 and /dev/null differ diff --git a/test/old-elf/Inputs/ifunc.x86-64 b/test/old-elf/Inputs/ifunc.x86-64 deleted file mode 100644 index 36c8e04ca837..000000000000 Binary files a/test/old-elf/Inputs/ifunc.x86-64 and /dev/null differ diff --git a/test/old-elf/Inputs/libfnarchive.a b/test/old-elf/Inputs/libfnarchive.a deleted file mode 100644 index 753acd6e2c65..000000000000 Binary files a/test/old-elf/Inputs/libfnarchive.a and /dev/null differ diff --git a/test/old-elf/Inputs/libifunc.x86-64.so b/test/old-elf/Inputs/libifunc.x86-64.so deleted file mode 100644 index 0f05b308ce78..000000000000 Binary files a/test/old-elf/Inputs/libifunc.x86-64.so and /dev/null differ diff --git a/test/old-elf/Inputs/libundef.so b/test/old-elf/Inputs/libundef.so deleted file mode 100644 index 41f2a668f360..000000000000 Binary files a/test/old-elf/Inputs/libundef.so and /dev/null differ diff --git a/test/old-elf/Inputs/libweaksym.so b/test/old-elf/Inputs/libweaksym.so deleted file mode 100755 index 7ff4ea56ae60..000000000000 Binary files a/test/old-elf/Inputs/libweaksym.so and /dev/null differ diff --git a/test/old-elf/Inputs/main-with-global-def.o.yaml b/test/old-elf/Inputs/main-with-global-def.o.yaml deleted file mode 100644 index d3eeb8fe24b6..000000000000 --- a/test/old-elf/Inputs/main-with-global-def.o.yaml +++ /dev/null @@ -1,55 +0,0 @@ ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 554889E5B8C80000005DC3554889E54883EC10C745FC00000000B000E8000000004883C4105DC3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x000000000000001D - Symbol: my_func - Type: R_X86_64_PC32 - Addend: -4 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Global: - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x000000000000000B - Size: 0x000000000000001C - - Name: my_weak_func2 - Type: STT_FUNC - Section: .text - Size: 0x000000000000000B - - Name: my_func -... diff --git a/test/old-elf/Inputs/mainobj.x86_64 b/test/old-elf/Inputs/mainobj.x86_64 deleted file mode 100644 index d0f29418237d..000000000000 Binary files a/test/old-elf/Inputs/mainobj.x86_64 and /dev/null differ diff --git a/test/old-elf/Inputs/no-unique-section-names.x86-64 b/test/old-elf/Inputs/no-unique-section-names.x86-64 deleted file mode 100644 index fd92f5f0c6e7..000000000000 Binary files a/test/old-elf/Inputs/no-unique-section-names.x86-64 and /dev/null differ diff --git a/test/old-elf/Inputs/object-test.elf-hexagon b/test/old-elf/Inputs/object-test.elf-hexagon deleted file mode 100644 index bfc85a7d0b76..000000000000 Binary files a/test/old-elf/Inputs/object-test.elf-hexagon and /dev/null differ diff --git a/test/old-elf/Inputs/object-test.elf-i386 b/test/old-elf/Inputs/object-test.elf-i386 deleted file mode 100644 index 872684c7fcc1..000000000000 Binary files a/test/old-elf/Inputs/object-test.elf-i386 and /dev/null differ diff --git a/test/old-elf/Inputs/phdr.i386 b/test/old-elf/Inputs/phdr.i386 deleted file mode 100644 index 7c83dd314891..000000000000 Binary files a/test/old-elf/Inputs/phdr.i386 and /dev/null differ diff --git a/test/old-elf/Inputs/quickdata-sort-test.o.elf-hexagon b/test/old-elf/Inputs/quickdata-sort-test.o.elf-hexagon deleted file mode 100644 index 03d028707129..000000000000 Binary files a/test/old-elf/Inputs/quickdata-sort-test.o.elf-hexagon and /dev/null differ diff --git a/test/old-elf/Inputs/quickdata-sortcommon-test.o.elf-hexagon b/test/old-elf/Inputs/quickdata-sortcommon-test.o.elf-hexagon deleted file mode 100644 index 410a3d47d320..000000000000 Binary files a/test/old-elf/Inputs/quickdata-sortcommon-test.o.elf-hexagon and /dev/null differ diff --git a/test/old-elf/Inputs/quickdata-test.elf-hexagon b/test/old-elf/Inputs/quickdata-test.elf-hexagon deleted file mode 100644 index c3ae53a6babe..000000000000 Binary files a/test/old-elf/Inputs/quickdata-test.elf-hexagon and /dev/null differ diff --git a/test/old-elf/Inputs/reloc-test.elf-i386 b/test/old-elf/Inputs/reloc-test.elf-i386 deleted file mode 100644 index 1a5558131fff..000000000000 Binary files a/test/old-elf/Inputs/reloc-test.elf-i386 and /dev/null differ diff --git a/test/old-elf/Inputs/reloc-xb.x86 b/test/old-elf/Inputs/reloc-xb.x86 deleted file mode 100644 index 4d9770aa2356..000000000000 Binary files a/test/old-elf/Inputs/reloc-xb.x86 and /dev/null differ diff --git a/test/old-elf/Inputs/reloc-xt.x86 b/test/old-elf/Inputs/reloc-xt.x86 deleted file mode 100644 index dcdfbfb09f71..000000000000 Binary files a/test/old-elf/Inputs/reloc-xt.x86 and /dev/null differ diff --git a/test/old-elf/Inputs/relocs-dynamic.x86-64 b/test/old-elf/Inputs/relocs-dynamic.x86-64 deleted file mode 100644 index 0c44924d18e6..000000000000 Binary files a/test/old-elf/Inputs/relocs-dynamic.x86-64 and /dev/null differ diff --git a/test/old-elf/Inputs/relocs.x86-64 b/test/old-elf/Inputs/relocs.x86-64 deleted file mode 100644 index 112dfa733db9..000000000000 Binary files a/test/old-elf/Inputs/relocs.x86-64 and /dev/null differ diff --git a/test/old-elf/Inputs/responsefile b/test/old-elf/Inputs/responsefile deleted file mode 100644 index 2fe657a0e3b0..000000000000 --- a/test/old-elf/Inputs/responsefile +++ /dev/null @@ -1 +0,0 @@ ---inresponsefile diff --git a/test/old-elf/Inputs/rodata-test.hexagon b/test/old-elf/Inputs/rodata-test.hexagon deleted file mode 100644 index f448748e2abe..000000000000 Binary files a/test/old-elf/Inputs/rodata-test.hexagon and /dev/null differ diff --git a/test/old-elf/Inputs/rodata-test.i386 b/test/old-elf/Inputs/rodata-test.i386 deleted file mode 100644 index 09f71eb59969..000000000000 Binary files a/test/old-elf/Inputs/rodata-test.i386 and /dev/null differ diff --git a/test/old-elf/Inputs/rodata.c b/test/old-elf/Inputs/rodata.c deleted file mode 100644 index b43c9c945898..000000000000 --- a/test/old-elf/Inputs/rodata.c +++ /dev/null @@ -1,4 +0,0 @@ -const unsigned char *str = "llvm"; -int foo() { - return str[0]; -} diff --git a/test/old-elf/Inputs/rodata.o b/test/old-elf/Inputs/rodata.o deleted file mode 100644 index f13ddc9bba98..000000000000 Binary files a/test/old-elf/Inputs/rodata.o and /dev/null differ diff --git a/test/old-elf/Inputs/section-test.i386 b/test/old-elf/Inputs/section-test.i386 deleted file mode 100644 index 2b447a9f8f5b..000000000000 Binary files a/test/old-elf/Inputs/section-test.i386 and /dev/null differ diff --git a/test/old-elf/Inputs/shared.c b/test/old-elf/Inputs/shared.c deleted file mode 100644 index 2be91c4b9e45..000000000000 --- a/test/old-elf/Inputs/shared.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -extern int i; -int i = 42; - -// Undefined weak function in a dynamic library. -__attribute__((weak)) void weakfoo(); - -// Regular function in a dynamic library. -void foo() { - // Try to call weakfoo so that the reference to weekfoo will be included in - // the resulting .so file. - if (weakfoo) - weakfoo(); - puts("Fooo!!"); -} diff --git a/test/old-elf/Inputs/shared.so-x86-64 b/test/old-elf/Inputs/shared.so-x86-64 deleted file mode 100644 index 0240f0e67431..000000000000 Binary files a/test/old-elf/Inputs/shared.so-x86-64 and /dev/null differ diff --git a/test/old-elf/Inputs/shndx.o-x86_64 b/test/old-elf/Inputs/shndx.o-x86_64 deleted file mode 100644 index 9e3e5d8526d7..000000000000 Binary files a/test/old-elf/Inputs/shndx.o-x86_64 and /dev/null differ diff --git a/test/old-elf/Inputs/stripped-empty.x86_64 b/test/old-elf/Inputs/stripped-empty.x86_64 deleted file mode 100644 index 7368ba280d79..000000000000 Binary files a/test/old-elf/Inputs/stripped-empty.x86_64 and /dev/null differ diff --git a/test/old-elf/Inputs/target-test.hexagon b/test/old-elf/Inputs/target-test.hexagon deleted file mode 100644 index 7da114561920..000000000000 Binary files a/test/old-elf/Inputs/target-test.hexagon and /dev/null differ diff --git a/test/old-elf/Inputs/target-test.ppc b/test/old-elf/Inputs/target-test.ppc deleted file mode 100644 index 001be338c20d..000000000000 Binary files a/test/old-elf/Inputs/target-test.ppc and /dev/null differ diff --git a/test/old-elf/Inputs/tls-tbss-size.yaml b/test/old-elf/Inputs/tls-tbss-size.yaml deleted file mode 100644 index 0577dd157c6e..000000000000 --- a/test/old-elf/Inputs/tls-tbss-size.yaml +++ /dev/null @@ -1,59 +0,0 @@ ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .tbss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x0000000000000004 - Size: 16 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' -Symbols: - Local: - - Name: t1.c - Type: STT_FILE - - Name: .tbss - Type: STT_TLS - Section: .tbss - Global: - - Name: t0 - Type: STT_TLS - Section: .tbss - Size: 0x0000000000000004 - - Name: t1 - Type: STT_TLS - Section: .tbss - Value: 0x0000000000000004 - Size: 0x0000000000000004 - - Name: t2 - Type: STT_TLS - Section: .tbss - Value: 0x0000000000000008 - Size: 0x0000000000000004 - - Name: t3 - Type: STT_TLS - Section: .tbss - Value: 0x000000000000000C - Size: 0x0000000000000004 -... diff --git a/test/old-elf/Inputs/tls.S b/test/old-elf/Inputs/tls.S deleted file mode 100644 index 7d9eab647b53..000000000000 --- a/test/old-elf/Inputs/tls.S +++ /dev/null @@ -1,50 +0,0 @@ - .text - .globl main - .align 16, 0x90 - .type main,@function -main: # @main - callq GOTTPOFF - addl %fs:tls1@TPOFF, %eax - addl %fs:tls0@TPOFF, %eax - addl %fs:tls2@TPOFF, %eax - ret - - .text - .globl GOTTPOFF - .type GOTTPOFF,@function -GOTTPOFF: - movq tls2@GOTTPOFF(%rip), %rax - movl %fs:0(%rax), %eax - ret - - .text - .globl TLSLD - .type TLSLD,@function -TLSLD: - leaq tls0@tlsld(%rip), %rdi - call __tls_get_addr@plt - leaq tls0@dtpoff(%rax), %rax - ret - - .type tls0,@object # @tls0 - .section .tbss,"awT",@nobits - .globl tls0 - .align 4 -tls0: - .long 0 # 0x0 - .size tls0, 4 - - .type tls1,@object # @tls1 - .globl tls1 - .align 4 -tls1: - .long 0 # 0x0 - .size tls1, 4 - - .type tls2,@object # @tls2 - .section .tdata,"awT",@progbits - .globl tls2 - .align 4 -tls2: - .long 1 # 0x1 - .size tls2, 4 diff --git a/test/old-elf/Inputs/tls.c b/test/old-elf/Inputs/tls.c deleted file mode 100644 index 672350756562..000000000000 --- a/test/old-elf/Inputs/tls.c +++ /dev/null @@ -1,11 +0,0 @@ -extern __thread int tls0; -extern __thread int tls1; -extern __thread int tls2; - -__thread int tls0 = 0; -__thread int tls1 = 0; -__thread int tls2 = 1; - -int main() { - return tls0 + tls1 + tls2; -} diff --git a/test/old-elf/Inputs/tls.x86-64 b/test/old-elf/Inputs/tls.x86-64 deleted file mode 100644 index b420ce89b19b..000000000000 Binary files a/test/old-elf/Inputs/tls.x86-64 and /dev/null differ diff --git a/test/old-elf/Inputs/tlsAddr.x86-64 b/test/old-elf/Inputs/tlsAddr.x86-64 deleted file mode 100644 index 16cc9ab25abf..000000000000 Binary files a/test/old-elf/Inputs/tlsAddr.x86-64 and /dev/null differ diff --git a/test/old-elf/Inputs/tlsaddr.c b/test/old-elf/Inputs/tlsaddr.c deleted file mode 100644 index f62d57b3bfb4..000000000000 --- a/test/old-elf/Inputs/tlsaddr.c +++ /dev/null @@ -1,8 +0,0 @@ -__thread int tls0 = 0; -__thread int tls1 = 0; -__thread int tls2 = 1; -__thread int tls3 = 2; - -int main() { - return tls0 + tls1 + tls2; -} diff --git a/test/old-elf/Inputs/undef-from-main-so.c b/test/old-elf/Inputs/undef-from-main-so.c deleted file mode 100644 index f1cb63db7ada..000000000000 --- a/test/old-elf/Inputs/undef-from-main-so.c +++ /dev/null @@ -1 +0,0 @@ -int x[2] = {1, 2}; diff --git a/test/old-elf/Inputs/undef-from-main.c b/test/old-elf/Inputs/undef-from-main.c deleted file mode 100644 index 366d934dd84f..000000000000 --- a/test/old-elf/Inputs/undef-from-main.c +++ /dev/null @@ -1,5 +0,0 @@ -extern int x[2]; - -int main() { - x[0] = 2; -} diff --git a/test/old-elf/Inputs/undef-pc32.o b/test/old-elf/Inputs/undef-pc32.o deleted file mode 100644 index 954916d59991..000000000000 Binary files a/test/old-elf/Inputs/undef-pc32.o and /dev/null differ diff --git a/test/old-elf/Inputs/undef.o b/test/old-elf/Inputs/undef.o deleted file mode 100644 index 3c9b60c6ca33..000000000000 Binary files a/test/old-elf/Inputs/undef.o and /dev/null differ diff --git a/test/old-elf/Inputs/undef2-so.o.yaml b/test/old-elf/Inputs/undef2-so.o.yaml deleted file mode 100644 index f640cea39a5d..000000000000 --- a/test/old-elf/Inputs/undef2-so.o.yaml +++ /dev/null @@ -1,49 +0,0 @@ ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000001 - Content: 554889E5488B05000000008B005DC3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000007 - Symbol: myexportedsymbol - Type: R_X86_64_GOTPCREL - Addend: -4 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Global: - - Name: func - Type: STT_FUNC - Section: .text - Size: 0x000000000000000F - - Name: _GLOBAL_OFFSET_TABLE_ - - Name: myexportedsymbol diff --git a/test/old-elf/Inputs/use-shared-32s.c b/test/old-elf/Inputs/use-shared-32s.c deleted file mode 100644 index 63054cb036ea..000000000000 --- a/test/old-elf/Inputs/use-shared-32s.c +++ /dev/null @@ -1,8 +0,0 @@ -void foo(); - -void (*func)(); - -int main() { - func = foo; - func(); -} diff --git a/test/old-elf/Inputs/use-shared-32s.x86-64 b/test/old-elf/Inputs/use-shared-32s.x86-64 deleted file mode 100644 index 7e223677b93f..000000000000 Binary files a/test/old-elf/Inputs/use-shared-32s.x86-64 and /dev/null differ diff --git a/test/old-elf/Inputs/use-shared.c b/test/old-elf/Inputs/use-shared.c deleted file mode 100644 index b370eaa4fac2..000000000000 --- a/test/old-elf/Inputs/use-shared.c +++ /dev/null @@ -1,7 +0,0 @@ -extern int i; -void foo(); - -int main() { - foo(); - return i; -} diff --git a/test/old-elf/Inputs/use-shared.x86-64 b/test/old-elf/Inputs/use-shared.x86-64 deleted file mode 100644 index 25e1eb87a2b4..000000000000 Binary files a/test/old-elf/Inputs/use-shared.x86-64 and /dev/null differ diff --git a/test/old-elf/Inputs/weaksym.o b/test/old-elf/Inputs/weaksym.o deleted file mode 100644 index 010ce704a313..000000000000 Binary files a/test/old-elf/Inputs/weaksym.o and /dev/null differ diff --git a/test/old-elf/Inputs/writersyms.o b/test/old-elf/Inputs/writersyms.o deleted file mode 100644 index 7cd472d99d77..000000000000 Binary files a/test/old-elf/Inputs/writersyms.o and /dev/null differ diff --git a/test/old-elf/Inputs/x86-64-relocs.S b/test/old-elf/Inputs/x86-64-relocs.S deleted file mode 100644 index 2547c0f19bb0..000000000000 --- a/test/old-elf/Inputs/x86-64-relocs.S +++ /dev/null @@ -1,12 +0,0 @@ - .text - .globl main - .align 16, 0x90 - .type main,@function -main: # @main - call foo@PLT - ret - - .globl foo - .type foo,@function -foo: - ret diff --git a/test/old-elf/Mips/abi-flags-01.test b/test/old-elf/Mips/abi-flags-01.test deleted file mode 100644 index d2eb13f3186a..000000000000 --- a/test/old-elf/Mips/abi-flags-01.test +++ /dev/null @@ -1,35 +0,0 @@ -# Check rejecting .MIPS.abiflags section with a wrong version. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: not lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o 2>&1 \ -# RUN: | FileCheck %s - -# CHECK: {{.*}}abi-flags-01.test.tmp.o: .MIPS.abiflags section has unsupported version '1' - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Size: 4 - AddressAlign: 16 - -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - Version: 1 - ISA: MIPS32 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 diff --git a/test/old-elf/Mips/abi-flags-02.test b/test/old-elf/Mips/abi-flags-02.test deleted file mode 100644 index f3c1f29abc55..000000000000 --- a/test/old-elf/Mips/abi-flags-02.test +++ /dev/null @@ -1,92 +0,0 @@ -# Check generation of .MIPS.abiflags section under the following conditions: -# - There is the only input object file -# - The input file has valid .MIPS.abiflags section -# -# The .MIPS.abiflags section in the output file should have the same -# settings as the input section. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o -# RUN: llvm-readobj -s -program-headers -mips-abi-flags %t.so | FileCheck %s - -# CHECK: Section { -# CHECK: Index: 1 -# CHECK-NEXT: Name: .MIPS.abiflags -# CHECK-NEXT: Type: SHT_MIPS_ABIFLAGS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x{{[0-9A-F]+}} -# CHECK-NEXT: Offset: 0x{{[0-9A-F]+}} -# CHECK-NEXT: Size: 24 -# CHECK-NEXT: Link: 0 -# CHECK-NEXT: Info: 0 -# CHECK-NEXT: AddressAlignment: 8 -# CHECK-NEXT: EntrySize: 24 -# CHECK-NEXT: } - -# CHECK: ProgramHeaders [ -# CHECK-NEXT: ProgramHeader { -# CHECK-NEXT: Type: PT_MIPS_ABIFLAGS (0x70000003) -# CHECK-NEXT: Offset: 0x{{[0-9A-F]+}} -# CHECK-NEXT: VirtualAddress: 0x{{[0-9A-F]+}} -# CHECK-NEXT: PhysicalAddress: 0x{{[0-9A-F]+}} -# CHECK-NEXT: FileSize: 24 -# CHECK-NEXT: MemSize: 24 -# CHECK-NEXT: Flags [ -# CHECK-NEXT: PF_R -# CHECK-NEXT: ] -# CHECK-NEXT: Alignment: 8 -# CHECK-NEXT: } - -# CHECK: MIPS ABI Flags { -# CHECK-NEXT: Version: 0 -# CHECK-NEXT: ISA: MIPS32r2 -# CHECK-NEXT: ISA Extension: None (0x0) -# CHECK-NEXT: ASEs [ (0x800) -# CHECK-NEXT: microMIPS (0x800) -# CHECK-NEXT: ] -# CHECK-NEXT: FP ABI: Hard float (32-bit CPU, Any FPU) (0x5) -# CHECK-NEXT: GPR size: 32 -# CHECK-NEXT: CPR1 size: 32 -# CHECK-NEXT: CPR2 size: 0 -# CHECK-NEXT: Flags 1 [ (0x0) -# CHECK-NEXT: ] -# CHECK-NEXT: Flags 2: 0x0 -# CHECK-NEXT: } - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Size: 4 - AddressAlign: 16 - -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 2 - ISAExtension: EXT_NONE - ASEs: [ MICROMIPS ] - FpABI: FP_XX - GPRSize: REG_32 - CPR1Size: REG_32 - CPR2Size: REG_NONE - Flags1: [ ] - Flags2: 0x0 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 diff --git a/test/old-elf/Mips/abi-flags-03.test b/test/old-elf/Mips/abi-flags-03.test deleted file mode 100644 index a28bb2826730..000000000000 --- a/test/old-elf/Mips/abi-flags-03.test +++ /dev/null @@ -1,149 +0,0 @@ -# Check generation of .MIPS.abiflags section under the following conditions: -# - There are multiple input object files -# - Every input file has valid .MIPS.abiflags section -# - All .MIPS.abiflags sections are compatible with each other -# -# The .MIPS.abiflags section in the output file should reproduce result -# of merging input object file sections. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t3.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t1.o %t2.o %t3.o -# RUN: llvm-readobj -mips-abi-flags %t.so | FileCheck %s - -# CHECK: MIPS ABI Flags { -# CHECK-NEXT: Version: 0 -# CHECK-NEXT: ISA: MIPS32r2 -# CHECK-NEXT: ISA Extension: None (0x0) -# CHECK-NEXT: ASEs [ (0x810) -# CHECK-NEXT: MDMX (0x10) -# CHECK-NEXT: microMIPS (0x800) -# CHECK-NEXT: ] -# CHECK-NEXT: FP ABI: Hard float (double precision) (0x1) -# CHECK-NEXT: GPR size: 32 -# CHECK-NEXT: CPR1 size: 64 -# CHECK-NEXT: CPR2 size: 0 -# CHECK-NEXT: Flags 1 [ (0x1) -# CHECK-NEXT: ODDSPREG -# CHECK-NEXT: ] -# CHECK-NEXT: Flags 2: 0x0 -# CHECK-NEXT: } - -# o1.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32, EF_MIPS_ARCH_ASE_MDMX] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Size: 4 - AddressAlign: 16 - -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 1 - ISAExtension: EXT_NONE - ASEs: [ MDMX ] - FpABI: FP_DOUBLE - GPRSize: REG_32 - CPR1Size: REG_64 - CPR2Size: REG_NONE - Flags1: [ ] - Flags2: 0x0 - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# o2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Size: 4 - AddressAlign: 16 - -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 2 - ISAExtension: EXT_NONE - ASEs: [ MICROMIPS ] - FpABI: FP_XX - GPRSize: REG_32 - CPR1Size: REG_32 - CPR2Size: REG_NONE - Flags1: [ODDSPREG] - Flags2: 0x0 - -Symbols: - Global: - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# o3.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Size: 4 - AddressAlign: 16 - -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 2 - ISAExtension: EXT_NONE - ASEs: [ MICROMIPS ] - FpABI: FP_XX - GPRSize: REG_32 - CPR1Size: REG_32 - CPR2Size: REG_NONE - Flags1: [ ] - Flags2: 0x0 - -Symbols: - Global: - - Name: T3 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 -... diff --git a/test/old-elf/Mips/abi-flags-04.test b/test/old-elf/Mips/abi-flags-04.test deleted file mode 100644 index 6cde797dd3a0..000000000000 --- a/test/old-elf/Mips/abi-flags-04.test +++ /dev/null @@ -1,125 +0,0 @@ -# Check generation of .MIPS.abiflags section under the following conditions: -# - There are multiple input object files -# - Every input file has valid .MIPS.abiflags section -# - .MIPS.abiflags sections have different but compatible FP ABI -# -# The .MIPS.abiflags section in the output file should reproduce result -# of merging FP ABI flags. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-xx.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-double.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-64.o -# RUN: yaml2obj -format=elf -docnum 4 %s > %t-64a.o - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t1 %t-xx.o %t-double.o -# RUN: llvm-readobj -mips-abi-flags %t1 | FileCheck -check-prefix=XX-DOUBLE %s - -# XX-DOUBLE: FP ABI: Hard float (double precision) (0x1) -# XX-DOUBLE: GPR size: 32 -# XX-DOUBLE: CPR1 size: 32 -# XX-DOUBLE: Flags 1 [ (0x0) - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t2 %t-xx.o %t-64.o -# RUN: llvm-readobj -mips-abi-flags %t2 | FileCheck -check-prefix=XX-64 %s - -# XX-64: FP ABI: Hard float (32-bit CPU, 64-bit FPU) (0x6) -# XX-64: GPR size: 32 -# XX-64: CPR1 size: 64 -# XX-64: Flags 1 [ (0x1) -# XX-64: ODDSPREG (0x1) - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t3 %t-xx.o %t-64a.o -# RUN: llvm-readobj -mips-abi-flags %t3 | FileCheck -check-prefix=XX-64A %s - -# XX-64A: FP ABI: Hard float compat (32-bit CPU, 64-bit FPU) (0x7) -# XX-64A: GPR size: 32 -# XX-64A: CPR1 size: 64 -# XX-64A: Flags 1 [ (0x0) - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t4 %t-64.o %t-64a.o -# RUN: llvm-readobj -mips-abi-flags %t4 | FileCheck -check-prefix=64-64A %s - -# 64-64A: FP ABI: Hard float (32-bit CPU, 64-bit FPU) (0x6) -# 64-64A: GPR size: 32 -# 64-64A: CPR1 size: 64 -# 64-64A: Flags 1 [ (0x1) -# 64-64A: ODDSPREG (0x1) - -# xx.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 1 - FpABI: FP_XX - GPRSize: REG_32 - CPR1Size: REG_32 - -# double.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 1 - FpABI: FP_DOUBLE - GPRSize: REG_32 - CPR1Size: REG_32 - -# 64.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 2 - FpABI: FP_64 - GPRSize: REG_32 - CPR1Size: REG_64 - Flags1: [ODDSPREG] - -# 64a.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 2 - FpABI: FP_64A - GPRSize: REG_32 - CPR1Size: REG_64 - Flags1: [] -... diff --git a/test/old-elf/Mips/abi-flags-05.test b/test/old-elf/Mips/abi-flags-05.test deleted file mode 100644 index 6a009db7344a..000000000000 --- a/test/old-elf/Mips/abi-flags-05.test +++ /dev/null @@ -1,186 +0,0 @@ -# Check generation of .MIPS.abiflags section under the following conditions: -# - There are multiple input object files -# - Every input file has valid .MIPS.abiflags section -# - .MIPS.abiflags sections have different and incompatible FP ABI -# -# The .MIPS.abiflags section in the output file should reproduce result -# of merging FP ABI flags but the linker must show a warning. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-xx.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-dbl.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-sgl.o -# RUN: yaml2obj -format=elf -docnum 4 %s > %t-soft.o -# RUN: yaml2obj -format=elf -docnum 5 %s > %t-64.o -# RUN: yaml2obj -format=elf -docnum 6 %s > %t-64a.o - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t1 %t-xx.o %t-sgl.o 2>&1 \ -# RUN: | FileCheck -check-prefix=XX-SINGLE-WARN %s - -# XX-SINGLE-WARN: FP ABI {{-mfpxx|-msingle-float}} is incompatible with {{-msingle-float|-mfpxx}} - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t2 %t-xx.o %t-soft.o 2>&1 \ -# RUN: | FileCheck -check-prefix=XX-SOFT-WARN %s - -# XX-SOFT-WARN: FP ABI {{-mfpxx|-msoft-float}} is incompatible with {{-msoft-float|-mfpxx}} - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t3 %t-dbl.o %t-sgl.o 2>&1 \ -# RUN: | FileCheck -check-prefix=DOUBLE-SINGLE-WARN %s - -# DOUBLE-SINGLE-WARN: FP ABI {{-mdouble-float|-msingle-float}} is incompatible with {{-msingle-float|-mdouble-float}} - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t4 %t-dbl.o %t-soft.o 2>&1 \ -# RUN: | FileCheck -check-prefix=DOUBLE-SOFT-WARN %s - -# DOUBLE-SOFT-WARN: FP ABI {{-mdouble-float|-msoft-float}} is incompatible with {{-msoft-float|-mdouble-float}} - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t5 %t-dbl.o %t-64.o 2>&1 \ -# RUN: | FileCheck -check-prefix=DOUBLE-64-WARN %s - -# DOUBLE-64-WARN: FP ABI {{-mdouble-float|-mgp32 -mfp64}} is incompatible with {{-mgp32 -mfp64|-mdouble-float}} - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t6 %t-dbl.o %t-64a.o 2>&1 \ -# RUN: | FileCheck -check-prefix=DOUBLE-64A-WARN %s - -# DOUBLE-64A-WARN: FP ABI {{-mdouble-float|-mgp32 -mfp64 -mno-odd-spreg}} is incompatible with {{-mgp32 -mfp64 -mno-odd-spreg|-mdouble-float}} - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t7 %t-sgl.o %t-soft.o 2>&1 \ -# RUN: | FileCheck -check-prefix=SINGLE-SOFT-WARN %s - -# SINGLE-SOFT-WARN: FP ABI {{-msingle-float|-msoft-float}} is incompatible with {{-msoft-float|-msingle-float}} - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t8 %t-sgl.o %t-64.o 2>&1 \ -# RUN: | FileCheck -check-prefix=SINGLE-64-WARN %s - -# SINGLE-64-WARN: FP ABI {{-msingle-float|-mgp32 -mfp64}} is incompatible with {{-mgp32 -mfp64|-msingle-float}} - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t9 %t-sgl.o %t-64a.o 2>&1 \ -# RUN: | FileCheck -check-prefix=SINGLE-64A-WARN %s - -# SINGLE-64A-WARN: FP ABI {{-msingle-float|-mgp32 -mfp64 -mno-odd-spreg}} is incompatible with {{-mgp32 -mfp64 -mno-odd-spreg|-msingle-float}} - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t10 %t-soft.o %t-64.o 2>&1 \ -# RUN: | FileCheck -check-prefix=SOFT-64-WARN %s - -# SOFT-64-WARN: FP ABI {{-msoft-float|-mgp32 -mfp64}} is incompatible with {{-mgp32 -mfp64|-msoft-float}} - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t11 %t-soft.o %t-64a.o 2>&1 \ -# RUN: | FileCheck -check-prefix=SOFT-64A-WARN %s - -# SOFT-64A-WARN: FP ABI {{-msoft-float|-mgp32 -mfp64 -mno-odd-spreg}} is incompatible with {{-mgp32 -mfp64 -mno-odd-spreg|-msoft-float}} - -# xx.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 1 - FpABI: FP_XX - GPRSize: REG_32 - CPR1Size: REG_32 - -# double.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 1 - FpABI: FP_DOUBLE - GPRSize: REG_32 - CPR1Size: REG_32 - -# single.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 1 - FpABI: FP_SINGLE - GPRSize: REG_32 - CPR1Size: REG_32 - -# soft.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 1 - FpABI: FP_SOFT - GPRSize: REG_32 - CPR1Size: REG_NONE - -# 64.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 2 - FpABI: FP_64 - GPRSize: REG_32 - CPR1Size: REG_64 - Flags1: [ODDSPREG] - -# 64a.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 2 - FpABI: FP_64A - GPRSize: REG_32 - CPR1Size: REG_64 - Flags1: [] -... diff --git a/test/old-elf/Mips/abi-flags-06.test b/test/old-elf/Mips/abi-flags-06.test deleted file mode 100644 index d7df379039bb..000000000000 --- a/test/old-elf/Mips/abi-flags-06.test +++ /dev/null @@ -1,79 +0,0 @@ -# Check generation of .MIPS.abiflags section under the following conditions: -# - There are multiple input object files -# - Not all input files have a .MIPS.abiflags section -# -# The .MIPS.abiflags section in the output file should reproduce result -# of merging input object file sections and data come from ELF header flags. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-abi.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-elf.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-abi.o %t-elf.o -# RUN: llvm-readobj -mips-abi-flags %t.so | FileCheck %s - -# CHECK: MIPS ABI Flags { -# CHECK-NEXT: Version: 0 -# CHECK-NEXT: ISA: MIPS32r2 -# CHECK-NEXT: ISA Extension: None (0x0) -# CHECK-NEXT: ASEs [ (0x810) -# CHECK-NEXT: MDMX (0x10) -# CHECK-NEXT: microMIPS (0x800) -# CHECK-NEXT: ] -# CHECK-NEXT: FP ABI: Hard float (double precision) (0x1) -# CHECK-NEXT: GPR size: 32 -# CHECK-NEXT: CPR1 size: 64 -# CHECK-NEXT: CPR2 size: 0 -# CHECK-NEXT: Flags 1 [ (0x0) -# CHECK-NEXT: ] -# CHECK-NEXT: Flags 2: 0x0 -# CHECK-NEXT: } - -# abi.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32, EF_MIPS_ARCH_ASE_MDMX] - -Sections: -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 1 - ISAExtension: EXT_NONE - ASEs: [ MDMX ] - FpABI: FP_DOUBLE - GPRSize: REG_32 - CPR1Size: REG_64 - CPR2Size: REG_NONE - Flags1: [ ] - Flags2: 0x0 - -# elf.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Size: 4 - AddressAlign: 16 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 -... diff --git a/test/old-elf/Mips/abi-flags-07.test b/test/old-elf/Mips/abi-flags-07.test deleted file mode 100644 index 6cae9b2feb4d..000000000000 --- a/test/old-elf/Mips/abi-flags-07.test +++ /dev/null @@ -1,60 +0,0 @@ -# Check that .MIPS.abiflags section is not written if no input object files -# contain that section. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t1.o %t2.o -# RUN: llvm-readobj -mips-abi-flags %t.so | FileCheck %s - -# CHECK: There is no .MIPS.abiflags section in the file. - -# abi.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32, EF_MIPS_ARCH_ASE_MDMX] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Size: 4 - AddressAlign: 16 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# elf.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Size: 4 - AddressAlign: 16 - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 -... diff --git a/test/old-elf/Mips/abi-flags-08.test b/test/old-elf/Mips/abi-flags-08.test deleted file mode 100644 index c4b75bcf4516..000000000000 --- a/test/old-elf/Mips/abi-flags-08.test +++ /dev/null @@ -1,71 +0,0 @@ -# Check that the linker shows errors if ELF header flags -# and .MIPS.abiflags section are incompatible. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-isa.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-ext.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-ases.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t1.so %t-isa.o 2>&1 \ -# RUN: | FileCheck -check-prefix=ISA-ERR %s -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t2.so %t-ext.o 2>&1 \ -# RUN: | FileCheck -check-prefix=EXT-ERR %s -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t3.so %t-ases.o 2>&1 \ -# RUN: | FileCheck -check-prefix=ASE-ERR %s -# RUN: llvm-readobj -mips-abi-flags %t1.so %t2.so %t3.so \ -# RUN: | FileCheck -check-prefix=SEC %s - -# ISA-ERR: inconsistent ISA between .MIPS.abiflags and ELF header e_flags field -# EXT-ERR: inconsistent ISA between .MIPS.abiflags and ELF header e_flags field -# ASE-ERR: inconsistent ASEs between .MIPS.abiflags and ELF header e_flags field - -# SEC: There is no .MIPS.abiflags section in the file. - -# isa.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 2 - -# ext.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_3, EF_MIPS_MACH_4650] - -Sections: -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS3 - ISAExtension: EXT_4120 - -# ases.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 2 - ASEs: [] - -... diff --git a/test/old-elf/Mips/abi-flags-09.test b/test/old-elf/Mips/abi-flags-09.test deleted file mode 100644 index 1ab03abe3810..000000000000 --- a/test/old-elf/Mips/abi-flags-09.test +++ /dev/null @@ -1,67 +0,0 @@ -# Check position of PT_MIPS_ABIFLAGS segment. -# It should go right after the PT_INTERP segment. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-readobj -program-headers %t.exe | FileCheck %s - -# CHECK: ProgramHeader { -# CHECK: Type: PT_INTERP -# CHECK-NEXT: Offset: 0x{{[0-9A-F]+}} -# CHECK-NEXT: VirtualAddress: 0x{{[0-9A-F]+}} -# CHECK-NEXT: PhysicalAddress: 0x{{[0-9A-F]+}} -# CHECK-NEXT: FileSize: 13 -# CHECK-NEXT: MemSize: 13 -# CHECK-NEXT: Flags [ -# CHECK-NEXT: PF_R -# CHECK-NEXT: ] -# CHECK-NEXT: Alignment: 1 -# CHECK-NEXT: } -# CHECK-NEXT: ProgramHeader { -# CHECK-NEXT: Type: PT_MIPS_ABIFLAGS -# CHECK-NEXT: Offset: 0x{{[0-9A-F]+}} -# CHECK-NEXT: VirtualAddress: 0x{{[0-9A-F]+}} -# CHECK-NEXT: PhysicalAddress: 0x{{[0-9A-F]+}} -# CHECK-NEXT: FileSize: 24 -# CHECK-NEXT: MemSize: 24 -# CHECK-NEXT: Flags [ -# CHECK-NEXT: PF_R -# CHECK-NEXT: ] -# CHECK-NEXT: Alignment: 8 -# CHECK-NEXT: } - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Size: 4 - AddressAlign: 16 - -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 2 - ISAExtension: EXT_NONE - ASEs: [ MICROMIPS ] - FpABI: FP_XX - GPRSize: REG_32 - CPR1Size: REG_32 - CPR2Size: REG_NONE - Flags1: [ ] - Flags2: 0x0 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 diff --git a/test/old-elf/Mips/abi-flags-10.test b/test/old-elf/Mips/abi-flags-10.test deleted file mode 100644 index 50732d5c1151..000000000000 --- a/test/old-elf/Mips/abi-flags-10.test +++ /dev/null @@ -1,60 +0,0 @@ -# Check that SHT_MIPS_REGINFO section does not get a separate segment -# if there is a SHT_MIPS_ABIFLAGS section. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-readobj -program-headers %t.exe | FileCheck %s - -# CHECK: ProgramHeaders [ -# CHECK-NEXT: ProgramHeader { -# CHECK-NEXT: Type: PT_PHDR -# CHECK: } -# CHECK-NEXT: ProgramHeader { -# CHECK-NEXT: Type: PT_INTERP -# CHECK: } -# CHECK-NEXT: ProgramHeader { -# CHECK-NEXT: Type: PT_MIPS_ABIFLAGS -# CHECK: } -# CHECK-NOT: Type: PT_MIPS_REGINFO - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Size: 4 - AddressAlign: 16 - -- Name: .reginfo - Type: SHT_MIPS_REGINFO - Flags: [ SHF_ALLOC ] - AddressAlign: 4 - Content: "F0000000E0000000D0000000C0000000B000000000100000" - -- Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 2 - ISAExtension: EXT_NONE - ASEs: [ MICROMIPS ] - FpABI: FP_XX - GPRSize: REG_32 - CPR1Size: REG_32 - CPR2Size: REG_NONE - Flags1: [ ] - Flags2: 0x0 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 diff --git a/test/old-elf/Mips/abi-flags-11.test b/test/old-elf/Mips/abi-flags-11.test deleted file mode 100644 index e0e8547abbc7..000000000000 --- a/test/old-elf/Mips/abi-flags-11.test +++ /dev/null @@ -1,59 +0,0 @@ -# Check position of PT_MIPS_REGINFO segment. -# It should go right after the PT_INTERP segment. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-readobj -program-headers %t.exe | FileCheck %s - -# CHECK: ProgramHeader { -# CHECK: Type: PT_INTERP -# CHECK-NEXT: Offset: 0x{{[0-9A-F]+}} -# CHECK-NEXT: VirtualAddress: 0x{{[0-9A-F]+}} -# CHECK-NEXT: PhysicalAddress: 0x{{[0-9A-F]+}} -# CHECK-NEXT: FileSize: 13 -# CHECK-NEXT: MemSize: 13 -# CHECK-NEXT: Flags [ -# CHECK-NEXT: PF_R -# CHECK-NEXT: ] -# CHECK-NEXT: Alignment: 1 -# CHECK-NEXT: } -# CHECK-NEXT: ProgramHeader { -# CHECK-NEXT: Type: PT_MIPS_REGINFO -# CHECK-NEXT: Offset: 0x{{[0-9A-F]+}} -# CHECK-NEXT: VirtualAddress: 0x{{[0-9A-F]+}} -# CHECK-NEXT: PhysicalAddress: 0x{{[0-9A-F]+}} -# CHECK-NEXT: FileSize: 24 -# CHECK-NEXT: MemSize: 24 -# CHECK-NEXT: Flags [ -# CHECK-NEXT: PF_R -# CHECK-NEXT: ] -# CHECK-NEXT: Alignment: 4 -# CHECK-NEXT: } - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Size: 4 - AddressAlign: 16 - -- Name: .reginfo - Type: SHT_MIPS_REGINFO - Flags: [ SHF_ALLOC ] - AddressAlign: 4 - Content: "F0000000E0000000D0000000C0000000B000000000100000" - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 diff --git a/test/old-elf/Mips/base-address-64.test b/test/old-elf/Mips/base-address-64.test deleted file mode 100644 index 6b553d227820..000000000000 --- a/test/old-elf/Mips/base-address-64.test +++ /dev/null @@ -1,80 +0,0 @@ -# Check executable base address configuration. Base address should be -# equal to 0x400000 and the MIPS_BASE_ADDRESS dynamic tag's value should -# be the same. -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips64el --noinhibit-exec -o %t.exe %t.o -# RUN: llvm-readobj -dynamic-table -program-headers %t.exe | FileCheck %s - -# CHECK: DynamicSection [ (15 entries) -# CHECK: Tag Type Name/Value -# CHECK-NEXT: 0x0000000000000004 HASH 0x{{[0-9A-F]+}} -# CHECK-NEXT: 0x0000000000000005 STRTAB 0x{{[0-9A-F]+}} -# CHECK-NEXT: 0x0000000000000006 SYMTAB 0x{{[0-9A-F]+}} -# CHECK-NEXT: 0x000000000000000A STRSZ 1 (bytes) -# CHECK-NEXT: 0x000000000000000B SYMENT 24 (bytes) -# CHECK-NEXT: 0x0000000070000001 MIPS_RLD_VERSION 1 -# CHECK-NEXT: 0x0000000070000016 MIPS_RLD_MAP 0x120002000 -# CHECK-NEXT: 0x0000000070000035 MIPS_RLD_MAP_REL 0x1DB8 -# CHECK-NEXT: 0x0000000070000005 MIPS_FLAGS NOTPOT -# CHECK-NEXT: 0x0000000070000006 MIPS_BASE_ADDRESS 0x120000000 -# CHECK-NEXT: 0x000000007000000A MIPS_LOCAL_GOTNO 2 -# CHECK-NEXT: 0x0000000070000011 MIPS_SYMTABNO 1 -# CHECK-NEXT: 0x0000000070000013 MIPS_GOTSYM 0x1 -# CHECK-NEXT: 0x0000000000000003 PLTGOT 0x120001000 -# CHECK-NEXT: 0x0000000000000000 NULL 0x0 -# CHECK-NEXT: ] - -# CHECK: ProgramHeaders [ -# CHECK: ProgramHeader { -# CHECK: Type: PT_PHDR (0x6) -# CHECK: Offset: 0x40 -# CHECK: VirtualAddress: 0x{{[0-9A-F]+}} -# CHECK: } -# CHECK: ProgramHeader { -# CHECK: Type: PT_INTERP (0x3) -# CHECK: Offset: 0x190 -# CHECK: VirtualAddress: 0x{{[0-9A-F]+}} -# CHECK: } -# CHECK: ProgramHeader { -# CHECK: Type: PT_LOAD (0x1) -# CHECK-NEXT: Offset: 0x0 -# CHECK-NEXT: VirtualAddress: 0x120000000 - -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ARCH_64R2 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x10 - Size: 0x00 - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x10 - Size: 0x00 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Global: - - Name: main - Section: .text diff --git a/test/old-elf/Mips/base-address.test b/test/old-elf/Mips/base-address.test deleted file mode 100644 index 67c04326cc15..000000000000 --- a/test/old-elf/Mips/base-address.test +++ /dev/null @@ -1,95 +0,0 @@ -# Check executable base address configuration. Base address should be -# equal to 0x400000 and the MIPS_BASE_ADDRESS dynamic tag's value should -# be the same. -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel --noinhibit-exec -o %t.exe %t.o -# RUN: llvm-readobj -dynamic-table -program-headers %t.exe | FileCheck %s - -# CHECK: DynamicSection [ (15 entries) -# CHECK: Tag Type Name/Value -# CHECK-NEXT: 0x00000004 HASH 0x{{[0-9A-F]+}} -# CHECK-NEXT: 0x00000005 STRTAB 0x{{[0-9A-F]+}} -# CHECK-NEXT: 0x00000006 SYMTAB 0x{{[0-9A-F]+}} -# CHECK-NEXT: 0x0000000A STRSZ 1 (bytes) -# CHECK-NEXT: 0x0000000B SYMENT 16 (bytes) -# CHECK-NEXT: 0x70000001 MIPS_RLD_VERSION 1 -# CHECK-NEXT: 0x70000016 MIPS_RLD_MAP 0x402000 -# CHECK-NEXT: 0x70000035 MIPS_RLD_MAP_REL 0x1E9C -# CHECK-NEXT: 0x70000005 MIPS_FLAGS NOTPOT -# CHECK-NEXT: 0x70000006 MIPS_BASE_ADDRESS 0x400000 -# CHECK-NEXT: 0x7000000A MIPS_LOCAL_GOTNO 2 -# CHECK-NEXT: 0x70000011 MIPS_SYMTABNO 1 -# CHECK-NEXT: 0x70000013 MIPS_GOTSYM 0x1 -# CHECK-NEXT: 0x00000003 PLTGOT 0x401000 -# CHECK-NEXT: 0x00000000 NULL 0x0 -# CHECK-NEXT: ] - -# CHECK: ProgramHeaders [ -# CHECK: ProgramHeader { -# CHECK: Type: PT_PHDR (0x6) -# CHECK: Offset: 0x34 -# CHECK: VirtualAddress: 0x{{[0-9A-F]+}} -# CHECK: } -# CHECK: ProgramHeader { -# CHECK: Type: PT_INTERP (0x3) -# CHECK: Offset: 0xF4 -# CHECK: VirtualAddress: 0x{{[0-9A-F]+}} -# CHECK: } -# CHECK: ProgramHeader { -# CHECK: Type: PT_LOAD (0x1) -# CHECK: Offset: 0x0 -# CHECK: VirtualAddress: 0x{{[0-9A-F]+}} -# CHECK: } -# CHECK: ProgramHeader { -# CHECK: Type: PT_LOAD (0x1) -# CHECK: Offset: 0x1000 -# CHECK: VirtualAddress: 0x{{[0-9A-F]+}} -# CHECK: } -# CHECK: ProgramHeader { -# CHECK: Type: PT_LOAD (0x1) -# CHECK: Offset: 0x2000 -# CHECK: VirtualAddress: 0x{{[0-9A-F]+}} -# CHECK: } -# CHECK: ProgramHeader { -# CHECK: Type: PT_DYNAMIC (0x2) -# CHECK: Offset: 0x12C -# CHECK: VirtualAddress: 0x{{[0-9A-F]+}} -# CHECK: } -# CHECK: ] - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x04 - Size: 0x00 - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x04 - Size: 0x00 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Global: - - Name: main - Section: .text diff --git a/test/old-elf/Mips/ctors-order.test b/test/old-elf/Mips/ctors-order.test deleted file mode 100644 index b33ed43292e7..000000000000 --- a/test/old-elf/Mips/ctors-order.test +++ /dev/null @@ -1,164 +0,0 @@ -# Check ordering of .ctors.* sections. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-crtbeginS.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-crtendS.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-obj.o -# RUN: lld -flavor old-gnu -target mipsel -shared --output-filetype=yaml \ -# RUN: %t-crtbeginS.o %t-obj.o %t-crtendS.o | FileCheck %s -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so \ -# RUN: %t-crtbeginS.o %t-obj.o %t-crtendS.o -# RUN: llvm-objdump -s %t.so | FileCheck -check-prefix=RAW %s - -# CHECK: defined-atoms: -# CHECK-NEXT: - type: data -# CHECK-NEXT: alignment: 4 -# CHECK-NEXT: section-choice: custom-required -# CHECK-NEXT: section-name: .ctors -# CHECK-NEXT: references: -# CHECK-NEXT: - kind: layout-after -# CHECK-NEXT: offset: 0 -# CHECK-NEXT: target: __CTOR_LIST__ -# CHECK-NEXT: - name: __CTOR_LIST__ -# CHECK-NEXT: type: data -# CHECK-NEXT: content: [ FF, FF, FF, FF ] -# CHECK-NEXT: alignment: 4 -# CHECK-NEXT: section-choice: custom-required -# CHECK-NEXT: section-name: .ctors -# CHECK-NEXT: - type: data -# CHECK-NEXT: content: [ 11, 11, 11, 11 ] -# CHECK-NEXT: alignment: 4 -# CHECK-NEXT: section-choice: custom-required -# CHECK-NEXT: section-name: .ctors.1 -# CHECK-NEXT: - type: data -# CHECK-NEXT: content: [ 22, 22, 22, 22 ] -# CHECK-NEXT: alignment: 4 -# CHECK-NEXT: section-choice: custom-required -# CHECK-NEXT: section-name: .ctors.2 -# CHECK-NEXT: - ref-name: L004 -# CHECK-NEXT: type: data -# CHECK-NEXT: alignment: 4 -# CHECK-NEXT: section-choice: custom-required -# CHECK-NEXT: section-name: .ctors -# CHECK-NEXT: references: -# CHECK-NEXT: - kind: layout-after -# CHECK-NEXT: offset: 0 -# CHECK-NEXT: target: __CTOR_END__ -# CHECK-NEXT: - name: __CTOR_END__ -# CHECK-NEXT: type: data -# CHECK-NEXT: content: [ 00, 00, 00, 00 ] -# CHECK-NEXT: alignment: 4 -# CHECK-NEXT: section-choice: custom-required -# CHECK-NEXT: section-name: .ctors - -# RAW: Contents of section .ctors: -# RAW-NEXT: 1000 ffffffff 11111111 22222222 00000000 - -# crtbeginS.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] -Sections: - - Name: .ctors - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x04 - Content: 'FFFFFFFF' - -Symbols: - Local: - - Name: .ctors - Type: STT_SECTION - Section: .ctors - - Name: __CTOR_LIST__ - Type: STT_OBJECT - Section: .ctors - -# crtendS.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x0F - - Name: .rel.text - Type: SHT_REL - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0x00 - Symbol: .ctors - Type: R_MIPS_GOT16 - - Offset: 0x04 - Symbol: .ctors - Type: R_MIPS_LO16 - - Offset: 0x08 - Symbol: .ctors - Type: R_MIPS_GOT16 - - Offset: 0x0C - Symbol: .ctors - Type: R_MIPS_LO16 - - Name: .ctors - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .ctors - Type: STT_SECTION - Section: .ctors - - Name: __CTOR_END__ - Type: STT_OBJECT - Section: .ctors - - Name: __do_global_ctors_aux - Type: STT_FUNC - Section: .text - -# obj.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] -Sections: - - Name: .ctors.2 - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x04 - Content: '22222222' - - Name: .ctors.1 - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x04 - Content: '11111111' - -Symbols: - Local: - - Name: .ctors.2 - Type: STT_SECTION - Section: .ctors.2 - - Name: .ctors.1 - Type: STT_SECTION - Section: .ctors.1 -... diff --git a/test/old-elf/Mips/driver-hash-style.test b/test/old-elf/Mips/driver-hash-style.test deleted file mode 100644 index 0ab636c427c9..000000000000 --- a/test/old-elf/Mips/driver-hash-style.test +++ /dev/null @@ -1,15 +0,0 @@ -# REQUIRES: mips - -# Check that the driver rejects all --hash-style arguments except 'sysv' -# because it is the only style supported by MIPS ABI. - -# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o -# RUN: not lld -flavor old-gnu -target mips --hash-style=both %t.o -o %t.exe 2>&1 \ -# RUN: | FileCheck %s -# RUN: not lld -flavor old-gnu -target mips --hash-style=gnu %t.o -o %t.exe 2>&1 \ -# RUN: | FileCheck %s - -# CHECK: error: .gnu.hash is incompatible with the MIPS ABI - - .globl __start; -__start: diff --git a/test/old-elf/Mips/dt-textrel-64.test b/test/old-elf/Mips/dt-textrel-64.test deleted file mode 100644 index 152e82372799..000000000000 --- a/test/old-elf/Mips/dt-textrel-64.test +++ /dev/null @@ -1,74 +0,0 @@ -# Check that if a dynamic relocation R_MIPS_64 modify a read-only section, -# .dynamic section contains the DT_TEXTREL tag. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mips64el -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -dynamic-table %t.exe | FileCheck %s - -# CHECK: 0x{{[0-9A-F]+}} TEXTREL - -# so.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x4 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 0x08 - -# o.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x4 - Size: 0x8 - - - Name: .rel.text - Type: SHT_RELA - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_64 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 0x8 - - Name: T1 -... diff --git a/test/old-elf/Mips/dt-textrel.test b/test/old-elf/Mips/dt-textrel.test deleted file mode 100644 index af86f4926273..000000000000 --- a/test/old-elf/Mips/dt-textrel.test +++ /dev/null @@ -1,74 +0,0 @@ -# Check that if a dynamic relocation modify a read-only section, -# .dynamic section contains the DT_TEXTREL tag. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -dynamic-table %t.exe | FileCheck %s - -# CHECK: 0x{{[0-9A-F]+}} TEXTREL - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x04 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 0x04 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Content: '00000000' - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_32 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 0x04 - - Name: T1 -... diff --git a/test/old-elf/Mips/dynamic-linking.test b/test/old-elf/Mips/dynamic-linking.test deleted file mode 100644 index aeab7645ed51..000000000000 --- a/test/old-elf/Mips/dynamic-linking.test +++ /dev/null @@ -1,22 +0,0 @@ -# REQUIRES: mips - -# Check _DYNAMIC_LINKING symbol definition. - -# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o -# RUN: lld -flavor old-gnu -target mips %t.o -o %t.exe -# RUN: llvm-nm %t.exe | FileCheck -check-prefix=EXE-DYN %s - -# EXE-DYN: 00000001 A _DYNAMIC_LINKING - -# RUN: lld -flavor old-gnu -target mips -static %t.o -o %t.exe -# RUN: llvm-nm -just-symbol-name %t.exe | FileCheck -check-prefix=EXE-STATIC %s - -# EXE-STATIC-NOT: _DYNAMIC_LINKING - -# RUN: lld -flavor old-gnu -target mips -shared %t.o -o %t.so -# RUN: llvm-nm -just-symbol-name %t.so | FileCheck -check-prefix=DYNLIB %s - -# DYNLIB-NOT: _DYNAMIC_LINKING - - .globl __start; -__start: diff --git a/test/old-elf/Mips/dynamic-sym.test b/test/old-elf/Mips/dynamic-sym.test deleted file mode 100644 index 43a69d82c3a3..000000000000 --- a/test/old-elf/Mips/dynamic-sym.test +++ /dev/null @@ -1,41 +0,0 @@ -# Check _DYNAMIC symbol's value -# -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared -e T0 -o %t.so %t.o -# RUN: llvm-objdump -h -t %t.so | FileCheck -check-prefix=SHARED %s - -# SHARED: Sections: -# SHARED: Idx Name Size Address Type -# SHARED: 5 .dynamic 00000068 00000000[[ADDR:[0-9a-f]+]] - -# SHARED: SYMBOL TABLE: -# SHARED: [[ADDR]] g .dynamic 00000000 _DYNAMIC - -# RUN: lld -flavor old-gnu -target mipsel -e main -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -h -t %t.exe | FileCheck -check-prefix=EXE %s - -# EXE: Sections: -# EXE: Idx Name Size Address Type -# EXE: 6 .dynamic 00000078 00000000[[ADDR:[0-9a-f]+]] - -# EXE: SYMBOL TABLE: -# EXE: [[ADDR]] g .dynamic 00000000 _DYNAMIC - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [SHF_ALLOC, SHF_EXECINSTR] - AddressAlign: 0x10 - Size: 0x04 - -Symbols: - Global: - - Name: T0 - Section: .text diff --git a/test/old-elf/Mips/dynlib-dynamic.test b/test/old-elf/Mips/dynlib-dynamic.test deleted file mode 100644 index fca036a52624..000000000000 --- a/test/old-elf/Mips/dynlib-dynamic.test +++ /dev/null @@ -1,110 +0,0 @@ -# Check MIPS specific tags in the dynamic table. - -# Build shared library -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared --noinhibit-exec -o %t.so %t.o -# RUN: llvm-readobj -dynamic-table %t.so | FileCheck %s - -# CHECK: Format: ELF32-mips -# CHECK: Arch: mipsel -# CHECK: AddressSize: 32bit -# CHECK: LoadName: -# CHECK: DynamicSection [ (13 entries) -# CHECK: Tag Type Name/Value -# CHECK-NEXT: 0x00000004 HASH 0x{{[0-9A-F]+}} -# CHECK-NEXT: 0x00000005 STRTAB 0x{{[0-9A-F]+}} -# CHECK-NEXT: 0x00000006 SYMTAB 0x{{[0-9A-F]+}} -# CHECK-NEXT: 0x0000000A STRSZ 17 (bytes) -# CHECK-NEXT: 0x0000000B SYMENT 16 (bytes) -# CHECK-NEXT: 0x70000001 MIPS_RLD_VERSION 1 -# CHECK-NEXT: 0x70000005 MIPS_FLAGS NOTPOT -# CHECK-NEXT: 0x70000006 MIPS_BASE_ADDRESS 0x0 -# CHECK-NEXT: 0x7000000A MIPS_LOCAL_GOTNO 4 -# CHECK-NEXT: 0x70000011 MIPS_SYMTABNO 4 -# CHECK-NEXT: 0x70000013 MIPS_GOTSYM 0x2 -# CHECK-NEXT: 0x00000003 PLTGOT 0x1000 -# CHECK-NEXT: 0x00000000 NULL 0x0 -# CHECK-NEXT: ] - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x18 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: '$.str1' - Type: R_MIPS_GOT16 - - Offset: 0x04 - Symbol: '$.str1' - Type: R_MIPS_LO16 - - Offset: 0x08 - Symbol: '$.str2' - Type: R_MIPS_GOT16 - - Offset: 0x0C - Symbol: '$.str2' - Type: R_MIPS_LO16 - - Offset: 0x10 - Symbol: glob2 - Type: R_MIPS_CALL16 - - Offset: 0x14 - Symbol: ext1 - Type: R_MIPS_CALL16 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x04 - Size: 0x00 - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x04 - Size: 0x00 - - Name: .rodata.str1 - Type: SHT_PROGBITS - AddressAlign: 0x01 - Size: 0x05 - - Name: .rodata.str2 - Type: SHT_PROGBITS - AddressAlign: 0x01 - Size: 0x05 - -Symbols: - Local: - - Name: '$.str1' - Section: .rodata.str1 - - Name: '$.str2' - Section: .rodata.str2 - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .rodata.str1 - Type: STT_SECTION - Section: .rodata.str1 - - Name: .rodata.str2 - Type: STT_SECTION - Section: .rodata.str2 - Global: - - Name: glob - Section: .text - - Name: ext1 - - Name: glob2 diff --git a/test/old-elf/Mips/dynlib-dynsym-micro.test b/test/old-elf/Mips/dynlib-dynsym-micro.test deleted file mode 100644 index 6757847fac73..000000000000 --- a/test/old-elf/Mips/dynlib-dynsym-micro.test +++ /dev/null @@ -1,208 +0,0 @@ -# 1. Check sorting of .dynsym content accordingly to .got section -# in case of using microMIPS relocations. -# 2. Check that microMIPS records in a dynamic symbol table have: -# - cleared the STO_MIPS_MICROMIPS flag -# - adjusted adress - -# Build shared library -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared --noinhibit-exec -o %t-so %t.o -# RUN: llvm-readobj -dyn-symbols %t-so | FileCheck -check-prefix=CHECK-DYN %s - -# Build shared library (yaml format) -# RUN: lld -flavor old-gnu -target mipsel -shared --noinhibit-exec \ -# RUN: --output-filetype=yaml -o %t-yaml %t.o -# RUN: FileCheck -check-prefix=CHECK-GOT %s < %t-yaml - -# CHECK-DYN: Format: ELF32-mips -# CHECK-DYN: Arch: mipsel -# CHECK-DYN: AddressSize: 32bit -# CHECK-DYN: LoadName: -# CHECK-DYN: DynamicSymbols [ -# CHECK-DYN: Symbol { -# CHECK-DYN: Name: @ (0) -# CHECK-DYN: Value: 0x0 -# CHECK-DYN: Size: 0 -# CHECK-DYN: Binding: Local (0x0) -# CHECK-DYN: Type: None (0x0) -# CHECK-DYN: Other: 0 -# CHECK-DYN: Section: Undefined (0x0) -# CHECK-DYN: } -# CHECK-DYN: Symbol { -# CHECK-DYN: Name: bar@ (5) -# CHECK-DYN: Value: 0x139 -# CHECK-DYN: Size: 4 -# CHECK-DYN: Binding: Global (0x1) -# CHECK-DYN: Type: Function (0x2) -# CHECK-DYN: Other: 0 -# CHECK-DYN: Section: .text (0x4) -# CHECK-DYN: } -# CHECK-DYN: Symbol { -# CHECK-DYN: Name: foo@ (1) -# CHECK-DYN: Value: 0x121 -# CHECK-DYN: Size: 24 -# CHECK-DYN: Binding: Global (0x1) -# CHECK-DYN: Type: Function (0x2) -# CHECK-DYN: Other: 0 -# CHECK-DYN: Section: .text (0x4) -# CHECK-DYN: } -# CHECK-DYN: Symbol { -# CHECK-DYN: Name: ext1@ (9) -# CHECK-DYN: Value: 0x0 -# CHECK-DYN: Size: 0 -# CHECK-DYN: Binding: Global (0x1) -# CHECK-DYN: Type: None (0x0) -# CHECK-DYN: Other: 0 -# CHECK-DYN: Section: Undefined (0x0) -# CHECK-DYN: } -# CHECK-DYN: Symbol { -# CHECK-DYN: Name: ext2@ (14) -# CHECK-DYN: Value: 0x0 -# CHECK-DYN: Size: 0 -# CHECK-DYN: Binding: Global (0x1) -# CHECK-DYN: Type: None (0x0) -# CHECK-DYN: Other: 0 -# CHECK-DYN: Section: Undefined (0x0) -# CHECK-DYN: } -# CHECK-DYN: ] - -# CHECK-GOT: - type: got -# CHECK-GOT: content: [ 00, 00, 00, 00 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: - type: got -# CHECK-GOT: content: [ 00, 00, 00, 80 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: - ref-name: L000 -# CHECK-GOT: type: got -# CHECK-GOT: content: [ 00, 00, 00, 00 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: references: -# CHECK-GOT: - kind: LLD_R_MIPS_32_HI16 -# CHECK-GOT: offset: 0 -# CHECK-GOT: target: L007 -# CHECK-GOT: - ref-name: L002 -# CHECK-GOT: type: got -# CHECK-GOT: content: [ 00, 00, 00, 00 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: references: -# CHECK-GOT: - kind: LLD_R_MIPS_32_HI16 -# CHECK-GOT: offset: 0 -# CHECK-GOT: target: L008 -# CHECK-GOT: - ref-name: L004 -# CHECK-GOT: type: got -# CHECK-GOT: content: [ 00, 00, 00, 00 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: references: -# CHECK-GOT: - kind: LLD_R_MIPS_GLOBAL_GOT -# CHECK-GOT: offset: 0 -# CHECK-GOT: target: foo -# CHECK-GOT: - ref-name: L005 -# CHECK-GOT: type: got -# CHECK-GOT: content: [ 00, 00, 00, 00 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: references: -# CHECK-GOT: - kind: LLD_R_MIPS_GLOBAL_GOT -# CHECK-GOT: offset: 0 -# CHECK-GOT: target: ext1 -# CHECK-GOT: - ref-name: L006 -# CHECK-GOT: type: got -# CHECK-GOT: content: [ 00, 00, 00, 00 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: references: -# CHECK-GOT: - kind: LLD_R_MIPS_GLOBAL_GOT -# CHECK-GOT: offset: 0 -# CHECK-GOT: target: ext2 - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x1C - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: .rodata.str1 - Type: R_MICROMIPS_GOT16 - - Offset: 0x04 - Symbol: .rodata.str1 - Type: R_MICROMIPS_LO16 - - Offset: 0x08 - Symbol: .rodata.str2 - Type: R_MICROMIPS_GOT16 - - Offset: 0x0C - Symbol: .rodata.str2 - Type: R_MICROMIPS_LO16 - - Offset: 0x10 - Symbol: foo - Type: R_MICROMIPS_CALL16 - - Offset: 0x14 - Symbol: ext1 - Type: R_MICROMIPS_CALL16 - - Offset: 0x18 - Symbol: ext2 - Type: R_MICROMIPS_CALL16 - - Name: .rodata.str1 - Type: SHT_PROGBITS - AddressAlign: 0x01 - Size: 0x05 - - Name: .rodata.str2 - Type: SHT_PROGBITS - AddressAlign: 0x01 - Size: 0x05 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .rodata.str1 - Type: STT_SECTION - Section: .rodata.str1 - - Name: .rodata.str2 - Type: STT_SECTION - Section: .rodata.str2 - Global: - - Name: bar - Section: .text - Value: 0x18 - Other: [ STO_MIPS_MICROMIPS ] - - Name: foo - Section: .text - Other: [ STO_MIPS_MICROMIPS ] - - Name: ext1 - - Name: ext2 -... diff --git a/test/old-elf/Mips/dynlib-dynsym.test b/test/old-elf/Mips/dynlib-dynsym.test deleted file mode 100644 index 23b0cd6a90c2..000000000000 --- a/test/old-elf/Mips/dynlib-dynsym.test +++ /dev/null @@ -1,202 +0,0 @@ -# Check sorting of .dynsym content accordingly to .got section. - -# Build shared library -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared --noinhibit-exec -o %t-so %t.o -# RUN: llvm-readobj -dyn-symbols %t-so | FileCheck -check-prefix=CHECK-DYN %s - -# Build shared library (yaml format) -# RUN: lld -flavor old-gnu -target mipsel -shared --noinhibit-exec \ -# RUN: --output-filetype=yaml -o %t-yaml %t.o -# RUN: FileCheck -check-prefix=CHECK-GOT %s < %t-yaml - -# CHECK-DYN: Format: ELF32-mips -# CHECK-DYN: Arch: mipsel -# CHECK-DYN: AddressSize: 32bit -# CHECK-DYN: LoadName: -# CHECK-DYN: DynamicSymbols [ -# CHECK-DYN: Symbol { -# CHECK-DYN: Name: @ (0) -# CHECK-DYN: Value: 0x0 -# CHECK-DYN: Size: 0 -# CHECK-DYN: Binding: Local (0x0) -# CHECK-DYN: Type: None (0x0) -# CHECK-DYN: Other: 0 -# CHECK-DYN: Section: Undefined (0x0) -# CHECK-DYN: } -# CHECK-DYN: Symbol { -# CHECK-DYN: Name: bar@ (5) -# CHECK-DYN: Value: 0x138 -# CHECK-DYN: Size: 4 -# CHECK-DYN: Binding: Global (0x1) -# CHECK-DYN: Type: Function (0x2) -# CHECK-DYN: Other: 0 -# CHECK-DYN: Section: .text (0x4) -# CHECK-DYN: } -# CHECK-DYN: Symbol { -# CHECK-DYN: Name: foo@ (1) -# CHECK-DYN: Value: 0x120 -# CHECK-DYN: Size: 24 -# CHECK-DYN: Binding: Global (0x1) -# CHECK-DYN: Type: Function (0x2) -# CHECK-DYN: Other: 0 -# CHECK-DYN: Section: .text (0x4) -# CHECK-DYN: } -# CHECK-DYN: Symbol { -# CHECK-DYN: Name: ext1@ (9) -# CHECK-DYN: Value: 0x0 -# CHECK-DYN: Size: 0 -# CHECK-DYN: Binding: Global (0x1) -# CHECK-DYN: Type: None (0x0) -# CHECK-DYN: Other: 0 -# CHECK-DYN: Section: Undefined (0x0) -# CHECK-DYN: } -# CHECK-DYN: Symbol { -# CHECK-DYN: Name: ext2@ (14) -# CHECK-DYN: Value: 0x0 -# CHECK-DYN: Size: 0 -# CHECK-DYN: Binding: Global (0x1) -# CHECK-DYN: Type: None (0x0) -# CHECK-DYN: Other: 0 -# CHECK-DYN: Section: Undefined (0x0) -# CHECK-DYN: } -# CHECK-DYN: ] - -# CHECK-GOT: - type: got -# CHECK-GOT: content: [ 00, 00, 00, 00 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: - type: got -# CHECK-GOT: content: [ 00, 00, 00, 80 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: - ref-name: L000 -# CHECK-GOT: type: got -# CHECK-GOT: content: [ 00, 00, 00, 00 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: references: -# CHECK-GOT: - kind: LLD_R_MIPS_32_HI16 -# CHECK-GOT: offset: 0 -# CHECK-GOT: target: L007 -# CHECK-GOT: - ref-name: L002 -# CHECK-GOT: type: got -# CHECK-GOT: content: [ 00, 00, 00, 00 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: references: -# CHECK-GOT: - kind: LLD_R_MIPS_32_HI16 -# CHECK-GOT: offset: 0 -# CHECK-GOT: target: L008 -# CHECK-GOT: - ref-name: L004 -# CHECK-GOT: type: got -# CHECK-GOT: content: [ 00, 00, 00, 00 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: references: -# CHECK-GOT: - kind: LLD_R_MIPS_GLOBAL_GOT -# CHECK-GOT: offset: 0 -# CHECK-GOT: target: foo -# CHECK-GOT: - ref-name: L005 -# CHECK-GOT: type: got -# CHECK-GOT: content: [ 00, 00, 00, 00 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: references: -# CHECK-GOT: - kind: LLD_R_MIPS_GLOBAL_GOT -# CHECK-GOT: offset: 0 -# CHECK-GOT: target: ext1 -# CHECK-GOT: - ref-name: L006 -# CHECK-GOT: type: got -# CHECK-GOT: content: [ 00, 00, 00, 00 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: references: -# CHECK-GOT: - kind: LLD_R_MIPS_GLOBAL_GOT -# CHECK-GOT: offset: 0 -# CHECK-GOT: target: ext2 - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x1C - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: .rodata.str1 - Type: R_MIPS_GOT16 - - Offset: 0x04 - Symbol: .rodata.str1 - Type: R_MIPS_LO16 - - Offset: 0x08 - Symbol: .rodata.str2 - Type: R_MIPS_GOT16 - - Offset: 0x0C - Symbol: .rodata.str2 - Type: R_MIPS_LO16 - - Offset: 0x10 - Symbol: foo - Type: R_MIPS_CALL16 - - Offset: 0x14 - Symbol: ext1 - Type: R_MIPS_CALL16 - - Offset: 0x18 - Symbol: ext2 - Type: R_MIPS_CALL16 - - Name: .rodata.str1 - Type: SHT_PROGBITS - AddressAlign: 0x01 - Size: 0x05 - - Name: .rodata.str2 - Type: SHT_PROGBITS - AddressAlign: 0x01 - Size: 0x05 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .rodata.str1 - Type: STT_SECTION - Section: .rodata.str1 - - Name: .rodata.str2 - Type: STT_SECTION - Section: .rodata.str2 - Global: - - Name: bar - Section: .text - Value: 0x18 - - Name: foo - Section: .text - - Name: ext1 - - Name: ext2 -... diff --git a/test/old-elf/Mips/dynlib-fileheader-64.test b/test/old-elf/Mips/dynlib-fileheader-64.test deleted file mode 100644 index f3b45d4d738e..000000000000 --- a/test/old-elf/Mips/dynlib-fileheader-64.test +++ /dev/null @@ -1,72 +0,0 @@ -# Check ELF Header for 64-bit shared library. - -# Build shared library -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t.o -# RUN: llvm-readobj -file-headers %t.so | FileCheck %s - -# CHECK: Format: ELF64-mips -# CHECK: Arch: mips64el -# CHECK: AddressSize: 64bit -# CHECK: LoadName: -# CHECK: ElfHeader { -# CHECK: Ident { -# CHECK: Magic: (7F 45 4C 46) -# CHECK: Class: 64-bit (0x2) -# CHECK: DataEncoding: LittleEndian (0x1) -# CHECK: FileVersion: 1 -# CHECK: OS/ABI: SystemV (0x0) -# CHECK: ABIVersion: 0 -# CHECK: Unused: (00 00 00 00 00 00 00) -# CHECK: } -# CHECK: Type: SharedObject (0x3) -# CHECK: Machine: EM_MIPS (0x8) -# CHECK: Version: 1 -# CHECK: Entry: 0x{{[0-9A-F]+}} -# CHECK: ProgramHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK: SectionHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK: Flags [ (0x80000006) -# CHECK: EF_MIPS_ARCH_64R2 (0x80000000) -# CHECK: EF_MIPS_CPIC (0x4) -# CHECK: EF_MIPS_PIC (0x2) -# CHECK: ] -# CHECK: HeaderSize: 64 -# CHECK: ProgramHeaderEntrySize: 56 -# CHECK: ProgramHeaderCount: {{[0-9]+}} -# CHECK: SectionHeaderEntrySize: 64 -# CHECK: SectionHeaderCount: {{[0-9]+}} -# CHECK: StringTableSectionIndex: {{[0-9]+}} -# CHECK: } - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64R2 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x10 - Size: 0x08 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - Global: - - Name: data - Type: STT_OBJECT - Section: .data - Size: 0x04 -... diff --git a/test/old-elf/Mips/dynlib-fileheader-micro-64.test b/test/old-elf/Mips/dynlib-fileheader-micro-64.test deleted file mode 100644 index 531cee134caf..000000000000 --- a/test/old-elf/Mips/dynlib-fileheader-micro-64.test +++ /dev/null @@ -1,75 +0,0 @@ -# Check ELF Header for shared library in case of microMIPS symbols. - -# Build shared library -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t.o -# RUN: llvm-readobj -file-headers %t.so | FileCheck %s - -# CHECK: Format: ELF64-mips -# CHECK-NEXT: Arch: mips64el -# CHECK-NEXT: AddressSize: 64bit -# CHECK-NEXT: LoadName: -# CHECK-NEXT: ElfHeader { -# CHECK-NEXT: Ident { -# CHECK-NEXT: Magic: (7F 45 4C 46) -# CHECK-NEXT: Class: 64-bit (0x2) -# CHECK-NEXT: DataEncoding: LittleEndian (0x1) -# CHECK-NEXT: FileVersion: 1 -# CHECK-NEXT: OS/ABI: SystemV (0x0) -# CHECK-NEXT: ABIVersion: 0 -# CHECK-NEXT: Unused: (00 00 00 00 00 00 00) -# CHECK-NEXT: } -# CHECK-NEXT: Type: SharedObject (0x3) -# CHECK-NEXT: Machine: EM_MIPS (0x8) -# CHECK-NEXT: Version: 1 -# CHECK-NEXT: Entry: 0x{{[0-9A-F]+}} -# CHECK-NEXT: ProgramHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK-NEXT: SectionHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK-NEXT: Flags [ (0x82000007) -# CHECK-NEXT: EF_MIPS_ARCH_64R2 (0x80000000) -# CHECK-NEXT: EF_MIPS_CPIC (0x4) -# CHECK-NEXT: EF_MIPS_MICROMIPS (0x2000000) -# CHECK-NEXT: EF_MIPS_NOREORDER (0x1) -# CHECK-NEXT: EF_MIPS_PIC (0x2) -# CHECK-NEXT: ] -# CHECK-NEXT: HeaderSize: 64 -# CHECK-NEXT: ProgramHeaderEntrySize: 56 -# CHECK-NEXT: ProgramHeaderCount: {{[0-9]+}} -# CHECK-NEXT: SectionHeaderEntrySize: 64 -# CHECK-NEXT: SectionHeaderCount: {{[0-9]+}} -# CHECK-NEXT: StringTableSectionIndex: {{[0-9]+}} -# CHECK-NEXT:} - -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_MICROMIPS, EF_MIPS_ARCH_64R2 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x10 - Size: 0x08 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - Global: - - Name: foo - Type: STT_FUNC - Section: .text - Size: 0x08 - Other: [ STO_MIPS_MICROMIPS ] diff --git a/test/old-elf/Mips/dynlib-fileheader-micro.test b/test/old-elf/Mips/dynlib-fileheader-micro.test deleted file mode 100644 index dcd38f1036d0..000000000000 --- a/test/old-elf/Mips/dynlib-fileheader-micro.test +++ /dev/null @@ -1,79 +0,0 @@ -# Check ELF Header for shared library in case of microMIPS symbols. - -# Build shared library -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o -# RUN: llvm-readobj -file-headers %t.so | FileCheck %s - -# CHECK: Format: ELF32-mips -# CHECK-NEXT: Arch: mipsel -# CHECK-NEXT: AddressSize: 32bit -# CHECK-NEXT: LoadName: -# CHECK-NEXT: ElfHeader { -# CHECK-NEXT: Ident { -# CHECK-NEXT: Magic: (7F 45 4C 46) -# CHECK-NEXT: Class: 32-bit (0x1) -# CHECK-NEXT: DataEncoding: LittleEndian (0x1) -# CHECK-NEXT: FileVersion: 1 -# CHECK-NEXT: OS/ABI: SystemV (0x0) -# CHECK-NEXT: ABIVersion: 0 -# CHECK-NEXT: Unused: (00 00 00 00 00 00 00) -# CHECK-NEXT: } -# CHECK-NEXT: Type: SharedObject (0x3) -# CHECK-NEXT: Machine: EM_MIPS (0x8) -# CHECK-NEXT: Version: 1 -# CHECK-NEXT: Entry: 0x{{[0-9A-F]+}} -# CHECK-NEXT: ProgramHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK-NEXT: SectionHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK-NEXT: Flags [ (0x72001007) -# CHECK-NEXT: EF_MIPS_ABI_O32 (0x1000) -# CHECK-NEXT: EF_MIPS_ARCH_32R2 (0x70000000) -# CHECK-NEXT: EF_MIPS_CPIC (0x4) -# CHECK-NEXT: EF_MIPS_MICROMIPS (0x2000000) -# CHECK-NEXT: EF_MIPS_NOREORDER (0x1) -# CHECK-NEXT: EF_MIPS_PIC (0x2) -# CHECK-NEXT: ] -# CHECK-NEXT: HeaderSize: 52 -# CHECK-NEXT: ProgramHeaderEntrySize: 32 -# CHECK-NEXT: ProgramHeaderCount: {{[0-9]+}} -# CHECK-NEXT: SectionHeaderEntrySize: 40 -# CHECK-NEXT: SectionHeaderCount: {{[0-9]+}} -# CHECK-NEXT: StringTableSectionIndex: {{[0-9]+}} -# CHECK-NEXT:} - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x04 - Size: 0x00 - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x04 - Size: 0x00 - - Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x08 - ISA: MIPS32 - ISARevision: 2 - ASEs: [ MICROMIPS ] - -Symbols: - Global: - - Name: glob - Section: .text - Other: [ STO_MIPS_MICROMIPS ] diff --git a/test/old-elf/Mips/dynlib-fileheader.test b/test/old-elf/Mips/dynlib-fileheader.test deleted file mode 100644 index a3b4a19a90f1..000000000000 --- a/test/old-elf/Mips/dynlib-fileheader.test +++ /dev/null @@ -1,76 +0,0 @@ -# Check ELF Header for shared library. - -# Build shared library -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o -# RUN: llvm-readobj -file-headers %t.so | FileCheck %s - -# CHECK: Format: ELF32-mips -# CHECK: Arch: mipsel -# CHECK: AddressSize: 32bit -# CHECK: LoadName: -# CHECK: ElfHeader { -# CHECK: Ident { -# CHECK: Magic: (7F 45 4C 46) -# CHECK: Class: 32-bit (0x1) -# CHECK: DataEncoding: LittleEndian (0x1) -# CHECK: FileVersion: 1 -# CHECK: OS/ABI: SystemV (0x0) -# CHECK: ABIVersion: 0 -# CHECK: Unused: (00 00 00 00 00 00 00) -# CHECK: } -# CHECK: Type: SharedObject (0x3) -# CHECK: Machine: EM_MIPS (0x8) -# CHECK: Version: 1 -# CHECK: Entry: 0x{{[0-9A-F]+}} -# CHECK: ProgramHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK: SectionHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK: Flags [ (0x70001007) -# CHECK: EF_MIPS_ABI_O32 (0x1000) -# CHECK: EF_MIPS_ARCH_32R2 (0x70000000) -# CHECK: EF_MIPS_CPIC (0x4) -# CHECK: EF_MIPS_NOREORDER (0x1) -# CHECK: EF_MIPS_PIC (0x2) -# CHECK: ] -# CHECK: HeaderSize: 52 -# CHECK: ProgramHeaderEntrySize: 32 -# CHECK: ProgramHeaderCount: {{[0-9]+}} -# CHECK: SectionHeaderEntrySize: 40 -# CHECK: SectionHeaderCount: {{[0-9]+}} -# CHECK: StringTableSectionIndex: {{[0-9]+}} -# CHECK:} - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x04 - Size: 0x00 - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x04 - Size: 0x00 - - Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x08 - ISA: MIPS32 - ISARevision: 2 - -Symbols: - Global: - - Name: glob - Section: .text diff --git a/test/old-elf/Mips/dynsym-table-1.test b/test/old-elf/Mips/dynsym-table-1.test deleted file mode 100644 index 8821ae358254..000000000000 --- a/test/old-elf/Mips/dynsym-table-1.test +++ /dev/null @@ -1,127 +0,0 @@ -# Check that LLD does not populate an executable file dynamic symbol table -# by unnecessary symbols. -# 1. bar.so defines T2 -# 2. foo.so defines T1 and references T2 -# 3. main.o reference T1 -# 4. a.out dynamic table should contain T1 entry only - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-bar.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-foo.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-main.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t-bar.so %t-bar.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t-foo.so %t-foo.o %t-bar.so -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe --as-needed \ -# RUN: %t-main.o %t-foo.so %t-bar.so -# RUN: llvm-readobj -dt -dynamic-table %t.exe | FileCheck %s - -# CHECK: DynamicSymbols [ -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: @ (0) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Local (0x0) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: T1@ ({{.*}}) -# CHECK-NEXT: Value: {{.*}} -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Function (0x2) -# CHECK-NEXT: Other: 8 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: ] - -# CHECK: 0x00000003 PLTGOT 0x{{[0-9A-F]+}} -# CHECK-NEXT: 0x00000001 NEEDED SharedLibrary (dynsym-table-1.test.tmp-foo.so) -# CHECK-NEXT: 0x00000000 NULL 0x0 - -# bar.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 -Symbols: - Global: - - Name: T2 - Type: STT_FUNC - Section: .text - Size: 0x08 - -# foo.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x08 - Info: .text - Relocations: - - Offset: 0 - Symbol: T2 - Type: R_MIPS_CALL16 -Symbols: - Global: - - Name: T1 - Type: STT_FUNC - Section: .text - Size: 0x08 - - Name: T2 - -# main.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x08 - Info: .text - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_32 -Symbols: - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 0x08 - - Name: T1 -... diff --git a/test/old-elf/Mips/dynsym-table-2.test b/test/old-elf/Mips/dynsym-table-2.test deleted file mode 100644 index ad85bfe84e43..000000000000 --- a/test/old-elf/Mips/dynsym-table-2.test +++ /dev/null @@ -1,105 +0,0 @@ -# Check that LLD does not populate a shared library dynamic symbol table -# by unnecessary symbols. -# 1. bar.so defines T2 and T3 -# 2. foo.so defines T1 and references T2 -# 4. foo.so dynamic table should contain T1 and T2 entries only - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-bar.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-foo.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t-bar.so %t-bar.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t-foo.so %t-foo.o %t-bar.so -# RUN: llvm-readobj -dt -dynamic-table %t-foo.so | FileCheck %s - -# CHECK: DynamicSymbols [ -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: @ (0) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Local (0x0) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: T1@ ({{.*}}) -# CHECK-NEXT: Value: {{.*}} -# CHECK-NEXT: Size: 8 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Function (0x2) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: .text (0x4) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: T2@ ({{.*}}) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Function (0x2) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: ] - -# CHECK: 0x00000003 PLTGOT 0x{{[0-9A-F]+}} -# CHECK-NEXT: 0x00000001 NEEDED SharedLibrary (dynsym-table-2.test.tmp-bar.so) -# CHECK-NEXT: 0x00000000 NULL 0x0 - -# bar.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 -Symbols: - Global: - - Name: T2 - Type: STT_FUNC - Section: .text - Size: 0x04 - - Name: T3 - Type: STT_FUNC - Section: .text - Value: 0x04 - Size: 0x04 - -# foo.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x08 - Info: .text - Relocations: - - Offset: 0 - Symbol: T2 - Type: R_MIPS_CALL16 -Symbols: - Global: - - Name: T1 - Type: STT_FUNC - Section: .text - Size: 0x08 - - Name: T2 -... diff --git a/test/old-elf/Mips/e-flags-merge-1-64.test b/test/old-elf/Mips/e-flags-merge-1-64.test deleted file mode 100644 index 3e52afd223cd..000000000000 --- a/test/old-elf/Mips/e-flags-merge-1-64.test +++ /dev/null @@ -1,30 +0,0 @@ -# Check that the linker shows an error when object -# file has unsupported ASE flags. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-mips16.o -# RUN: not lld -flavor old-gnu -target mips64el -e T -o %t.exe %t-mips16.o 2>&1 | \ -# RUN: FileCheck -check-prefix=MIPS16 %s - -# MIPS16: Unsupported extension: MIPS16 - -# mips16.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ARCH_64, EF_MIPS_ARCH_ASE_M16] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 - -Symbols: - Global: - - Name: T - Section: .text -... diff --git a/test/old-elf/Mips/e-flags-merge-1.test b/test/old-elf/Mips/e-flags-merge-1.test deleted file mode 100644 index bc100534112d..000000000000 --- a/test/old-elf/Mips/e-flags-merge-1.test +++ /dev/null @@ -1,56 +0,0 @@ -# Check that the linker shows an error when object file has missed -# or unsupported ABI and ARCH flags or unsupported ASE flags. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-no-abi.o -# RUN: not lld -flavor old-gnu -target mipsel -e T -o %t.exe %t-no-abi.o 2>&1 | \ -# RUN: FileCheck -check-prefix=INVALID-ABI %s - -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-mips16.o -# RUN: not lld -flavor old-gnu -target mipsel -e T -o %t.exe %t-mips16.o 2>&1 | \ -# RUN: FileCheck -check-prefix=MIPS16 %s - -# INVALID-ABI: Unsupported ABI -# MIPS16: Unsupported extension: MIPS16 - -# no-abi.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: T - Section: .text - -# mips16.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_ARCH_ASE_M16] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: T - Section: .text -... diff --git a/test/old-elf/Mips/e-flags-merge-10.test b/test/old-elf/Mips/e-flags-merge-10.test deleted file mode 100644 index 5dacaa0e069d..000000000000 --- a/test/old-elf/Mips/e-flags-merge-10.test +++ /dev/null @@ -1,43 +0,0 @@ -# Check that LLD shows an error and does not link files with mips32r2 -# and mips32r6 instructions sets. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-32r2.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-32r6.o - -# RUN: not lld -flavor old-gnu -target mipsel -shared -o %t.so \ -# RUN: %t-32r2.o %t-32r6.o 2>&1 | FileCheck %s - -# CHECK: Linking modules with incompatible ISA - -# 32r2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -# 32r6.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 -... diff --git a/test/old-elf/Mips/e-flags-merge-11.test b/test/old-elf/Mips/e-flags-merge-11.test deleted file mode 100644 index e61eb0d6d65a..000000000000 --- a/test/old-elf/Mips/e-flags-merge-11.test +++ /dev/null @@ -1,43 +0,0 @@ -# Check that LLD shows an error and does not link files with mips64r2 -# and mips64r6 instructions sets. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-64r2.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-64r6.o - -# RUN: not lld -flavor old-gnu -target mips64el -shared -o %t.so \ -# RUN: %t-64r2.o %t-64r6.o 2>&1 | FileCheck %s - -# CHECK: Linking modules with incompatible ISA - -# 64r2.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ARCH_64R2] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -# 64r6.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ARCH_64R6] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 -... diff --git a/test/old-elf/Mips/e-flags-merge-12.test b/test/old-elf/Mips/e-flags-merge-12.test deleted file mode 100644 index 0a0c43fc996a..000000000000 --- a/test/old-elf/Mips/e-flags-merge-12.test +++ /dev/null @@ -1,44 +0,0 @@ -# Check that LLD shows an error and does not link files with O32 and N32 ABIs. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-o32.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-n32.o - -# RUN: not lld -flavor old-gnu -target mipsel -shared -o %t.so \ -# RUN: %t-o32.o %t-n32.o 2>&1 | FileCheck %s - -# CHECK: Linking modules with incompatible ABI - -# o32.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_32BITMODE, EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -# n32.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI2, - EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 -... diff --git a/test/old-elf/Mips/e-flags-merge-2-64.test b/test/old-elf/Mips/e-flags-merge-2-64.test deleted file mode 100644 index 4e024d2a465b..000000000000 --- a/test/old-elf/Mips/e-flags-merge-2-64.test +++ /dev/null @@ -1,33 +0,0 @@ -# Check that the linker copies ELF header flags from the single input object -# file to the generated executable - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips64el -e T -o %t.exe %t.o -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s - -# CHECK: Flags [ (0x62000001) -# CHECK-NEXT: EF_MIPS_ARCH_64 (0x60000000) -# CHECK-NEXT: EF_MIPS_MICROMIPS (0x2000000) -# CHECK-NEXT: EF_MIPS_NOREORDER (0x1) -# CHECK-NEXT: ] - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_ARCH_64, EF_MIPS_NOREORDER, EF_MIPS_MICROMIPS ] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 - -Symbols: - Global: - - Name: T - Section: .text -... diff --git a/test/old-elf/Mips/e-flags-merge-2.test b/test/old-elf/Mips/e-flags-merge-2.test deleted file mode 100644 index 3ca531728728..000000000000 --- a/test/old-elf/Mips/e-flags-merge-2.test +++ /dev/null @@ -1,35 +0,0 @@ -# Check that the linker copies ELF header flags from the single input object -# file to the generated executable - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T -o %t.exe %t.o -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s - -# CHECK: Flags [ (0x52001001) -# CHECK-NEXT: EF_MIPS_ABI_O32 (0x1000) -# CHECK-NEXT: EF_MIPS_ARCH_32 (0x50000000) -# CHECK-NEXT: EF_MIPS_MICROMIPS (0x2000000) -# CHECK-NEXT: EF_MIPS_NOREORDER (0x1) -# CHECK-NEXT: ] - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, - EF_MIPS_NOREORDER, EF_MIPS_MICROMIPS] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: T - Section: .text -... diff --git a/test/old-elf/Mips/e-flags-merge-3-64.test b/test/old-elf/Mips/e-flags-merge-3-64.test deleted file mode 100644 index 45326813e12f..000000000000 --- a/test/old-elf/Mips/e-flags-merge-3-64.test +++ /dev/null @@ -1,130 +0,0 @@ -# Check PIC/CPIC flags merging in case of multiple input objects. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-none.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-cpic.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-pic.o -# RUN: yaml2obj -format=elf -docnum 4 %s > %t-both.o - -# RUN: lld -flavor old-gnu -target mips64el -e T1 -o %t-abi1.exe \ -# RUN: %t-none.o %t-pic.o 2>&1 | FileCheck -check-prefix=ABI-CALLS-WARN %s -# RUN: llvm-readobj -file-headers %t-abi1.exe \ -# RUN: | FileCheck -check-prefix=ABI-CALLS1 %s - -# RUN: lld -flavor old-gnu -target mips64el -e T1 -o %t-abi2.exe \ -# RUN: %t-cpic.o %t-none.o 2>&1 | FileCheck -check-prefix=ABI-CALLS-WARN %s -# RUN: llvm-readobj -file-headers %t-abi2.exe \ -# RUN: | FileCheck -check-prefix=ABI-CALLS2 %s - -# RUN: lld -flavor old-gnu -target mips64el -e T2 -o %t-cpic.exe %t-cpic.o %t-pic.o -# RUN: llvm-readobj -file-headers %t-cpic.exe | FileCheck -check-prefix=CPIC %s - -# RUN: lld -flavor old-gnu -target mips64el -e T3 -o %t-both.exe %t-pic.o %t-both.o -# RUN: llvm-readobj -file-headers %t-both.exe | FileCheck -check-prefix=BOTH %s - -# ABI-CALLS-WARN: lld warning: linking abicalls and non-abicalls files - -# ABI-CALLS1: Flags [ (0x60000004) -# ABI-CALLS1-NEXT: EF_MIPS_ARCH_64 (0x60000000) -# ABI-CALLS1-NEXT: EF_MIPS_CPIC (0x4) -# ABI-CALLS1-NEXT: ] - -# ABI-CALLS2: Flags [ (0x60000004) -# ABI-CALLS2-NEXT: EF_MIPS_ARCH_64 (0x60000000) -# ABI-CALLS2-NEXT: EF_MIPS_CPIC (0x4) -# ABI-CALLS2-NEXT: ] - -# CPIC: Flags [ (0x60000004) -# CPIC-NEXT: EF_MIPS_ARCH_64 (0x60000000) -# CPIC-NEXT: EF_MIPS_CPIC (0x4) -# CPIC-NEXT: ] - -# BOTH: Flags [ (0x60000006) -# BOTH-NEXT: EF_MIPS_ARCH_64 (0x60000000) -# BOTH-NEXT: EF_MIPS_CPIC (0x4) -# BOTH-NEXT: EF_MIPS_PIC (0x2) -# BOTH-NEXT: ] - -# none.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 - -Symbols: - Global: - - Name: T1 - Section: .text - -# cpic.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ARCH_64, EF_MIPS_CPIC] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 - -Symbols: - Global: - - Name: T2 - Section: .text - -# pic.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ARCH_64, EF_MIPS_PIC] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 - -Symbols: - Global: - - Name: T3 - Section: .text - -# both.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ARCH_64, EF_MIPS_CPIC, EF_MIPS_PIC] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 - -Symbols: - Global: - - Name: T4 - Section: .text -... diff --git a/test/old-elf/Mips/e-flags-merge-3.test b/test/old-elf/Mips/e-flags-merge-3.test deleted file mode 100644 index 612f0b458631..000000000000 --- a/test/old-elf/Mips/e-flags-merge-3.test +++ /dev/null @@ -1,134 +0,0 @@ -# Check PIC/CPIC flags merging in case of multiple input objects. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-none.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-cpic.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-pic.o -# RUN: yaml2obj -format=elf -docnum 4 %s > %t-both.o - -# RUN: lld -flavor old-gnu -target mipsel -e T1 -o %t-abi1.exe \ -# RUN: %t-none.o %t-pic.o 2>&1 | FileCheck -check-prefix=ABI-CALLS-WARN %s -# RUN: llvm-readobj -file-headers %t-abi1.exe \ -# RUN: | FileCheck -check-prefix=ABI-CALLS1 %s - -# RUN: lld -flavor old-gnu -target mipsel -e T1 -o %t-abi2.exe \ -# RUN: %t-cpic.o %t-none.o 2>&1 | FileCheck -check-prefix=ABI-CALLS-WARN %s -# RUN: llvm-readobj -file-headers %t-abi2.exe \ -# RUN: | FileCheck -check-prefix=ABI-CALLS2 %s - -# RUN: lld -flavor old-gnu -target mipsel -e T2 -o %t-cpic.exe %t-cpic.o %t-pic.o -# RUN: llvm-readobj -file-headers %t-cpic.exe | FileCheck -check-prefix=CPIC %s - -# RUN: lld -flavor old-gnu -target mipsel -e T3 -o %t-both.exe %t-pic.o %t-both.o -# RUN: llvm-readobj -file-headers %t-both.exe | FileCheck -check-prefix=BOTH %s - -# ABI-CALLS-WARN: lld warning: linking abicalls and non-abicalls files - -# ABI-CALLS1: Flags [ (0x50001004) -# ABI-CALLS1-NEXT: EF_MIPS_ABI_O32 (0x1000) -# ABI-CALLS1-NEXT: EF_MIPS_ARCH_32 (0x50000000) -# ABI-CALLS1-NEXT: EF_MIPS_CPIC (0x4) -# ABI-CALLS1-NEXT: ] - -# ABI-CALLS2: Flags [ (0x50001004) -# ABI-CALLS2-NEXT: EF_MIPS_ABI_O32 (0x1000) -# ABI-CALLS2-NEXT: EF_MIPS_ARCH_32 (0x50000000) -# ABI-CALLS2-NEXT: EF_MIPS_CPIC (0x4) -# ABI-CALLS2-NEXT: ] - -# CPIC: Flags [ (0x50001004) -# CPIC-NEXT: EF_MIPS_ABI_O32 (0x1000) -# CPIC-NEXT: EF_MIPS_ARCH_32 (0x50000000) -# CPIC-NEXT: EF_MIPS_CPIC (0x4) -# CPIC-NEXT: ] - -# BOTH: Flags [ (0x50001006) -# BOTH-NEXT: EF_MIPS_ABI_O32 (0x1000) -# BOTH-NEXT: EF_MIPS_ARCH_32 (0x50000000) -# BOTH-NEXT: EF_MIPS_CPIC (0x4) -# BOTH-NEXT: EF_MIPS_PIC (0x2) -# BOTH-NEXT: ] - -# none.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: T1 - Section: .text - -# cpic.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: T2 - Section: .text - -# pic.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_PIC] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: T3 - Section: .text - -# both.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC, EF_MIPS_PIC] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: T4 - Section: .text -... diff --git a/test/old-elf/Mips/e-flags-merge-4-64.test b/test/old-elf/Mips/e-flags-merge-4-64.test deleted file mode 100644 index 59a8bf131d95..000000000000 --- a/test/old-elf/Mips/e-flags-merge-4-64.test +++ /dev/null @@ -1,64 +0,0 @@ -# Check ELF flags merging. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-none.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-noreorder.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-micro.o - -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so \ -# RUN: %t-none.o %t-noreorder.o %t-micro.o -# RUN: llvm-readobj -file-headers %t.so | FileCheck %s - -# CHECK: Flags [ (0x82000001) -# CHECK-NEXT: EF_MIPS_ARCH_64R2 (0x80000000) -# CHECK-NEXT: EF_MIPS_MICROMIPS (0x2000000) -# CHECK-NEXT: EF_MIPS_NOREORDER (0x1) -# CHECK-NEXT: ] - -# none.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ARCH_5] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 - -# noreorder.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ARCH_64, EF_MIPS_NOREORDER] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 - -# micro.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ARCH_64R2, EF_MIPS_MICROMIPS] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 -... diff --git a/test/old-elf/Mips/e-flags-merge-4.test b/test/old-elf/Mips/e-flags-merge-4.test deleted file mode 100644 index 6a2de375e624..000000000000 --- a/test/old-elf/Mips/e-flags-merge-4.test +++ /dev/null @@ -1,65 +0,0 @@ -# Check ELF flags merging. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-none.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-noreorder.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-micro.o - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so \ -# RUN: %t-none.o %t-noreorder.o %t-micro.o -# RUN: llvm-readobj -file-headers %t.so | FileCheck %s - -# CHECK: Flags [ (0x52001001) -# CHECK-NEXT: EF_MIPS_ABI_O32 (0x1000) -# CHECK-NEXT: EF_MIPS_ARCH_32 (0x50000000) -# CHECK-NEXT: EF_MIPS_MICROMIPS (0x2000000) -# CHECK-NEXT: EF_MIPS_NOREORDER (0x1) -# CHECK-NEXT: ] - -# none.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -# noreorder.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_NOREORDER] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -# micro.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_MICROMIPS] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 -... diff --git a/test/old-elf/Mips/e-flags-merge-5-64.test b/test/old-elf/Mips/e-flags-merge-5-64.test deleted file mode 100644 index f1fdac2c8c05..000000000000 --- a/test/old-elf/Mips/e-flags-merge-5-64.test +++ /dev/null @@ -1,42 +0,0 @@ -# Check that LLD does not allow to mix 32 and 64-bit MIPS object files. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-32.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-64.o - -# RUN: not lld -flavor old-gnu -target mips64el -shared -o %t.so \ -# RUN: %t-32.o %t-64.o 2>&1 | FileCheck %s - -# CHECK: ELF64 expected, but got ELF32 - -# 32.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -# 64.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 -... diff --git a/test/old-elf/Mips/e-flags-merge-5.test b/test/old-elf/Mips/e-flags-merge-5.test deleted file mode 100644 index 56edc4bfa10f..000000000000 --- a/test/old-elf/Mips/e-flags-merge-5.test +++ /dev/null @@ -1,42 +0,0 @@ -# Check that LLD does not allow to mix 32 and 64-bit MIPS object files. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-32.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-64.o - -# RUN: not lld -flavor old-gnu -target mipsel -shared -o %t.so \ -# RUN: %t-32.o %t-64.o 2>&1 | FileCheck %s - -# CHECK: ELF32 expected, but got ELF64 - -# 32.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -# 64.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 -... diff --git a/test/old-elf/Mips/e-flags-merge-6-64.test b/test/old-elf/Mips/e-flags-merge-6-64.test deleted file mode 100644 index 9f83365441af..000000000000 --- a/test/old-elf/Mips/e-flags-merge-6-64.test +++ /dev/null @@ -1,79 +0,0 @@ -# Check selecting ELF header ARCH flag. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-m3.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-m5.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-m64.o -# RUN: yaml2obj -format=elf -docnum 4 %s > %t-m64r2.o - -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so \ -# RUN: %t-m64.o %t-m5.o %t-m64r2.o %t-m3.o -# RUN: llvm-readobj -file-headers %t.so | FileCheck %s - -# CHECK: Flags [ (0x80000000) -# CHECK-NEXT: EF_MIPS_ARCH_64R2 (0x80000000) -# CHECK-NEXT: ] - -# m3.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ARCH_3] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 - -# m5.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ARCH_5] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 - -# m64.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 - -# m64r2.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ARCH_64R2] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 -... diff --git a/test/old-elf/Mips/e-flags-merge-6.test b/test/old-elf/Mips/e-flags-merge-6.test deleted file mode 100644 index 0d8bcee5ad64..000000000000 --- a/test/old-elf/Mips/e-flags-merge-6.test +++ /dev/null @@ -1,80 +0,0 @@ -# Check selecting ELF header ARCH flag. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-m1.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-m2.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-m32.o -# RUN: yaml2obj -format=elf -docnum 4 %s > %t-m32r2.o - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so \ -# RUN: %t-m32.o %t-m2.o %t-m32r2.o %t-m1.o -# RUN: llvm-readobj -file-headers %t.so | FileCheck %s - -# CHECK: Flags [ (0x70001000) -# CHECK-NEXT: EF_MIPS_ABI_O32 (0x1000) -# CHECK-NEXT: EF_MIPS_ARCH_32R2 (0x70000000) -# CHECK-NEXT: ] - -# m1.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_1] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -# m2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_2] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -# m32.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -# m32r2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 -... diff --git a/test/old-elf/Mips/e-flags-merge-7-64.test b/test/old-elf/Mips/e-flags-merge-7-64.test deleted file mode 100644 index 0e74ac53684a..000000000000 --- a/test/old-elf/Mips/e-flags-merge-7-64.test +++ /dev/null @@ -1,42 +0,0 @@ -# Check that LLD does not allow to mix nan2008 and legacy MIPS object files. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-2008.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-legacy.o - -# RUN: not lld -flavor old-gnu -target mips64el -shared -o %t.so \ -# RUN: %t-2008.o %t-legacy.o 2>&1 | FileCheck %s - -# CHECK: Linking -mnan=2008 and -mnan=legacy modules - -# 2008.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ARCH_64, EF_MIPS_NAN2008] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 - -# legacy.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 -... diff --git a/test/old-elf/Mips/e-flags-merge-7.test b/test/old-elf/Mips/e-flags-merge-7.test deleted file mode 100644 index 08051df506be..000000000000 --- a/test/old-elf/Mips/e-flags-merge-7.test +++ /dev/null @@ -1,42 +0,0 @@ -# Check that LLD does not allow to mix nan2008 and legacy MIPS object files. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-2008.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-legacy.o - -# RUN: not lld -flavor old-gnu -target mipsel -shared -o %t.so \ -# RUN: %t-2008.o %t-legacy.o 2>&1 | FileCheck %s - -# CHECK: Linking -mnan=2008 and -mnan=legacy modules - -# 2008.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_NAN2008] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -# legacy.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 -... diff --git a/test/old-elf/Mips/e-flags-merge-8.test b/test/old-elf/Mips/e-flags-merge-8.test deleted file mode 100644 index 2a2fdfee3c46..000000000000 --- a/test/old-elf/Mips/e-flags-merge-8.test +++ /dev/null @@ -1,65 +0,0 @@ -# Check that LLD links files with mips32 and mips64 instructions -# if all these files satisfy O32 ABI. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-32.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-64.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-64r2.o - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-32.o %t-64.o %t-64r2.o -# RUN: llvm-readobj -file-headers %t.so | FileCheck %s - -# CHECK: Flags [ (0x80001100) -# CHECK-NEXT: EF_MIPS_32BITMODE (0x100) -# CHECK-NEXT: EF_MIPS_ABI_O32 (0x1000) -# CHECK-NEXT: EF_MIPS_ARCH_64R2 (0x80000000) -# CHECK-NEXT: ] - - -# 32.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -# 64.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_64, EF_MIPS_32BITMODE] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -# 64r2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_64R2, EF_MIPS_32BITMODE] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 -... diff --git a/test/old-elf/Mips/e-flags-merge-9.test b/test/old-elf/Mips/e-flags-merge-9.test deleted file mode 100644 index ada24d788c9a..000000000000 --- a/test/old-elf/Mips/e-flags-merge-9.test +++ /dev/null @@ -1,43 +0,0 @@ -# Check that LLD shows an error and does not link files with mips32r2 -# and mips64 instructions sets. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-32r2.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-64.o - -# RUN: not lld -flavor old-gnu -target mipsel -shared -o %t.so \ -# RUN: %t-32r2.o %t-64.o 2>&1 | FileCheck %s - -# CHECK: Linking modules with incompatible ISA - -# 32r2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -# 64.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_64, EF_MIPS_32BITMODE] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 -... diff --git a/test/old-elf/Mips/entry-name.test b/test/old-elf/Mips/entry-name.test deleted file mode 100644 index f6ce0c4f223b..000000000000 --- a/test/old-elf/Mips/entry-name.test +++ /dev/null @@ -1,26 +0,0 @@ -# Check name of executable entry symbol. -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel --noinhibit-exec -o %t.exe %t.o -# RUN: llvm-nm %t.exe | FileCheck %s - -# CHECK: U __start -# CHECK: {{[0-9A-F]+}} T main - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: main - Section: .text diff --git a/test/old-elf/Mips/exe-dynamic.test b/test/old-elf/Mips/exe-dynamic.test deleted file mode 100644 index 93fdce9fdc7d..000000000000 --- a/test/old-elf/Mips/exe-dynamic.test +++ /dev/null @@ -1,110 +0,0 @@ -# Check MIPS specific tags in the dynamic table in case executable linking. - -# Build shared library -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o - -# Build executable -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e glob -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -dynamic-table %t.exe | FileCheck %s - -# CHECK: Format: ELF32-mips -# CHECK: Arch: mipsel -# CHECK: AddressSize: 32bit -# CHECK: LoadName: -# CHECK: DynamicSection [ (20 entries) -# CHECK: Tag Type Name/Value -# CHECK-NEXT: 0x00000004 HASH 0x{{[0-9A-F]+}} -# CHECK-NEXT: 0x00000005 STRTAB 0x{{[0-9A-F]+}} -# CHECK-NEXT: 0x00000006 SYMTAB 0x{{[0-9A-F]+}} -# CHECK-NEXT: 0x0000000A STRSZ 28 (bytes) -# CHECK-NEXT: 0x0000000B SYMENT 16 (bytes) -# CHECK-NEXT: 0x00000002 PLTRELSZ 8 (bytes) -# CHECK-NEXT: 0x70000032 MIPS_PLTGOT 0x{{[0-9A-F]+}} -# CHECK-NEXT: 0x00000014 PLTREL REL -# CHECK-NEXT: 0x00000017 JMPREL 0x{{[0-9A-F]+}} -# CHECK-NEXT: 0x70000001 MIPS_RLD_VERSION 1 -# CHECK-NEXT: 0x70000016 MIPS_RLD_MAP 0x40200C -# CHECK-NEXT: 0x70000035 MIPS_RLD_MAP_REL 0x1E0C -# CHECK-NEXT: 0x70000005 MIPS_FLAGS NOTPOT -# CHECK-NEXT: 0x70000006 MIPS_BASE_ADDRESS 0x400000 -# CHECK-NEXT: 0x7000000A MIPS_LOCAL_GOTNO 2 -# CHECK-NEXT: 0x70000011 MIPS_SYMTABNO 2 -# CHECK-NEXT: 0x70000013 MIPS_GOTSYM 0x2 -# CHECK-NEXT: 0x00000003 PLTGOT 0x{{[0-9A-F]+}} -# CHECK-NEXT: 0x00000001 NEEDED SharedLibrary (exe-dynamic.test.tmp.so) -# CHECK-NEXT: 0x00000000 NULL 0x0 -# CHECK-NEXT: ] - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Content: 0000000C000000000000000C000000000000000C00000000 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_26 - Addend: 0 - - Offset: 0x08 - Symbol: .text - Type: R_MIPS_26 - Addend: 0 - - Offset: 0x10 - Symbol: glob - Type: R_MIPS_26 - Addend: 0 - -Symbols: - Local: - - Name: loc - Section: .text - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: glob - Section: .text - Value: 0x08 - - Name: T1 -... diff --git a/test/old-elf/Mips/exe-dynsym-micro.test b/test/old-elf/Mips/exe-dynsym-micro.test deleted file mode 100644 index 477e174f3d6c..000000000000 --- a/test/old-elf/Mips/exe-dynsym-micro.test +++ /dev/null @@ -1,94 +0,0 @@ -# Check that symbol referenced by an entry in the global part of GOT -# has a corresponded entry in the .dynsym section. This test covers -# the case when the GOT entry created because of the R_MICROMIPS_GOT16 -# relocation. - -# Build executable -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e glob -o %t.exe %t.o -# RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck -check-prefix=CHECK-DYN %s - -# Build executabl (yaml format)e -# RUN: lld -flavor old-gnu -target mipsel -e glob \ -# RUN: --output-filetype=yaml -o %t.yaml %t.o -# RUN: FileCheck -check-prefix=CHECK-GOT %s < %t.yaml - -# CHECK-DYN: Format: ELF32-mips -# CHECK-DYN: Arch: mipsel -# CHECK-DYN: AddressSize: 32bit -# CHECK-DYN: LoadName: -# CHECK-DYN: DynamicSymbols [ -# CHECK-DYN: Symbol { -# CHECK-DYN: Name: @ (0) -# CHECK-DYN: Value: 0x0 -# CHECK-DYN: Size: 0 -# CHECK-DYN: Binding: Local (0x0) -# CHECK-DYN: Type: None (0x0) -# CHECK-DYN: Other: 0 -# CHECK-DYN: Section: Undefined (0x0) -# CHECK-DYN: } -# CHECK-DYN: Symbol { -# CHECK-DYN: Name: weakf@ (1) -# CHECK-DYN: Value: 0x0 -# CHECK-DYN: Size: 0 -# CHECK-DYN: Binding: Weak (0x2) -# CHECK-DYN: Type: None (0x0) -# CHECK-DYN: Other: 0 -# CHECK-DYN: Section: Undefined (0x0) -# CHECK-DYN: } -# CHECK-DYN: ] - -# CHECK-GOT: - type: got -# CHECK-GOT: content: [ 00, 00, 00, 00 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: - type: got -# CHECK-GOT: content: [ 00, 00, 00, 80 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: - ref-name: L000 -# CHECK-GOT: type: got -# CHECK-GOT: content: [ 00, 00, 00, 00 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: references: -# CHECK-GOT: - kind: LLD_R_MIPS_GLOBAL_GOT -# CHECK-GOT: offset: 0 -# CHECK-GOT: target: weakf - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x04 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: weakf - Type: R_MICROMIPS_GOT16 - -Symbols: - Global: - - Name: glob - Section: .text - Other: [ STO_MIPS_MICROMIPS ] - Weak: - - Name: weakf diff --git a/test/old-elf/Mips/exe-dynsym.test b/test/old-elf/Mips/exe-dynsym.test deleted file mode 100644 index c50ce67d5f57..000000000000 --- a/test/old-elf/Mips/exe-dynsym.test +++ /dev/null @@ -1,91 +0,0 @@ -# Check that symbol referenced by an entry in the global part of GOT -# has a corresponded entry in the .dynsym section. - -# Build executable -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e glob -o %t.exe %t.o -# RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck -check-prefix=CHECK-DYN %s - -# Build executabl (yaml format)e -# RUN: lld -flavor old-gnu -target mipsel -e glob \ -# RUN: --output-filetype=yaml -o %t.yaml %t.o -# RUN: FileCheck -check-prefix=CHECK-GOT %s < %t.yaml - -# CHECK-DYN: Format: ELF32-mips -# CHECK-DYN: Arch: mipsel -# CHECK-DYN: AddressSize: 32bit -# CHECK-DYN: LoadName: -# CHECK-DYN: DynamicSymbols [ -# CHECK-DYN: Symbol { -# CHECK-DYN: Name: @ (0) -# CHECK-DYN: Value: 0x0 -# CHECK-DYN: Size: 0 -# CHECK-DYN: Binding: Local (0x0) -# CHECK-DYN: Type: None (0x0) -# CHECK-DYN: Other: 0 -# CHECK-DYN: Section: Undefined (0x0) -# CHECK-DYN: } -# CHECK-DYN: Symbol { -# CHECK-DYN: Name: weakf@ (1) -# CHECK-DYN: Value: 0x0 -# CHECK-DYN: Size: 0 -# CHECK-DYN: Binding: Weak (0x2) -# CHECK-DYN: Type: None (0x0) -# CHECK-DYN: Other: 0 -# CHECK-DYN: Section: Undefined (0x0) -# CHECK-DYN: } -# CHECK-DYN: ] - -# CHECK-GOT: - type: got -# CHECK-GOT: content: [ 00, 00, 00, 00 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: - type: got -# CHECK-GOT: content: [ 00, 00, 00, 80 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: - ref-name: L000 -# CHECK-GOT: type: got -# CHECK-GOT: content: [ 00, 00, 00, 00 ] -# CHECK-GOT: alignment: 4 -# CHECK-GOT: section-choice: custom-required -# CHECK-GOT: section-name: .got -# CHECK-GOT: permissions: rw- -# CHECK-GOT: references: -# CHECK-GOT: - kind: LLD_R_MIPS_GLOBAL_GOT -# CHECK-GOT: offset: 0 -# CHECK-GOT: target: weakf - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x04 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: weakf - Type: R_MIPS_GOT16 - -Symbols: - Global: - - Name: glob - Section: .text - Weak: - - Name: weakf diff --git a/test/old-elf/Mips/exe-fileheader-02.test b/test/old-elf/Mips/exe-fileheader-02.test deleted file mode 100644 index b3cd88c139b6..000000000000 --- a/test/old-elf/Mips/exe-fileheader-02.test +++ /dev/null @@ -1,62 +0,0 @@ -# Check that LLD set ABIVersion to '1' if it generates executable -# file without EF_MIPS_PIC in the ELF header. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s - -# CHECK: Format: ELF32-mips -# CHECK: Arch: mipsel -# CHECK: AddressSize: 32bit -# CHECK: LoadName: -# CHECK: ElfHeader { -# CHECK: Ident { -# CHECK: Magic: (7F 45 4C 46) -# CHECK: Class: 32-bit (0x1) -# CHECK: DataEncoding: LittleEndian (0x1) -# CHECK: FileVersion: 1 -# CHECK: OS/ABI: SystemV (0x0) -# CHECK: ABIVersion: 1 -# CHECK: Unused: (00 00 00 00 00 00 00) -# CHECK: } -# CHECK: Type: Executable (0x2) -# CHECK: Machine: EM_MIPS (0x8) -# CHECK: Version: 1 -# CHECK: Entry: 0x{{[0-9A-F]+}} -# CHECK: ProgramHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK: SectionHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK: Flags [ (0x50001005) -# CHECK: EF_MIPS_ABI_O32 (0x1000) -# CHECK: EF_MIPS_ARCH_32 (0x50000000) -# CHECK: EF_MIPS_CPIC (0x4) -# CHECK: EF_MIPS_NOREORDER (0x1) -# CHECK: ] -# CHECK: HeaderSize: 52 -# CHECK: ProgramHeaderEntrySize: 32 -# CHECK: ProgramHeaderCount: {{[0-9]+}} -# CHECK: SectionHeaderEntrySize: 40 -# CHECK: SectionHeaderCount: {{[0-9]+}} -# CHECK: StringTableSectionIndex: {{[0-9]+}} -# CHECK: } - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 8 - -Symbols: - Global: - - Name: T0 - Section: .text -... diff --git a/test/old-elf/Mips/exe-fileheader-03.test b/test/old-elf/Mips/exe-fileheader-03.test deleted file mode 100644 index dfe4fcc43e67..000000000000 --- a/test/old-elf/Mips/exe-fileheader-03.test +++ /dev/null @@ -1,72 +0,0 @@ -# Check that LLD set ABIVersion to '3' if it generates executable -# file with FP_64 / FP_64A floating point abi flags. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s - -# CHECK: Format: ELF32-mips -# CHECK: Arch: mipsel -# CHECK: AddressSize: 32bit -# CHECK: LoadName: -# CHECK: ElfHeader { -# CHECK: Ident { -# CHECK: Magic: (7F 45 4C 46) -# CHECK: Class: 32-bit (0x1) -# CHECK: DataEncoding: LittleEndian (0x1) -# CHECK: FileVersion: 1 -# CHECK: OS/ABI: SystemV (0x0) -# CHECK: ABIVersion: 3 -# CHECK: Unused: (00 00 00 00 00 00 00) -# CHECK: } -# CHECK: Type: Executable (0x2) -# CHECK: Machine: EM_MIPS (0x8) -# CHECK: Version: 1 -# CHECK: Entry: 0x{{[0-9A-F]+}} -# CHECK: ProgramHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK: SectionHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK: Flags [ (0x50001005) -# CHECK: EF_MIPS_ABI_O32 (0x1000) -# CHECK: EF_MIPS_ARCH_32 (0x50000000) -# CHECK: EF_MIPS_CPIC (0x4) -# CHECK: EF_MIPS_NOREORDER (0x1) -# CHECK: ] -# CHECK: HeaderSize: 52 -# CHECK: ProgramHeaderEntrySize: 32 -# CHECK: ProgramHeaderCount: {{[0-9]+}} -# CHECK: SectionHeaderEntrySize: 40 -# CHECK: SectionHeaderCount: {{[0-9]+}} -# CHECK: StringTableSectionIndex: {{[0-9]+}} -# CHECK: } - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 8 - - - Name: .MIPS.abiflags - Type: SHT_MIPS_ABIFLAGS - AddressAlign: 8 - ISA: MIPS32 - ISARevision: 1 - ISAExtension: EXT_NONE - FpABI: FP_64 - GPRSize: REG_32 - CPR1Size: REG_64 - -Symbols: - Global: - - Name: T0 - Section: .text -... diff --git a/test/old-elf/Mips/exe-fileheader-64.test b/test/old-elf/Mips/exe-fileheader-64.test deleted file mode 100644 index 20bb43a216d5..000000000000 --- a/test/old-elf/Mips/exe-fileheader-64.test +++ /dev/null @@ -1,66 +0,0 @@ -# Check ELF Header for 64-bit executable file. - -# Build executable -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target mips64el -e glob -o %t.exe %t-o.o -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s - -# CHECK: Format: ELF64-mips -# CHECK: Arch: mips64el -# CHECK: AddressSize: 64bit -# CHECK: LoadName: -# CHECK: ElfHeader { -# CHECK: Ident { -# CHECK: Magic: (7F 45 4C 46) -# CHECK: Class: 64-bit (0x2) -# CHECK: DataEncoding: LittleEndian (0x1) -# CHECK: FileVersion: 1 -# CHECK: OS/ABI: SystemV (0x0) -# CHECK: ABIVersion: 0 -# CHECK: Unused: (00 00 00 00 00 00 00) -# CHECK: } -# CHECK: Type: Executable (0x2) -# CHECK: Machine: EM_MIPS (0x8) -# CHECK: Version: 1 -# CHECK: Entry: 0x{{[0-9A-F]+}} -# CHECK: ProgramHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK: SectionHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK: Flags [ (0x60000007) -# CHECK: EF_MIPS_ARCH_64 (0x60000000) -# CHECK: EF_MIPS_CPIC (0x4) -# CHECK: EF_MIPS_NOREORDER (0x1) -# CHECK: EF_MIPS_PIC (0x2) -# CHECK: ] -# CHECK: HeaderSize: 64 -# CHECK: ProgramHeaderEntrySize: 56 -# CHECK: ProgramHeaderCount: {{[0-9]+}} -# CHECK: SectionHeaderEntrySize: 64 -# CHECK: SectionHeaderCount: {{[0-9]+}} -# CHECK: StringTableSectionIndex: {{[0-9]+}} -# CHECK: } - -# o.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ARCH_64 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: glob - Section: .text -... diff --git a/test/old-elf/Mips/exe-fileheader-be-64.test b/test/old-elf/Mips/exe-fileheader-be-64.test deleted file mode 100644 index 70457fe217c6..000000000000 --- a/test/old-elf/Mips/exe-fileheader-be-64.test +++ /dev/null @@ -1,60 +0,0 @@ -# Check ELF Header for non-pic big-endian 64-bit executable file. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips64 -o %t.exe %t.o -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s - -# CHECK: Format: ELF64-mips -# CHECK: Arch: mips64 -# CHECK: AddressSize: 64bit -# CHECK: LoadName: -# CHECK: ElfHeader { -# CHECK: Ident { -# CHECK: Magic: (7F 45 4C 46) -# CHECK: Class: 64-bit (0x2) -# CHECK: DataEncoding: BigEndian (0x2) -# CHECK: FileVersion: 1 -# CHECK: OS/ABI: SystemV (0x0) -# CHECK: ABIVersion: 0 -# CHECK: Unused: (00 00 00 00 00 00 00) -# CHECK: } -# CHECK: Type: Executable (0x2) -# CHECK: Machine: EM_MIPS (0x8) -# CHECK: Version: 1 -# CHECK: Entry: 0x{{[0-9A-F]+}} -# CHECK: ProgramHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK: SectionHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK: Flags [ (0x60000007) -# CHECK: EF_MIPS_ARCH_64 (0x60000000) -# CHECK: EF_MIPS_CPIC (0x4) -# CHECK: EF_MIPS_NOREORDER (0x1) -# CHECK: EF_MIPS_PIC (0x2) -# CHECK: ] -# CHECK: HeaderSize: 64 -# CHECK: ProgramHeaderEntrySize: 56 -# CHECK: ProgramHeaderCount: {{[0-9]+}} -# CHECK: SectionHeaderEntrySize: 64 -# CHECK: SectionHeaderCount: {{[0-9]+}} -# CHECK: StringTableSectionIndex: {{[0-9]+}} -# CHECK: } - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2MSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 8 - -Symbols: - Global: - - Name: __start - Section: .text -... diff --git a/test/old-elf/Mips/exe-fileheader-be.test b/test/old-elf/Mips/exe-fileheader-be.test deleted file mode 100644 index 292a92e59097..000000000000 --- a/test/old-elf/Mips/exe-fileheader-be.test +++ /dev/null @@ -1,60 +0,0 @@ -# Check ELF Header for non-pic big-endian 32-bit executable file. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips -o %t.exe %t.o -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s - -# CHECK: Format: ELF32-mips -# CHECK: Arch: mips -# CHECK: AddressSize: 32bit -# CHECK: LoadName: -# CHECK: ElfHeader { -# CHECK: Ident { -# CHECK: Magic: (7F 45 4C 46) -# CHECK: Class: 32-bit (0x1) -# CHECK: DataEncoding: BigEndian (0x2) -# CHECK: FileVersion: 1 -# CHECK: OS/ABI: SystemV (0x0) -# CHECK: ABIVersion: 1 -# CHECK: Unused: (00 00 00 00 00 00 00) -# CHECK: } -# CHECK: Type: Executable (0x2) -# CHECK: Machine: EM_MIPS (0x8) -# CHECK: Version: 1 -# CHECK: Entry: 0x{{[0-9A-F]+}} -# CHECK: ProgramHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK: SectionHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK: Flags [ (0x50001005) -# CHECK: EF_MIPS_ABI_O32 (0x1000) -# CHECK: EF_MIPS_ARCH_32 (0x50000000) -# CHECK: EF_MIPS_CPIC (0x4) -# CHECK: EF_MIPS_NOREORDER (0x1) -# CHECK: ] -# CHECK: HeaderSize: 52 -# CHECK: ProgramHeaderEntrySize: 32 -# CHECK: ProgramHeaderCount: {{[0-9]+}} -# CHECK: SectionHeaderEntrySize: 40 -# CHECK: SectionHeaderCount: {{[0-9]+}} -# CHECK: StringTableSectionIndex: {{[0-9]+}} -# CHECK: } - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2MSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 8 - -Symbols: - Global: - - Name: __start - Section: .text -... diff --git a/test/old-elf/Mips/exe-fileheader-micro-64.test b/test/old-elf/Mips/exe-fileheader-micro-64.test deleted file mode 100644 index a37d2d710637..000000000000 --- a/test/old-elf/Mips/exe-fileheader-micro-64.test +++ /dev/null @@ -1,68 +0,0 @@ -# Check ELF Header for 64-bit executable file in case of microMIPS entry symbol. - -# Build executable -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target mips64el -e glob -o %t.exe %t-o.o -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s - -# CHECK: Format: ELF64-mips -# CHECK: Arch: mips64el -# CHECK: AddressSize: 64bit -# CHECK: LoadName: -# CHECK: ElfHeader { -# CHECK: Ident { -# CHECK: Magic: (7F 45 4C 46) -# CHECK: Class: 64-bit (0x2) -# CHECK: DataEncoding: LittleEndian (0x1) -# CHECK: FileVersion: 1 -# CHECK: OS/ABI: SystemV (0x0) -# CHECK: ABIVersion: 0 -# CHECK: Unused: (00 00 00 00 00 00 00) -# CHECK: } -# CHECK: Type: Executable (0x2) -# CHECK: Machine: EM_MIPS (0x8) -# CHECK: Version: 1 -# CHECK: Entry: 0x{{[0-9A-F]+}} -# CHECK: ProgramHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK: SectionHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK: Flags [ (0x82000007) -# CHECK: EF_MIPS_ARCH_64R2 (0x80000000) -# CHECK: EF_MIPS_CPIC (0x4) -# CHECK: EF_MIPS_MICROMIPS (0x2000000) -# CHECK: EF_MIPS_NOREORDER (0x1) -# CHECK: EF_MIPS_PIC (0x2) -# CHECK: ] -# CHECK: HeaderSize: 64 -# CHECK: ProgramHeaderEntrySize: 56 -# CHECK: ProgramHeaderCount: 6 -# CHECK: SectionHeaderEntrySize: 64 -# CHECK: SectionHeaderCount: 12 -# CHECK: StringTableSectionIndex: 9 -# CHECK: } - -# o.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_MICROMIPS, EF_MIPS_ARCH_64R2 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: glob - Section: .text - Other: [ STO_MIPS_MICROMIPS ] -... diff --git a/test/old-elf/Mips/exe-fileheader-micro.test b/test/old-elf/Mips/exe-fileheader-micro.test deleted file mode 100644 index 0adaf5b17373..000000000000 --- a/test/old-elf/Mips/exe-fileheader-micro.test +++ /dev/null @@ -1,69 +0,0 @@ -# Check ELF Header for non-pic executable file in case -# of microMIPS entry symbol. - -# Build executable -# RUN: yaml2obj -format=elf %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e glob -o %t.exe %t-o.o -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s - -# CHECK: Format: ELF32-mips -# CHECK-NEXT: Arch: mipsel -# CHECK-NEXT: AddressSize: 32bit -# CHECK-NEXT: LoadName: -# CHECK-NEXT: ElfHeader { -# CHECK-NEXT: Ident { -# CHECK-NEXT: Magic: (7F 45 4C 46) -# CHECK-NEXT: Class: 32-bit (0x1) -# CHECK-NEXT: DataEncoding: LittleEndian (0x1) -# CHECK-NEXT: FileVersion: 1 -# CHECK-NEXT: OS/ABI: SystemV (0x0) -# CHECK-NEXT: ABIVersion: 1 -# CHECK-NEXT: Unused: (00 00 00 00 00 00 00) -# CHECK-NEXT: } -# CHECK-NEXT: Type: Executable (0x2) -# CHECK-NEXT: Machine: EM_MIPS (0x8) -# CHECK-NEXT: Version: 1 -# CHECK-NEXT: Entry: 0x{{[0-9A-F]+[13579bdf]}} -# CHECK-NEXT: ProgramHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK-NEXT: SectionHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK-NEXT: Flags [ (0x72001005) -# CHECK-NEXT: EF_MIPS_ABI_O32 (0x1000) -# CHECK-NEXT: EF_MIPS_ARCH_32R2 (0x70000000) -# CHECK-NEXT: EF_MIPS_CPIC (0x4) -# CHECK-NEXT: EF_MIPS_MICROMIPS (0x2000000) -# CHECK-NEXT: EF_MIPS_NOREORDER (0x1) -# CHECK-NEXT: ] -# CHECK-NEXT: HeaderSize: 52 -# CHECK-NEXT: ProgramHeaderEntrySize: 32 -# CHECK-NEXT: ProgramHeaderCount: 6 -# CHECK-NEXT: SectionHeaderEntrySize: 40 -# CHECK-NEXT: SectionHeaderCount: 12 -# CHECK-NEXT: StringTableSectionIndex: 9 -# CHECK-NEXT: } - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: glob - Section: .text - Other: [ STO_MIPS_MICROMIPS ] -... diff --git a/test/old-elf/Mips/exe-fileheader-n32.test b/test/old-elf/Mips/exe-fileheader-n32.test deleted file mode 100644 index f6a1725b4443..000000000000 --- a/test/old-elf/Mips/exe-fileheader-n32.test +++ /dev/null @@ -1,65 +0,0 @@ -# Check ELF Header for N32 ABI executable file. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -o %t.exe %t.o -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s - -# CHECK: Format: ELF32-mips -# CHECK-NEXT: Arch: mipsel -# CHECK-NEXT: AddressSize: 32bit -# CHECK-NEXT: LoadName: -# CHECK-NEXT: ElfHeader { -# CHECK-NEXT: Ident { -# CHECK-NEXT: Magic: (7F 45 4C 46) -# CHECK-NEXT: Class: 32-bit -# CHECK-NEXT: DataEncoding: LittleEndian -# CHECK-NEXT: FileVersion: 1 -# CHECK-NEXT: OS/ABI: SystemV -# CHECK-NEXT: ABIVersion: 0 -# CHECK-NEXT: Unused: (00 00 00 00 00 00 00) -# CHECK-NEXT: } -# CHECK-NEXT: Type: Executable -# CHECK-NEXT: Machine: EM_MIPS -# CHECK-NEXT: Version: 1 -# CHECK-NEXT: Entry: 0x10000130 -# CHECK-NEXT: ProgramHeaderOffset: 0x34 -# CHECK-NEXT: SectionHeaderOffset: 0x22C0 -# CHECK-NEXT: Flags [ (0x60000027) -# CHECK-NEXT: EF_MIPS_ABI2 -# CHECK-NEXT: EF_MIPS_ARCH_64 -# CHECK-NEXT: EF_MIPS_CPIC -# CHECK-NEXT: EF_MIPS_NOREORDER -# CHECK-NEXT: EF_MIPS_PIC -# CHECK-NEXT: ] -# CHECK-NEXT: HeaderSize: 52 -# CHECK-NEXT: ProgramHeaderEntrySize: 32 -# CHECK-NEXT: ProgramHeaderCount: {{[0-9]+}} -# CHECK-NEXT: SectionHeaderEntrySize: 40 -# CHECK-NEXT: SectionHeaderCount: {{[0-9]+}} -# CHECK-NEXT: StringTableSectionIndex: {{[0-9]+}} -# CHECK-NEXT: } - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI2, EF_MIPS_ARCH_64 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Size: 8 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: __start - Section: .text -... diff --git a/test/old-elf/Mips/exe-fileheader.test b/test/old-elf/Mips/exe-fileheader.test deleted file mode 100644 index 0188a682b3fb..000000000000 --- a/test/old-elf/Mips/exe-fileheader.test +++ /dev/null @@ -1,105 +0,0 @@ -# Check ELF Header for non-pic executable file. - -# Build shared library -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o - -# Build executable -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e glob -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s - -# CHECK: Format: ELF32-mips -# CHECK: Arch: mipsel -# CHECK: AddressSize: 32bit -# CHECK: LoadName: -# CHECK: ElfHeader { -# CHECK: Ident { -# CHECK: Magic: (7F 45 4C 46) -# CHECK: Class: 32-bit (0x1) -# CHECK: DataEncoding: LittleEndian (0x1) -# CHECK: FileVersion: 1 -# CHECK: OS/ABI: SystemV (0x0) -# CHECK: ABIVersion: 1 -# CHECK: Unused: (00 00 00 00 00 00 00) -# CHECK: } -# CHECK: Type: Executable (0x2) -# CHECK: Machine: EM_MIPS (0x8) -# CHECK: Version: 1 -# CHECK: Entry: 0x{{[0-9A-F]+}} -# CHECK: ProgramHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK: SectionHeaderOffset: 0x{{[0-9A-F]+}} -# CHECK: Flags [ (0x50001005) -# CHECK: EF_MIPS_ABI_O32 (0x1000) -# CHECK: EF_MIPS_ARCH_32 (0x50000000) -# CHECK: EF_MIPS_CPIC (0x4) -# CHECK: EF_MIPS_NOREORDER (0x1) -# CHECK: ] -# CHECK: HeaderSize: 52 -# CHECK: ProgramHeaderEntrySize: 32 -# CHECK: ProgramHeaderCount: {{[0-9]+}} -# CHECK: SectionHeaderEntrySize: 40 -# CHECK: SectionHeaderCount: {{[0-9]+}} -# CHECK: StringTableSectionIndex: {{[0-9]+}} -# CHECK: } - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_26 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: glob - Section: .text - - Name: T1 -... diff --git a/test/old-elf/Mips/exe-got-micro.test b/test/old-elf/Mips/exe-got-micro.test deleted file mode 100644 index 7b3a919880de..000000000000 --- a/test/old-elf/Mips/exe-got-micro.test +++ /dev/null @@ -1,115 +0,0 @@ -# Check that external symbol defined in the executable file -# and referenced by R_MICROMIPS_CALL16 relocation has a corresponded -# entry in the local GOT section. -# -# Build shared library -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o - -# Build executable -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e glob \ -# RUN: --output-filetype=yaml -o %t.exe %t-o.o %t.so -# RUN: FileCheck -check-prefix=GOT %s < %t.exe - -# GOT header -# GOT: - type: got -# GOT: content: [ 00, 00, 00, 00 ] -# GOT: alignment: 4 -# GOT: section-choice: custom-required -# GOT: section-name: .got -# GOT: permissions: rw- -# GOT: - type: got -# GOT: content: [ 00, 00, 00, 80 ] -# GOT: alignment: 4 -# GOT: section-choice: custom-required -# GOT: section-name: .got -# GOT: permissions: rw- -# Local GOT entry for 'glob' symbol -# GOT: - ref-name: L000 -# GOT: type: got -# GOT: content: [ 00, 00, 00, 00 ] -# GOT: alignment: 4 -# GOT: section-choice: custom-required -# GOT: section-name: .got -# GOT: permissions: rw- -# GOT: references: -# GOT: - kind: R_MIPS_32 -# GOT: offset: 0 -# GOT: target: glob -# Global GOT entry for 'T1' symbol -# GOT: - ref-name: L001 -# GOT: type: got -# GOT: content: [ 00, 00, 00, 00 ] -# GOT: alignment: 4 -# GOT: section-choice: custom-required -# GOT: section-name: .got -# GOT: permissions: rw- -# GOT: references: -# GOT: - kind: LLD_R_MIPS_GLOBAL_GOT -# GOT: offset: 0 -# GOT: target: T1 - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: glob - Type: R_MICROMIPS_CALL16 - - Offset: 0x04 - Symbol: T1 - Type: R_MICROMIPS_CALL16 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: glob - Section: .text - Other: [ STO_MIPS_MICROMIPS ] - - Name: T1 -... diff --git a/test/old-elf/Mips/exe-got.test b/test/old-elf/Mips/exe-got.test deleted file mode 100644 index 636de16b4202..000000000000 --- a/test/old-elf/Mips/exe-got.test +++ /dev/null @@ -1,116 +0,0 @@ -# Check that external symbol defined in the executable file -# and referenced by R_MIPS_CALL16 relocation has a corresponded -# entry in the local GOT section. -# -# Build shared library -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o - -# Build executable -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e glob \ -# RUN: --output-filetype=yaml -o %t.exe %t-o.o %t.so -# RUN: FileCheck -check-prefix=GOT %s < %t.exe - -# GOT header -# GOT: - type: got -# GOT: content: [ 00, 00, 00, 00 ] -# GOT: alignment: 4 -# GOT: section-choice: custom-required -# GOT: section-name: .got -# GOT: permissions: rw- -# GOT: - type: got -# GOT: content: [ 00, 00, 00, 80 ] -# GOT: alignment: 4 -# GOT: section-choice: custom-required -# GOT: section-name: .got -# GOT: permissions: rw- -# Local GOT entry for 'glob' symbol -# GOT: - ref-name: L000 -# GOT: type: got -# GOT: content: [ 00, 00, 00, 00 ] -# GOT: alignment: 4 -# GOT: section-choice: custom-required -# GOT: section-name: .got -# GOT: permissions: rw- -# GOT: references: -# GOT: - kind: R_MIPS_32 -# GOT: offset: 0 -# GOT: target: glob -# Global GOT entry for 'T1' symbol -# GOT: - ref-name: L001 -# GOT: type: got -# GOT: content: [ 00, 00, 00, 00 ] -# GOT: alignment: 4 -# GOT: section-choice: custom-required -# GOT: section-name: .got -# GOT: permissions: rw- -# GOT: references: -# GOT: - kind: LLD_R_MIPS_GLOBAL_GOT -# GOT: offset: 0 -# GOT: target: T1 - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: glob - Type: R_MIPS_CALL16 - Addend: 0 - - Offset: 0x04 - Symbol: T1 - Type: R_MIPS_CALL16 - Addend: 0 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: glob - Section: .text - - Name: T1 -... diff --git a/test/old-elf/Mips/got-page-32-micro.test b/test/old-elf/Mips/got-page-32-micro.test deleted file mode 100644 index 5457ab9f1879..000000000000 --- a/test/old-elf/Mips/got-page-32-micro.test +++ /dev/null @@ -1,251 +0,0 @@ -# Check handling of R_MICROMIPS_GOT_DISP / PAGE / OFST relocations -# in case of O32 ABI. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -symbols -dyn-symbols -mips-plt-got %t.exe \ -# RUN: | FileCheck -check-prefix=GOT %s -# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=RAW %s - -# GOT: Symbol { -# GOT: Name: LT3 -# GOT-NEXT: Value: 0x[[LT3:[0-9A-F]+]] -# GOT: Symbol { -# GOT: Name: LT4 -# GOT-NEXT: Value: 0x{{[0-9A-F]+}} -# GOT: Symbol { -# GOT: Name: T0 -# GOT-NEXT: Value: 0x{{[0-9A-F]+}} -# GOT: Symbol { -# GOT: Name: LT1 -# GOT-NEXT: Value: 0x[[LT1:[0-9A-F]+]] -# GOT: Symbol { -# GOT: Name: LT2 -# GOT-NEXT: Value: 0x{{[0-9A-F]+}} -# GOT: Symbol { -# GOT: Name: T1@ -# GOT-NEXT: Value: 0x0 -# GOT: Symbol { -# GOT: Name: T2@ -# GOT-NEXT: Value: 0x0 - -# GOT: Primary GOT { -# GOT-NEXT: Canonical gp value: 0x408FF0 -# GOT-NEXT: Reserved entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401000 -# GOT-NEXT: Access: -32752 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Purpose: Lazy resolver -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401004 -# GOT-NEXT: Access: -32748 -# GOT-NEXT: Initial: 0x80000000 -# GOT-NEXT: Purpose: Module pointer (GNU extension) -# GOT-NEXT: } -# GOT-NEXT: ] -# GOT-NEXT: Local entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401008 -# GOT-NEXT: Access: -32744 -# GOT-NEXT: Initial: 0x[[LT1]] -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x40100C -# GOT-NEXT: Access: -32740 -# GOT-NEXT: Initial: 0x400000 -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401010 -# GOT-NEXT: Access: -32736 -# GOT-NEXT: Initial: 0x400000 -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401014 -# GOT-NEXT: Access: -32732 -# GOT-NEXT: Initial: 0x[[LT3]] -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401018 -# GOT-NEXT: Access: -32728 -# GOT-NEXT: Initial: 0x400000 -# GOT-NEXT: } -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x40101C -# GOT-NEXT: Access: -32724 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T1@ -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401020 -# GOT-NEXT: Access: -32720 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T2@ -# GOT-NEXT: } -# GOT-NEXT: ] -# GOT-NEXT: Number of TLS and multi-GOT entries: 0 -# GOT-NEXT: } - -# RAW: Contents of section .text: -# RAW-NEXT: {{[0-9a-f]+}} 00002c80 00001880 00002c80 00003080 -# ^ = -32724 (T1) -# ^ = -32744 (LT1) -# ^ -32724 (T1) -# ^ -32720 (T2) -# RAW-NEXT: {{[0-9a-f]+}} 00001c80 00002080 00000000 00000000 -# ^ -32740 (PAGE) -# ^ -32736 (PAGE) -# ^ T1 OFST -# ^ T2 OFST -# RAW-NEXT: {{[0-9a-f]+}} 0000a501 0000a901 00002480 00002880 -# ^ LT1 OFST -# ^ LT2 OFST -# ^ = -32732 (LT3) -# ^ -32728 (PAGE) -# RAW-NEXT: {{[0-9a-f]+}} 0000b101 00000000 -# ^ LT4 OFST - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ARCH_32R2, EF_MIPS_ABI_O32, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 0x4 - Other: [STO_MIPS_MICROMIPS] - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 0x4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ARCH_32R2, EF_MIPS_ABI_O32, EF_MIPS_MICROMIPS] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x4 - Size: 0x38 - - - Name: .rel.text - Type: SHT_RELA - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0x0 - Symbol: T1 - Type: R_MICROMIPS_GOT_DISP - - Offset: 0x4 - Symbol: LT1 - Type: R_MICROMIPS_GOT_DISP - - Offset: 0x8 - Symbol: T1 - Type: R_MICROMIPS_GOT_PAGE - - Offset: 0xC - Symbol: T2 - Type: R_MICROMIPS_GOT_PAGE - - Offset: 0x10 - Symbol: LT1 - Type: R_MICROMIPS_GOT_PAGE - - Offset: 0x14 - Symbol: LT2 - Type: R_MICROMIPS_GOT_PAGE - - Offset: 0x18 - Symbol: T1 - Type: R_MICROMIPS_GOT_OFST - - Offset: 0x1C - Symbol: T2 - Type: R_MICROMIPS_GOT_OFST - - Offset: 0x20 - Symbol: LT1 - Type: R_MICROMIPS_GOT_OFST - - Offset: 0x24 - Symbol: LT2 - Type: R_MICROMIPS_GOT_OFST - - Offset: 0x28 - Symbol: LT3 - Type: R_MICROMIPS_GOT_DISP - - Offset: 0x2C - Symbol: LT4 - Type: R_MICROMIPS_GOT_PAGE - - Offset: 0x30 - Symbol: LT4 - Type: R_MICROMIPS_GOT_OFST - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: LT3 - Type: STT_FUNC - Section: .text - Value: 0x30 - Size: 0x4 - Other: [STO_MIPS_MICROMIPS] - - Name: LT4 - Type: STT_FUNC - Section: .text - Value: 0x34 - Size: 0x4 - Other: [STO_MIPS_MICROMIPS] - - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 0x8 - Other: [STO_MIPS_MICROMIPS] - - Name: LT1 - Type: STT_FUNC - Section: .text - Value: 0x28 - Size: 0x4 - Other: [STO_MIPS_MICROMIPS] - - Name: LT2 - Type: STT_FUNC - Section: .text - Value: 0x2c - Size: 0x4 - Other: [STO_MIPS_MICROMIPS] - - Name: T1 - - Name: T2 -... diff --git a/test/old-elf/Mips/got-page-32.test b/test/old-elf/Mips/got-page-32.test deleted file mode 100644 index 44f45536d501..000000000000 --- a/test/old-elf/Mips/got-page-32.test +++ /dev/null @@ -1,244 +0,0 @@ -# Check handling of R_MIPS_GOT_DISP / PAGE / OFST relocations. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -symbols -dyn-symbols -mips-plt-got %t.exe \ -# RUN: | FileCheck -check-prefix=GOT %s -# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=RAW %s - -# GOT: Symbol { -# GOT: Name: LT3 (12) -# GOT-NEXT: Value: 0x[[LT3:[0-9A-F]+]] -# GOT: Symbol { -# GOT: Name: LT4 (16) -# GOT-NEXT: Value: 0x{{[0-9A-F]+}} -# GOT: Symbol { -# GOT: Name: T0 (1) -# GOT-NEXT: Value: 0x{{[0-9A-F]+}} -# GOT: Symbol { -# GOT: Name: LT1 (4) -# GOT-NEXT: Value: 0x[[LT1:[0-9A-F]+]] -# GOT: Symbol { -# GOT: Name: LT2 (8) -# GOT-NEXT: Value: 0x{{[0-9A-F]+}} -# GOT: Symbol { -# GOT: Name: T1@ (1) -# GOT-NEXT: Value: 0x0 -# GOT: Symbol { -# GOT: Name: T2@ (4) -# GOT-NEXT: Value: 0x0 - -# GOT: Primary GOT { -# GOT-NEXT: Canonical gp value: 0x408FF0 -# GOT-NEXT: Reserved entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401000 -# GOT-NEXT: Access: -32752 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Purpose: Lazy resolver -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401004 -# GOT-NEXT: Access: -32748 -# GOT-NEXT: Initial: 0x80000000 -# GOT-NEXT: Purpose: Module pointer (GNU extension) -# GOT-NEXT: } -# GOT-NEXT: ] -# GOT-NEXT: Local entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401008 -# GOT-NEXT: Access: -32744 -# GOT-NEXT: Initial: 0x[[LT1]] -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x40100C -# GOT-NEXT: Access: -32740 -# GOT-NEXT: Initial: 0x400000 -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401010 -# GOT-NEXT: Access: -32736 -# GOT-NEXT: Initial: 0x400000 -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401014 -# GOT-NEXT: Access: -32732 -# GOT-NEXT: Initial: 0x[[LT3]] -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401018 -# GOT-NEXT: Access: -32728 -# GOT-NEXT: Initial: 0x400000 -# GOT-NEXT: } -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x40101C -# GOT-NEXT: Access: -32724 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T1@ (1) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401020 -# GOT-NEXT: Access: -32720 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T2@ (4) -# GOT-NEXT: } -# GOT-NEXT: ] -# GOT-NEXT: Number of TLS and multi-GOT entries: 0 -# GOT-NEXT: } - -# RAW: Contents of section .text: -# RAW-NEXT: {{[0-9a-f]+}} 2c800000 18800000 2c800000 30800000 -# ^ = -32724 (T1) -# ^ = -32744 (LT1) -# ^ -32724 (T1) -# ^ -32720 (T2) -# RAW-NEXT: {{[0-9a-f]+}} 1c800000 20800000 00000000 00000000 -# ^ -32740 (PAGE) -# ^ -32736 (PAGE) -# ^ T1 OFST -# ^ T2 OFST -# RAW-NEXT: {{[0-9a-f]+}} 9c010000 a0010000 24800000 28800000 -# ^ LT1 OFST -# ^ LT2 OFST -# ^ = -32732 (LT3) -# ^ -32728 (PAGE) -# RAW-NEXT: {{[0-9a-f]+}} a8010000 00000000 -# ^ LT4 OFST - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ARCH_32, EF_MIPS_ABI_O32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 0x4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 0x4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ARCH_32, EF_MIPS_ABI_O32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x4 - Size: 0x38 - - - Name: .rel.text - Type: SHT_RELA - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0x0 - Symbol: T1 - Type: R_MIPS_GOT_DISP - - Offset: 0x4 - Symbol: LT1 - Type: R_MIPS_GOT_DISP - - Offset: 0x8 - Symbol: T1 - Type: R_MIPS_GOT_PAGE - - Offset: 0xC - Symbol: T2 - Type: R_MIPS_GOT_PAGE - - Offset: 0x10 - Symbol: LT1 - Type: R_MIPS_GOT_PAGE - - Offset: 0x14 - Symbol: LT2 - Type: R_MIPS_GOT_PAGE - - Offset: 0x18 - Symbol: T1 - Type: R_MIPS_GOT_OFST - - Offset: 0x1C - Symbol: T2 - Type: R_MIPS_GOT_OFST - - Offset: 0x20 - Symbol: LT1 - Type: R_MIPS_GOT_OFST - - Offset: 0x24 - Symbol: LT2 - Type: R_MIPS_GOT_OFST - - Offset: 0x28 - Symbol: LT3 - Type: R_MIPS_GOT_DISP - - Offset: 0x2C - Symbol: LT4 - Type: R_MIPS_GOT_PAGE - - Offset: 0x30 - Symbol: LT4 - Type: R_MIPS_GOT_OFST - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: LT3 - Type: STT_FUNC - Section: .text - Value: 0x30 - Size: 0x4 - - Name: LT4 - Type: STT_FUNC - Section: .text - Value: 0x34 - Size: 0x4 - - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 0x8 - - Name: LT1 - Type: STT_FUNC - Section: .text - Value: 0x28 - Size: 0x4 - - Name: LT2 - Type: STT_FUNC - Section: .text - Value: 0x2c - Size: 0x4 - - Name: T1 - - Name: T2 -... diff --git a/test/old-elf/Mips/got-page-64-micro.test b/test/old-elf/Mips/got-page-64-micro.test deleted file mode 100644 index 37bae77001e4..000000000000 --- a/test/old-elf/Mips/got-page-64-micro.test +++ /dev/null @@ -1,210 +0,0 @@ -# Check handling of R_MICROMIPS_GOT_DISP / PAGE / OFST relocations -# in case of N64 ABI. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mips64el -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -symbols -dyn-symbols -mips-plt-got %t.exe \ -# RUN: | FileCheck -check-prefix=GOT %s -# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=RAW %s - -# GOT: Symbol { -# GOT: Name: T0 -# GOT-NEXT: Value: 0x{{[0-9A-F]+}} -# GOT: Symbol { -# GOT: Name: LT1 -# GOT-NEXT: Value: 0x[[LT1:[0-9A-F]+]] -# GOT: Symbol { -# GOT: Name: LT2 -# GOT-NEXT: Value: 0x{{[0-9A-F]+}} -# GOT: Symbol { -# GOT: Name: T1@ -# GOT-NEXT: Value: 0x0 -# GOT: Symbol { -# GOT: Name: T2@ -# GOT-NEXT: Value: 0x0 - -# GOT: Primary GOT { -# GOT-NEXT: Canonical gp value: 0x120008FF0 -# GOT-NEXT: Reserved entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x120001000 -# GOT-NEXT: Access: -32752 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Purpose: Lazy resolver -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x120001008 -# GOT-NEXT: Access: -32744 -# GOT-NEXT: Initial: 0x8000000000000000 -# GOT-NEXT: Purpose: Module pointer (GNU extension) -# GOT-NEXT: } -# GOT-NEXT: ] -# GOT-NEXT: Local entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x120001010 -# GOT-NEXT: Access: -32736 -# GOT-NEXT: Initial: 0x[[LT1]] -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x120001018 -# GOT-NEXT: Access: -32728 -# GOT-NEXT: Initial: 0x120000000 -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x120001020 -# GOT-NEXT: Access: -32720 -# GOT-NEXT: Initial: 0x120000000 -# GOT-NEXT: } -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x120001028 -# GOT-NEXT: Access: -32712 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T1@ -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x120001030 -# GOT-NEXT: Access: -32704 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T2@ -# GOT-NEXT: } -# GOT-NEXT: ] -# GOT-NEXT: Number of TLS and multi-GOT entries: 0 -# GOT-NEXT: } - -# RAW: Contents of section .text: -# RAW-NEXT: {{[0-9a-f]+}} 38800000 20800000 38800000 40800000 -# ^ = -32712 (T1) -# ^ = -32736 (LT1) -# ^ -32712 (T1) -# ^ -32704 (T2) -# RAW-NEXT: {{[0-9a-f]+}} 28800000 30800000 00000000 00000000 -# ^ -32728 (PAGE) -# ^ -32720 (PAGE) -# ^ T1 OFST -# ^ T2 OFST -# RAW-NEXT: {{[0-9a-f]+}} 59020000 5d020000 00000000 00000000 -# ^ LT1 OFST -# ^ LT2 OFST - -# so.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ARCH_64R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 0x4 - Other: [STO_MIPS_MICROMIPS] - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 0x4 - -# o.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ARCH_64R2, EF_MIPS_MICROMIPS] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x4 - Size: 0x30 - - - Name: .rel.text - Type: SHT_RELA - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0x0 - Symbol: T1 - Type: R_MIPS_GOT_DISP - - Offset: 0x4 - Symbol: LT1 - Type: R_MIPS_GOT_DISP - - Offset: 0x8 - Symbol: T1 - Type: R_MIPS_GOT_PAGE - - Offset: 0xC - Symbol: T2 - Type: R_MIPS_GOT_PAGE - - Offset: 0x10 - Symbol: LT1 - Type: R_MIPS_GOT_PAGE - - Offset: 0x14 - Symbol: LT2 - Type: R_MIPS_GOT_PAGE - - Offset: 0x18 - Symbol: T1 - Type: R_MIPS_GOT_OFST - - Offset: 0x1C - Symbol: T2 - Type: R_MIPS_GOT_OFST - - Offset: 0x20 - Symbol: LT1 - Type: R_MIPS_GOT_OFST - - Offset: 0x24 - Symbol: LT2 - Type: R_MIPS_GOT_OFST - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 0x8 - Other: [STO_MIPS_MICROMIPS] - - Name: LT1 - Type: STT_FUNC - Section: .text - Value: 0x28 - Size: 0x4 - Other: [STO_MIPS_MICROMIPS] - - Name: LT2 - Type: STT_FUNC - Section: .text - Value: 0x2c - Size: 0x4 - Other: [STO_MIPS_MICROMIPS] - - Name: T1 - - Name: T2 -... diff --git a/test/old-elf/Mips/got-page-64.test b/test/old-elf/Mips/got-page-64.test deleted file mode 100644 index 3c6ef57c78f5..000000000000 --- a/test/old-elf/Mips/got-page-64.test +++ /dev/null @@ -1,203 +0,0 @@ -# Check handling of R_MIPS_GOT_DISP / PAGE / OFST relocations. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mips64el -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -symbols -dyn-symbols -mips-plt-got %t.exe \ -# RUN: | FileCheck -check-prefix=GOT %s -# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=RAW %s - -# GOT: Symbol { -# GOT: Name: T0 (1) -# GOT-NEXT: Value: 0x{{[0-9A-F]+}} -# GOT: Symbol { -# GOT: Name: LT1 (4) -# GOT-NEXT: Value: 0x[[LT1:[0-9A-F]+]] -# GOT: Symbol { -# GOT: Name: LT2 (8) -# GOT-NEXT: Value: 0x{{[0-9A-F]+}} -# GOT: Symbol { -# GOT: Name: T1@ (1) -# GOT-NEXT: Value: 0x0 -# GOT: Symbol { -# GOT: Name: T2@ (4) -# GOT-NEXT: Value: 0x0 - -# GOT: Primary GOT { -# GOT-NEXT: Canonical gp value: 0x120008FF0 -# GOT-NEXT: Reserved entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x120001000 -# GOT-NEXT: Access: -32752 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Purpose: Lazy resolver -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x120001008 -# GOT-NEXT: Access: -32744 -# GOT-NEXT: Initial: 0x8000000000000000 -# GOT-NEXT: Purpose: Module pointer (GNU extension) -# GOT-NEXT: } -# GOT-NEXT: ] -# GOT-NEXT: Local entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x120001010 -# GOT-NEXT: Access: -32736 -# GOT-NEXT: Initial: 0x[[LT1]] -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x120001018 -# GOT-NEXT: Access: -32728 -# GOT-NEXT: Initial: 0x120000000 -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x120001020 -# GOT-NEXT: Access: -32720 -# GOT-NEXT: Initial: 0x120000000 -# GOT-NEXT: } -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x120001028 -# GOT-NEXT: Access: -32712 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T1@ (1) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x120001030 -# GOT-NEXT: Access: -32704 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T2@ (4) -# GOT-NEXT: } -# GOT-NEXT: ] -# GOT-NEXT: Number of TLS and multi-GOT entries: 0 -# GOT-NEXT: } - -# RAW: Contents of section .text: -# RAW-NEXT: {{[0-9a-f]+}} 38800000 20800000 38800000 40800000 -# ^ = -32712 (T1) -# ^ = -32736 (LT1) -# ^ -32712 (T1) -# ^ -32704 (T2) -# RAW-NEXT: {{[0-9a-f]+}} 28800000 30800000 00000000 00000000 -# ^ -32728 (PAGE) -# ^ -32720 (PAGE) -# ^ T1 OFST -# ^ T2 OFST -# RAW-NEXT: {{[0-9a-f]+}} 50020000 54020000 00000000 00000000 -# ^ LT1 OFST -# ^ LT2 OFST - -# so.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 0x4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 0x4 - -# o.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x4 - Size: 0x30 - - - Name: .rel.text - Type: SHT_RELA - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0x0 - Symbol: T1 - Type: R_MIPS_GOT_DISP - - Offset: 0x4 - Symbol: LT1 - Type: R_MIPS_GOT_DISP - - Offset: 0x8 - Symbol: T1 - Type: R_MIPS_GOT_PAGE - - Offset: 0xC - Symbol: T2 - Type: R_MIPS_GOT_PAGE - - Offset: 0x10 - Symbol: LT1 - Type: R_MIPS_GOT_PAGE - - Offset: 0x14 - Symbol: LT2 - Type: R_MIPS_GOT_PAGE - - Offset: 0x18 - Symbol: T1 - Type: R_MIPS_GOT_OFST - - Offset: 0x1C - Symbol: T2 - Type: R_MIPS_GOT_OFST - - Offset: 0x20 - Symbol: LT1 - Type: R_MIPS_GOT_OFST - - Offset: 0x24 - Symbol: LT2 - Type: R_MIPS_GOT_OFST - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 0x8 - - Name: LT1 - Type: STT_FUNC - Section: .text - Value: 0x28 - Size: 0x4 - - Name: LT2 - Type: STT_FUNC - Section: .text - Value: 0x2c - Size: 0x4 - - Name: T1 - - Name: T2 -... diff --git a/test/old-elf/Mips/got16-2.test b/test/old-elf/Mips/got16-2.test deleted file mode 100644 index 01f11a5920cd..000000000000 --- a/test/old-elf/Mips/got16-2.test +++ /dev/null @@ -1,73 +0,0 @@ -# Check handling of R_MIPS_GOT16 relocation against local -# symbols when addresses of local data cross 64 KBytes border. - -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t-exe %t-obj -# RUN: llvm-objdump -s %t-exe | FileCheck %s - -# CHECK: Contents of section .got: -# CHECK-NEXT: 40a000 00000000 00000080 00004000 00004100 ..........@...A. -# lazy module 0x400000 0x410000 -# resolver pointer for L1 for L2 - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Content: '00000000000000000000000000000000' - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - Info: .text - AddressAlign: 0x04 - Address: 0x1000 - Relocations: - - Offset: 0 - Symbol: L1 - Type: R_MIPS_GOT16 - - Offset: 4 - Symbol: L1 - Type: R_MIPS_LO16 - - Offset: 8 - Symbol: L2 - Type: R_MIPS_GOT16 - - Offset: 12 - Symbol: L2 - Type: R_MIPS_LO16 - - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x04 - Size: 0x9000 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: L1 - Type: STT_OBJECT - Section: .data - Value: 0x00 - Size: 0x8000 - - Name: L2 - Type: STT_OBJECT - Section: .data - Value: 0x8000 - Size: 0x04 - - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 0x04 diff --git a/test/old-elf/Mips/got16-micro.test b/test/old-elf/Mips/got16-micro.test deleted file mode 100644 index 25de08e95c4e..000000000000 --- a/test/old-elf/Mips/got16-micro.test +++ /dev/null @@ -1,165 +0,0 @@ -# REQUIRES: mips - -# Check handling of global/local R_MICROMIPS_GOT16 relocations. -# RUN: llvm-mc -triple=mipsel -mattr=micromips -relocation-model=pic \ -# RUN: -filetype=obj -o=%t.o %s -# RUN: lld -flavor old-gnu -target mipsel -shared --noinhibit-exec \ -# RUN: --output-filetype=yaml %t.o \ -# RUN: | FileCheck -check-prefix YAML %s -# RUN: lld -flavor old-gnu -target mipsel -shared --noinhibit-exec -o %t2 %t.o -# RUN: llvm-objdump -t -disassemble -mattr=micromips %t2 \ -# RUN: | FileCheck -check-prefix RAW %s - -# Function glob -# YAML: - name: main -# YAML: scope: global -# YAML: content: [ 5C, FC, 00, 00, 42, 30, 00, 00, 5C, FC, 00, 00, -# YAML: 42, 30, 00, 00, 5C, FC, 00, 00, 5C, FC, 00, 00, -# YAML: 5C, FC, 00, 00 ] -# YAML: alignment: 4 mod 16 -# YAML: code-model: mips-micro -# YAML: references: -# YAML-NEXT: - kind: R_MICROMIPS_GOT16 -# YAML-NEXT: offset: 0 -# YAML-NEXT: target: L000 -# YAML-NEXT: - kind: R_MICROMIPS_LO16 -# YAML-NEXT: offset: 4 -# YAML-NEXT: target: data_1 -# YAML-NEXT: - kind: R_MICROMIPS_GOT16 -# YAML-NEXT: offset: 8 -# YAML-NEXT: target: L001 -# YAML-NEXT: - kind: R_MICROMIPS_LO16 -# YAML-NEXT: offset: 12 -# YAML-NEXT: target: data_2 -# YAML-NEXT: - kind: R_MICROMIPS_GOT16 -# YAML-NEXT: offset: 16 -# YAML-NEXT: target: L002 -# YAML-NEXT: - kind: R_MICROMIPS_CALL16 -# YAML-NEXT: offset: 20 -# YAML-NEXT: target: L003 -# YAML-NEXT: - kind: R_MICROMIPS_CALL16 -# YAML-NEXT: offset: 24 -# YAML-NEXT: target: L004 - -# Local GOT entries: -# YAML: - ref-name: L000 -# YAML-NEXT: type: got -# YAML-NEXT: content: [ 00, 00, 00, 00 ] -# YAML-NEXT: alignment: 4 -# YAML-NEXT: section-choice: custom-required -# YAML-NEXT: section-name: .got -# YAML-NEXT: permissions: rw- -# YAML-NEXT: references: -# YAML-NEXT: - kind: LLD_R_MIPS_32_HI16 -# YAML-NEXT: offset: 0 -# YAML-NEXT: target: data_1 -# YAML-NEXT: - ref-name: L001 -# YAML-NEXT: type: got -# YAML-NEXT: content: [ 00, 00, 00, 00 ] -# YAML-NEXT: alignment: 4 -# YAML-NEXT: section-choice: custom-required -# YAML-NEXT: section-name: .got -# YAML-NEXT: permissions: rw- -# YAML-NEXT: references: -# YAML-NEXT: - kind: LLD_R_MIPS_32_HI16 -# YAML-NEXT: offset: 0 -# YAML-NEXT: target: data_2 -# YAML-NEXT: - ref-name: L002 -# YAML-NEXT: type: got -# YAML-NEXT: content: [ 00, 00, 00, 00 ] -# YAML-NEXT: alignment: 4 -# YAML-NEXT: section-choice: custom-required -# YAML-NEXT: section-name: .got -# YAML-NEXT: permissions: rw- -# YAML-NEXT: references: -# YAML-NEXT: - kind: R_MIPS_32 -# YAML-NEXT: offset: 0 -# YAML-NEXT: target: data_h - -# Global GOT entries: -# YAML-NEXT: - ref-name: L003 -# YAML-NEXT: type: got -# YAML-NEXT: content: [ 00, 00, 00, 00 ] -# YAML-NEXT: alignment: 4 -# YAML-NEXT: section-choice: custom-required -# YAML-NEXT: section-name: .got -# YAML-NEXT: permissions: rw- -# YAML-NEXT: references: -# YAML-NEXT: - kind: LLD_R_MIPS_GLOBAL_GOT -# YAML-NEXT: offset: 0 -# YAML-NEXT: target: bar -# YAML-NEXT: - kind: R_MIPS_32 -# YAML-NEXT: offset: 0 -# YAML-NEXT: target: bar -# YAML-NEXT: - ref-name: L004 -# YAML-NEXT: type: got -# YAML-NEXT: content: [ 00, 00, 00, 00 ] -# YAML-NEXT: alignment: 4 -# YAML-NEXT: section-choice: custom-required -# YAML-NEXT: section-name: .got -# YAML-NEXT: permissions: rw- -# YAML-NEXT: references: -# YAML-NEXT: - kind: LLD_R_MIPS_GLOBAL_GOT -# YAML-NEXT: offset: 0 -# YAML-NEXT: target: foo - -# RAW: Disassembly of section .text: -# RAW: main: -# RAW-NEXT: {{[0x0-9a-f]+}}: 5c fc 18 80 lw $2, -32744($gp) -# RAW-NEXT: {{[0x0-9a-f]+}}: 42 30 40 10 addiu $2, $2, 4160 -# RAW-NEXT: {{[0x0-9a-f]+}}: 5c fc 1c 80 lw $2, -32740($gp) -# RAW-NEXT: {{[0x0-9a-f]+}}: 42 30 60 20 addiu $2, $2, 8288 -# RAW-NEXT: {{[0x0-9a-f]+}}: 5c fc 20 80 lw $2, -32736($gp) -# RAW-NEXT: {{[0x0-9a-f]+}}: 5c fc 24 80 lw $2, -32732($gp) -# RAW-NEXT: {{[0x0-9a-f]+}}: 5c fc 28 80 lw $2, -32728($gp) - -# RAW: SYMBOL TABLE: -# RAW: {{[0x0-9a-f]+}} *UND* 00000000 -# RAW: {{[0x0-9a-f]+}} l .data 00001020 data_1 -# RAW: {{[0x0-9a-f]+}} l .data 00000001 data_2 -# RAW: {{[0x0-9a-f]+}} g F .text 00000004 bar -# RAW: {{[0x0-9a-f]+}} g F .text 0000001c main -# RAW: {{[0x0-9a-f]+}} g .data 00000001 data_h - - .data - .type data_1, @object - .size data_1, 4128 -data_1: - .byte 1 - .space 4127 - .type data_2, @object - .size data_2, 1 -data_2: - .byte 2 - .hidden data_h - .globl data_h - .type data_h, @object - .size data_h, 1 -data_h: - .byte 3 - - .text - .globl bar - .set micromips - .ent bar - .type bar, @function -bar: - nop - .end bar - .size bar, .-bar - - .globl main - .set micromips - .ent main - .type main, @function -main: - lw $2,%got(data_1)($28) - addiu $2,$2,%lo(data_1) - lw $2,%got(data_2)($28) - addiu $2,$2,%lo(data_2) - lw $2,%got(data_h)($28) - lw $2,%call16(bar)($28) - lw $2,%call16(foo)($28) - - .end main - .size main, .-main diff --git a/test/old-elf/Mips/got16.test b/test/old-elf/Mips/got16.test deleted file mode 100644 index 4dde15a11c26..000000000000 --- a/test/old-elf/Mips/got16.test +++ /dev/null @@ -1,196 +0,0 @@ -# REQUIRES: mips - -# Check handling of global/local GOT16 relocations. -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared --noinhibit-exec \ -# RUN: --output-filetype=yaml %t.o \ -# RUN: | FileCheck -check-prefix YAML %s -# RUN: lld -flavor old-gnu -target mipsel -shared --noinhibit-exec -o %t2 %t.o -# RUN: llvm-objdump -t -disassemble %t2 | FileCheck -check-prefix RAW %s - -# Function glob -# YAML: - name: glob -# YAML: scope: global -# YAML: content: [ 00, 00, 84, 8F, 00, 00, 84, 24, 01, 00, 84, 8F, -# YAML: 00, 02, 84, 24, 00, 00, 84, 8F, 00, 00, 84, 8F, -# YAML: 00, 00, 84, 8F ] -# YAML: alignment: 4 -# YAML: references: -# YAML: - kind: R_MIPS_GOT16 -# YAML: offset: 0 -# YAML: target: L000 -# YAML: - kind: R_MIPS_LO16 -# YAML: offset: 4 -# YAML: target: L009 -# YAML: - kind: R_MIPS_GOT16 -# YAML: offset: 8 -# YAML: target: L002 -# YAML: addend: 66048 -# YAML: - kind: R_MIPS_LO16 -# YAML: offset: 12 -# YAML: target: L009 -# YAML: addend: 512 -# YAML: - kind: R_MIPS_GOT16 -# YAML: offset: 16 -# YAML: target: L004 -# YAML: - kind: R_MIPS_CALL16 -# YAML: offset: 20 -# YAML: target: L005 -# YAML: - kind: R_MIPS_CALL16 -# YAML: offset: 24 -# YAML: target: L006 - -# Local GOT entries: -# YAML: - ref-name: L000 -# YAML-NEXT: type: got -# YAML-NEXT: content: [ 00, 00, 00, 00 ] -# YAML-NEXT: alignment: 4 -# YAML-NEXT: section-choice: custom-required -# YAML-NEXT: section-name: .got -# YAML-NEXT: permissions: rw- -# YAML-NEXT: references: -# YAML-NEXT: - kind: LLD_R_MIPS_32_HI16 -# YAML-NEXT: offset: 0 -# YAML-NEXT: target: L009 -# YAML-NEXT: - ref-name: L002 -# YAML-NEXT: type: got -# YAML-NEXT: content: [ 00, 00, 00, 00 ] -# YAML-NEXT: alignment: 4 -# YAML-NEXT: section-choice: custom-required -# YAML-NEXT: section-name: .got -# YAML-NEXT: permissions: rw- -# YAML-NEXT: references: -# YAML-NEXT: - kind: LLD_R_MIPS_32_HI16 -# YAML-NEXT: offset: 0 -# YAML-NEXT: target: L009 -# YAML-NEXT: addend: 66048 -# YAML-NEXT: - ref-name: L004 -# YAML-NEXT: type: got -# YAML-NEXT: content: [ 00, 00, 00, 00 ] -# YAML-NEXT: alignment: 4 -# YAML-NEXT: section-choice: custom-required -# YAML-NEXT: section-name: .got -# YAML-NEXT: permissions: rw- -# YAML-NEXT: references: -# YAML-NEXT: - kind: R_MIPS_32 -# YAML-NEXT: offset: 0 -# YAML-NEXT: target: hidden - -# Global GOT entries: -# YAML-NEXT: - ref-name: L005 -# YAML-NEXT: type: got -# YAML-NEXT: content: [ 00, 00, 00, 00 ] -# YAML-NEXT: alignment: 4 -# YAML-NEXT: section-choice: custom-required -# YAML-NEXT: section-name: .got -# YAML-NEXT: permissions: rw- -# YAML-NEXT: references: -# YAML-NEXT: - kind: LLD_R_MIPS_GLOBAL_GOT -# YAML-NEXT: offset: 0 -# YAML-NEXT: target: glob -# YAML-NEXT: - kind: R_MIPS_32 -# YAML-NEXT: offset: 0 -# YAML-NEXT: target: glob -# YAML-NEXT: - ref-name: L006 -# YAML-NEXT: type: got -# YAML-NEXT: content: [ 00, 00, 00, 00 ] -# YAML-NEXT: alignment: 4 -# YAML-NEXT: section-choice: custom-required -# YAML-NEXT: section-name: .got -# YAML-NEXT: permissions: rw- -# YAML-NEXT: references: -# YAML-NEXT: - kind: LLD_R_MIPS_GLOBAL_GOT -# YAML-NEXT: offset: 0 -# YAML-NEXT: target: extern - -# RAW: Disassembly of section .text: -# RAW: glob: -# RAW-NEXT: {{[0x0-9a-f]+}}: 18 80 84 8f lw $4, -32744($gp) -# RAW-NEXT: {{[0x0-9a-f]+}}: 00 20 84 24 addiu $4, $4, 8192 -# RAW-NEXT: {{[0x0-9a-f]+}}: 1c 80 84 8f lw $4, -32740($gp) -# RAW-NEXT: {{[0x0-9a-f]+}}: 00 22 84 24 addiu $4, $4, 8704 -# RAW-NEXT: {{[0x0-9a-f]+}}: 20 80 84 8f lw $4, -32736($gp) -# RAW-NEXT: {{[0x0-9a-f]+}}: 24 80 84 8f lw $4, -32732($gp) -# RAW-NEXT: {{[0x0-9a-f]+}}: 28 80 84 8f lw $4, -32728($gp) - -# RAW: SYMBOL TABLE: -# RAW: {{[0x0-9a-f]+}} *UND* 00000000 -# RAW: {{[0x0-9a-f]+}} l .data 00000000 str1 -# RAW: {{[0x0-9a-f]+}} l .data 00000005 str2 -# RAW: {{[0x0-9a-f]+}} g F .text 0000001c glob -# RAW: {{[0x0-9a-f]+}} g .data 00000004 hidden - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Content: '0000848F000084240100848F000284240000848F0000848F0000848F' - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: .data - Type: R_MIPS_GOT16 - - Offset: 0x04 - Symbol: .data - Type: R_MIPS_LO16 - - Offset: 0x08 - Symbol: .data - Type: R_MIPS_GOT16 - - Offset: 0x0C - Symbol: .data - Type: R_MIPS_LO16 - - Offset: 0x10 - Symbol: hidden - Type: R_MIPS_GOT16 - - Offset: 0x14 - Symbol: glob - Type: R_MIPS_CALL16 - - Offset: 0x18 - Symbol: extern - Type: R_MIPS_CALL16 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x04 - Size: 0x10209 - -Symbols: - Local: - - Name: str1 - Type: STT_OBJECT - Section: .data - Size: 0x10200 - - Name: str2 - Type: STT_OBJECT - Section: .data - Value: 0x10200 - Size: 0x05 - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - Global: - - Name: glob - Section: .text - - Name: hidden - Type: STT_OBJECT - Section: .data - Value: 0x10205 - Size: 0x04 - Visibility: STV_HIDDEN - - Name: extern diff --git a/test/old-elf/Mips/gotsym.test b/test/old-elf/Mips/gotsym.test deleted file mode 100644 index bc89ba5d3768..000000000000 --- a/test/old-elf/Mips/gotsym.test +++ /dev/null @@ -1,43 +0,0 @@ -# Check _gp_disp and GOT_OFFSET_TABLE value -# -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared --noinhibit-exec -o %t.so %t.o -# RUN: llvm-objdump -h -t %t.so | FileCheck -check-prefix=SHARED %s - -# SHARED: Sections: -# SHARED: Idx Name Size Address Type -# SHARED: 6 .got 00000008 0000000000001000 DATA -# SHARED: SYMBOL TABLE: -# SHARED: 00001000 .got 00000000 _GLOBAL_OFFSET_TABLE_ -# SHARED: 00008ff0 g *ABS* 00000000 _gp -# SHARED: 00008ff0 g *ABS* 00000000 _gp_disp - -# RUN: lld -flavor old-gnu -target mipsel -e main --noinhibit-exec -o %t.exe %t.o -# RUN: llvm-objdump -h -t %t.exe | FileCheck -check-prefix=EXE %s - -# EXE: Sections: -# EXE: Idx Name Size Address Type -# EXE: 7 .got 00000008 0000000000401000 DATA -# EXE: SYMBOL TABLE: -# EXE: 00401000 .got 00000000 _GLOBAL_OFFSET_TABLE_ -# EXE: 00408ff0 g *ABS* 00000000 _gp -# EXE: 00408ff0 g *ABS* 00000000 _gp_disp - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x04 - -Symbols: - Global: - - Name: main - Section: .text diff --git a/test/old-elf/Mips/gp-sym-1-micro.test b/test/old-elf/Mips/gp-sym-1-micro.test deleted file mode 100644 index 0e1bea9c38da..000000000000 --- a/test/old-elf/Mips/gp-sym-1-micro.test +++ /dev/null @@ -1,88 +0,0 @@ -# Check that microMIPS relocations against __gnu_local_gp -# use "gp" value as target. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -symbols %t.exe | FileCheck -check-prefix=SYM %s -# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=SEC %s - -# SYM: Name: _gp -# SYM-NEXT: Value: 0x408FF0 - -# SEC: Contents of section .text: -# SEC-NEXT: 400184 00004100 0000f08f 2000bc00 ..A..... ... -# SEC: Contents of section .got: -# SEC-NEXT: 401000 00000000 00000080 ........ - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 12 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0x00 - Symbol: __gnu_local_gp - Type: R_MICROMIPS_HI16 - - Offset: 0x04 - Symbol: __gnu_local_gp - Type: R_MICROMIPS_LO16 - - Offset: 0x08 - Symbol: T1 - Type: R_MICROMIPS_26_S1 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 0x08 - Other: [ STO_MIPS_MICROMIPS ] - - Name: __gnu_local_gp - - Name: T1 -... diff --git a/test/old-elf/Mips/gp-sym-1.test b/test/old-elf/Mips/gp-sym-1.test deleted file mode 100644 index ebb73c3afd60..000000000000 --- a/test/old-elf/Mips/gp-sym-1.test +++ /dev/null @@ -1,86 +0,0 @@ -# Check that relocations against __gnu_local_gp use "gp" value as target. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -symbols %t.exe | FileCheck -check-prefix=SYM %s -# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=SEC %s - -# SYM: Name: _gp -# SYM-NEXT: Value: 0x408FF0 - -# SEC: Contents of section .text: -# SEC-NEXT: 400190 41000000 f08f0000 60001000 -# SEC: Contents of section .got: -# SEC-NEXT: 401000 00000000 00000080 - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 12 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0x00 - Symbol: __gnu_local_gp - Type: R_MIPS_HI16 - - Offset: 0x04 - Symbol: __gnu_local_gp - Type: R_MIPS_LO16 - - Offset: 0x08 - Symbol: T1 - Type: R_MIPS_26 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 0x08 - - Name: __gnu_local_gp - - Name: T1 -... diff --git a/test/old-elf/Mips/gp-sym-2.test b/test/old-elf/Mips/gp-sym-2.test deleted file mode 100644 index b6d95f350af3..000000000000 --- a/test/old-elf/Mips/gp-sym-2.test +++ /dev/null @@ -1,103 +0,0 @@ -# Check that R_MIPS32 relocation against __gnu_local_gp causes emitting -# of R_MIPS_REL32 relocation in case of shared library file linking -# and does not produce any dynamic relocation in case of linking a non-shared -# executable file. - -# Now the test failed because the __gnu_local_gp symbol becomes defined -# absolute symbol and we do not generate R_MIPS_REL32 in case of shared -# library linking. -# XFAIL: * - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t-1.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t-1.so -# RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=EXE %s -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t-2.so %t-o.o %t-1.so -# RUN: llvm-readobj -r %t-2.so | FileCheck -check-prefix=SO %s - -# EXE: Relocations [ -# EXE-NEXT: ] - -# SO: Relocations [ -# SO-NEXT: Section (5) .rel.dyn { -# SO-NEXT: 0x0 R_MIPS_NONE - 0x0 -# SO-NEXT: 0x2EC R_MIPS_REL32 __gnu_local_gp 0x0 -# SO-NEXT: } -# SO-NEXT: ] - -# so.so ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC, EF_MIPS_PIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 12 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0x00 - Symbol: __gnu_local_gp - Type: R_MIPS_32 - - Offset: 0x04 - Symbol: T1 - Type: R_MIPS_LO16 - - Offset: 0x08 - Symbol: T2 - Type: R_MIPS_CALL16 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 0x08 - - Name: __gnu_local_gp - - Name: T1 - - Name: T2 -... diff --git a/test/old-elf/Mips/hilo16-1.test b/test/old-elf/Mips/hilo16-1.test deleted file mode 100644 index b284140f748f..000000000000 --- a/test/old-elf/Mips/hilo16-1.test +++ /dev/null @@ -1,40 +0,0 @@ -# REQUIRES: mips - -# Check handling multiple HI16 relocation followed by a single LO16 relocation. - -# RUN: llvm-mc -arch=mipsel -filetype=obj -o=%t.o %s -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -d -t %t.exe | FileCheck %s - -# CHECK: Disassembly of section .text: -# CHECK-NEXT: T0: -# CHECK-NEXT: 400180: 40 00 08 3c lui $8, 64 -# CHECK-NEXT: {{[0-9a-f]+}}: 40 00 08 3c lui $8, 64 -# CHECK-NEXT: {{[0-9a-f]+}}: 40 00 08 3c lui $8, 64 -# CHECK-NEXT: {{[0-9a-f]+}}: 40 00 08 3c lui $8, 64 -# CHECK-NEXT: {{[0-9a-f]+}}: 42 00 08 3c lui $8, 66 -# CHECK-NEXT: {{[0-9a-f]+}}: 3e 00 08 3c lui $8, 62 -# CHECK-NEXT: {{[0-9a-f]+}}: 40 02 08 3c lui $8, 576 -# CHECK-NEXT: {{[0-9a-f]+}}: 40 fe 08 3c lui $8, 65088 -# CHECK-NEXT: {{[0-9a-f]+}}: a5 01 08 25 addiu $8, $8, 421 - -# CHECK: SYMBOL TABLE: -# CHECK: 00400180 g F .text 00000024 T0 -# CHECK: 004001a4 g F .text 00000004 T1 - - .text - .globl T0 -T0: - lui $8, %hi(T1+1) - lui $8, %hi(T1-1) - lui $8, %hi(T1+0x1ff) - lui $8, %hi(T1+(-0x1ff)) - lui $8, %hi(T1+0x1ffff) - lui $8, %hi(T1+(-0x1ffff)) - lui $8, %hi(T1+0x1ffffff) - lui $8, %hi(T1+(-0x1ffffff)) - addiu $8, $8, %lo(T1+(-0x1ffffff)) - - .globl T1 -T1: - nop diff --git a/test/old-elf/Mips/hilo16-2.test b/test/old-elf/Mips/hilo16-2.test deleted file mode 100644 index e47b9003a8dd..000000000000 --- a/test/old-elf/Mips/hilo16-2.test +++ /dev/null @@ -1,70 +0,0 @@ -# REQUIRES: mips - -# Check handling of HI16 and LO16 relocations for regular symbol. -# -# R_MIPS_HI16: (AHL + S) - (short)(AHL + S) -# R_MIPS_LO16: AHL + S -# where AHL = (AHI << 16) + ALO - -# RUN: llvm-mc -arch=mipsel -filetype=obj -o=%t.o %s -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -d %t.exe | FileCheck %s - -# CHECK: Disassembly of section .text: -# CHECK-NEXT: T0: -# CHECK-NEXT: 400180: 40 00 08 3c lui $8, 64 -# CHECK-NEXT: {{[0-9a-f]+}}: c1 01 08 25 addiu $8, $8, 449 -# CHECK-NEXT: {{[0-9a-f]+}}: 40 00 08 3c lui $8, 64 -# CHECK-NEXT: {{[0-9a-f]+}}: bf 01 08 25 addiu $8, $8, 447 -# CHECK-NEXT: {{[0-9a-f]+}}: 40 00 08 3c lui $8, 64 -# CHECK-NEXT: {{[0-9a-f]+}}: bf 03 08 25 addiu $8, $8, 959 -# CHECK-NEXT: {{[0-9a-f]+}}: 40 00 08 3c lui $8, 64 -# CHECK-NEXT: {{[0-9a-f]+}}: c1 ff 08 25 addiu $8, $8, -63 -# -# CHECK: T1: -# CHECK-NEXT: 4001a0: 42 00 08 3c lui $8, 66 -# CHECK-NEXT: {{[0-9a-f]+}}: bf 01 08 25 addiu $8, $8, 447 -# CHECK-NEXT: {{[0-9a-f]+}}: 3e 00 08 3c lui $8, 62 -# CHECK-NEXT: {{[0-9a-f]+}}: c1 01 08 25 addiu $8, $8, 449 -# CHECK-NEXT: {{[0-9a-f]+}}: 40 02 08 3c lui $8, 576 -# CHECK-NEXT: {{[0-9a-f]+}}: bf 01 08 25 addiu $8, $8, 447 -# CHECK-NEXT: {{[0-9a-f]+}}: 40 fe 08 3c lui $8, 65088 -# CHECK-NEXT: {{[0-9a-f]+}}: c1 01 08 25 addiu $8, $8, 449 -# -# CHECK: T2: -# CHECK-NEXT: 4001c0: 00 00 00 00 nop - - .section .text.1,"ax",@progbits - .align 4 - .globl T0 -T0: - lui $8, %hi(T2+1) - addiu $8, $8, %lo(T2+1) - lui $8, %hi(T2+(-1)) - addiu $8, $8, %lo(T2+(-1)) - lui $8, %hi(T2+0x1ff) - addiu $8, $8, %lo(T2+0x1ff) - lui $8, %hi(T2+(-0x1ff)) - addiu $8, $8, %lo(T2+(-0x1ff)) - .size T0, .-T0 - - .section .text.2,"ax",@progbits - .align 4 - .globl T1 -T1: - lui $8, %hi(T2+0x1ffff) - addiu $8, $8, %lo(T2+0x1ffff) - lui $8, %hi(T2+(-0x1ffff)) - addiu $8, $8, %lo(T2+(-0x1ffff)) - lui $8, %hi(T2+0x1ffffff) - addiu $8, $8, %lo(T2+0x1ffffff) - lui $8, %hi(T2+(-0x1ffffff)) - addiu $8, $8, %lo(T2+(-0x1ffffff)) - .size T1, .-T1 - - .section .text.3,"ax",@progbits - .align 4 - .globl T2 -T2: - nop - .size T2, .-T2 diff --git a/test/old-elf/Mips/hilo16-3-overflow.test b/test/old-elf/Mips/hilo16-3-overflow.test deleted file mode 100644 index 94fc90b3be54..000000000000 --- a/test/old-elf/Mips/hilo16-3-overflow.test +++ /dev/null @@ -1,44 +0,0 @@ -# Check R_MIPS_HI16 relocation overflow handling. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: not lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o 2>&1 \ -# RUN: | FileCheck %s - -# CHECK: Relocation out of range in file {{.*}} reference from T0+0 to _gp_disp+2147483648 of type 5 (R_MIPS_HI16) - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "0080000000000000" -# ^ %hi(gp+0x80000000) -# ^ %lo(gp+0x80000000) - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x0 - Symbol: _gp_disp - Type: R_MIPS_HI16 - - Offset: 0x4 - Symbol: _gp_disp - Type: R_MIPS_LO16 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 8 - - Name: _gp_disp diff --git a/test/old-elf/Mips/hilo16-3.test b/test/old-elf/Mips/hilo16-3.test deleted file mode 100644 index 17873c0a629c..000000000000 --- a/test/old-elf/Mips/hilo16-3.test +++ /dev/null @@ -1,74 +0,0 @@ -# Check handling of HI16 and LO16 relocations for _gp_disp. -# -# R_MIPS_HI16: (AHL + GP - P) - (short)(AHL + GP - P) -# R_MIPS_LO16: AHL + GP - P + 4 -# where AHL = (AHI << 16) + ALO - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o -# RUN: llvm-objdump -s -t %t.so | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: 00d0 0100083c 218f0885 0100083c 178f0885 -# CHECK-NEXT: 00e0 0100083c 0f910885 0100083c 098d0885 -# CHECK-NEXT: 00f0 0200083c ffff0885 - -# CHECK: SYMBOL TABLE: -# CHECK: 000000d0 g F .text 00000028 T0 -# CHECK: 00008ff0 g *ABS* 00000000 _gp_disp - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "0000083C010008850000083CFFFF08850000083CFF0108850000083C01FE08850200083CFFFF0885" -# ^ %hi(gp+1) ^ %hi(gp-1) ^ %hi(gp+0x1ff) ^ %hi(gp-0x1ff) ^ %lo(gp+0x1ffff) -# ^ %lo(gp+1) ^ %lo(gp-1) ^ %lo(gp+0x1ff) ^ %lo(gp-0x1ff) -# ^ %hi(gp+0x1ffff) - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x0 - Symbol: _gp_disp - Type: R_MIPS_HI16 - - Offset: 0x4 - Symbol: _gp_disp - Type: R_MIPS_LO16 - - Offset: 0x8 - Symbol: _gp_disp - Type: R_MIPS_HI16 - - Offset: 0xC - Symbol: _gp_disp - Type: R_MIPS_LO16 - - Offset: 0x10 - Symbol: _gp_disp - Type: R_MIPS_HI16 - - Offset: 0x14 - Symbol: _gp_disp - Type: R_MIPS_LO16 - - Offset: 0x18 - Symbol: _gp_disp - Type: R_MIPS_HI16 - - Offset: 0x1C - Symbol: _gp_disp - Type: R_MIPS_LO16 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 80 - - Name: _gp_disp diff --git a/test/old-elf/Mips/hilo16-4.test b/test/old-elf/Mips/hilo16-4.test deleted file mode 100644 index 2db17344e30f..000000000000 --- a/test/old-elf/Mips/hilo16-4.test +++ /dev/null @@ -1,93 +0,0 @@ -# REQUIRES: mips - -# Check pairing of R_MIPS_HI16 and R_MIPS_LO16 relocations. -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target mipsel -e glob1 -o %t-exe %t-obj -# RUN: llvm-objdump -t -disassemble %t-exe | FileCheck %s - -# CHECK: Disassembly of section .text: -# CHECK: glob1: -# CHECK-NEXT: 400130: 40 00 04 3c lui $4, 64 -# CHECK-NEXT: 400134: ff 9f a6 8c lw $6, -24577($5) - -# CHECK: glob2: -# CHECK-NEXT: 400138: 00 20 c7 80 lb $7, 8192($6) -# CHECK-NEXT: 40013c: 04 20 c8 80 lb $8, 8196($6) - -# CHECK: glob3: -# CHECK-NEXT: 400140: 40 80 05 3c lui $5, 32832 - -# CHECK: SYMBOL TABLE: -# CHECK: 00400130 g F .text 00000008 glob1 -# CHECK: 00400138 g F .text 00000008 glob2 -# CHECK: 00400140 g F .text 00000004 glob3 -# CHECK: 00402000 g .data 0000000c X - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS -# glob1: -# lui $4,%hi(X) # rel A -# lw $6,%lo(X+32767)($5) # rel B -# glob2: -# lb $7,%lo(X)($6) # rel C -# lb $8,%lo(X+4)($6) # rel D -# glob3: -# lui $5,%hi(X+32767) # rel E - Content: "0000043CFF7FA68C0000C7800400C880FF7F053C" - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Content: "000000000000000000000000" - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x10 # rel E - Symbol: X - Type: R_MIPS_HI16 - - Offset: 0x04 # rel B - Symbol: X - Type: R_MIPS_LO16 - - Offset: 0x00 # rel A - Symbol: X - Type: R_MIPS_HI16 - - Offset: 0x0C # rel D - Symbol: X - Type: R_MIPS_LO16 - - Offset: 0x08 # rel C - Symbol: X - Type: R_MIPS_LO16 - -Symbols: - Global: - - Name: glob1 - Section: .text - Value: 0x0 - Size: 8 - - Name: glob2 - Section: .text - Value: 0x8 - Size: 8 - - Name: glob3 - Section: .text - Value: 0x10 - Size: 4 - - Name: X - Section: .data - Value: 0x0 - Size: 12 diff --git a/test/old-elf/Mips/hilo16-5.test b/test/old-elf/Mips/hilo16-5.test deleted file mode 100644 index 597425e8ba74..000000000000 --- a/test/old-elf/Mips/hilo16-5.test +++ /dev/null @@ -1,103 +0,0 @@ -# Check that linker shows a warning when -# there is orphaned R_MIPS_HI16 relocation. - -# RUN: yaml2obj -format=elf -o %t-so.o -docnum 1 %s -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -o %t-o.o -docnum 2 %s -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so 2>&1 \ -# RUN: | FileCheck -check-prefix=DIAG %s -# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=DATA %s - -# DIAG: lld warning: cannot matching LO16 relocation -# DIAG: lld warning: cannot matching LO16 relocation - -# DATA: Contents of section .data: -# DATA-NEXT: 402000 40000000 10200000 40000000 @.... ..@... - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .data - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -Symbols: - Global: - - Name: D1 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 4 - - Name: D2 - Section: .data - Type: STT_OBJECT - Value: 0x4 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Content: "000000000000000000000000" - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: D1 - Type: R_MIPS_HI16 - - Offset: 0x08 - Symbol: D2 - Type: R_MIPS_HI16 - - Offset: 0x04 - Symbol: D1 - Type: R_MIPS_LO16 - - Offset: 0x08 - Symbol: .text - Type: R_MIPS_HI16 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: D1 - - Name: D2 -... diff --git a/test/old-elf/Mips/hilo16-8-micro.test b/test/old-elf/Mips/hilo16-8-micro.test deleted file mode 100644 index ef8ac782341c..000000000000 --- a/test/old-elf/Mips/hilo16-8-micro.test +++ /dev/null @@ -1,81 +0,0 @@ -# REQUIRES: mips - -# Check calculation of AHL addendums for R_MICROMIPS_HI16 / R_MICROMIPS_LO16 -# relocations for a regular symbol. - -# RUN: llvm-mc -arch=mipsel -filetype=obj -mattr=micromips -o=%t.o %s -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -d -mattr=micromips %t.exe | FileCheck %s - -# CHECK: Disassembly of section .text: -# CHECK-NEXT: T0: -# CHECK-NEXT: 400180: a8 41 40 00 lui $8, 64 -# CHECK-NEXT: 400184: 08 31 c1 01 addiu $8, $8, 449 -# CHECK-NEXT: 400188: a8 41 41 00 lui $8, 65 -# CHECK-NEXT: 40018c: 08 31 bf 81 addiu $8, $8, -32321 -# CHECK-NEXT: 400190: a8 41 41 00 lui $8, 65 -# CHECK-NEXT: 400194: 08 31 40 82 addiu $8, $8, -32192 -# CHECK-NEXT: 400198: a8 41 42 00 lui $8, 66 -# CHECK-NEXT: 40019c: 08 31 c0 81 addiu $8, $8, -32320 -# -# CHECK: T1: -# CHECK-NEXT: 4001a0: a8 41 40 40 lui $8, 16448 -# CHECK-NEXT: 4001a4: 08 31 c0 01 addiu $8, $8, 448 -# CHECK-NEXT: 4001a8: a8 41 40 80 lui $8, 32832 -# CHECK-NEXT: 4001ac: 08 31 c0 01 addiu $8, $8, 448 -# CHECK-NEXT: 4001b0: a8 41 c1 80 lui $8, 32961 -# CHECK-NEXT: 4001b4: 08 31 40 82 addiu $8, $8, -32192 -# CHECK-NEXT: 4001b8: 00 00 00 00 nop -# CHECK-NEXT: 4001bc: 00 00 00 00 nop -# -# CHECK: T2: -# CHECK-NEXT: 4001c0: 00 00 00 00 nop -# CHECK-NEXT: 4001c4: a8 41 40 00 lui $8, 64 -# CHECK-NEXT: 4001c8: a8 41 40 00 lui $8, 64 -# CHECK-NEXT: 4001cc: a8 41 41 00 lui $8, 65 -# CHECK-NEXT: 4001d0: a8 41 42 00 lui $8, 66 -# CHECK-NEXT: 4001d4: a8 41 40 40 lui $8, 16448 -# CHECK-NEXT: 4001d8: a8 41 40 80 lui $8, 32832 -# CHECK-NEXT: 4001dc: a8 41 c1 80 lui $8, 32961 -# CHECK-NEXT: 4001e0: 08 31 00 82 addiu $8, $8, -32256 - - .section .text.1,"ax",@progbits - .align 4 - .globl T0 -T0: - lui $8, %hi(T2+1) - addiu $8, $8, %lo(T2+1) - lui $8, %hi(T2+0x7fff) - addiu $8, $8, %lo(T2+0x7fff) - lui $8, %hi(T2+0x8080) - addiu $8, $8, %lo(T2+0x8080) - lui $8, %hi(T2+0x18000) - addiu $8, $8, %lo(T2+0x18000) - .size T0, .-T0 - - .section .text.2,"ax",@progbits - .align 4 - .globl T1 -T1: - lui $8, %hi(T2+0x40000000) - addiu $8, $8, %lo(T2+0x40000000) - lui $8, %hi(T2+0x80000000) - addiu $8, $8, %lo(T2+0x80000000) - lui $8, %hi(T2+0x80808080) - addiu $8, $8, %lo(T2+0x80808080) - .size T1, .-T1 - - .section .text.3,"ax",@progbits - .align 4 - .globl T2 -T2: - nop - lui $8, %hi(T0+0x1) - lui $8, %hi(T0+0x7fff) - lui $8, %hi(T0+0x8080) - lui $8, %hi(T0+0x18000) - lui $8, %hi(T0+0x40000000) - lui $8, %hi(T0+0x80000000) - lui $8, %hi(T0+0x80808080) - addiu $8, $8, %lo(T0+0x80808080) - .size T2, .-T2 diff --git a/test/old-elf/Mips/hilo16-9-micro.test b/test/old-elf/Mips/hilo16-9-micro.test deleted file mode 100644 index 293e35f36cd5..000000000000 --- a/test/old-elf/Mips/hilo16-9-micro.test +++ /dev/null @@ -1,142 +0,0 @@ -# Check calculation of AHL addendums for R_MICROMIPS_HI16 / R_MICROMIPS_LO16 -# relocations for the _gp_disp symbol. -# -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o -# RUN: llvm-objdump -s -t %t.so | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: 0110 00000100 0000e08e 00000100 0000d60e -# CHECK-NEXT: 0120 00000100 00004f0f 00000000 00000000 -# CHECK-NEXT: 0130 00000200 0000bf0e 00000140 0000378f -# CHECK-NEXT: 0140 00000100 00000100 00000200 00000300 -# CHECK-NEXT: 0150 00000140 00001f8f - -# CHECK: SYMBOL TABLE: -# CHECK: 00000110 g F .text 00000018 T0 -# CHECK: 00000130 g F .text 00000010 T1 -# CHECK: 00000140 g F .text 00000018 T2 -# CHECK: 00008ff0 g *ABS* 00000000 _gp_disp - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text.1 - Type: SHT_PROGBITS - Content: "0000000000000100000000000000FF7F0000010000008080" -# ^ %hi(gp+0x1) ^ %hi(gp+0x7fff) ^ %lo(gp+0x8080) -# ^ %lo(gp+0x1) ^ %lo(gp+0x7fff) -# ^ %hi(gp+0x8080) - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text.1 - Type: SHT_REL - Info: .text.1 - AddressAlign: 4 - Relocations: - - Offset: 0x0 - Symbol: _gp_disp - Type: R_MICROMIPS_HI16 - - Offset: 0x4 - Symbol: _gp_disp - Type: R_MICROMIPS_LO16 - - Offset: 0x8 - Symbol: _gp_disp - Type: R_MICROMIPS_HI16 - - Offset: 0xC - Symbol: _gp_disp - Type: R_MICROMIPS_LO16 - - Offset: 0x10 - Symbol: _gp_disp - Type: R_MICROMIPS_HI16 - - Offset: 0x14 - Symbol: _gp_disp - Type: R_MICROMIPS_LO16 - -- Name: .text.2 - Type: SHT_PROGBITS - Content: "00000200000000800000004000008000" -# ^ %hi(gp+0x18000) ^ %lo(gp+0x40000080) -# ^ %lo(gp+0x18000) -# ^ %hi(gp+0x40000080) - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text.2 - Type: SHT_REL - Info: .text.2 - AddressAlign: 4 - Relocations: - - Offset: 0x0 - Symbol: _gp_disp - Type: R_MICROMIPS_HI16 - - Offset: 0x4 - Symbol: _gp_disp - Type: R_MICROMIPS_LO16 - - Offset: 0x8 - Symbol: _gp_disp - Type: R_MICROMIPS_HI16 - - Offset: 0xC - Symbol: _gp_disp - Type: R_MICROMIPS_LO16 - -- Name: .text.3 - Type: SHT_PROGBITS - Content: "000000000000000000000100000002000000004000008000" -# ^ %hi(gp+0x1) ^ %hi(gp+0x8080) ^ %lo(gp+0x40000080) -# ^ %hi(gp+0x7fff) ^ %hi(gp+0x40000080) -# ^ %hi(gp+0x18000) - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text.3 - Type: SHT_REL - Info: .text.3 - AddressAlign: 4 - Relocations: - - Offset: 0x0 - Symbol: _gp_disp - Type: R_MICROMIPS_HI16 - - Offset: 0x4 - Symbol: _gp_disp - Type: R_MICROMIPS_HI16 - - Offset: 0x8 - Symbol: _gp_disp - Type: R_MICROMIPS_HI16 - - Offset: 0xC - Symbol: _gp_disp - Type: R_MICROMIPS_HI16 - - Offset: 0x10 - Symbol: _gp_disp - Type: R_MICROMIPS_HI16 - - Offset: 0x14 - Symbol: _gp_disp - Type: R_MICROMIPS_LO16 - -Symbols: - Global: - - Name: T0 - Section: .text.1 - Type: STT_FUNC - Value: 0 - Size: 24 - Other: [STO_MIPS_MICROMIPS] - - Name: T1 - Section: .text.2 - Type: STT_FUNC - Value: 0 - Size: 16 - Other: [STO_MIPS_MICROMIPS] - - Name: T2 - Section: .text.3 - Type: STT_FUNC - Value: 0 - Size: 24 - Other: [STO_MIPS_MICROMIPS] - - Name: _gp_disp diff --git a/test/old-elf/Mips/initfini-micro.test b/test/old-elf/Mips/initfini-micro.test deleted file mode 100644 index ca2708f1bb29..000000000000 --- a/test/old-elf/Mips/initfini-micro.test +++ /dev/null @@ -1,45 +0,0 @@ -# Check that if _init/_fini symbols are microMIPS encoded, DT_INIT/DT_FINI tags -# use adjusted values with set the last bit. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o -# RUN: llvm-readobj -symbols -dynamic-table %t.so | FileCheck %s - -# CHECK: Name: _init (1) -# CHECK-NEXT: Value: 0xF5 -# CHECK: Name: _fini (7) -# CHECK-NEXT: Value: 0xF9 -# -# CHECK: 0x0000000C INIT 0xF5 -# CHECK: 0x0000000D FINI 0xF9 - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x18 - -Symbols: - Global: - - Name: _init - Type: STT_FUNC - Section: .text - Value: 0x0 - Size: 0x4 - Other: [ STO_MIPS_MICROMIPS ] - - Name: _fini - Type: STT_FUNC - Section: .text - Value: 0x4 - Size: 0x4 - Other: [ STO_MIPS_MICROMIPS ] -... diff --git a/test/old-elf/Mips/interpreter-64.test b/test/old-elf/Mips/interpreter-64.test deleted file mode 100644 index 7cfd0c51a3c4..000000000000 --- a/test/old-elf/Mips/interpreter-64.test +++ /dev/null @@ -1,26 +0,0 @@ -# Check program interpreter setup. -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips64el -e main -o %t.exe %t.o -# RUN: llvm-objdump -s %t.exe | FileCheck %s - -# CHECK: Contents of section .interp: -# CHECK-NEXT: {{[0-9a-f]+}} 2f6c6962 36342f6c 642e736f 2e3100 /lib64/ld.so.1. - -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64 ] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x08 - -Symbols: - Global: - - Name: main - Section: .text diff --git a/test/old-elf/Mips/interpreter-n32.test b/test/old-elf/Mips/interpreter-n32.test deleted file mode 100644 index 7d17256ba43c..000000000000 --- a/test/old-elf/Mips/interpreter-n32.test +++ /dev/null @@ -1,27 +0,0 @@ -# Check program interpreter setup in case of N32 ABI. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -o %t.exe %t.o -# RUN: llvm-objdump -s %t.exe | FileCheck %s - -# CHECK: Contents of section .interp: -# CHECK-NEXT: {{[0-9a-f ]+}} /lib32/ld.so.1. - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64, EF_MIPS_ABI2 ] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Size: 8 - -Symbols: - Global: - - Name: __start - Section: .text diff --git a/test/old-elf/Mips/interpreter.test b/test/old-elf/Mips/interpreter.test deleted file mode 100644 index 4ae17b42df1c..000000000000 --- a/test/old-elf/Mips/interpreter.test +++ /dev/null @@ -1,26 +0,0 @@ -# Check program interpreter setup. -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e main -o %t.exe %t.o -# RUN: llvm-objdump -s %t.exe | FileCheck %s - -# CHECK: Contents of section .interp: -# CHECK-NEXT: {{[0-9a-f]+}} 2f6c6962 2f6c642e 736f2e31 00 /lib/ld.so.1. - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x04 - -Symbols: - Global: - - Name: main - Section: .text diff --git a/test/old-elf/Mips/invalid-reginfo.test b/test/old-elf/Mips/invalid-reginfo.test deleted file mode 100644 index 2856ecc92607..000000000000 --- a/test/old-elf/Mips/invalid-reginfo.test +++ /dev/null @@ -1,28 +0,0 @@ -# Check that LLD shows an error if .reginfo section has invalid size - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: not lld -flavor old-gnu -target mipsel -o %t.exe %t.o 2>&1 | FileCheck %s - -# CHECK: Invalid size of MIPS_REGINFO section - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - - Name: .reginfo - Type: SHT_MIPS_REGINFO - Flags: [ SHF_ALLOC ] - AddressAlign: 0x01 - Size: 0x25 -Symbols: - Global: - - Name: main - Section: .text diff --git a/test/old-elf/Mips/jalx-align-err.test b/test/old-elf/Mips/jalx-align-err.test deleted file mode 100644 index 8fc5310bbad8..000000000000 --- a/test/old-elf/Mips/jalx-align-err.test +++ /dev/null @@ -1,46 +0,0 @@ -# Check that LLD shows an error if jalx target value is not word-aligned. - -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: not lld -flavor old-gnu -target mipsel -e T0 -o %t-exe %t-obj 2>&1 \ -# RUN: | FileCheck %s - -# CHECK: The jalx target 0x{{[0-9a-f]+}} is not word-aligned - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, - EF_MIPS_MICROMIPS ] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MICROMIPS_26_S1 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 6 - Size: 2 diff --git a/test/old-elf/Mips/jalx-jalr.test b/test/old-elf/Mips/jalx-jalr.test deleted file mode 100644 index d02e9d7c2bac..000000000000 --- a/test/old-elf/Mips/jalx-jalr.test +++ /dev/null @@ -1,47 +0,0 @@ -# Check that R_MIPS_JALR relocation does not affect code in case of cross jump. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -o %t.exe %t.o -# RUN: llvm-objdump -s %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: {{[0-9a-f]+}} 08002003 00000000 - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_MICROMIPS, EF_MIPS_ARCH_32R2] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Content: "0800200300000000" - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 0 - Symbol: M1 - Type: R_MIPS_JALR - -Symbols: - Global: - - Name: __start - Type: STT_FUNC - Section: .text - Value: 0 - Size: 4 - - Name: M1 - Type: STT_FUNC - Section: .text - Value: 4 - Size: 4 - Other: [ STO_MIPS_MICROMIPS ] diff --git a/test/old-elf/Mips/jalx.test b/test/old-elf/Mips/jalx.test deleted file mode 100644 index 60d6ea71193c..000000000000 --- a/test/old-elf/Mips/jalx.test +++ /dev/null @@ -1,71 +0,0 @@ -# Check jal => jalx conversion in case of mixed microMIPS and regular code. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T1 -o %t.exe %t.o -# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=RAW %s -# RUN: llvm-nm %t.exe | FileCheck -check-prefix=SYM %s - -# RAW: Contents of section .text: -# RAW-NEXT: 400130 00000000 4c001074 10f04d00 4e001074 - -# SYM: 00400138 T M1 -# SYM: 00400130 T M2 -# SYM: 0040013c T T1 -# SYM: 00400134 T T2 - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_MICROMIPS, EF_MIPS_ARCH_32R2] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Content: "000000000000000c00f400000000000c" -# ^ M2 ^ T2 ^ M1 ^ T1 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 4 - Symbol: M2 - Type: R_MIPS_26 - - Offset: 8 - Symbol: T2 - Type: R_MICROMIPS_26_S1 - - Offset: 12 - Symbol: M1 - Type: R_MIPS_26 - -Symbols: - Global: - - Name: M2 - Type: STT_FUNC - Section: .text - Value: 0 - Size: 4 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T2 - Type: STT_FUNC - Section: .text - Value: 4 - Size: 4 - - Name: M1 - Type: STT_FUNC - Section: .text - Value: 8 - Size: 4 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T1 - Type: STT_FUNC - Section: .text - Value: 12 - Size: 4 diff --git a/test/old-elf/Mips/jump-fix-err.test b/test/old-elf/Mips/jump-fix-err.test deleted file mode 100644 index 0e5a5298a731..000000000000 --- a/test/old-elf/Mips/jump-fix-err.test +++ /dev/null @@ -1,45 +0,0 @@ -# Check that LLD shows an error in case -# of replacing an unknown unstruction by jalx. - -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: not lld -flavor old-gnu -target mipsel -o %t-exe %t-obj 2>&1 | FileCheck %s - -# CHECK: Unsupported jump opcode (0x0) for ISA modes cross call - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, - EF_MIPS_MICROMIPS ] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T0 - Type: R_MICROMIPS_26_S1 - -Symbols: - Global: - - Name: __start - Section: .text - Type: STT_FUNC - Size: 4 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 4 - Size: 4 diff --git a/test/old-elf/Mips/la25-stub-be.test b/test/old-elf/Mips/la25-stub-be.test deleted file mode 100644 index 9527e7a80644..000000000000 --- a/test/old-elf/Mips/la25-stub-be.test +++ /dev/null @@ -1,113 +0,0 @@ -# REQUIRES: mips - -# Check LA25 stubs creation in the big-endian case. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-npic.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-pic.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-main.o -# RUN: lld -flavor old-gnu -target mips -o %t.exe %t-npic.o %t-pic.o %t-main.o - -# RUN: llvm-objdump -disassemble %t.exe | FileCheck %s - -# CHECK: 400170: 3c 19 00 40 lui $25, 64 -# CHECK-NEXT: 400174: 08 10 00 50 j 4194624 -# CHECK-NEXT: 400178: 27 39 01 40 addiu $25, $25, 320 -# CHECK-NEXT: 40017c: 00 00 00 00 nop - -# npic.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2MSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1N - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# pic.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2MSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC, EF_MIPS_PIC] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# main.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2MSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 40 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 8 - Symbol: .text - Type: R_MIPS_26 - - Offset: 16 - Symbol: __start - Type: R_MIPS_26 - - Offset: 24 - Symbol: T1N - Type: R_MIPS_26 - - Offset: 32 - Symbol: T1 - Type: R_MIPS_26 - -Symbols: - Local: - - Name: loc - Section: .text - Value: 16 - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: __start - Section: .text - - Name: T1 - - Name: T1N -... diff --git a/test/old-elf/Mips/la25-stub-micro-be.test b/test/old-elf/Mips/la25-stub-micro-be.test deleted file mode 100644 index 0bea3e6ac8b0..000000000000 --- a/test/old-elf/Mips/la25-stub-micro-be.test +++ /dev/null @@ -1,121 +0,0 @@ -# REQUIRES: mips - -# Check LA25 stubs creation in the big-endian case. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-npic.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-pic.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-main.o -# RUN: lld -flavor old-gnu -target mips -o %t.exe %t-npic.o %t-pic.o %t-main.o - -# RUN: llvm-objdump -disassemble -mattr=micromips %t.exe | FileCheck %s - -# CHECK: 400170: 41 be 00 40 lui $fp, 64 -# CHECK-NEXT: 400174: d4 20 00 a0 j 4194624 -# CHECK-NEXT: 400178: 33 39 01 41 addiu $25, $25, 321 -# CHECK-NEXT: 40017c: 00 00 00 00 nop - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2MSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, - EF_MIPS_CPIC, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1N - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - Other: [ STO_MIPS_MICROMIPS ] - -# pic.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2MSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, - EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - Other: [ STO_MIPS_MICROMIPS ] - -# main.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2MSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, - EF_MIPS_CPIC, EF_MIPS_MICROMIPS] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Content: '0000000000000000f400000000000000f400000000000000f400000000000000f400000000000000' -# jal loc jal glob jal T1N jal T1 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 8 - Symbol: .text - Type: R_MICROMIPS_26_S1 - - Offset: 16 - Symbol: glob - Type: R_MICROMIPS_26_S1 - - Offset: 24 - Symbol: T1N - Type: R_MICROMIPS_26_S1 - - Offset: 32 - Symbol: T1 - Type: R_MICROMIPS_26_S1 - -Symbols: - Local: - - Name: loc - Section: .text - Value: 16 - Size: 24 - Other: [ STO_MIPS_MICROMIPS ] - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: __start - Section: .text - Size: 16 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T1 - - Name: T1N -... diff --git a/test/old-elf/Mips/la25-stub-micro.test b/test/old-elf/Mips/la25-stub-micro.test deleted file mode 100644 index c01da5908829..000000000000 --- a/test/old-elf/Mips/la25-stub-micro.test +++ /dev/null @@ -1,136 +0,0 @@ -# Check microMIPS LA25 stubs creation when PIC code -# is called from non-PIC routines. - -# Build executable from pic and non-pic code. -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-npic.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-pic.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-main.o -# RUN: lld -flavor old-gnu -target mipsel -e glob -o %t.exe \ -# RUN: %t-npic.o %t-pic.o %t-main.o - -# RUN: llvm-nm %t.exe | FileCheck -check-prefix=SYM %s -# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=ASM %s - -# SYM: 00400140 T T1 -# SYM: 00400130 T T1N -# SYM: 00400144 T glob -# SYM: 00400154 t loc - -# ASM: Contents of section .text: -# ASM-NEXT: 400130 00000000 00000000 00000000 00000000 -# ASM-NEXT: 400140 00000000 00000000 00000000 10f05100 -# 0x100055 << 2 == 0x400154 (jalx glob) --^ -# ASM-NEXT: 400150 00000000 20f4a200 00000000 20f49800 -# ^-- 0x100055 << 2 == 0x400154 (jal glob) -# 0x10004c << 2 == 0x400130 (jal T1N) --^ -# ASM-NEXT: 400160 00000000 20f4b800 00000000 00000000 -# ^-- 0x100054 << 2 == 0x400170 (jal T1 stub) -# ASM-NEXT: 400170 b9414000 20d4a000 39334101 00000000 -# ^-- j 0x400140 (T1) - -# npic.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, - EF_MIPS_CPIC, EF_MIPS_MICROMIPS ] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x04 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1N - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - Other: [ STO_MIPS_MICROMIPS ] - -# pic.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, - EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_MICROMIPS ] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x04 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - Other: [ STO_MIPS_MICROMIPS ] - -# main.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, - EF_MIPS_CPIC, EF_MIPS_MICROMIPS ] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Content: '000000000000000000f400000000000000f400000000000000f400000000000000f4000000000000' -# jal loc jal glob jal T1N jal T1 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x08 - Symbol: .text - Type: R_MICROMIPS_26_S1 - - Offset: 0x10 - Symbol: glob - Type: R_MICROMIPS_26_S1 - - Offset: 0x18 - Symbol: T1N - Type: R_MICROMIPS_26_S1 - - Offset: 0x20 - Symbol: T1 - Type: R_MICROMIPS_26_S1 - -Symbols: - Local: - - Name: loc - Section: .text - Value: 0x10 - Size: 0x18 - Other: [ STO_MIPS_MICROMIPS ] - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: glob - Section: .text - Size: 0x10 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T1 - - Name: T1N -... diff --git a/test/old-elf/Mips/la25-stub-npic-01.test b/test/old-elf/Mips/la25-stub-npic-01.test deleted file mode 100644 index 9ff6af06cb2b..000000000000 --- a/test/old-elf/Mips/la25-stub-npic-01.test +++ /dev/null @@ -1,153 +0,0 @@ -# Check that LA25 stubs are created for branch relocations -# when a PIC function is called from non-pic code. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-pic.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-reg.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-micro.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe \ -# RUN: %t-reg.o %t-micro.o %t-pic.o - -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK-NOT: Contents of section .plt: -# CHECK: Contents of section .text: -# CHECK-NEXT: 400130 5c001000 0f000000 0e000000 0d000000 -# ^ T0 ^ .pic.T1 (0x400170) -# ^ 0x400134 + 0x3c = 0x400170 -# ^ ... -# CHECK-NEXT: 400140 2000c000 1e000000 1c000000 00001a00 -# ^ T3 ^ .pic.T2 -# ^ ... -# CHECK-NEXT: 400150 00000c00 00000000 00000000 00000000 -# CHECK-NEXT: 400160 00000000 00000000 00000000 00000000 -# ^ T1 ^ T2 -# CHECK-NEXT: 400170 4000193c 58001008 60013927 00000000 -# ^ .pic.T1 -# CHECK-NEXT: 400180 b9414000 20d4b200 39336501 00000000 -# ^ .pic.T2 - -# CHECK: SYMBOL TABLE: -# CHECK: 00400130 g F .text 00000010 T0 -# CHECK: 00400140 g F .text 00000014 T3 -# CHECK: 00400160 g F .text 00000004 T1 -# CHECK: 00400164 g F .text 00000004 T2 - -# pic.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, - EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 4 - Size: 4 - Other: [STO_MIPS_MICROMIPS] - -# reg.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 16 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_26 - - Offset: 4 - Symbol: T1 - Type: R_MIPS_PC16 - - Offset: 8 - Symbol: T1 - Type: R_MIPS_PC21_S2 - - Offset: 12 - Symbol: T1 - Type: R_MIPS_PC26_S2 - -Symbols: - Global: - - Name: T0 - Section: .text - Size: 16 - - Name: T1 - -# micro.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC, EF_MIPS_MICROMIPS] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 20 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0 - Symbol: T2 - Type: R_MICROMIPS_26_S1 - - Offset: 4 - Symbol: T2 - Type: R_MICROMIPS_PC7_S1 - - Offset: 8 - Symbol: T2 - Type: R_MICROMIPS_PC10_S1 - - Offset: 12 - Symbol: T2 - Type: R_MICROMIPS_PC16_S1 - - Offset: 16 - Symbol: T2 - Type: R_MICROMIPS_PC23_S2 - -Symbols: - Global: - - Name: T3 - Section: .text - Size: 20 - Other: [STO_MIPS_MICROMIPS] - - Name: T2 -... diff --git a/test/old-elf/Mips/la25-stub-npic-02.test b/test/old-elf/Mips/la25-stub-npic-02.test deleted file mode 100644 index 4f2eb14d8c92..000000000000 --- a/test/old-elf/Mips/la25-stub-npic-02.test +++ /dev/null @@ -1,123 +0,0 @@ -# Check that LA25 stubs are created for branch relocations -# when a PIC function is defined in a non-PIC file and -# is called from non-pic code. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t1.o %t2.o - -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK-NOT: Contents of section .plt: -# CHECK: Contents of section .text: -# CHECK-NEXT: 400130 00000000 00000000 58001000 09000000 -# ^ T1 ^ T2 ^ .pic.T1 (0x400160) -# CHECK-NEXT: 400140 08000000 07000000 2000b800 12000000 -# ^ .pic.T2 (0x400170) -# CHECK-NEXT: 400150 10000000 00000e00 00000600 00000000 -# CHECK-NEXT: 400160 4000193c 4c001008 30013927 00000000 -# ^ .pic.T1 -# CHECK-NEXT: 400170 b9414000 20d49a00 39333501 00000000 -# ^ .pic.T2 - -# CHECK: SYMBOL TABLE: -# CHECK: 00400130 g F .text 00000004 T1 -# CHECK: 00400134 g F .text 00000004 T2 -# CHECK: 00400138 g F .text 00000010 T0 -# CHECK: 00400148 g F .text 00000014 T3 - -# 1.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - Other: [STO_MIPS_PIC] - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 4 - Size: 4 - Other: [STO_MIPS_MICROMIPS, STO_MIPS_PIC] - -# 2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC, EF_MIPS_MICROMIPS] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 36 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_26 - - Offset: 4 - Symbol: T1 - Type: R_MIPS_PC16 - - Offset: 8 - Symbol: T1 - Type: R_MIPS_PC21_S2 - - Offset: 12 - Symbol: T1 - Type: R_MIPS_PC26_S2 - - Offset: 16 - Symbol: T2 - Type: R_MICROMIPS_26_S1 - - Offset: 20 - Symbol: T2 - Type: R_MICROMIPS_PC7_S1 - - Offset: 24 - Symbol: T2 - Type: R_MICROMIPS_PC10_S1 - - Offset: 28 - Symbol: T2 - Type: R_MICROMIPS_PC16_S1 - - Offset: 32 - Symbol: T2 - Type: R_MICROMIPS_PC23_S2 - -Symbols: - Global: - - Name: T0 - Section: .text - Value: 0 - Size: 16 - - Name: T3 - Section: .text - Value: 16 - Size: 20 - Other: [STO_MIPS_MICROMIPS] - - Name: T1 - - Name: T2 -... diff --git a/test/old-elf/Mips/la25-stub-npic-shared.test b/test/old-elf/Mips/la25-stub-npic-shared.test deleted file mode 100644 index 72bac30f86ad..000000000000 --- a/test/old-elf/Mips/la25-stub-npic-shared.test +++ /dev/null @@ -1,152 +0,0 @@ -# Check that PLT entries are created for branch relocations -# when a PIC shared library function is called from non-pic code. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-pic.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-reg.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-micro.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-pic.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-reg.o %t-micro.o %t.so - -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .plt: -# CHECK-NEXT: 400190 40001c3c 0020998f 00209c27 23c01c03 -# CHECK-NEXT: 4001a0 2578e003 82c01800 09f82003 feff1827 -# CHECK-NEXT: 4001b0 40000f3c 0820f98d 08002003 0820f825 -# ^ PLT.T1 -# CHECK-NEXT: 4001c0 00799307 22ff0000 9945020f -# ^ PLT.T2 - -# CHECK: Contents of section .text: -# CHECK-NEXT: 4001cc 6c001000 f8ff0000 f7ff1f00 f6ffff03 -# ^ T0 ^ PLT.T1 (0x4001b0) -# ^ 0x4001d0 -32 = 0x4001b0 -# ^ ... -# CHECK-NEXT: 4001dc 2000e000 70000000 ee030000 0000ecff -# ^ T3 ^ PLT.T2 -# ^ ... -# CHECK-NEXT: 4001ec 7f00f5ff - -# CHECK: SYMBOL TABLE: -# CHECK: 004001cc g F .text 00000010 T0 -# CHECK: 004001dc g F .text 00000014 T3 - -# pic.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, - EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 4 - Size: 4 - Other: [STO_MIPS_MICROMIPS] - -# reg.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 16 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_26 - - Offset: 4 - Symbol: T1 - Type: R_MIPS_PC16 - - Offset: 8 - Symbol: T1 - Type: R_MIPS_PC21_S2 - - Offset: 12 - Symbol: T1 - Type: R_MIPS_PC26_S2 - -Symbols: - Global: - - Name: T0 - Section: .text - Size: 16 - - Name: T1 - -# micro.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC, EF_MIPS_MICROMIPS] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 20 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0 - Symbol: T2 - Type: R_MICROMIPS_26_S1 - - Offset: 4 - Symbol: T2 - Type: R_MICROMIPS_PC7_S1 - - Offset: 8 - Symbol: T2 - Type: R_MICROMIPS_PC10_S1 - - Offset: 12 - Symbol: T2 - Type: R_MICROMIPS_PC16_S1 - - Offset: 16 - Symbol: T2 - Type: R_MICROMIPS_PC23_S2 - -Symbols: - Global: - - Name: T3 - Section: .text - Size: 20 - Other: [STO_MIPS_MICROMIPS] - - Name: T2 -... diff --git a/test/old-elf/Mips/la25-stub-pic.test b/test/old-elf/Mips/la25-stub-pic.test deleted file mode 100644 index 8db88404aaef..000000000000 --- a/test/old-elf/Mips/la25-stub-pic.test +++ /dev/null @@ -1,144 +0,0 @@ -# Check that we do not create LA26 stubs and PLT entries -# when a PIC function is called from PIC code. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-reg.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-micro.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o %t-reg.o %t-micro.o - -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK-NOT: Contents of section .plt: -# CHECK: Contents of section .text: -# CHECK-NEXT: 400130 00000000 00000000 4c001000 fdff0000 -# ^ T1 ^ T2 ^ T1 (0x400130) -# ^ 0x40013c - 12 = 0x0x400130 -# CHECK-NEXT: 400140 fcff1f00 fbffff03 20009a00 74000000 -# ^ T2 (0x400134) - -# CHECK: SYMBOL TABLE: -# CHECK: 00400130 g F .text 00000004 T1 -# CHECK: 00400134 g F .text 00000004 T2 -# CHECK: 00400138 g F .text 00000010 T0 -# CHECK: 00400148 g F .text 00000014 T3 - -# pic.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, - EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 4 - Size: 4 - Other: [STO_MIPS_MICROMIPS] - -# reg.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC, EF_MIPS_PIC] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 16 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_26 - - Offset: 4 - Symbol: T1 - Type: R_MIPS_PC16 - - Offset: 8 - Symbol: T1 - Type: R_MIPS_PC21_S2 - - Offset: 12 - Symbol: T1 - Type: R_MIPS_PC26_S2 - -Symbols: - Global: - - Name: T0 - Section: .text - Size: 16 - - Name: T1 - -# micro.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, - EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_MICROMIPS] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 20 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0 - Symbol: T2 - Type: R_MICROMIPS_26_S1 - - Offset: 4 - Symbol: T2 - Type: R_MICROMIPS_PC7_S1 - - Offset: 8 - Symbol: T2 - Type: R_MICROMIPS_PC10_S1 - - Offset: 12 - Symbol: T2 - Type: R_MICROMIPS_PC16_S1 - - Offset: 16 - Symbol: T2 - Type: R_MICROMIPS_PC23_S2 - -Symbols: - Global: - - Name: T3 - Section: .text - Size: 20 - Other: [STO_MIPS_MICROMIPS] - - Name: T2 -... diff --git a/test/old-elf/Mips/la25-stub.test b/test/old-elf/Mips/la25-stub.test deleted file mode 100644 index 4df7f85e8c89..000000000000 --- a/test/old-elf/Mips/la25-stub.test +++ /dev/null @@ -1,133 +0,0 @@ -# Check LA25 stubs creation when PIC code is called from non-PIC routines. - -# Build executable from pic and non-pic code. -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-npic.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-pic.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-main.o -# RUN: lld -flavor old-gnu -target mipsel -e glob -o %t.exe \ -# RUN: %t-npic.o %t-pic.o %t-main.o - -# RUN: llvm-readobj -t %t.exe | FileCheck -check-prefix=SYM %s -# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=ASM %s - -# SYM: Name: loc (13) -# SYM-NEXT: Value: 0x400154 -# SYM: Name: T1N (1) -# SYM-NEXT: Value: 0x400130 -# SYM: Name: T1 (5) -# SYM-NEXT: Value: 0x400140 -# SYM: Name: glob (8) -# SYM-NEXT: Value: 0x400144 - -# ASM: Contents of section .text: -# ASM-NEXT: 400130 00000000 00000000 00000000 00000000 -# ASM-NEXT: 400140 00000000 00000000 00000000 51001000 -# 0x100051 << 2 == 0x400144 (glob) --^ -# ASM-NEXT: 400150 00000000 51001000 00000000 4c001000 -# ^-- 0x100051 << 2 == 0x400144 (glob) -# 0x100044 << 2 == 0x400110 (T1N) --^ -# ASM-NEXT: 400160 00000000 5c001000 00000000 00000000 -# ^-- 0x10005c << 2 == 0x400170 (T1 stub) -# ASM-NEXT: 400170 4000193c 50001008 40013927 00000000 -# ^-- j 0x400140 (T1) - -# npic.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC ] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x04 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1N - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# pic.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC, EF_MIPS_PIC ] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x04 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# main.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC ] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x28 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x08 - Symbol: .text - Type: R_MIPS_26 - Addend: 0 - - Offset: 0x10 - Symbol: glob - Type: R_MIPS_26 - Addend: 0 - - Offset: 0x18 - Symbol: T1N - Type: R_MIPS_26 - Addend: 0 - - Offset: 0x20 - Symbol: T1 - Type: R_MIPS_26 - Addend: 0 - -Symbols: - Local: - - Name: loc - Section: .text - Value: 0x10 - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: glob - Section: .text - - Name: T1 - - Name: T1N -... diff --git a/test/old-elf/Mips/mips-options-01.test b/test/old-elf/Mips/mips-options-01.test deleted file mode 100644 index 8f2e63ca3b5f..000000000000 --- a/test/old-elf/Mips/mips-options-01.test +++ /dev/null @@ -1,34 +0,0 @@ -# Check that LLD does not write a .MIPS.options section if input -# object file does not contain such section. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t.o -# RUN: llvm-readobj -s -dynamic-table %t.so | FileCheck %s - -# CHECK: Sections [ -# CHECK-NOT: Name: .MIPS.options - -# CHECK: DynamicSection [ -# CHECK-NOT: 0x{{[0-9A-F]+}} MIPS_OPTIONS - -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ARCH_64R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 diff --git a/test/old-elf/Mips/mips-options-02.test b/test/old-elf/Mips/mips-options-02.test deleted file mode 100644 index a5f19e55735f..000000000000 --- a/test/old-elf/Mips/mips-options-02.test +++ /dev/null @@ -1,104 +0,0 @@ -# Check merging input .MIPS.options sections. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.o -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t1.o %t2.o -# RUN: llvm-readobj -s -dynamic-table %t.so | FileCheck -check-prefix=SEC %s -# RUN: llvm-objdump -s -t %t.so | FileCheck -check-prefix=RAW %s -# RUN: llvm-readobj -program-headers %t.so | FileCheck -check-prefix=PHDR %s - -# SEC: Index: 1 -# SEC-NEXT: Name: .MIPS.options (1) -# SEC-NEXT: Type: SHT_MIPS_OPTIONS (0x7000000D) -# SEC-NEXT: Flags [ (0x8000002) -# SEC-NEXT: SHF_ALLOC (0x2) -# SEC-NEXT: SHF_MIPS_NOSTRIP (0x8000000) -# SEC-NEXT: ] -# SEC-NEXT: Address: 0x[[OPT_ADDR:[0-9A-F]+]] -# SEC-NEXT: Offset: {{[0-9A-F]+}} -# SEC-NEXT: Size: 40 -# SEC-NEXT: Link: 0 -# SEC-NEXT: Info: 0 -# SEC-NEXT: AddressAlignment: 8 -# SEC-NEXT: EntrySize: 1 - -# SEC: DynamicSection [ -# SEC: 0x{{[0-9A-F]+}} MIPS_OPTIONS 0x[[OPT_ADDR]] - -# RAW: Contents of section .MIPS.options: -# RAW-NEXT: {{[0-9a-f]+}} 01280000 00000000 f0000001 00000000 -# RAW-NEXT: {{[0-9a-f]+}} e0000002 d0000003 b0000004 c0000005 -# RAW-NEXT: {{[0-9a-f]+}} f08f0000 00000000 - -# RAW: SYMBOL TABLE: -# RAW: 0000000000008ff0 g *ABS* 00000000 _gp - -# Check that %t.so contains only two PT_LOAD segments -# PHDR: ProgramHeaders -# PHDR: Type: PT_LOAD -# PHDR: Type: PT_LOAD -# PHDR-NOT: Type: PT_LOAD -# PHDR: Type: PT_DYNAMIC - -# t1.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ARCH_64R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .MIPS.options - Type: SHT_MIPS_OPTIONS - Flags: [ SHF_ALLOC ] - AddressAlign: 8 -# v ODK_NULL 0x18 bytes long v ODK_REGINFO - Content: "0018000000000000000000000000000000000000000000000128000000000000F000000000000000E0000000D0000000B0000000C00000000010000000000000" - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# t2.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ARCH_64R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .MIPS.options - Type: SHT_MIPS_OPTIONS - Flags: [ SHF_ALLOC ] - AddressAlign: 8 -# v ODK_NULL 0x18 bytes long v ODK_REGINFO - Content: "00180000000000000000000000000000000000000000000001280000000000000000000100000000000000020000000300000004000000050000010000000000" - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 -... diff --git a/test/old-elf/Mips/mips-options-03.test b/test/old-elf/Mips/mips-options-03.test deleted file mode 100644 index a0dea5709b6f..000000000000 --- a/test/old-elf/Mips/mips-options-03.test +++ /dev/null @@ -1,41 +0,0 @@ -# Check handling a zero-filled input .MIPS.options section. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t.o -# RUN: llvm-objdump -s -t %t.so | FileCheck %s - -# CHECK: Contents of section .MIPS.options: -# CHECK-NEXT: {{[0-9a-f]+}} 01280000 00000000 00000000 00000000 -# CHECK-NEXT: {{[0-9a-f]+}} 00000000 00000000 00000000 00000000 -# CHECK-NEXT: {{[0-9a-f]+}} f08f0000 00000000 - -# CHECK: SYMBOL TABLE: -# CHECK: 00008ff0 g *ABS* 00000000 _gp - -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ARCH_64R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .MIPS.options - Type: SHT_MIPS_OPTIONS - Flags: [ SHF_ALLOC ] - AddressAlign: 8 - Content: "01280000000000000000000000000000000000000000000000000000000000000000000000000000" - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 diff --git a/test/old-elf/Mips/mips-options-04.test b/test/old-elf/Mips/mips-options-04.test deleted file mode 100644 index 5df94aae9257..000000000000 --- a/test/old-elf/Mips/mips-options-04.test +++ /dev/null @@ -1,77 +0,0 @@ -# Check that .MIPS.options sections from shared libraries do not affect -# output .MIPS.options section content. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t.so.o -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t.so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t.exe.o -# RUN: lld -flavor old-gnu -target mips64el -e T0 -o %t.exe %t.so %t.exe.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .MIPS.options: -# CHECK-NEXT: {{[0-9a-f]+}} 01280000 00000000 44444444 00000000 -# CHECK-NEXT: {{[0-9a-f]+}} 44444444 44444444 44444444 44444444 -# CHECK-NEXT: {{[0-9a-f]+}} f08f0020 01000000 - -# CHECK: SYMBOL TABLE: -# CHECK: 20008ff0 g *ABS* 00000000 _gp - -# t.so.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ARCH_64R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .MIPS.options - Type: SHT_MIPS_OPTIONS - Flags: [ SHF_ALLOC ] - AddressAlign: 8 - Content: "01280000000000001111111100000000111111111111111111111111111111110010000000000000" - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# t.exe.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ARCH_64R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .MIPS.options - Type: SHT_MIPS_OPTIONS - Flags: [ SHF_ALLOC ] - AddressAlign: 8 - Content: "01280000000000004444444400000000444444444444444444444444444444440010000000000000" - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 -... diff --git a/test/old-elf/Mips/mips-options-05.test b/test/old-elf/Mips/mips-options-05.test deleted file mode 100644 index f7e9728b3cf4..000000000000 --- a/test/old-elf/Mips/mips-options-05.test +++ /dev/null @@ -1,119 +0,0 @@ -# Check that .MIPS.options section gets register usage mask from "used" files -# only. In this test case we take only t2.o from liboptions.a and should not -# add register usage masks from t1.o to the output .MIPS.options section. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.o -# RUN: llvm-ar q %T/liboptions.a %t1.o %t2.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t3.o -# RUN: lld -flavor old-gnu -target mips64el -e T0 -o %t.exe %t3.o -L%T -loptions -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .MIPS.options: -# CHECK-NEXT: {{[0-9a-f]+}} 01280000 00000000 66666666 00000000 -# CHECK-NEXT: {{[0-9a-f]+}} 66666666 66666666 66666666 66666666 -# CHECK-NEXT: {{[0-9a-f]+}} f08f0020 01000000 - -# CHECK: SYMBOL TABLE: -# CHECK: 20008ff0 g *ABS* 00000000 _gp - -# t1.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ARCH_64R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .MIPS.options - Type: SHT_MIPS_OPTIONS - Flags: [ SHF_ALLOC ] - AddressAlign: 8 - Content: "01280000000000001111111100000000111111111111111111111111111111110010000000000000" - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# t2.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ARCH_64R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .MIPS.options - Type: SHT_MIPS_OPTIONS - Flags: [ SHF_ALLOC ] - AddressAlign: 8 - Content: "01280000000000002222222200000000222222222222222222222222222222220010000000000000" - -Symbols: - Global: - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# t3.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ARCH_64R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T2 - Type: R_MIPS_32 - -- Name: .MIPS.options - Type: SHT_MIPS_OPTIONS - Flags: [ SHF_ALLOC ] - AddressAlign: 8 - Content: "01280000000000004444444400000000444444444444444444444444444444440010000000000000" - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: T2 -... diff --git a/test/old-elf/Mips/mips-options-gp0.test b/test/old-elf/Mips/mips-options-gp0.test deleted file mode 100644 index 73e578347f2c..000000000000 --- a/test/old-elf/Mips/mips-options-gp0.test +++ /dev/null @@ -1,77 +0,0 @@ -# Check reading GP0 value from .MIPS.options section -# -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips64el -e G1 -shared -o %t.so %t.o -# RUN: llvm-readobj -symbols %t.so | FileCheck -check-prefix=SYM %s -# RUN: llvm-objdump -s %t.so | FileCheck -check-prefix=SEC %s - -# SYM: Name: L1 -# SYM-NEXT: Value: 0x15C -# SYM-NEXT: Size: 4 -# SYM-NEXT: Binding: Local (0x0) -# SYM-NEXT: Type: Function (0x2) -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: .text (0x5) - -# SYM: Name: _gp -# SYM-NEXT: Value: 0x8FF0 -# SYM-NEXT: Size: 0 -# SYM-NEXT: Binding: Global (0x1) -# SYM-NEXT: Type: Object (0x1) -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: Absolute (0xFFF1) - -# 0xffff816c == 0x0 (addend) + 0x015C (L1) + 0x1000 (GP0) - 0x8ff0 (_gp) -# SEC: Contents of section .rodata: -# SEC-NEXT: {{[0-9a-f]+}} 6c81ffff 00000000 00000000 00000000 - -!ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64R2 ] -Sections: -- Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 - -- Name: .rodata - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x04 - Size: 16 - -- Name: .rel.rodata - Type: SHT_RELA - Link: .symtab - Info: .rodata - AddressAlign: 0x04 - Relocations: - - Offset: 0 - Symbol: L1 - Type: R_MIPS_GPREL32 - -- Name: .MIPS.options - Type: SHT_MIPS_OPTIONS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x01 - Content: "012800000000000000000000000000000000000000000000000000000000000000100000" - -Symbols: - Local: - - Name: L1 - Section: .text - Value: 0x00 - Size: 0x04 - - Name: .rodata - Type: STT_SECTION - Section: .rodata - Global: - - Name: G1 - Section: .text - Value: 0x04 - Size: 0x04 diff --git a/test/old-elf/Mips/n32-rela-chain.test b/test/old-elf/Mips/n32-rela-chain.test deleted file mode 100644 index 9569eb7c5855..000000000000 --- a/test/old-elf/Mips/n32-rela-chain.test +++ /dev/null @@ -1,68 +0,0 @@ -# Check grouping of multiple consecutive relocations in case of N32 -# and 64-bit MIPS ABIs. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: 10000130 00001001 00002004 - -# CHECK: 10002000 l .data 00000004 D0 - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2MSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64, EF_MIPS_ABI2] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Size: 8 - - - Name: .rel.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 0 - Symbol: D0 - Type: R_MIPS_32 - Addend: 0x10000 - - Offset: 0 - Symbol: D0 - Type: R_MIPS_HI16 - - Offset: 4 - Symbol: D0 - Type: R_MIPS_32 - Addend: 4 - - Offset: 4 - Symbol: D0 - Type: R_MIPS_LO16 - - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 16 - Size: 4 - -Symbols: - Local: - - Name: D0 - Type: STT_FUNC - Section: .data - Value: 0 - Size: 4 - Global: - - Name: __start - Type: STT_FUNC - Section: .text - Value: 0 - Size: 8 -... diff --git a/test/old-elf/Mips/n64-rel-chain.test b/test/old-elf/Mips/n64-rel-chain.test deleted file mode 100644 index 3797c4321701..000000000000 --- a/test/old-elf/Mips/n64-rel-chain.test +++ /dev/null @@ -1,204 +0,0 @@ -# Check handling MIPS N64 ABI relocation "chains". - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mips64el -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -s -t -dt -mips-plt-got %t.exe | \ -# RUN: FileCheck -check-prefix=SYM %s -# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=RAW %s - -# SYM: Section { -# SYM: Index: 6 -# SYM-NEXT: Name: .rodata -# SYM-NEXT: Type: SHT_PROGBITS -# SYM-NEXT: Flags [ -# SYM-NEXT: SHF_ALLOC -# SYM-NEXT: ] -# SYM-NEXT: Address: 0x120000230 -# -# SYM: Symbol { -# SYM: Name: LT1 -# SYM-NEXT: Value: 0x120000210 -# SYM-NEXT: Size: 16 -# SYM-NEXT: Binding: Global -# SYM-NEXT: Type: Function -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: .text -# SYM-NEXT: } -# SYM: Symbol { -# SYM: Name: T0 -# SYM-NEXT: Value: 0x120000220 -# SYM-NEXT: Size: 16 -# SYM-NEXT: Binding: Global -# SYM-NEXT: Type: Function -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: .text -# SYM-NEXT: } -# SYM: Symbol { -# SYM: Name: T1@ -# SYM-NEXT: Value: 0x0 -# SYM-NEXT: Size: 0 -# SYM-NEXT: Binding: Global -# SYM-NEXT: Type: Function -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: Undefined -# SYM-NEXT: } -# -# SYM: Canonical gp value: 0x120008FF0 -# SYM: Local entries [ -# SYM-NEXT: Entry { -# SYM-NEXT: Address: 0x{{[0-9A-F]+}} -# SYM-NEXT: Access: -32736 -# SYM-NEXT: Initial: 0x120000000 -# SYM-NEXT: } -# SYM-NEXT: ] -# SYM-NEXT: Global entries [ -# SYM-NEXT: Entry { -# SYM-NEXT: Address: 0x{{[0-9A-F]+}} -# SYM-NEXT: Access: -32728 -# SYM-NEXT: Initial: 0x0 -# SYM-NEXT: Value: 0x0 -# SYM-NEXT: Type: Function (0x2) -# SYM-NEXT: Section: Undefined (0x0) -# SYM-NEXT: Name: T1@ (1) -# SYM-NEXT: } -# SYM-NEXT: ] - -# RAW: Contents of section .text: -# RAW-NEXT: 120000210 01000000 00000000 e08d0000 00000000 -# ^ -# S - GP = 0x120000210 - 0x120008ff0 = -36320 -# S - A = 0 - (-36320) = 36320 -# (AHL + S + 0x8000) >> 16 = 1 -# ^ -# S - GP = 0x120000210 - 0x120008ff0 = -36320 -# S - A = 0 - (-36320) = 36320 -# AHL + S = 0x8DE0 -# RAW-NEXT: 120000220 20800000 38020000 28800000 00000000 -# ^ 0x8020 = -32736 GOT -# ^ (0x120000230 + 8 - page) = 0x238 -# ^ 0x8028 = -32728 -# RAW: Contents of section .pdr: -# RAW-NEXT: 0000 10020020 20020020 - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Size: 8 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Global: - - Name: T1 - Type: STT_FUNC - Section: .text - Value: 0 - Size: 8 - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Size: 32 - - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 8 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: LT1 - Type: R_MIPS_GPREL16 - Type2: R_MIPS_SUB - Type3: R_MIPS_HI16 - - Offset: 0x08 - Symbol: LT1 - Type: R_MIPS_GPREL16 - Type2: R_MIPS_SUB - Type3: R_MIPS_LO16 - - Offset: 0x10 - Symbol: .rodata - Type: R_MIPS_GOT_PAGE - Addend: 8 - - Offset: 0x14 - Symbol: .rodata - Type: R_MIPS_GOT_OFST - Addend: 8 - - Offset: 0x18 - Symbol: T1 - Type: R_MIPS_CALL16 - - - Name: .pdr - Type: SHT_PROGBITS - AddressAlign: 4 - Size: 8 - - - Name: .rela.pdr - Type: SHT_RELA - Link: .symtab - AddressAlign: 8 - Info: .pdr - Relocations: - - Offset: 0x00 - Symbol: LT1 - Type: R_MIPS_32 - - Offset: 0x04 - Symbol: T0 - Type: R_MIPS_32 - - - Name: .rodata - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 16 - Size: 16 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .rodata - Type: STT_SECTION - Section: .rodata - - Name: .pdr - Type: STT_SECTION - Section: .pdr - - Global: - - Name: LT1 - Type: STT_FUNC - Section: .text - Value: 0x00 - Size: 0x10 - - Name: T0 - Type: STT_FUNC - Section: .text - Value: 0x10 - Size: 0x10 - - Name: T1 -... diff --git a/test/old-elf/Mips/n64-rel-shift.test b/test/old-elf/Mips/n64-rel-shift.test deleted file mode 100644 index 31a780beb998..000000000000 --- a/test/old-elf/Mips/n64-rel-shift.test +++ /dev/null @@ -1,48 +0,0 @@ -# Check that LLD shift right relocation result after calculation -# each relocations in N64 relocation chain. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t.o -# RUN: llvm-objdump -s %t.so | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: {{[0-9a-f]+}} 00000000 01000000 00000000 00000000 - -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64R2] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Size: 16 - - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 8 - Info: .text - Relocations: - - Offset: 4 - Symbol: T1 - Addend: 8 - Type: R_MIPS_PC19_S2 - Type2: R_MIPS_64 - -Symbols: - Global: - - Name: T1 - Type: STT_FUNC - Section: .text - Value: 0 - Size: 8 - - Name: bar - Type: STT_FUNC - Section: .text - Value: 8 - Size: 8 diff --git a/test/old-elf/Mips/opt-emulation.test b/test/old-elf/Mips/opt-emulation.test deleted file mode 100644 index a48b49bfaa02..000000000000 --- a/test/old-elf/Mips/opt-emulation.test +++ /dev/null @@ -1,43 +0,0 @@ -# Check MIPS specific arguments of the -m command line option. - -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target mipsel -m elf32ltsmip -o %t-exe %t-obj -# RUN: llvm-readobj -file-headers %t-exe | FileCheck -check-prefix=LE-O32 %s -# RUN: lld -flavor old-gnu -target mipsel -melf32ltsmip -o %t-exe %t-obj -# RUN: llvm-readobj -file-headers %t-exe | FileCheck -check-prefix=LE-O32 %s - -# LE-O32: Class: 32-bit (0x1) -# LE-O32: DataEncoding: LittleEndian (0x1) -# LE-O32: FileVersion: 1 -# LE-O32: OS/ABI: SystemV (0x0) -# LE-O32: ABIVersion: 1 -# LE-O32: Machine: EM_MIPS (0x8) -# LE-O32: Version: 1 -# LE-O32: Flags [ (0x70001005) -# LE-O32-NEXT: EF_MIPS_ABI_O32 (0x1000) -# LE-O32-NEXT: EF_MIPS_ARCH_32R2 (0x70000000) -# LE-O32-NEXT: EF_MIPS_CPIC (0x4) -# LE-O32-NEXT: EF_MIPS_NOREORDER (0x1) -# LE-O32-NEXT: ] - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: __start - Section: .text - Value: 0x0 - Size: 4 diff --git a/test/old-elf/Mips/pc23-range.test b/test/old-elf/Mips/pc23-range.test deleted file mode 100644 index 89e9ab7bb73f..000000000000 --- a/test/old-elf/Mips/pc23-range.test +++ /dev/null @@ -1,54 +0,0 @@ -# Check that LLD shows an error if ADDIUPC immediate is out of range. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: not lld -flavor old-gnu -target mipsel -o %t.exe %t.o 2>&1 | FileCheck %s - -# CHECK: Relocation out of range in file {{.*}}: reference from __start+4 to T0+4 of type 173 (R_MICROMIPS_PC23_S2) - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "0000000080780100" -# ^ PC23: 1 << 2 = 4 => T0 + 4 - 4 = T0 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x04 - Size: 0x4000000 - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 4 - Symbol: T0 - Type: R_MICROMIPS_PC23_S2 - -Symbols: - Global: - - Name: __start - Section: .text - Type: STT_FUNC - Size: 8 - Other: [ STO_MIPS_MICROMIPS ] - - Name: TZ - Section: .data - Type: STT_FUNC - Value: 0 - Size: 0x2000000 - - Name: T0 - Section: .data - Type: STT_FUNC - Value: 0x2000000 - Size: 4 diff --git a/test/old-elf/Mips/plt-entry-mixed-1.test b/test/old-elf/Mips/plt-entry-mixed-1.test deleted file mode 100644 index e05eec4c8109..000000000000 --- a/test/old-elf/Mips/plt-entry-mixed-1.test +++ /dev/null @@ -1,114 +0,0 @@ -# REQUIRES: mips - -# Conditions: -# a) Object file contains both R_MIPS_26 and microMIPS non-jal relocations. -# b) The R_MIPS_26 relocation handled first. -# Check: -# a) PLT contains the only regular entry. - -# Build shared library -# RUN: yaml2obj -format=elf -docnum 1 %s > %t.so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.so.o - -# Build executable -# RUN: yaml2obj -format=elf -docnum 2 %s > %t.o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o.o %t.so -# RUN: llvm-objdump -d %t.exe | FileCheck %s - -# CHECK: Disassembly of section .plt: -# CHECK-NEXT: .plt: -# CHECK-NEXT: 400170: 40 00 1c 3c lui $gp, 64 -# CHECK-NEXT: 400174: 00 20 99 8f lw $25, 8192($gp) -# CHECK-NEXT: 400178: 00 20 9c 27 addiu $gp, $gp, 8192 -# CHECK-NEXT: 40017c: 23 c0 1c 03 subu $24, $24, $gp -# CHECK-NEXT: 400180: 25 78 e0 03 move $15, $ra -# CHECK-NEXT: 400184: 82 c0 18 00 srl $24, $24, 2 -# CHECK-NEXT: 400188: 09 f8 20 03 jalr $25 -# CHECK-NEXT: 40018c: fe ff 18 27 addiu $24, $24, -2 -# CHECK-NEXT: 400190: 40 00 0f 3c lui $15, 64 -# CHECK-NEXT: 400194: 08 20 f9 8d lw $25, 8200($15) -# CHECK-NEXT: 400198: 08 00 20 03 jr $25 -# CHECK-NEXT: 40019c: 08 20 f8 25 addiu $24, $15, 8200 - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "0000000C00000000" - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x0 - Symbol: T1 - Type: R_MIPS_26 - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: T1 - Type: R_MICROMIPS_HI16 - - Offset: 0x00 - Symbol: T1 - Type: R_MICROMIPS_LO16 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 0x8 - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 8 - - Name: T1 -... diff --git a/test/old-elf/Mips/plt-entry-mixed-2.test b/test/old-elf/Mips/plt-entry-mixed-2.test deleted file mode 100644 index 299aa5ce065c..000000000000 --- a/test/old-elf/Mips/plt-entry-mixed-2.test +++ /dev/null @@ -1,93 +0,0 @@ -# REQUIRES: mips - -# Conditions: -# a) Object file contains both R_MIPS_26 and R_MICROMIPS_26_S1 relocations. -# Check: -# a) PLT contains both regular and compressed PLT entries - -# Build shared library -# RUN: yaml2obj -format=elf -docnum 1 %s > %t.so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.so.o - -# Build executable -# RUN: yaml2obj -format=elf -docnum 2 %s > %t.o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o.o %t.so -# RUN: llvm-objdump -s %t.exe | FileCheck %s - -# FIXME (simon): Check the disassembler output when llvm-objdump starts -# to support microMIPS instruction encoding. - -# CHECK: Contents of section .plt: -# CHECK-NEXT: 400170 40001c3c 0020998f 00209c27 23c01c03 -# CHECK-NEXT: 400180 2578e003 82c01800 09f82003 feff1827 -# CHECK-NEXT: 400190 40000f3c 0820f98d 08002003 0820f825 -# CHECK-NEXT: 4001a0 00799a07 22ff0000 9945020f - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "0000000C000000000000000000000000" - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x0 - Symbol: T2 - Type: R_MIPS_26 - - Offset: 0x8 - Symbol: T2 - Type: R_MICROMIPS_26_S1 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 0x8 - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x8 - Size: 0x8 - Other: [STO_MIPS_MICROMIPS] - - Name: T2 -... diff --git a/test/old-elf/Mips/plt-entry-mixed-3.test b/test/old-elf/Mips/plt-entry-mixed-3.test deleted file mode 100644 index c946ecc82d2f..000000000000 --- a/test/old-elf/Mips/plt-entry-mixed-3.test +++ /dev/null @@ -1,98 +0,0 @@ -# REQUIRES: mips - -# Conditions: -# a) Object file contains microMIPS instructions. -# b) There is a relocation refers arbitrary symbols and requires a PLT entry. -# Check: -# a) PLT contains a compressed entry. - -# Build shared library -# RUN: yaml2obj -format=elf -docnum 1 %s > %t.so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.so.o - -# Build executable -# RUN: yaml2obj -format=elf -docnum 2 %s > %t.o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o.o %t.so -# RUN: llvm-objdump -s %t.exe | FileCheck %s - -# FIXME (simon): Check the disassembler output when llvm-objdump starts -# to support microMIPS instruction encoding. - -# CHECK: Contents of section .plt: -# CHECK-NEXT: 400170 8079a407 23ff0000 35052525 0233feff .y..#...5.%%.3.. -# CHECK-NEXT: 400180 ff0df945 830f000c 0079a007 22ff0000 ...E.....y.."... -# CHECK-NEXT: 400190 9945020f .E.. - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 16 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: T1 - Type: R_MICROMIPS_HI16 - - Offset: 0x00 - Symbol: T1 - Type: R_MICROMIPS_LO16 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 16 - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 8 - - Name: T1 -... diff --git a/test/old-elf/Mips/plt-entry-mixed-4.test b/test/old-elf/Mips/plt-entry-mixed-4.test deleted file mode 100644 index ba8b04866b98..000000000000 --- a/test/old-elf/Mips/plt-entry-mixed-4.test +++ /dev/null @@ -1,85 +0,0 @@ -# REQUIRES: mips - -# Conditions: -# a) Object file contains R_MIPS_26 relocation refers to the microMIPS symbol. -# Check: -# a) PLT contains a regular non-compressed entry. - -# Build shared library -# RUN: yaml2obj -format=elf -docnum 1 %s > %t.so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.so.o - -# Build executable -# RUN: yaml2obj -format=elf -docnum 2 %s > %t.o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o.o %t.so -# RUN: llvm-objdump -s %t.exe | FileCheck %s - -# FIXME (simon): Check the disassembler output when llvm-objdump starts -# to support microMIPS instruction encoding. - -# CHECK: Contents of section .plt: -# CHECK-NEXT: 400170 40001c3c 0020998f 00209c27 23c01c03 -# CHECK-NEXT: 400180 2578e003 82c01800 09f82003 feff1827 -# CHECK-NEXT: 400190 40000f3c 0820f98d 08002003 0820f825 - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - Other: [STO_MIPS_MICROMIPS] - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "0000000C00000000" - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x0 - Symbol: T1 - Type: R_MIPS_26 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 0x8 - - Name: T1 -... diff --git a/test/old-elf/Mips/plt-entry-r6-be.test b/test/old-elf/Mips/plt-entry-r6-be.test deleted file mode 100644 index 3e15ece894e0..000000000000 --- a/test/old-elf/Mips/plt-entry-r6-be.test +++ /dev/null @@ -1,109 +0,0 @@ -# REQUIRES: mips - -# Check generation of PLT entries in case of R6 big-endian target ABI. - -# Build shared library -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mips -shared -o %t.so %t-so.o - -# Build executable -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mips -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-objdump -d %t.exe | FileCheck %s - -# CHECK: Disassembly of section .plt: -# CHECK-NEXT: .plt: -# CHECK-NEXT: 400160: 3c 1c 00 40 lui $gp, 64 -# CHECK-NEXT: 400164: 8f 99 20 00 lw $25, 8192($gp) -# CHECK-NEXT: 400168: 27 9c 20 00 addiu $gp, $gp, 8192 -# CHECK-NEXT: 40016c: 03 1c c0 23 subu $24, $24, $gp -# CHECK-NEXT: 400170: 03 e0 78 25 move $15, $ra -# CHECK-NEXT: 400174: 00 18 c0 82 srl $24, $24, 2 -# CHECK-NEXT: 400178: 03 20 f8 09 jalr $25 -# CHECK-NEXT: 40017c: 27 18 ff fe addiu $24, $24, -2 -# CHECK-NEXT: 400180: 3c 0f 00 40 lui $15, 64 -# CHECK-NEXT: 400184: 8d f9 20 08 lw $25, 8200($15) -# CHECK-NEXT: 400188: 03 20 00 09 jr $25 -# CHECK-NEXT: 40018c: 25 f8 20 08 addiu $24, $15, 8200 - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2MSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2MSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "0C00000000000000" - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x0 - Symbol: T1 - Type: R_MIPS_26 - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_HI16 - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_LO16 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 0x8 - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 8 - - Name: T1 -... diff --git a/test/old-elf/Mips/plt-entry-r6.test b/test/old-elf/Mips/plt-entry-r6.test deleted file mode 100644 index 0d8bbf494afe..000000000000 --- a/test/old-elf/Mips/plt-entry-r6.test +++ /dev/null @@ -1,109 +0,0 @@ -# REQUIRES: mips - -# Check generation of PLT entries in case of R6 target ABI. - -# Build shared library -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o - -# Build executable -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-objdump -d %t.exe | FileCheck %s - -# CHECK: Disassembly of section .plt: -# CHECK-NEXT: .plt: -# CHECK-NEXT: 400160: 40 00 1c 3c lui $gp, 64 -# CHECK-NEXT: 400164: 00 20 99 8f lw $25, 8192($gp) -# CHECK-NEXT: 400168: 00 20 9c 27 addiu $gp, $gp, 8192 -# CHECK-NEXT: 40016c: 23 c0 1c 03 subu $24, $24, $gp -# CHECK-NEXT: 400170: 25 78 e0 03 move $15, $ra -# CHECK-NEXT: 400174: 82 c0 18 00 srl $24, $24, 2 -# CHECK-NEXT: 400178: 09 f8 20 03 jalr $25 -# CHECK-NEXT: 40017c: fe ff 18 27 addiu $24, $24, -2 -# CHECK-NEXT: 400180: 40 00 0f 3c lui $15, 64 -# CHECK-NEXT: 400184: 08 20 f9 8d lw $25, 8200($15) -# CHECK-NEXT: 400188: 09 00 20 03 jr $25 -# CHECK-NEXT: 40018c: 08 20 f8 25 addiu $24, $15, 8200 - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "0000000C00000000" - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x0 - Symbol: T1 - Type: R_MIPS_26 - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_HI16 - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_LO16 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 0x8 - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 8 - - Name: T1 -... diff --git a/test/old-elf/Mips/plt-header-be.test b/test/old-elf/Mips/plt-header-be.test deleted file mode 100644 index e453e44f76d6..000000000000 --- a/test/old-elf/Mips/plt-header-be.test +++ /dev/null @@ -1,104 +0,0 @@ -# REQUIRES: mips - -# Check initialization of big-endian .plt header entries. - -# Build shared library -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mips -shared -o %t.so %t-so.o - -# Build executable -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mips -o %t.exe %t-o.o %t.so -# RUN: llvm-objdump -section-headers -disassemble %t.exe | FileCheck %s - -# CHECK: Disassembly of section .plt: -# CHECK-NEXT: .plt: -# CHECK-NEXT: 400160: 3c 1c 00 40 lui $gp, 64 -# CHECK-NEXT: 400164: 8f 99 20 00 lw $25, 8192($gp) -# CHECK-NEXT: 400168: 27 9c 20 00 addiu $gp, $gp, 8192 -# CHECK-NEXT: 40016c: 03 1c c0 23 subu $24, $24, $gp -# CHECK-NEXT: 400170: 03 e0 78 25 move $15, $ra -# CHECK-NEXT: 400174: 00 18 c0 82 srl $24, $24, 2 -# CHECK-NEXT: 400178: 03 20 f8 09 jalr $25 -# CHECK-NEXT: 40017c: 27 18 ff fe addiu $24, $24, -2 - -# CHECK-NEXT: 400180: 3c 0f 00 40 lui $15, 64 -# CHECK-NEXT: 400184: 8d f9 20 08 lw $25, 8200($15) -# CHECK-NEXT: 400188: 03 20 00 08 jr $25 -# CHECK-NEXT: 40018c: 25 f8 20 08 addiu $24, $15, 8200 - -# CHECK: Sections: -# CHECK: Idx Name Size Address Type -# CHECK: 6 .plt 00000030 0000000000400160 TEXT DATA -# CHECK: 10 .got.plt 0000000c 0000000000402000 DATA - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2MSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Size: 12 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2MSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 32 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 8 - Symbol: .text - Type: R_MIPS_26 - - Offset: 16 - Symbol: __start - Type: R_MIPS_26 - - Offset: 24 - Symbol: T1 - Type: R_MIPS_26 - -Symbols: - Local: - - Name: loc - Section: .text - Value: 16 - - Name: .text - Type: STT_SECTION - Section: .text - - Global: - - Name: __start - Section: .text - - Name: T1 -... diff --git a/test/old-elf/Mips/plt-header-micro-be.test b/test/old-elf/Mips/plt-header-micro-be.test deleted file mode 100644 index e9aa51ef85eb..000000000000 --- a/test/old-elf/Mips/plt-header-micro-be.test +++ /dev/null @@ -1,105 +0,0 @@ -# REQUIRES: mips - -# Check initialization of .plt header entries -# if all PLT entries use microMIPS big-endian encoding. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.o -# RUN: lld -flavor old-gnu -target mips -shared -o %t.so %t1.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.o -# RUN: lld -flavor old-gnu -target mips -o %t.exe %t2.o %t.so -# RUN: llvm-objdump -section-headers -d -mattr=micromips %t.exe | FileCheck %s - -# CHECK: Disassembly of section .plt: -# CHECK-NEXT: .plt: -# CHECK-NEXT: 400170: 79 80 07 a4 addiupc $3, 7824 -# CHECK-NEXT: 400174: ff 23 00 00 lw $25, 0($3) -# CHECK-NEXT: 400178: 05 35 subu16 $2, $2, $3 -# CHECK-NEXT: 40017a: 25 25 srl16 $2, $2, 2 -# CHECK-NEXT: 40017c: 33 02 ff fe addiu $24, $2, -2 -# CHECK-NEXT: 400180: 0d ff move $15, $ra -# CHECK-NEXT: 400182: 45 f9 jalrs16 $25 -# CHECK-NEXT: 400184: 0f 83 move $gp, $3 -# CHECK-NEXT: 400186: 0c 00 nop - -# CHECK-NEXT: 400188: 79 00 07 a0 addiupc $2, 7808 -# CHECK-NEXT: 40018c: ff 22 00 00 lw $25, 0($2) -# CHECK-NEXT: 400190: 45 99 jr16 $25 -# CHECK-NEXT: 400192: 0f 02 move $24, $2 - -# CHECK: Sections: -# CHECK: Idx Name Size Address Type -# CHECK: 6 .plt 00000024 0000000000400170 TEXT DATA -# CHECK: 10 .got.plt 0000000c 0000000000402000 DATA - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2MSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Size: 12 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2MSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Content: '0000000000000000f40000000000000000000000f400000000000000f4000000' -# jal .text jal __start jal T1 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 8 - Symbol: .text - Type: R_MICROMIPS_26_S1 - - Offset: 20 - Symbol: __start - Type: R_MICROMIPS_26_S1 - - Offset: 28 - Symbol: T1 - Type: R_MICROMIPS_26_S1 - -Symbols: - Local: - - Name: loc - Section: .text - Value: 16 - Other: [ STO_MIPS_MICROMIPS ] - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: __start - Section: .text - Other: [ STO_MIPS_MICROMIPS ] - - Name: T1 -... diff --git a/test/old-elf/Mips/plt-header-micro.test b/test/old-elf/Mips/plt-header-micro.test deleted file mode 100644 index 743c4c332184..000000000000 --- a/test/old-elf/Mips/plt-header-micro.test +++ /dev/null @@ -1,108 +0,0 @@ -# REQUIRES: mips - -# Check initialization of .plt header entries -# if all PLT entries use microMIPS encoding. - -# Build shared library -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o - -# Build executable -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e glob -o %t.exe %t-o.o %t.so -# RUN: llvm-objdump -d -mattr=micromips %t.exe | FileCheck -check-prefix=DIS %s -# RUN: llvm-objdump -section-headers %t.exe | FileCheck -check-prefix=EXE %s - -# DIS: Disassembly of section .plt: -# DIS-NEXT: .plt: -# DIS-NEXT: 400170: 80 79 a4 07 addiupc $3, 7824 -# DIS-NEXT: 400174: 23 ff 00 00 lw $25, 0($3) -# DIS-NEXT: 400178: 35 05 subu16 $2, $2, $3 -# DIS-NEXT: 40017a: 25 25 srl16 $2, $2, 2 -# DIS-NEXT: 40017c: 02 33 fe ff addiu $24, $2, -2 -# DIS-NEXT: 400180: ff 0d move $15, $ra -# DIS-NEXT: 400182: f9 45 jalrs16 $25 -# DIS-NEXT: 400184: 83 0f move $gp, $3 -# DIS-NEXT: 400186: 00 0c nop - -# DIS-NEXT: 400188: 00 79 a0 07 addiupc $2, 7808 -# DIS-NEXT: 40018c: 22 ff 00 00 lw $25, 0($2) -# DIS-NEXT: 400190: 99 45 jr16 $25 -# DIS-NEXT: 400192: 02 0f move $24, $2 - -# EXE: Sections: -# EXE: Idx Name Size Address Type -# EXE: 6 .plt 00000024 0000000000400170 TEXT DATA -# EXE: 10 .got.plt 0000000c 0000000000402000 DATA - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Content: '000000000000000000f4000000000000f400000000000000f400000000000000' -# jal .text jal glob jal T1 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x08 - Symbol: .text - Type: R_MICROMIPS_26_S1 - - Offset: 0x10 - Symbol: glob - Type: R_MICROMIPS_26_S1 - - Offset: 0x18 - Symbol: T1 - Type: R_MICROMIPS_26_S1 - -Symbols: - Local: - - Name: loc - Section: .text - Value: 0x10 - Other: [ STO_MIPS_MICROMIPS ] - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: glob - Section: .text - Other: [ STO_MIPS_MICROMIPS ] - - Name: T1 -... diff --git a/test/old-elf/Mips/plt-header-mixed.test b/test/old-elf/Mips/plt-header-mixed.test deleted file mode 100644 index 456f5a91c98b..000000000000 --- a/test/old-elf/Mips/plt-header-mixed.test +++ /dev/null @@ -1,105 +0,0 @@ -# REQUIRES: mips - -# Check initialization of .plt header entries if there are both regular -# and microMIPS encoded PLT entries. Check that R_MIPS_26 and R_MICROMIPS_26_S1 -# relocation with the same target cause generation of two distinct PLT entries. - -# Build shared library -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o - -# Build executable -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e globR -o %t.exe %t-o.o %t.so -# RUN: llvm-objdump -d %t.exe | FileCheck -check-prefix=DIS %s -# RUN: llvm-objdump -section-headers %t.exe | FileCheck -check-prefix=EXE %s - -# DIS: Disassembly of section .plt: -# DIS-NEXT: .plt: -# DIS-NEXT: 400170: 40 00 1c 3c lui $gp, 64 -# DIS-NEXT: 400174: 00 20 99 8f lw $25, 8192($gp) -# DIS-NEXT: 400178: 00 20 9c 27 addiu $gp, $gp, 8192 -# DIS-NEXT: 40017c: 23 c0 1c 03 subu $24, $24, $gp -# DIS-NEXT: 400180: 25 78 e0 03 move $15, $ra -# DIS-NEXT: 400184: 82 c0 18 00 srl $24, $24, 2 -# DIS-NEXT: 400188: 09 f8 20 03 jalr $25 -# DIS-NEXT: 40018c: fe ff 18 27 addiu $24, $24, -2 - -# DIS-NEXT: 400190: 40 00 0f 3c lui $15, 64 -# DIS-NEXT: 400194: 08 20 f9 8d lw $25, 8200($15) -# DIS-NEXT: 400198: 08 00 20 03 jr $25 -# DIS-NEXT: 40019c: 08 20 f8 25 addiu $24, $15, 8200 - -# FIXME (simon): Check micromips PLT entry -# DIS-NEXT: 4001a8: 99 45 02 0f jal 201922148 - -# EXE: Sections: -# EXE: Idx Name Size Address Type -# EXE: 6 .plt 0000003c 0000000000400170 TEXT DATA -# EXE: 10 .got.plt 0000000c 0000000000402000 DATA - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x8 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x0 - Symbol: T1 - Type: R_MIPS_26 - - Offset: 0x4 - Symbol: T1 - Type: R_MICROMIPS_26_S1 - -Symbols: - Global: - - Name: globR - Section: .text - Value: 0x0 - Size: 0x4 - - Name: globM - Section: .text - Value: 0x4 - Size: 0x4 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T1 -... diff --git a/test/old-elf/Mips/plt-header.test b/test/old-elf/Mips/plt-header.test deleted file mode 100644 index 6d303254d16d..000000000000 --- a/test/old-elf/Mips/plt-header.test +++ /dev/null @@ -1,99 +0,0 @@ -# REQUIRES: mips - -# Check initialization of .plt header entries. - -# Build shared library -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o - -# Build executable -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e glob -o %t.exe %t-o.o %t.so -# RUN: llvm-objdump -section-headers -disassemble %t.exe | \ -# RUN: FileCheck -check-prefix=EXE %s - -# EXE: Disassembly of section .plt: -# EXE: .plt: -# PLT0 entry. Points to the .got.plt[0] -# EXE-NEXT: 400160: 40 00 1c 3c lui $gp, 64 -# EXE-NEXT: 400164: 00 20 99 8f lw $25, 8192($gp) -# EXE-NEXT: 400168: 00 20 9c 27 addiu $gp, $gp, 8192 -# EXE-NEXT: 40016c: 23 c0 1c 03 subu $24, $24, $gp -# EXE-NEXT: 400170: 25 78 e0 03 move $15, $ra -# EXE-NEXT: 400174: 82 c0 18 00 srl $24, $24, 2 -# EXE-NEXT: 400178: 09 f8 20 03 jalr $25 -# EXE-NEXT: 40017c: fe ff 18 27 addiu $24, $24, -2 - -# EXE: Sections: -# EXE: Idx Name Size Address Type -# EXE: 6 .plt 00000030 0000000000400160 TEXT DATA -# EXE: 10 .got.plt 0000000c 0000000000402000 DATA - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x20 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x08 - Symbol: .text - Type: R_MIPS_26 - - Offset: 0x10 - Symbol: glob - Type: R_MIPS_26 - - Offset: 0x18 - Symbol: T1 - Type: R_MIPS_26 - -Symbols: - Local: - - Name: loc - Section: .text - Value: 0x10 - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: glob - Section: .text - - Name: T1 -... diff --git a/test/old-elf/Mips/r26-1-micro.test b/test/old-elf/Mips/r26-1-micro.test deleted file mode 100644 index c59b5aa61a53..000000000000 --- a/test/old-elf/Mips/r26-1-micro.test +++ /dev/null @@ -1,131 +0,0 @@ -# REQUIRES: mips - -# Check handling of R_MICROMIPS_26_S1 relocation. - -# Build shared library -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o - -# Build executable -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: llvm-readobj -relocations %t-o.o | \ -# RUN: FileCheck -check-prefix=OBJ-REL %s -# RUN: lld -flavor old-gnu -target mipsel -e glob -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -relocations %t.exe | FileCheck -check-prefix=EXE-REL %s -# RUN: llvm-objdump -section-headers %t.exe | FileCheck -check-prefix=EXE %s -# RUN: llvm-objdump -s -d -mattr=micromips %t.exe | \ -# RUN: FileCheck -check-prefix=DIS %s - -# Object file has three R_MICROMIPS_26_S1 relocations -# OBJ-REL: Relocations [ -# OBJ-REL-NEXT: Section (2) .rel.text { -# OBJ-REL-NEXT: 0x8 R_MICROMIPS_26_S1 loc 0x0 -# OBJ-REL-NEXT: 0x10 R_MICROMIPS_26_S1 glob 0x0 -# OBJ-REL-NEXT: 0x18 R_MICROMIPS_26_S1 T1 0x0 -# OBJ-REL-NEXT: } -# OBJ-REL-NEXT: ] - -# Executable file has the only relocation for external symbol -# EXE-REL: Relocations [ -# EXE-REL-NEXT: Section (5) .rel.plt { -# EXE-REL-NEXT: 0x402008 R_MIPS_JUMP_SLOT T1 0x0 -# EXE-REL-NEXT: } -# EXE-REL-NEXT: ] - -# EXE: Sections: -# EXE: Idx Name Size Address Type -# EXE: 6 .plt 00000024 0000000000400160 TEXT DATA -# EXE: 10 .got.plt 0000000c 0000000000402000 DATA - -# DIS: Disassembly of section .plt: -# DIS-NEXT: .plt: -# DIS-NEXT: 400160: 80 79 a8 07 addiupc $3, 7840 -# DIS-NEXT: 400164: 23 ff 00 00 lw $25, 0($3) -# DIS-NEXT: 400168: 35 05 subu16 $2, $2, $3 -# DIS-NEXT: 40016a: 25 25 srl16 $2, $2, 2 -# DIS-NEXT: 40016c: 02 33 fe ff addiu $24, $2, -2 -# DIS-NEXT: 400170: ff 0d move $15, $ra -# DIS-NEXT: 400172: f9 45 jalrs16 $25 -# DIS-NEXT: 400174: 83 0f move $gp, $3 -# DIS-NEXT: 400176: 00 0c nop - -# DIS-NEXT: 400178: 00 79 a4 07 addiupc $2, 7824 -# DIS-NEXT: 40017c: 22 ff 00 00 lw $25, 0($2) -# DIS-NEXT: 400180: 99 45 jr16 $25 -# DIS-NEXT: 400182: 02 0f move $24, $2 - -# DIS: Contents of section .text: -# DIS-NEXT: 400184 09f82003 00000000 2400ca0c 00000000 .. .....$....... -# DIS-NEXT: 400194 2000c20c 00000000 2000bc0c 00000000 ....... ....... - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Content: '09F82003000000000400000C000000000000000C000000000000000C00000000' - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x08 - Symbol: loc - Type: R_MICROMIPS_26_S1 - - Offset: 0x10 - Symbol: glob - Type: R_MICROMIPS_26_S1 - - Offset: 0x18 - Symbol: T1 - Type: R_MICROMIPS_26_S1 - -Symbols: - Local: - - Name: loc - Section: .text - Value: 0x10 - Other: [ STO_MIPS_MICROMIPS ] - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: glob - Section: .text - Other: [ STO_MIPS_MICROMIPS ] - - Name: T1 -... diff --git a/test/old-elf/Mips/r26-1.test b/test/old-elf/Mips/r26-1.test deleted file mode 100644 index 41c58deceedb..000000000000 --- a/test/old-elf/Mips/r26-1.test +++ /dev/null @@ -1,132 +0,0 @@ -# REQUIRES: mips - -# Check handling of R_MIPS_26 relocation. - -# Build shared library -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o - -# Build executable -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: llvm-readobj -relocations %t-o.o | \ -# RUN: FileCheck -check-prefix=OBJ-REL %s -# RUN: lld -flavor old-gnu -target mipsel -e glob -o %t.exe %t-o.o %t.so -# RUN: llvm-objdump -section-headers -disassemble %t.exe | \ -# RUN: FileCheck -check-prefix=EXE %s -# RUN: llvm-readobj -relocations %t.exe | FileCheck -check-prefix=EXE-REL %s - -# Object file has three R_MIPS_26 relocations -# OBJ-REL: Relocations [ -# OBJ-REL-NEXT: Section (2) .rel.text { -# OBJ-REL-NEXT: 0x8 R_MIPS_26 .text 0x0 -# OBJ-REL-NEXT: 0x10 R_MIPS_26 glob 0x0 -# OBJ-REL-NEXT: 0x18 R_MIPS_26 T1 0x0 -# OBJ-REL-NEXT: } -# OBJ-REL-NEXT: ] - -# Executable file has the only relocation for external symbol -# EXE-REL: Relocations [ -# EXE-REL-NEXT: Section (5) .rel.plt { -# EXE-REL-NEXT: 0x402008 R_MIPS_JUMP_SLOT T1 0x0 -# EXE-REL-NEXT: } -# EXE-REL-NEXT: ] - -# EXE: Disassembly of section .plt: -# EXE: .plt: -# PLTA entry. Points to the .got.plt[1] -# EXE: 400180: 40 00 0f 3c lui $15, 64 -# EXE-NEXT: 400184: 08 20 f9 8d lw $25, 8200($15) -# EXE-NEXT: 400188: 08 00 20 03 jr $25 -# EXE-NEXT: 40018c: 08 20 f8 25 addiu $24, $15, 8200 - -# EXE: Disassembly of section .text: -# EXE: glob: -# EXE-NEXT: 400190: 09 f8 20 03 jalr $25 -# EXE-NEXT: 400194: 00 00 00 00 nop -# -# Jump to 'loc' label address -# EXE-NEXT: 400198: 68 00 10 0c jal 4194720 -# EXE-NEXT: 40019c: 00 00 00 00 nop -# -# EXE: loc: -# Jump to 'glob' label address -# EXE-NEXT: 4001a0: 64 00 10 0c jal 4194704 -# EXE-NEXT: 4001a4: 00 00 00 00 nop -# -# Jump to the first PLT entry (.plt + 32) for T1 entry -# EXE-NEXT: 4001a8: 60 00 10 0c jal 4194688 -# EXE-NEXT: 4001ac: 00 00 00 00 nop - -# EXE: Sections: -# EXE: Idx Name Size Address Type -# EXE: 6 .plt 00000030 0000000000400160 TEXT DATA -# EXE: 10 .got.plt 0000000c 0000000000402000 DATA - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Content: '09F82003000000000400000C000000000000000C000000000000000C00000000' - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x08 - Symbol: .text - Type: R_MIPS_26 - - Offset: 0x10 - Symbol: glob - Type: R_MIPS_26 - - Offset: 0x18 - Symbol: T1 - Type: R_MIPS_26 - -Symbols: - Local: - - Name: loc - Section: .text - Value: 0x10 - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: glob - Section: .text - - Name: T1 -... diff --git a/test/old-elf/Mips/r26-2-micro.test b/test/old-elf/Mips/r26-2-micro.test deleted file mode 100644 index 7d4f86e57f70..000000000000 --- a/test/old-elf/Mips/r26-2-micro.test +++ /dev/null @@ -1,31 +0,0 @@ -# REQUIRES: mips - -# Check reading addendum for R_MICROMIPS_26_S1 relocation. -# RUN: llvm-mc -arch=mipsel -filetype=obj -mattr=micromips -o=%t.o %s -# RUN: lld -flavor old-gnu -target mipsel -o %t.exe %t.o -# RUN: llvm-objdump -d -mattr=micromips %t.exe | FileCheck %s - -# CHECK: Disassembly of section .text: -# CHECK-NEXT: __start: -# CHECK-NEXT: 400180: 10 f0 60 70 jalx 2154688 -# CHECK-NEXT: 400184: 00 00 00 00 nop -# CHECK-NEXT: 400188: 10 f0 68 70 jalx 2154704 -# CHECK-NEXT: 40018c: 00 00 00 00 nop -# CHECK-NEXT: 400190: 10 f0 58 00 jalx 2097328 -# CHECK-NEXT: 400194: 00 00 00 00 nop -# CHECK-NEXT: 400198: 10 f0 62 00 jalx 2097348 -# CHECK-NEXT: 40019c: 00 00 00 00 nop -# -# CHECK: loc: -# CHECK-NEXT: 4001a0: 00 00 00 00 nop - - .text - .globl __start -__start: - jal __start + 0x1C000 - jal loc + 0x1C000 - jal __start + 0x7ffffe2 - jal loc + 0x7ffffea - -loc: - nop diff --git a/test/old-elf/Mips/r26-2.test b/test/old-elf/Mips/r26-2.test deleted file mode 100644 index b9db959d3ea7..000000000000 --- a/test/old-elf/Mips/r26-2.test +++ /dev/null @@ -1,31 +0,0 @@ -# REQUIRES: mips - -# Check reading addendum for R_MIPS_26 relocation. -# RUN: llvm-mc -arch=mipsel -filetype=obj -o=%t.o %s -# RUN: lld -flavor old-gnu -target mipsel -o %t.exe %t.o -# RUN: llvm-objdump -d %t.exe | FileCheck %s - -# CHECK: Disassembly of section .text: -# CHECK-NEXT: __start: -# CHECK-NEXT: 400180: 60 70 10 0c jal 4309376 -# CHECK-NEXT: 400184: 00 00 00 00 nop -# CHECK-NEXT: 400188: 68 70 10 0c jal 4309408 -# CHECK-NEXT: 40018c: 00 00 00 00 nop -# CHECK-NEXT: 400190: 5f 00 10 0c jal 4194684 -# CHECK-NEXT: 400194: 00 00 00 00 nop -# CHECK-NEXT: 400198: 67 00 10 0c jal 4194716 -# CHECK-NEXT: 40019c: 00 00 00 00 nop -# -# CHECK: loc: -# CHECK-NEXT: 4001a0: 00 00 00 00 nop - - .text - .globl __start -__start: - jal __start + 0x1C000 - jal loc + 0x1C000 - jal __start + (-1) - jal loc + (-1) - -loc: - nop diff --git a/test/old-elf/Mips/reginfo-01.test b/test/old-elf/Mips/reginfo-01.test deleted file mode 100644 index ee7cd6a5fcee..000000000000 --- a/test/old-elf/Mips/reginfo-01.test +++ /dev/null @@ -1,30 +0,0 @@ -# Check that LLD does not write a .reginfo section if input -# object file does not contain such section. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o -# RUN: llvm-readobj -s %t.so | FileCheck %s - -# CHECK-NOT: Name: .reginfo - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 diff --git a/test/old-elf/Mips/reginfo-02.test b/test/old-elf/Mips/reginfo-02.test deleted file mode 100644 index 41eac01a11b1..000000000000 --- a/test/old-elf/Mips/reginfo-02.test +++ /dev/null @@ -1,107 +0,0 @@ -# Check merging input .reginfo sections. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t1.o %t2.o -# RUN: llvm-readobj -program-headers -s -t -mips-reginfo %t.so | FileCheck %s - -# CHECK: Index: 1 -# CHECK-NEXT: Name: .reginfo (1) -# CHECK-NEXT: Type: SHT_MIPS_REGINFO -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: {{[0-9A-F]+}} -# CHECK-NEXT: Offset: {{[0-9A-F]+}} -# CHECK-NEXT: Size: 24 -# CHECK-NEXT: Link: 0 -# CHECK-NEXT: Info: 0 -# CHECK-NEXT: AddressAlignment: 4 -# CHECK-NEXT: EntrySize: 24 - -# CHECK: Name: _gp -# CHECK-NEXT: 0x8FF0 - -# CHECK: ProgramHeaders [ -# CHECK-NEXT: ProgramHeader { -# CHECK-NEXT: Type: PT_MIPS_REGINFO -# CHECK-NEXT: Offset: 0x{{[0-9A-F]+}} -# CHECK-NEXT: VirtualAddress: 0x{{[0-9A-F]+}} -# CHECK-NEXT: PhysicalAddress: 0x{{[0-9A-F]+}} -# CHECK-NEXT: FileSize: 24 -# CHECK-NEXT: MemSize: 24 -# CHECK-NEXT: Flags [ -# CHECK-NEXT: PF_R -# CHECK-NEXT: ] -# CHECK-NEXT: Alignment: 4 -# CHECK-NEXT: } - -# CHECK: MIPS RegInfo { -# CHECK-NEXT: GP: 0x8FF0 -# CHECK-NEXT: General Mask: 0x10000F0 -# CHECK-NEXT: Co-Proc Mask0: 0x20000E0 -# CHECK-NEXT: Co-Proc Mask1: 0x30000D0 -# CHECK-NEXT: Co-Proc Mask2: 0x40000C0 -# CHECK-NEXT: Co-Proc Mask3: 0x50000B0 -# CHECK-NEXT: } - -# t1.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .reginfo - Type: SHT_MIPS_REGINFO - Flags: [ SHF_ALLOC ] - AddressAlign: 4 - Content: "F0000000E0000000D0000000C0000000B000000000100000" - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# t2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .reginfo - Type: SHT_MIPS_REGINFO - Flags: [ SHF_ALLOC ] - AddressAlign: 4 - Content: "000000010000000200000003000000040000000500000100" - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 -... diff --git a/test/old-elf/Mips/reginfo-03.test b/test/old-elf/Mips/reginfo-03.test deleted file mode 100644 index edee1440d358..000000000000 --- a/test/old-elf/Mips/reginfo-03.test +++ /dev/null @@ -1,45 +0,0 @@ -# Check handling a zero-filled input .reginfo section. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o -# RUN: llvm-readobj -t -mips-reginfo %t.so | FileCheck %s - -# CHECK: Name: _gp -# CHECK-NEXT: 0x8FF0 - -# CHECK: MIPS RegInfo { -# CHECK-NEXT: GP: 0x8FF0 -# CHECK-NEXT: General Mask: 0x0 -# CHECK-NEXT: Co-Proc Mask0: 0x0 -# CHECK-NEXT: Co-Proc Mask1: 0x0 -# CHECK-NEXT: Co-Proc Mask2: 0x0 -# CHECK-NEXT: Co-Proc Mask3: 0x0 -# CHECK-NEXT: } - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .reginfo - Type: SHT_MIPS_REGINFO - Flags: [ SHF_ALLOC ] - AddressAlign: 4 - Content: "000000000000000000000000000000000000000000000000" - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 diff --git a/test/old-elf/Mips/reginfo-04.test b/test/old-elf/Mips/reginfo-04.test deleted file mode 100644 index bad34e5003f7..000000000000 --- a/test/old-elf/Mips/reginfo-04.test +++ /dev/null @@ -1,81 +0,0 @@ -# Check that .reginfo sections from shared libraries do not affect -# output .reginfo section content. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t.so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t.exe.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.so %t.exe.o -# RUN: llvm-readobj -t -mips-reginfo %t.exe | FileCheck %s - -# CHECK: Name: _gp -# CHECK-NEXT: 0x408FF0 - -# CHECK: MIPS RegInfo { -# CHECK-NEXT: GP: 0x408FF0 -# CHECK-NEXT: General Mask: 0x44444444 -# CHECK-NEXT: Co-Proc Mask0: 0x44444444 -# CHECK-NEXT: Co-Proc Mask1: 0x44444444 -# CHECK-NEXT: Co-Proc Mask2: 0x44444444 -# CHECK-NEXT: Co-Proc Mask3: 0x44444444 -# CHECK-NEXT: } - -# t.so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .reginfo - Type: SHT_MIPS_REGINFO - Flags: [ SHF_ALLOC ] - AddressAlign: 4 - Content: "111111111111111111111111111111111111111100100000" - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# t.exe.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .reginfo - Type: SHT_MIPS_REGINFO - Flags: [ SHF_ALLOC ] - AddressAlign: 4 - Content: "444444444444444444444444444444444444444400000000" - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 -... diff --git a/test/old-elf/Mips/reginfo-05.test b/test/old-elf/Mips/reginfo-05.test deleted file mode 100644 index 9de9fa62149a..000000000000 --- a/test/old-elf/Mips/reginfo-05.test +++ /dev/null @@ -1,123 +0,0 @@ -# Check that .reginfo section gets register usage mask from "used" files only. -# In this test case we take only t2.o from libreginfo.a and should not add -# register usage masks from t1.o to the output .reginfo section. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.o -# RUN: llvm-ar q %T/libreginfo.a %t1.o %t2.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t3.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t3.o -L%T -lreginfo -# RUN: llvm-readobj -t -mips-reginfo %t.exe | FileCheck %s - -# CHECK: Name: _gp -# CHECK-NEXT: 0x408FF0 - -# CHECK: MIPS RegInfo { -# CHECK-NEXT: GP: 0x408FF0 -# CHECK-NEXT: General Mask: 0x66666666 -# CHECK-NEXT: Co-Proc Mask0: 0x66666666 -# CHECK-NEXT: Co-Proc Mask1: 0x66666666 -# CHECK-NEXT: Co-Proc Mask2: 0x66666666 -# CHECK-NEXT: Co-Proc Mask3: 0x66666666 -# CHECK-NEXT: } - -# t1.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .reginfo - Type: SHT_MIPS_REGINFO - Flags: [ SHF_ALLOC ] - AddressAlign: 4 - Content: "111111111111111111111111111111111111111100000000" - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# t2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .reginfo - Type: SHT_MIPS_REGINFO - Flags: [ SHF_ALLOC ] - AddressAlign: 4 - Content: "222222222222222222222222222222222222222200000000" - -Symbols: - Global: - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# t3.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T2 - Type: R_MIPS_32 - -- Name: .reginfo - Type: SHT_MIPS_REGINFO - Flags: [ SHF_ALLOC ] - AddressAlign: 4 - Content: "444444444444444444444444444444444444444400000000" - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: T2 -... diff --git a/test/old-elf/Mips/rel-16-overflow.test b/test/old-elf/Mips/rel-16-overflow.test deleted file mode 100644 index e2a73f693361..000000000000 --- a/test/old-elf/Mips/rel-16-overflow.test +++ /dev/null @@ -1,45 +0,0 @@ -# Check R_MIPS_16 relocation overflow handling. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: not lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o 2>&1 \ -# RUN: | FileCheck %s - -# CHECK: Relocation out of range in file {{.*}} reference from T0+0 to T1+32767 of type 1 (R_MIPS_16) - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "ff7f00000000000000000000" -# ^ T1 -# ^ T0 A := 0x7fff - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_16 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 8 - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 8 - Size: 4 diff --git a/test/old-elf/Mips/rel-16.test b/test/old-elf/Mips/rel-16.test deleted file mode 100644 index 24961e8b78ff..000000000000 --- a/test/old-elf/Mips/rel-16.test +++ /dev/null @@ -1,51 +0,0 @@ -# Check handling of R_MIPS_16 relocation. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: 00f0 f0000000 00000000 00000000 -# ^ V = (T1 - 8) = T0 - -# CHECK: SYMBOL TABLE: -# CHECK: 000000f0 g F .text 00000008 T0 -# CHECK: 000000f8 g F .text 00000004 T1 - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "f8ff00000000000000000000" -# ^ T1 -# ^ T0 A := 0xfff8 = -8 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_16 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 8 - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 8 - Size: 4 diff --git a/test/old-elf/Mips/rel-32-be.test b/test/old-elf/Mips/rel-32-be.test deleted file mode 100644 index 3eac8a2848f0..000000000000 --- a/test/old-elf/Mips/rel-32-be.test +++ /dev/null @@ -1,60 +0,0 @@ -# Check handling of R_MIPS_32 relocation in the big-endian case. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .data: -# CHECK-NEXT: 402000 00000000 01402088 01402084 -# ^^ D2 + 0x1000080 = 0x1402088 -# ^^ D1 + 0x1000080 = 0x1402084 -# CHECK: SYMBOL TABLE: -# CHECK: 00402004 g .data 00000004 D1 -# CHECK: 00402008 g .data 00000004 D2 - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2MSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - AddressAlign: 16 - Flags: [SHF_ALLOC] - Size: 4 - -- Name: .data - Type: SHT_PROGBITS - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - Content: "000000000100008001000080" - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 4 - Symbol: D2 - Type: R_MIPS_32 - - Offset: 8 - Symbol: D1 - Type: R_MIPS_32 - -Symbols: - Global: - - Name: __start - Section: .text - Value: 0 - Size: 4 - - Name: D1 - Section: .data - Value: 4 - Size: 4 - - Name: D2 - Section: .data - Value: 8 - Size: 4 diff --git a/test/old-elf/Mips/rel-32.test b/test/old-elf/Mips/rel-32.test deleted file mode 100644 index f028d79c8688..000000000000 --- a/test/old-elf/Mips/rel-32.test +++ /dev/null @@ -1,59 +0,0 @@ -# Check handling of R_MIPS_32 relocation. -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target mipsel -o %t-exe %t-obj -# RUN: llvm-objdump -s -t %t-exe | FileCheck %s - -# CHECK: Contents of section .data: -# CHECK-NEXT: 402000 00000000 09204080 05204080 ..... @.. @. -# ^^ data2 + 0x80000001 = 0x80402009 -# ^^ data1 + 0x80000001 = 0x80402005 -# CHECK: SYMBOL TABLE: -# CHECK: 00402004 g .data 00000004 data1 -# CHECK: 00402008 g .data 00000004 data2 - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 16 - Flags: [SHF_ALLOC] -- Name: .data - Type: SHT_PROGBITS - Content: "000000000100008001000080" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x4 - Symbol: data2 - Type: R_MIPS_32 - - Offset: 0x8 - Symbol: data1 - Type: R_MIPS_32 - -Symbols: - Global: - - Name: __start - Section: .text - Value: 0x0 - Size: 4 - - Name: data1 - Section: .data - Value: 0x4 - Size: 4 - - Name: data2 - Section: .data - Value: 0x8 - Size: 4 diff --git a/test/old-elf/Mips/rel-64.test b/test/old-elf/Mips/rel-64.test deleted file mode 100644 index c97ff991c0c4..000000000000 --- a/test/old-elf/Mips/rel-64.test +++ /dev/null @@ -1,61 +0,0 @@ -# Check handling of R_MIPS_64 relocation. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips64el -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .data: -# CHECK-NEXT: 120002000 d1010020 01000000 d0010020 01000100 ... ....... .... -# ^^ __start + 1 = 0x1200001d1 -# ^^ __start + 0x1000000000000 -# = 0x10001200001d0 -# CHECK: SYMBOL TABLE: -# CHECK: 00000001200001d0 g .rodata 00000008 __start - -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_ALLOC] -- Name: .data - Type: SHT_PROGBITS - Size: 0x10 - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rela.data - Type: SHT_RELA - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x0 - Symbol: __start - Type: R_MIPS_64 - Addend: 1 - - Offset: 0x8 - Symbol: __start - Type: R_MIPS_64 - Addend: 0x1000000000000 - -Symbols: - Global: - - Name: __start - Section: .text - Value: 0x0 - Size: 8 - - Name: data1 - Section: .data - Value: 0x0 - Size: 8 - - Name: data2 - Section: .data - Value: 0x8 - Size: 8 diff --git a/test/old-elf/Mips/rel-call-hilo-01.test b/test/old-elf/Mips/rel-call-hilo-01.test deleted file mode 100644 index 88f2e337d928..000000000000 --- a/test/old-elf/Mips/rel-call-hilo-01.test +++ /dev/null @@ -1,109 +0,0 @@ -# Check handling of R_MIPS_CALL_HI16 / R_MIPS_CALL_LO16 relocations. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t1.so %t1.so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t2.so %t2.so.o %t1.so -# RUN: llvm-objdump -s -t %t2.so | FileCheck -check-prefix=RAW %s -# RUN: llvm-readobj -mips-plt-got %t2.so | FileCheck -check-prefix=GOT %s - -# RAW: Contents of section .text: -# RAW-NEXT: 0110 00000000 18800000 00000000 1c800000 -# ^ -32744 ^ -32740 -# RAW-NEXT: 0120 00000000 - -# RAW: SYMBOL TABLE: -# RAW: 00000120 l F .text 00000004 T1 - -# GOT: Local entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1008 -# GOT-NEXT: Access: -32744 -# GOT-NEXT: Initial: 0x120 -# GOT-NEXT: } -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x100C -# GOT-NEXT: Access: -32740 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T2@ (4) -# GOT-NEXT: } -# GOT-NEXT: ] - -# t1.so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] - -Symbols: - Global: - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# t2.so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 20 - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_CALL_HI16 - - Offset: 4 - Symbol: T1 - Type: R_MIPS_CALL_LO16 - - Offset: 8 - Symbol: T2 - Type: R_MIPS_CALL_HI16 - - Offset: 12 - Symbol: T2 - Type: R_MIPS_CALL_LO16 - -Symbols: - Local: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 16 - Size: 4 - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 16 - - Name: T2 -... diff --git a/test/old-elf/Mips/rel-call-hilo-micro.test b/test/old-elf/Mips/rel-call-hilo-micro.test deleted file mode 100644 index 0df68def92b3..000000000000 --- a/test/old-elf/Mips/rel-call-hilo-micro.test +++ /dev/null @@ -1,154 +0,0 @@ -# Check handling of R_MICROMIPS_CALL_HI16 / R_MICROMIPS_CALL_LO16 relocations. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t1.so %t1.so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t2.so %t2.so.o %t1.so -# RUN: llvm-objdump -s -t %t2.so | FileCheck -check-prefix=RAW %s -# RUN: llvm-readobj -mips-plt-got %t2.so | FileCheck -check-prefix=GOT %s - -# RAW: Contents of section .text: -# RAW-NEXT: 0130 00000000 00001880 00000000 00002080 -# ^ -32744 ^ -32736 -# RAW-NEXT: 0140 00000000 00001c80 00000000 00002480 -# ^ -32740 ^ -32732 -# RAW-NEXT: 0150 00000000 00000000 - -# RAW: SYMBOL TABLE: -# RAW: 00000140 l F .text 00000014 T1 -# RAW: 00000154 l F .text 00000004 M1 - -# GOT: Local entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1008 -# GOT-NEXT: Access: -32744 -# GOT-NEXT: Initial: 0x140 -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x100C -# GOT-NEXT: Access: -32740 -# GOT-NEXT: Initial: 0x155 -# GOT-NEXT: } -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1010 -# GOT-NEXT: Access: -32736 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T2@ (4) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1014 -# GOT-NEXT: Access: -32732 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: M2@ (7) -# GOT-NEXT: } -# GOT-NEXT: ] - -# t1.so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] - -Symbols: - Global: - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: M2 - Section: .text - Type: STT_FUNC - Value: 4 - Size: 4 - Other: [STO_MIPS_MICROMIPS] - -# t2.so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 40 - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MICROMIPS_CALL_HI16 - - Offset: 4 - Symbol: T1 - Type: R_MICROMIPS_CALL_LO16 - - Offset: 8 - Symbol: T2 - Type: R_MICROMIPS_CALL_HI16 - - Offset: 12 - Symbol: T2 - Type: R_MICROMIPS_CALL_LO16 - - Offset: 16 - Symbol: M1 - Type: R_MICROMIPS_CALL_HI16 - - Offset: 20 - Symbol: M1 - Type: R_MICROMIPS_CALL_LO16 - - Offset: 24 - Symbol: M2 - Type: R_MICROMIPS_CALL_HI16 - - Offset: 28 - Symbol: M2 - Type: R_MICROMIPS_CALL_LO16 - -Symbols: - Local: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 16 - Size: 4 - - Name: M1 - Section: .text - Type: STT_FUNC - Value: 36 - Size: 4 - Other: [STO_MIPS_MICROMIPS] - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 16 - Other: [STO_MIPS_MICROMIPS] - - Name: T2 - - Name: M2 -... diff --git a/test/old-elf/Mips/rel-copy-micro.test b/test/old-elf/Mips/rel-copy-micro.test deleted file mode 100644 index ba47c84a2c5c..000000000000 --- a/test/old-elf/Mips/rel-copy-micro.test +++ /dev/null @@ -1,159 +0,0 @@ -# Check R_MIPS_COPY relocation emitting -# when linking non-shared executable file. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so1.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t1.so %t-so1.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-so2.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t2.so %t-so2.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t1.so %t2.so -# RUN: llvm-readobj -dt -r -dynamic-table %t.exe | FileCheck %s - -# CHECK: Relocations [ -# CHECK-NEXT: Section (5) .rel.dyn { -# CHECK-NEXT: 0x402010 R_MIPS_COPY D1 0x0 -# CHECK-NEXT: 0x402018 R_MIPS_COPY D2 0x0 -# CHECK-NEXT: } -# CHECK-NEXT: ] - -# CHECK: DynamicSymbols [ -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: @ (0) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Local (0x0) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D1@ (1) -# CHECK-NEXT: Value: 0x402010 -# CHECK-NEXT: Size: 8 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: .bss -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D2@ (4) -# CHECK-NEXT: Value: 0x402018 -# CHECK-NEXT: Size: 4 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: .bss -# CHECK-NEXT: } -# CHECK-NEXT: ] - -# CHECK: DynamicSection [ ({{.*}} entries) -# CHECK: 0x00000001 NEEDED SharedLibrary (rel-copy-micro.test.tmp1.so) -# CHECK: 0x00000001 NEEDED SharedLibrary (rel-copy-micro.test.tmp2.so) -# CHECK-NEXT: 0x00000000 NULL 0x0 -# CHECK-NEXT: ] - -# so1.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -Symbols: - Global: - - Name: D1 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 4 - -# so2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .data - Type: SHT_PROGBITS - Size: 0x04 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -Symbols: - Global: - - Name: D2 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: D1 - Type: R_MICROMIPS_HI16 - - Offset: 0x00 - Symbol: D1 - Type: R_MICROMIPS_LO16 - - Offset: 0x08 - Symbol: D2 - Type: R_MICROMIPS_HI16 - - Offset: 0x08 - Symbol: D2 - Type: R_MICROMIPS_LO16 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 8 - Other: [ STO_MIPS_MICROMIPS ] - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 8 - - Name: D1 - Type: STT_OBJECT - - Name: D2 -... diff --git a/test/old-elf/Mips/rel-copy-pc.test b/test/old-elf/Mips/rel-copy-pc.test deleted file mode 100644 index cf723f53719c..000000000000 --- a/test/old-elf/Mips/rel-copy-pc.test +++ /dev/null @@ -1,113 +0,0 @@ -# Check R_MIPS_COPY relocation emitting caused by R_MIPS_PCHI16 / R_MIPS_PCLO16 -# relocations when linking non-shared executable file. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -dt -r -dynamic-table %t.exe | FileCheck %s - -# CHECK: Relocations [ -# CHECK-NEXT: Section (5) .rel.dyn { -# CHECK-NEXT: 0x402008 R_MIPS_COPY D1 0x0 -# CHECK-NEXT: } -# CHECK-NEXT: ] - -# CHECK: DynamicSymbols [ -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: @ (0) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Local (0x0) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D1@ (1) -# CHECK-NEXT: Value: 0x402008 -# CHECK-NEXT: Size: 4 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: .bss -# CHECK-NEXT: } -# CHECK-NEXT: ] - -# CHECK: DynamicSection [ ({{.*}} entries) -# CHECK: 0x00000001 NEEDED SharedLibrary (rel-copy-pc.test.tmp.so) -# CHECK-NEXT: 0x00000000 NULL 0x0 -# CHECK-NEXT: ] - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: -- Name: .data - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -Symbols: - Global: - - Name: D1 - Section: .data - Type: STT_OBJECT - Value: 0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: D1 - Type: R_MIPS_PCHI16 - - Offset: 0 - Symbol: D1 - Type: R_MIPS_PCLO16 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0 - Size: 4 - - Name: D1 -... diff --git a/test/old-elf/Mips/rel-copy.test b/test/old-elf/Mips/rel-copy.test deleted file mode 100644 index 751034dcd728..000000000000 --- a/test/old-elf/Mips/rel-copy.test +++ /dev/null @@ -1,177 +0,0 @@ -# Check R_MIPS_COPY relocation emitting -# when linking non-shared executable file. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so1.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t1.so %t-so1.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-so2.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t2.so %t-so2.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t1.so %t2.so -# RUN: llvm-readobj -dt -r -dynamic-table %t.exe | FileCheck %s - -# CHECK: Relocations [ -# CHECK-NEXT: Section (5) .rel.dyn { -# CHECK-NEXT: 0x402004 R_MIPS_REL32 D2 0x0 -# CHECK-NEXT: 0x402010 R_MIPS_COPY D1 0x0 -# CHECK-NEXT: 0x402018 R_MIPS_COPY D3 0x0 -# CHECK-NEXT: } -# CHECK-NEXT: ] - -# CHECK: DynamicSymbols [ -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: @ (0) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Local (0x0) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D1@ (1) -# CHECK-NEXT: Value: 0x{{[0-9A-F]+}} -# CHECK-NEXT: Size: 4 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: .bss -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D3@ (4) -# CHECK-NEXT: Value: 0x{{[0-9A-F]+}} -# CHECK-NEXT: Size: 4 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: .bss -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D2@ (7) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 4 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: ] - -# CHECK: DynamicSection [ ({{.*}} entries) -# CHECK: 0x00000001 NEEDED SharedLibrary (rel-copy.test.tmp1.so) -# CHECK: 0x00000001 NEEDED SharedLibrary (rel-copy.test.tmp2.so) -# CHECK-NEXT: 0x00000000 NULL 0x0 -# CHECK-NEXT: ] - -# so1.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -Symbols: - Global: - - Name: D1 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 4 - - Name: D2 - Section: .data - Type: STT_OBJECT - Value: 0x4 - Size: 4 - -# so2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .data - Type: SHT_PROGBITS - Size: 0x04 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -Symbols: - Global: - - Name: D3 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: D1 - Type: R_MIPS_HI16 - - Offset: 0x00 - Symbol: D1 - Type: R_MIPS_LO16 - - Offset: 0x04 - Symbol: D2 - Type: R_MIPS_32 - - Offset: 0x08 - Symbol: D3 - Type: R_MIPS_HI16 - - Offset: 0x08 - Symbol: D3 - Type: R_MIPS_LO16 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 8 - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 8 - - Name: D1 - Type: STT_OBJECT - - Name: D2 - - Name: D3 -... diff --git a/test/old-elf/Mips/rel-dynamic-01-micro.test b/test/old-elf/Mips/rel-dynamic-01-micro.test deleted file mode 100644 index 56dd7dfdeccd..000000000000 --- a/test/old-elf/Mips/rel-dynamic-01-micro.test +++ /dev/null @@ -1,201 +0,0 @@ -# REQUIRES: mips - -# Conditions: -# a) Linking a non-shared executable file. -# b) Relocations' targets are symbols defined in the shared object. -# Check: -# a) Emitting R_MIPS_COPY, R_MIPS_JUMP_SLOT relocations. -# b) PLT entries creation. -# c) STO_MIPS_PLT flag in the dynamic symbol table for symbols require -# a pointer equality. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-objdump -d -mattr=micromips %t.exe | FileCheck -check-prefix=DIS %s -# RUN: llvm-readobj -dt -r %t.exe | FileCheck -check-prefix=PLT-SYM %s - -# DIS: Disassembly of section .plt: -# DIS-NEXT: .plt: -# DIS-NEXT: 4001b0: 80 79 94 07 addiupc $3, 7760 -# DIS-NEXT: 4001b4: 23 ff 00 00 lw $25, 0($3) -# DIS-NEXT: 4001b8: 35 05 subu16 $2, $2, $3 -# DIS-NEXT: 4001ba: 25 25 srl16 $2, $2, 2 -# DIS-NEXT: 4001bc: 02 33 fe ff addiu $24, $2, -2 -# DIS-NEXT: 4001c0: ff 0d move $15, $ra -# DIS-NEXT: 4001c2: f9 45 jalrs16 $25 -# DIS-NEXT: 4001c4: 83 0f move $gp, $3 -# DIS-NEXT: 4001c6: 00 0c nop - -# DIS-NEXT: 4001c8: 00 79 90 07 addiupc $2, 7744 -# DIS-NEXT: 4001cc: 22 ff 00 00 lw $25, 0($2) -# DIS-NEXT: 4001d0: 99 45 jr16 $25 -# DIS-NEXT: 4001d2: 02 0f move $24, $2 - -# DIS-NEXT: 4001d4: 00 79 8e 07 addiupc $2, 7736 -# DIS-NEXT: 4001d8: 22 ff 00 00 lw $25, 0($2) -# DIS-NEXT: 4001dc: 99 45 jr16 $25 -# DIS-NEXT: 4001de: 02 0f move $24, $2 - -# PLT-SYM: Relocations [ -# PLT-SYM-NEXT: Section (5) .rel.dyn { -# PLT-SYM-NEXT: 0x402020 R_MIPS_COPY D1 0x0 -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: Section (6) .rel.plt { -# PLT-SYM-NEXT: 0x402008 R_MIPS_JUMP_SLOT T3 0x0 -# PLT-SYM-NEXT: 0x40200C R_MIPS_JUMP_SLOT T1 0x0 -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: ] - -# PLT-SYM: DynamicSymbols [ -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: @ (0) -# PLT-SYM-NEXT: Value: 0x0 -# PLT-SYM-NEXT: Size: 0 -# PLT-SYM-NEXT: Binding: Local (0x0) -# PLT-SYM-NEXT: Type: None (0x0) -# PLT-SYM-NEXT: Other: 0 -# PLT-SYM-NEXT: Section: Undefined (0x0) -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: D1@ (1) -# PLT-SYM-NEXT: Value: 0x{{[0-9A-F]+}} -# PLT-SYM-NEXT: Size: 8 -# PLT-SYM-NEXT: Binding: Global (0x1) -# PLT-SYM-NEXT: Type: Object (0x1) -# PLT-SYM-NEXT: Other: 0 -# PLT-SYM-NEXT: Section: .bss -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: T1@ (4) -# PLT-SYM-NEXT: Value: 0x{{[0-9A-F]+}} -# PLT-SYM-NEXT: Size: 0 -# PLT-SYM-NEXT: Binding: Global (0x1) -# PLT-SYM-NEXT: Type: Function (0x2) -# PLT-SYM-NEXT: Other: 8 -# PLT-SYM-NEXT: Section: Undefined (0x0) -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: T3@ (7) -# PLT-SYM-NEXT: Value: 0x0 -# PLT-SYM-NEXT: Size: 0 -# PLT-SYM-NEXT: Binding: Global (0x1) -# PLT-SYM-NEXT: Type: Function (0x2) -# PLT-SYM-NEXT: Other: 0 -# PLT-SYM-NEXT: Section: Undefined (0x0) -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: ] - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T3 - Section: .text - Type: STT_FUNC - Value: 0x8 - Size: 4 - Other: [ STO_MIPS_MICROMIPS ] - - Name: D1 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 8 - -# o.o ---- -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x04 - Symbol: T3 - Type: R_MICROMIPS_26_S1 - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: T1 - Type: R_MICROMIPS_HI16 - - Offset: 0x00 - Symbol: T1 - Type: R_MICROMIPS_LO16 - - Offset: 0x04 - Symbol: D1 - Type: R_MICROMIPS_HI16 - - Offset: 0x04 - Symbol: D1 - Type: R_MICROMIPS_LO16 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 8 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T1 - Type: STT_FUNC - - Name: T3 - Type: STT_FUNC - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 8 - - Name: D1 - Type: STT_OBJECT -... diff --git a/test/old-elf/Mips/rel-dynamic-01.test b/test/old-elf/Mips/rel-dynamic-01.test deleted file mode 100644 index e24449eeeb58..000000000000 --- a/test/old-elf/Mips/rel-dynamic-01.test +++ /dev/null @@ -1,261 +0,0 @@ -# REQUIRES: mips - -# Conditions: -# a) Linking a non-shared executable file. -# b) Relocations' targets are symbols defined in the shared object. -# Check: -# a) Emitting R_MIPS_REL32, R_MIPS_COPY, R_MIPS_JUMP_SLOT relocations. -# b) PLT entries creation. -# c) STO_MIPS_PLT flag in the dynamic symbol table for symbols require -# a pointer equality. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-objdump -disassemble %t.exe | FileCheck -check-prefix=PLT %s -# RUN: llvm-readobj -dt -r %t.exe | FileCheck -check-prefix=PLT-SYM %s -# RUN: llvm-readobj -mips-plt-got %t.exe | FileCheck -check-prefix=GOT %s - -# PLT: Disassembly of section .plt: -# PLT-NEXT: .plt: -# PLT-NEXT: 4001f0: 40 00 1c 3c lui $gp, 64 -# PLT-NEXT: 4001f4: 00 20 99 8f lw $25, 8192($gp) -# PLT-NEXT: 4001f8: 00 20 9c 27 addiu $gp, $gp, 8192 -# PLT-NEXT: 4001fc: 23 c0 1c 03 subu $24, $24, $gp -# PLT-NEXT: 400200: 25 78 e0 03 move $15, $ra -# PLT-NEXT: 400204: 82 c0 18 00 srl $24, $24, 2 -# PLT-NEXT: 400208: 09 f8 20 03 jalr $25 -# PLT-NEXT: 40020c: fe ff 18 27 addiu $24, $24, -2 -# -# PLT-NEXT: 400210: 40 00 0f 3c lui $15, 64 -# PLT-NEXT: 400214: 08 20 f9 8d lw $25, 8200($15) -# PLT-NEXT: 400218: 08 00 20 03 jr $25 -# PLT-NEXT: 40021c: 08 20 f8 25 addiu $24, $15, 8200 -# -# PLT-NEXT: 400220: 40 00 0f 3c lui $15, 64 -# PLT-NEXT: 400224: 0c 20 f9 8d lw $25, 8204($15) -# PLT-NEXT: 400228: 08 00 20 03 jr $25 -# PLT-NEXT: 40022c: 0c 20 f8 25 addiu $24, $15, 8204 - -# PLT-SYM: Relocations [ -# PLT-SYM-NEXT: Section (5) .rel.dyn { -# PLT-SYM-NEXT: 0x402014 R_MIPS_REL32 T2 0x0 -# PLT-SYM-NEXT: 0x402014 R_MIPS_REL32 D2 0x0 -# PLT-SYM-NEXT: 0x402020 R_MIPS_COPY D1 0x0 -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: Section (6) .rel.plt { -# PLT-SYM-NEXT: 0x402008 R_MIPS_JUMP_SLOT T3 0x0 -# PLT-SYM-NEXT: 0x40200C R_MIPS_JUMP_SLOT T1 0x0 -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: ] - -# PLT-SYM: DynamicSymbols [ -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: @ (0) -# PLT-SYM-NEXT: Value: 0x0 -# PLT-SYM-NEXT: Size: 0 -# PLT-SYM-NEXT: Binding: Local (0x0) -# PLT-SYM-NEXT: Type: None (0x0) -# PLT-SYM-NEXT: Other: 0 -# PLT-SYM-NEXT: Section: Undefined (0x0) -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: D1@ (1) -# PLT-SYM-NEXT: Value: 0x{{[0-9A-F]+}} -# PLT-SYM-NEXT: Size: 4 -# PLT-SYM-NEXT: Binding: Global (0x1) -# PLT-SYM-NEXT: Type: Object (0x1) -# PLT-SYM-NEXT: Other: 0 -# PLT-SYM-NEXT: Section: .bss -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: T1@ (4) -# PLT-SYM-NEXT: Value: 0x{{[0-9A-F]+}} -# PLT-SYM-NEXT: Size: 0 -# PLT-SYM-NEXT: Binding: Global (0x1) -# PLT-SYM-NEXT: Type: Function (0x2) -# PLT-SYM-NEXT: Other: 8 -# PLT-SYM-NEXT: Section: Undefined (0x0) -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: T3@ (10) -# PLT-SYM-NEXT: Value: 0x0 -# PLT-SYM-NEXT: Size: 0 -# PLT-SYM-NEXT: Binding: Global (0x1) -# PLT-SYM-NEXT: Type: Function (0x2) -# PLT-SYM-NEXT: Other: 0 -# PLT-SYM-NEXT: Section: Undefined (0x0) -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: T2@ (7) -# PLT-SYM-NEXT: Value: 0x0 -# PLT-SYM-NEXT: Size: 0 -# PLT-SYM-NEXT: Binding: Global (0x1) -# PLT-SYM-NEXT: Type: Function (0x2) -# PLT-SYM-NEXT: Other: 0 -# PLT-SYM-NEXT: Section: Undefined (0x0) -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: D2@ (13) -# PLT-SYM-NEXT: Value: 0x0 -# PLT-SYM-NEXT: Size: 4 -# PLT-SYM-NEXT: Binding: Global (0x1) -# PLT-SYM-NEXT: Type: Object (0x1) -# PLT-SYM-NEXT: Other: 0 -# PLT-SYM-NEXT: Section: Undefined (0x0) -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: ] - -# GOT: Local entries [ -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x{{[0-9A-F]+}} -# GOT-NEXT: Access: -32744 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T2@ (7) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x{{[0-9A-F]+}} -# GOT-NEXT: Access: -32740 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Object (0x1) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: D2@ (13) -# GOT-NEXT: } -# GOT-NEXT: ] - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 4 - - Name: T3 - Section: .text - Type: STT_FUNC - Value: 0x8 - Size: 4 - - Name: D1 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 4 - - Name: D2 - Section: .data - Type: STT_OBJECT - Value: 0x4 - Size: 4 - -# o.o ---- -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x04 - Symbol: T3 - Type: R_MIPS_26 - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_HI16 - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_LO16 - - Offset: 0x04 - Symbol: T2 - Type: R_MIPS_32 - - - Offset: 0x04 - Symbol: D1 - Type: R_MIPS_HI16 - - Offset: 0x04 - Symbol: D1 - Type: R_MIPS_LO16 - - Offset: 0x04 - Symbol: D2 - Type: R_MIPS_32 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 8 - - Name: T1 - Type: STT_FUNC - - Name: T2 - Type: STT_FUNC - - Name: T3 - Type: STT_FUNC - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 8 - - Name: D1 - Type: STT_OBJECT - - Name: D2 - Type: STT_OBJECT -... diff --git a/test/old-elf/Mips/rel-dynamic-02.test b/test/old-elf/Mips/rel-dynamic-02.test deleted file mode 100644 index 24b7c624c6a0..000000000000 --- a/test/old-elf/Mips/rel-dynamic-02.test +++ /dev/null @@ -1,101 +0,0 @@ -# Conditions: -# a) Linking a shared library. -# b) Relocations' targets are undefined symbols. -# Check: -# a) Emitting R_MIPS_REL32 relocations for both undefined symbols. -# b) There should be no PLT entries. -# -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared --noinhibit-exec -o %t.so %t.o -# RUN: llvm-readobj -dt -r -s %t.so | FileCheck %s - -# CHECK: Sections [ -# CHECK: Section { -# CHECK-NOT: Name: .plt ({{[0-9]+}}) -# -# CHECK: Relocations [ -# CHECK-NEXT: Section (4) .rel.dyn { -# CHECK-NEXT: 0x[[ADDR1:[0-9A-Z]+]] R_MIPS_REL32 T1 0x0 -# CHECK-NEXT: 0x[[ADDR2:[0-9A-Z]+]] R_MIPS_REL32 T1 0x0 -# CHECK-NEXT: } -# CHECK-NEXT: ] -# -# CHECK: Symbol { -# CHECK: Name: T0@ -# CHECK-NEXT: Value: 0x[[ADDR1]] -# CHECK-NEXT: Size: 8 -# CHECK-NEXT: Binding: Global -# CHECK-NEXT: Type: Function -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: .text -# CHECK-NEXT: } -# CHECK: Symbol { -# CHECK: Name: D0@ -# CHECK-NEXT: Value: 0x[[ADDR2]] -# CHECK-NEXT: Size: 8 -# CHECK-NEXT: Binding: Global -# CHECK-NEXT: Type: Object -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: .data -# CHECK-NEXT: } -# CHECK: Symbol { -# CHECK: Name: T1@ -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global -# CHECK-NEXT: Type: None -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined -# CHECK-NEXT: } - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_32 - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_32 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: T1 - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0 - Size: 8 diff --git a/test/old-elf/Mips/rel-dynamic-03-micro.test b/test/old-elf/Mips/rel-dynamic-03-micro.test deleted file mode 100644 index 891649d8cdbc..000000000000 --- a/test/old-elf/Mips/rel-dynamic-03-micro.test +++ /dev/null @@ -1,133 +0,0 @@ -# REQUIRES: mips - -# Conditions: -# a) Linking a non-shared executable file. -# b) Relocations' target is a symbol defined in the shared object. -# c) The target symbol is referenced by both branch (R_MICROMIPS_26_S1) -# and regular (R_MIPS_32) relocations. -# Check: -# a) There should be no R_MIPS_REL32 relocation. -# b) Linker creates a single PLT entry. -# c) STO_MIPS_PLT flag in the dynamic symbol table for symbols require -# a pointer equality. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-objdump -d -mattr=micromips %t.exe | FileCheck -check-prefix=DIS %s -# RUN: llvm-readobj -dt -r %t.exe | FileCheck -check-prefix=PLT-SYM %s - -# DIS: Disassembly of section .plt: -# DIS-NEXT: .plt: -# DIS-NEXT: 400170: 80 79 a4 07 addiupc $3, 7824 -# DIS-NEXT: 400174: 23 ff 00 00 lw $25, 0($3) -# DIS-NEXT: 400178: 35 05 subu16 $2, $2, $3 -# DIS-NEXT: 40017a: 25 25 srl16 $2, $2, 2 -# DIS-NEXT: 40017c: 02 33 fe ff addiu $24, $2, -2 -# DIS-NEXT: 400180: ff 0d move $15, $ra -# DIS-NEXT: 400182: f9 45 jalrs16 $25 -# DIS-NEXT: 400184: 83 0f move $gp, $3 -# DIS-NEXT: 400186: 00 0c nop - -# DIS-NEXT: 400188: 00 79 a0 07 addiupc $2, 7808 -# DIS-NEXT: 40018c: 22 ff 00 00 lw $25, 0($2) -# DIS-NEXT: 400190: 99 45 jr16 $25 -# DIS-NEXT: 400192: 02 0f move $24, $2 - -# PLT-SYM: Relocations [ -# PLT-SYM-NEXT: Section (5) .rel.plt { -# PLT-SYM-NEXT: 0x402008 R_MIPS_JUMP_SLOT T1 0x0 -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: ] - -# PLT-SYM: Name: T1@ (1) -# PLT-SYM-NEXT: Value: 0x400189 -# PLT-SYM-NEXT: Size: 0 -# PLT-SYM-NEXT: Binding: Global (0x1) -# PLT-SYM-NEXT: Type: Function (0x2) -# PLT-SYM-NEXT: Other: 8 -# PLT-SYM-NEXT: Section: Undefined (0x0) - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - Other: [ STO_MIPS_MICROMIPS ] - -# o.o ---- -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x04 - Symbol: T1 - Type: R_MICROMIPS_26_S1 - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x04 - Symbol: T1 - Type: R_MIPS_32 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 8 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T1 - Type: STT_FUNC - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 8 -... diff --git a/test/old-elf/Mips/rel-dynamic-03.test b/test/old-elf/Mips/rel-dynamic-03.test deleted file mode 100644 index 2552473ca80f..000000000000 --- a/test/old-elf/Mips/rel-dynamic-03.test +++ /dev/null @@ -1,129 +0,0 @@ -# REQUIRES: mips - -# Conditions: -# a) Linking a non-shared executable file. -# b) Relocations' target is a symbol defined in the shared object. -# c) The target symbol is referenced by both branch (R_MIPS_26) -# and regular (R_MIPS_32) relocations. -# Check: -# a) There should be no R_MIPS_REL32 relocation. -# b) Linker creates a single PLT entry. -# c) STO_MIPS_PLT flag in the dynamic symbol table for symbols require -# a pointer equality. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-objdump -disassemble %t.exe | FileCheck -check-prefix=PLT %s -# RUN: llvm-readobj -dt -r %t.exe | FileCheck -check-prefix=PLT-SYM %s - -# PLT: Disassembly of section .plt: -# PLT-NEXT: .plt: -# PLT-NEXT: 400160: 40 00 1c 3c lui $gp, 64 -# PLT-NEXT: 400164: 00 20 99 8f lw $25, 8192($gp) -# PLT-NEXT: 400168: 00 20 9c 27 addiu $gp, $gp, 8192 -# PLT-NEXT: 40016c: 23 c0 1c 03 subu $24, $24, $gp -# PLT-NEXT: 400170: 25 78 e0 03 move $15, $ra -# PLT-NEXT: 400174: 82 c0 18 00 srl $24, $24, 2 -# PLT-NEXT: 400178: 09 f8 20 03 jalr $25 -# PLT-NEXT: 40017c: fe ff 18 27 addiu $24, $24, -2 -# -# PLT-NEXT: 400180: 40 00 0f 3c lui $15, 64 -# PLT-NEXT: 400184: 08 20 f9 8d lw $25, 8200($15) -# PLT-NEXT: 400188: 08 00 20 03 jr $25 -# PLT-NEXT: 40018c: 08 20 f8 25 addiu $24, $15, 8200 -# -# PLT-SYM: Relocations [ -# PLT-SYM-NEXT: Section (5) .rel.plt { -# PLT-SYM-NEXT: 0x402008 R_MIPS_JUMP_SLOT T1 0x0 -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: ] - -# PLT-SYM: Name: T1@ (1) -# PLT-SYM-NEXT: Value: 0x400180 -# PLT-SYM-NEXT: Size: 0 -# PLT-SYM-NEXT: Binding: Global (0x1) -# PLT-SYM-NEXT: Type: Function (0x2) -# PLT-SYM-NEXT: Other: 8 -# PLT-SYM-NEXT: Section: Undefined (0x0) - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x04 - Symbol: T1 - Type: R_MIPS_26 - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x04 - Symbol: T1 - Type: R_MIPS_32 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 8 - - Name: T1 - Type: STT_FUNC - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 8 -... diff --git a/test/old-elf/Mips/rel-dynamic-04-micro.test b/test/old-elf/Mips/rel-dynamic-04-micro.test deleted file mode 100644 index de1131c67f43..000000000000 --- a/test/old-elf/Mips/rel-dynamic-04-micro.test +++ /dev/null @@ -1,226 +0,0 @@ -# Conditions: -# a) Linking a non-shared executable file. -# b) Relocations' targets are symbols defined in the shared object. -# c) Relocations modify a writable section. -# d) The first symbol is referenced by R_MIPS32 relocation only -# e) The second symbol is referenced by R_MIPS_32 -# and R_MICROMIPS_26_S1 relocations. -# f) The third symbol is referenced by R_MICROMIPS_26_S1 -# and R_MIPS_32 relocations. -# Check: -# a) There should be the only R_MIPS_REL32 relocation. -# b) Linker creates a couple of PLT entry for both symbols referenced -# by the R_MICROMIPS_26_S1 branch relocation. -# c) STO_MIPS_PLT flag in the dynamic symbol table for symbols require -# a pointer equality. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -dt -r -s %t.exe | FileCheck -check-prefix=PLT %s -# RUN: llvm-readobj -mips-plt-got %t.exe | FileCheck -check-prefix=GOT %s - -# PLT: Section { -# PLT: Index: 5 -# PLT-NEXT: Name: .rel.dyn (31) -# PLT-NEXT: Type: SHT_REL (0x9) -# PLT-NEXT: Flags [ (0x2) -# PLT-NEXT: SHF_ALLOC (0x2) -# PLT-NEXT: ] -# PLT-NEXT: Address: 0x4010A0 -# PLT-NEXT: Offset: 0x10A0 -# PLT-NEXT: Size: 8 -# PLT-NEXT: Link: 3 -# PLT-NEXT: Info: 0 -# PLT-NEXT: AddressAlignment: 4 -# PLT-NEXT: EntrySize: 8 -# PLT-NEXT: } -# PLT-NEXT: Section { -# PLT-NEXT: Index: 6 -# PLT-NEXT: Name: .rel.plt (40) -# PLT-NEXT: Type: SHT_REL (0x9) -# PLT-NEXT: Flags [ (0x2) -# PLT-NEXT: SHF_ALLOC (0x2) -# PLT-NEXT: ] -# PLT-NEXT: Address: 0x4010A8 -# PLT-NEXT: Offset: 0x10A8 -# PLT-NEXT: Size: 16 -# PLT-NEXT: Link: 3 -# PLT-NEXT: Info: 0 -# PLT-NEXT: AddressAlignment: 4 -# PLT-NEXT: EntrySize: 8 -# PLT-NEXT: } -# PLT-NEXT: Section { -# PLT-NEXT: Index: 7 -# PLT-NEXT: Name: .plt (49) -# PLT-NEXT: Type: SHT_PROGBITS (0x1) -# PLT-NEXT: Flags [ (0x6) -# PLT-NEXT: SHF_ALLOC (0x2) -# PLT-NEXT: SHF_EXECINSTR (0x4) -# PLT-NEXT: ] -# PLT-NEXT: Address: 0x4010C0 -# PLT-NEXT: Offset: 0x10C0 -# PLT-NEXT: Size: 48 -# PLT-NEXT: Link: 0 -# PLT-NEXT: Info: 0 -# PLT-NEXT: AddressAlignment: 16 -# PLT-NEXT: EntrySize: 0 -# PLT-NEXT: } - -# PLT: Relocations [ -# PLT-NEXT: Section (5) .rel.dyn { -# PLT-NEXT: 0x400120 R_MIPS_REL32 T1 0x0 -# PLT-NEXT: } -# PLT-NEXT: Section (6) .rel.plt { -# PLT-NEXT: 0x403008 R_MIPS_JUMP_SLOT T2 0x0 -# PLT-NEXT: 0x40300C R_MIPS_JUMP_SLOT T3 0x0 -# PLT-NEXT: } -# PLT-NEXT: ] - -# PLT: DynamicSymbols [ -# PLT-NEXT: Symbol { -# PLT-NEXT: Name: @ (0) -# PLT-NEXT: Value: 0x0 -# PLT-NEXT: Size: 0 -# PLT-NEXT: Binding: Local (0x0) -# PLT-NEXT: Type: None (0x0) -# PLT-NEXT: Other: 0 -# PLT-NEXT: Section: Undefined (0x0) -# PLT-NEXT: } -# PLT-NEXT: Symbol { -# PLT-NEXT: Name: T2@ (4) -# PLT-NEXT: Value: 0x4010D9 -# PLT-NEXT: Size: 0 -# PLT-NEXT: Binding: Global (0x1) -# PLT-NEXT: Type: Function (0x2) -# PLT-NEXT: Other: 8 -# PLT-NEXT: Section: Undefined (0x0) -# PLT-NEXT: } -# PLT-NEXT: Symbol { -# PLT-NEXT: Name: T3@ (7) -# PLT-NEXT: Value: 0x4010E5 -# PLT-NEXT: Size: 0 -# PLT-NEXT: Binding: Global (0x1) -# PLT-NEXT: Type: Function (0x2) -# PLT-NEXT: Other: 8 -# PLT-NEXT: Section: Undefined (0x0) -# PLT-NEXT: } -# PLT-NEXT: Symbol { -# PLT-NEXT: Name: T1@ (1) -# PLT-NEXT: Value: 0x0 -# PLT-NEXT: Size: 0 -# PLT-NEXT: Binding: Global (0x1) -# PLT-NEXT: Type: Function (0x2) -# PLT-NEXT: Other: 0 -# PLT-NEXT: Section: Undefined (0x0) -# PLT-NEXT: } -# PLT-NEXT: ] - -# GOT: Local entries [ -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x402008 -# GOT-NEXT: Access: -32744 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T1@ (1) -# GOT-NEXT: } -# GOT-NEXT: ] - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 4 - - Name: T3 - Section: .text - Type: STT_FUNC - Value: 0x8 - Size: 4 - -# o.o ---- -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x14 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_EXECINSTR, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - # There is no branch relocation for T1. - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_32 - # The R_MIPS_32 relocation for T2 might produce R_MIPS_REL32 ... - - Offset: 0x04 - Symbol: T2 - Type: R_MIPS_32 - # ... but R_MICROMIPS_26_S1 creates PLT entry - # and makes R_MIPS_REL32 redundant. - - Offset: 0x08 - Symbol: T2 - Type: R_MICROMIPS_26_S1 - # Create PLT entry for T3 symbol. - - Offset: 0x0c - Symbol: T3 - Type: R_MICROMIPS_26_S1 - # Take in account existing PLT entry and do not create R_MIPS_REL32. - - Offset: 0x10 - Symbol: T3 - Type: R_MIPS_32 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 0x14 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T1 - Type: STT_FUNC - - Name: T2 - Type: STT_FUNC - - Name: T3 - Type: STT_FUNC -... diff --git a/test/old-elf/Mips/rel-dynamic-04.test b/test/old-elf/Mips/rel-dynamic-04.test deleted file mode 100644 index df8c676af330..000000000000 --- a/test/old-elf/Mips/rel-dynamic-04.test +++ /dev/null @@ -1,221 +0,0 @@ -# Conditions: -# a) Linking a non-shared executable file. -# b) Relocations' targets are symbols defined in the shared object. -# c) Relocations modify a writable section. -# d) The first symbol is referenced by R_MIPS32 relocation only -# e) The second symbol is referenced by R_MIPS_32 and R_MIPS26 relocations. -# f) The third symbol is referenced by R_MIPS26 and R_MIPS_32 relocations. -# Check: -# a) There should be the only R_MIPS_REL32 relocation. -# b) Linker creates a couple of PLT entry for both symbols referenced -# by the R_MIPS_26 branch relocation. -# c) STO_MIPS_PLT flag in the dynamic symbol table for symbols require -# a pointer equality. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -dt -r -s %t.exe | FileCheck -check-prefix=PLT %s -# RUN: llvm-readobj -mips-plt-got %t.exe | FileCheck -check-prefix=GOT %s - -# PLT: Section { -# PLT: Index: 5 -# PLT-NEXT: Name: .rel.dyn (31) -# PLT-NEXT: Type: SHT_REL (0x9) -# PLT-NEXT: Flags [ (0x2) -# PLT-NEXT: SHF_ALLOC (0x2) -# PLT-NEXT: ] -# PLT-NEXT: Address: 0x40109C -# PLT-NEXT: Offset: 0x109C -# PLT-NEXT: Size: 8 -# PLT-NEXT: Link: 3 -# PLT-NEXT: Info: 0 -# PLT-NEXT: AddressAlignment: 4 -# PLT-NEXT: EntrySize: 8 -# PLT-NEXT: } -# PLT-NEXT: Section { -# PLT-NEXT: Index: 6 -# PLT-NEXT: Name: .rel.plt (40) -# PLT-NEXT: Type: SHT_REL (0x9) -# PLT-NEXT: Flags [ (0x2) -# PLT-NEXT: SHF_ALLOC (0x2) -# PLT-NEXT: ] -# PLT-NEXT: Address: 0x4010A4 -# PLT-NEXT: Offset: 0x10A4 -# PLT-NEXT: Size: 16 -# PLT-NEXT: Link: 3 -# PLT-NEXT: Info: 0 -# PLT-NEXT: AddressAlignment: 4 -# PLT-NEXT: EntrySize: 8 -# PLT-NEXT: } -# PLT-NEXT: Section { -# PLT-NEXT: Index: 7 -# PLT-NEXT: Name: .plt (49) -# PLT-NEXT: Type: SHT_PROGBITS (0x1) -# PLT-NEXT: Flags [ (0x6) -# PLT-NEXT: SHF_ALLOC (0x2) -# PLT-NEXT: SHF_EXECINSTR (0x4) -# PLT-NEXT: ] -# PLT-NEXT: Address: 0x4010C0 -# PLT-NEXT: Offset: 0x10C0 -# PLT-NEXT: Size: 64 -# PLT-NEXT: Link: 0 -# PLT-NEXT: Info: 0 -# PLT-NEXT: AddressAlignment: 16 -# PLT-NEXT: EntrySize: 0 -# PLT-NEXT: } - -# PLT: Relocations [ -# PLT-NEXT: Section (5) .rel.dyn { -# PLT-NEXT: 0x400120 R_MIPS_REL32 T1 0x0 -# PLT-NEXT: } -# PLT-NEXT: Section (6) .rel.plt { -# PLT-NEXT: 0x403008 R_MIPS_JUMP_SLOT T2 0x0 -# PLT-NEXT: 0x40300C R_MIPS_JUMP_SLOT T3 0x0 -# PLT-NEXT: } -# PLT-NEXT: ] - -# PLT: DynamicSymbols [ -# PLT-NEXT: Symbol { -# PLT-NEXT: Name: @ (0) -# PLT-NEXT: Value: 0x0 -# PLT-NEXT: Size: 0 -# PLT-NEXT: Binding: Local (0x0) -# PLT-NEXT: Type: None (0x0) -# PLT-NEXT: Other: 0 -# PLT-NEXT: Section: Undefined (0x0) -# PLT-NEXT: } -# PLT-NEXT: Symbol { -# PLT-NEXT: Name: T2@ (4) -# PLT-NEXT: Value: 0x4010E0 -# PLT-NEXT: Size: 0 -# PLT-NEXT: Binding: Global (0x1) -# PLT-NEXT: Type: Function (0x2) -# PLT-NEXT: Other: 8 -# PLT-NEXT: Section: Undefined (0x0) -# PLT-NEXT: } -# PLT-NEXT: Symbol { -# PLT-NEXT: Name: T3@ (7) -# PLT-NEXT: Value: 0x4010F0 -# PLT-NEXT: Size: 0 -# PLT-NEXT: Binding: Global (0x1) -# PLT-NEXT: Type: Function (0x2) -# PLT-NEXT: Other: 8 -# PLT-NEXT: Section: Undefined (0x0) -# PLT-NEXT: } -# PLT-NEXT: Symbol { -# PLT-NEXT: Name: T1@ (1) -# PLT-NEXT: Value: 0x0 -# PLT-NEXT: Size: 0 -# PLT-NEXT: Binding: Global (0x1) -# PLT-NEXT: Type: Function (0x2) -# PLT-NEXT: Other: 0 -# PLT-NEXT: Section: Undefined (0x0) -# PLT-NEXT: } -# PLT-NEXT: ] - -# GOT: Local entries [ -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x402008 -# GOT-NEXT: Access: -32744 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T1@ (1) -# GOT-NEXT: } -# GOT-NEXT: ] - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 4 - - Name: T3 - Section: .text - Type: STT_FUNC - Value: 0x8 - Size: 4 - -# o.o ---- -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_EXECINSTR, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - # There is no branch relocation for T1. - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_32 - # The R_MIPS_32 relocation for T2 might produce R_MIPS_REL32 ... - - Offset: 0x00 - Symbol: T2 - Type: R_MIPS_32 - # ... but R_MIPS_26 creates PLT entry and makes R_MIPS_REL32 redundant. - - Offset: 0x04 - Symbol: T2 - Type: R_MIPS_26 - # Create PLT entry for T3 symbol. - - Offset: 0x00 - Symbol: T3 - Type: R_MIPS_26 - # Take in account existing PLT entry and do not create R_MIPS_REL32. - - Offset: 0x04 - Symbol: T3 - Type: R_MIPS_32 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 8 - - Name: T1 - Type: STT_FUNC - - Name: T2 - Type: STT_FUNC - - Name: T3 - Type: STT_FUNC -... diff --git a/test/old-elf/Mips/rel-dynamic-05-micro.test b/test/old-elf/Mips/rel-dynamic-05-micro.test deleted file mode 100644 index 16c6a9c6aad5..000000000000 --- a/test/old-elf/Mips/rel-dynamic-05-micro.test +++ /dev/null @@ -1,192 +0,0 @@ -# Conditions: -# a) Linking a non-shared executable file. -# b) Relocations' targets are symbols defined in the shared object. -# c) Relocations modify a read-only section. -# d) The first symbol is referenced by R_MIPS32 relocation only -# e) The second symbol is referenced by R_MIPS_32 -# and R_MICROMIPS_26_S1 relocations. -# f) The third symbol is referenced by R_MICROMIPS_26_S1 -# and R_MIPS_32 relocations. -# Check: -# a) There should be no R_MIPS_REL32 relocations. -# b) Linker creates PLT entries for all three relocations. -# c) STO_MIPS_PLT flag in the dynamic symbol table for symbols require -# a pointer equality. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -dt -r -s %t.exe | FileCheck -check-prefix=PLT %s - -# PLT: Section { -# PLT: Index: 5 -# PLT-NEXT: Name: .rel.plt (31) -# PLT-NEXT: Type: SHT_REL (0x9) -# PLT-NEXT: Flags [ (0x2) -# PLT-NEXT: SHF_ALLOC (0x2) -# PLT-NEXT: ] -# PLT-NEXT: Address: 0x400194 -# PLT-NEXT: Offset: 0x194 -# PLT-NEXT: Size: 24 -# PLT-NEXT: Link: 3 -# PLT-NEXT: Info: 0 -# PLT-NEXT: AddressAlignment: 4 -# PLT-NEXT: EntrySize: 8 -# PLT-NEXT: } -# PLT-NEXT: Section { -# PLT-NEXT: Index: 6 -# PLT-NEXT: Name: .plt (40) -# PLT-NEXT: Type: SHT_PROGBITS (0x1) -# PLT-NEXT: Flags [ (0x6) -# PLT-NEXT: SHF_ALLOC (0x2) -# PLT-NEXT: SHF_EXECINSTR (0x4) -# PLT-NEXT: ] -# PLT-NEXT: Address: 0x4001B0 -# PLT-NEXT: Offset: 0x1B0 -# PLT-NEXT: Size: 60 -# PLT-NEXT: Link: 0 -# PLT-NEXT: Info: 0 -# PLT-NEXT: AddressAlignment: 16 -# PLT-NEXT: EntrySize: 0 -# PLT-NEXT: } - -# PLT: Relocations [ -# PLT-NEXT: Section (5) .rel.plt { -# PLT-NEXT: 0x402008 R_MIPS_JUMP_SLOT T1 0x0 -# PLT-NEXT: 0x40200C R_MIPS_JUMP_SLOT T2 0x0 -# PLT-NEXT: 0x402010 R_MIPS_JUMP_SLOT T3 0x0 -# PLT-NEXT: } -# PLT-NEXT: ] - -# PLT: DynamicSymbols [ -# PLT-NEXT: Symbol { -# PLT-NEXT: Name: @ (0) -# PLT-NEXT: Value: 0x0 -# PLT-NEXT: Size: 0 -# PLT-NEXT: Binding: Local (0x0) -# PLT-NEXT: Type: None (0x0) -# PLT-NEXT: Other: 0 -# PLT-NEXT: Section: Undefined (0x0) -# PLT-NEXT: } -# PLT-NEXT: Symbol { -# PLT-NEXT: Name: T1@ (1) -# PLT-NEXT: Value: 0x4001C9 -# PLT-NEXT: Size: 0 -# PLT-NEXT: Binding: Global (0x1) -# PLT-NEXT: Type: Function (0x2) -# PLT-NEXT: Other: 8 -# PLT-NEXT: Section: Undefined (0x0) -# PLT-NEXT: } -# PLT-NEXT: Symbol { -# PLT-NEXT: Name: T2@ (4) -# PLT-NEXT: Value: 0x4001D5 -# PLT-NEXT: Size: 0 -# PLT-NEXT: Binding: Global (0x1) -# PLT-NEXT: Type: Function (0x2) -# PLT-NEXT: Other: 8 -# PLT-NEXT: Section: Undefined (0x0) -# PLT-NEXT: } -# PLT-NEXT: Symbol { -# PLT-NEXT: Name: T3@ (7) -# PLT-NEXT: Value: 0x4001E1 -# PLT-NEXT: Size: 0 -# PLT-NEXT: Binding: Global (0x1) -# PLT-NEXT: Type: Function (0x2) -# PLT-NEXT: Other: 8 -# PLT-NEXT: Section: Undefined (0x0) -# PLT-NEXT: } -# PLT-NEXT: ] - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 4 - - Name: T3 - Section: .text - Type: STT_FUNC - Value: 0x8 - Size: 4 - -# o.o ---- -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x14 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - # There is no branch relocation for T1. - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_32 - # The R_MIPS_32 relocation for T2 might produce R_MIPS_REL32 ... - - Offset: 0x04 - Symbol: T2 - Type: R_MIPS_32 - # ... but R_MICROMIPS_26_S1 creates PLT entry and makes R_MIPS_REL32 redundant. - - Offset: 0x08 - Symbol: T2 - Type: R_MICROMIPS_26_S1 - # Create PLT entry for T3 symbol. - - Offset: 0x0C - Symbol: T3 - Type: R_MICROMIPS_26_S1 - # Take in account existing PLT entry and do not create R_MIPS_REL32. - - Offset: 0x10 - Symbol: T3 - Type: R_MIPS_32 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 0x14 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T1 - Type: STT_FUNC - - Name: T2 - Type: STT_FUNC - - Name: T3 - Type: STT_FUNC -... diff --git a/test/old-elf/Mips/rel-dynamic-05.test b/test/old-elf/Mips/rel-dynamic-05.test deleted file mode 100644 index 8348bc511fbd..000000000000 --- a/test/old-elf/Mips/rel-dynamic-05.test +++ /dev/null @@ -1,188 +0,0 @@ -# Conditions: -# a) Linking a non-shared executable file. -# b) Relocations' targets are symbols defined in the shared object. -# c) Relocations modify a read-only section. -# d) The first symbol is referenced by R_MIPS32 relocation only -# e) The second symbol is referenced by R_MIPS_32 and R_MIPS26 relocations. -# f) The third symbol is referenced by R_MIPS26 and R_MIPS_32 relocations. -# Check: -# a) There should be no R_MIPS_REL32 relocations. -# b) Linker creates PLT entries for all three relocations. -# c) STO_MIPS_PLT flag in the dynamic symbol table for symbols require -# a pointer equality. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -dt -r -s %t.exe | FileCheck -check-prefix=PLT %s - -# PLT: Section { -# PLT: Index: 5 -# PLT-NEXT: Name: .rel.plt (31) -# PLT-NEXT: Type: SHT_REL (0x9) -# PLT-NEXT: Flags [ (0x2) -# PLT-NEXT: SHF_ALLOC (0x2) -# PLT-NEXT: ] -# PLT-NEXT: Address: 0x{{[0-9A-F]+}} -# PLT-NEXT: Offset: 0x{{[0-9A-F]+}} -# PLT-NEXT: Size: 24 -# PLT-NEXT: Link: 3 -# PLT-NEXT: Info: 0 -# PLT-NEXT: AddressAlignment: 4 -# PLT-NEXT: EntrySize: 8 -# PLT-NEXT: } -# PLT-NEXT: Section { -# PLT-NEXT: Index: 6 -# PLT-NEXT: Name: .plt (40) -# PLT-NEXT: Type: SHT_PROGBITS (0x1) -# PLT-NEXT: Flags [ (0x6) -# PLT-NEXT: SHF_ALLOC (0x2) -# PLT-NEXT: SHF_EXECINSTR (0x4) -# PLT-NEXT: ] -# PLT-NEXT: Address: 0x{{[0-9A-F]+}} -# PLT-NEXT: Offset: 0x{{[0-9A-F]+}} -# PLT-NEXT: Size: 80 -# PLT-NEXT: Link: 0 -# PLT-NEXT: Info: 0 -# PLT-NEXT: AddressAlignment: 16 -# PLT-NEXT: EntrySize: 0 -# PLT-NEXT: } - -# PLT: Relocations [ -# PLT-NEXT: Section (5) .rel.plt { -# PLT-NEXT: {{[0-9A-F]+}} R_MIPS_JUMP_SLOT T1 0x0 -# PLT-NEXT: {{[0-9A-F]+}} R_MIPS_JUMP_SLOT T2 0x0 -# PLT-NEXT: {{[0-9A-F]+}} R_MIPS_JUMP_SLOT T3 0x0 -# PLT-NEXT: } -# PLT-NEXT: ] - -# PLT: DynamicSymbols [ -# PLT-NEXT: Symbol { -# PLT-NEXT: Name: @ (0) -# PLT-NEXT: Value: 0x0 -# PLT-NEXT: Size: 0 -# PLT-NEXT: Binding: Local (0x0) -# PLT-NEXT: Type: None (0x0) -# PLT-NEXT: Other: 0 -# PLT-NEXT: Section: Undefined (0x0) -# PLT-NEXT: } -# PLT-NEXT: Symbol { -# PLT-NEXT: Name: T1@ (1) -# PLT-NEXT: Value: 0x{{[0-9A-F]+}} -# PLT-NEXT: Size: 0 -# PLT-NEXT: Binding: Global (0x1) -# PLT-NEXT: Type: Function (0x2) -# PLT-NEXT: Other: 8 -# PLT-NEXT: Section: Undefined (0x0) -# PLT-NEXT: } -# PLT-NEXT: Symbol { -# PLT-NEXT: Name: T2@ (4) -# PLT-NEXT: Value: 0x{{[0-9A-F]+}} -# PLT-NEXT: Size: 0 -# PLT-NEXT: Binding: Global (0x1) -# PLT-NEXT: Type: Function (0x2) -# PLT-NEXT: Other: 8 -# PLT-NEXT: Section: Undefined (0x0) -# PLT-NEXT: } -# PLT-NEXT: Symbol { -# PLT-NEXT: Name: T3@ (7) -# PLT-NEXT: Value: 0x{{[0-9A-F]+}} -# PLT-NEXT: Size: 0 -# PLT-NEXT: Binding: Global (0x1) -# PLT-NEXT: Type: Function (0x2) -# PLT-NEXT: Other: 8 -# PLT-NEXT: Section: Undefined (0x0) -# PLT-NEXT: } -# PLT-NEXT: ] - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 4 - - Name: T3 - Section: .text - Type: STT_FUNC - Value: 0x8 - Size: 4 - -# o.o ---- -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - # There is no branch relocation for T1. - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_32 - # The R_MIPS_32 relocation for T2 might produce R_MIPS_REL32 ... - - Offset: 0x00 - Symbol: T2 - Type: R_MIPS_32 - # ... but R_MIPS_26 creates PLT entry and makes R_MIPS_REL32 redundant. - - Offset: 0x04 - Symbol: T2 - Type: R_MIPS_26 - # Create PLT entry for T3 symbol. - - Offset: 0x00 - Symbol: T3 - Type: R_MIPS_26 - # Take in account existing PLT entry and do not create R_MIPS_REL32. - - Offset: 0x04 - Symbol: T3 - Type: R_MIPS_32 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 8 - - Name: T1 - Type: STT_FUNC - - Name: T2 - Type: STT_FUNC - - Name: T3 - Type: STT_FUNC -... diff --git a/test/old-elf/Mips/rel-dynamic-06-64.test b/test/old-elf/Mips/rel-dynamic-06-64.test deleted file mode 100644 index 6b0d28993f94..000000000000 --- a/test/old-elf/Mips/rel-dynamic-06-64.test +++ /dev/null @@ -1,114 +0,0 @@ -# Conditions: -# a) Linking a shared library. -# b) The first relocation modifies a regular .text section. -# c) The second relocation modifies a .pdr section without SHF_ALLOC flag. -# Check: -# a) There should be no PLT entries. -# b) Linker creates a single R_MIPS_REL32 relocation. -# -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t.o -# RUN: llvm-readobj -dt -r -s %t.so | FileCheck -check-prefix=SYM %s -# RUN: llvm-readobj -mips-plt-got %t.so | FileCheck -check-prefix=GOT %s - -# SYM: Sections [ -# SYM: Section { -# SYM-NOT: Name: .plt ({{[0-9]+}}) - -# SYM: Relocations [ -# SYM-NEXT: Section (4) .rel.dyn { -# SYM-NEXT: 0x[[ADDR:[0-9A-Z]+]] R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE T0 0x0 -# SYM-NEXT: } -# SYM-NEXT: ] - -# SYM: Symbol { -# SYM: Name: @ (0) -# SYM-NEXT: Value: 0x0 -# SYM-NEXT: Size: 0 -# SYM-NEXT: Binding: Local (0x0) -# SYM-NEXT: Type: None (0x0) -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: Undefined (0x0) -# SYM-NEXT: } -# SYM: Symbol { -# SYM: Name: T1@ (4) -# SYM-NEXT: Value: 0x174 -# SYM-NEXT: Size: 4 -# SYM-NEXT: Binding: Global (0x1) -# SYM-NEXT: Type: Function (0x2) -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: .text (0x5) -# SYM-NEXT: } -# SYM: Symbol { -# SYM: Name: T0@ (1) -# SYM-NEXT: Value: 0x[[ADDR]] -# SYM-NEXT: Size: 4 -# SYM-NEXT: Binding: Global (0x1) -# SYM-NEXT: Type: Function (0x2) -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: .text (0x5) -# SYM-NEXT: } - -# GOT: Local entries [ -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1010 -# GOT-NEXT: Access: -32736 -# GOT-NEXT: Initial: 0x170 -# GOT-NEXT: Value: 0x170 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: .text (0x5) -# GOT-NEXT: Name: T0@ (1) -# GOT-NEXT: } -# GOT-NEXT: ] - -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_RELA - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T0 - Type: R_MIPS_64 - -- Name: .pdr - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - -- Name: .rel.pdr - Type: SHT_RELA - Info: .pdr - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_64 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 4 - Size: 4 diff --git a/test/old-elf/Mips/rel-dynamic-06.test b/test/old-elf/Mips/rel-dynamic-06.test deleted file mode 100644 index ead7dfb08ddf..000000000000 --- a/test/old-elf/Mips/rel-dynamic-06.test +++ /dev/null @@ -1,115 +0,0 @@ -# Conditions: -# a) Linking a shared library. -# b) The first relocation modifies a regular .text section. -# c) The second relocation modifies a .pdr section without SHF_ALLOC flag. -# Check: -# a) There should be no PLT entries. -# b) Linker creates a single R_MIPS_REL32 relocation. -# -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o -# RUN: llvm-readobj -dt -r -s %t.so | FileCheck -check-prefix=SYM %s -# RUN: llvm-readobj -mips-plt-got %t.so | FileCheck -check-prefix=GOT %s - -# SYM: Sections [ -# SYM: Section { -# SYM-NOT: Name: .plt ({{[0-9]+}}) - -# SYM: Relocations [ -# SYM-NEXT: Section (4) .rel.dyn { -# SYM-NEXT: 0x[[ADDR:[0-9A-Z]+]] R_MIPS_REL32 T0 0x0 -# SYM-NEXT: } -# SYM-NEXT: ] - -# SYM: Symbol { -# SYM: Name: @ (0) -# SYM-NEXT: Value: 0x0 -# SYM-NEXT: Size: 0 -# SYM-NEXT: Binding: Local (0x0) -# SYM-NEXT: Type: None (0x0) -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: Undefined (0x0) -# SYM-NEXT: } -# SYM: Symbol { -# SYM: Name: T1@ (4) -# SYM-NEXT: Value: 0x104 -# SYM-NEXT: Size: 4 -# SYM-NEXT: Binding: Global (0x1) -# SYM-NEXT: Type: Function (0x2) -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: .text (0x5) -# SYM-NEXT: } -# SYM: Symbol { -# SYM: Name: T0@ (1) -# SYM-NEXT: Value: 0x[[ADDR]] -# SYM-NEXT: Size: 4 -# SYM-NEXT: Binding: Global (0x1) -# SYM-NEXT: Type: Function (0x2) -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: .text (0x5) -# SYM-NEXT: } - -# GOT: Local entries [ -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1008 -# GOT-NEXT: Access: -32744 -# GOT-NEXT: Initial: 0x100 -# GOT-NEXT: Value: 0x100 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: .text (0x5) -# GOT-NEXT: Name: T0@ (1) -# GOT-NEXT: } -# GOT-NEXT: ] - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T0 - Type: R_MIPS_32 - -- Name: .pdr - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [] - -- Name: .rel.pdr - Type: SHT_REL - Info: .pdr - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_32 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 4 - Size: 4 diff --git a/test/old-elf/Mips/rel-dynamic-07-64.test b/test/old-elf/Mips/rel-dynamic-07-64.test deleted file mode 100644 index 823a66d521e2..000000000000 --- a/test/old-elf/Mips/rel-dynamic-07-64.test +++ /dev/null @@ -1,348 +0,0 @@ -# Conditions: -# a) Linking a shared library. -# b) There ars multiple R_MIPS_64 relocations with various targets. -# Check: -# a) Emitting of R_MIPS_REL32 relocations. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t1.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mips64el -shared --noinhibit-exec \ -# RUN: -o %t2.so %t-o.o %t1.so -# RUN: llvm-readobj -dt -r -sections %t2.so | FileCheck %s -# RUN: llvm-readobj -mips-plt-got %t2.so | FileCheck -check-prefix=GOT %s - -# CHECK: Sections [ -# CHECK: Section { -# CHECK-NOT: Name: .plt ({{[0-9]+}}) - -# CHECK: Relocations [ -# CHECK-NEXT: Section (4) .rel.dyn { -# CHECK-NEXT: 0x2000 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE T0 0x0 -# CHECK-NEXT: 0x2000 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE T4 0x0 -# CHECK-NEXT: 0x2000 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE D2 0x0 -# CHECK-NEXT: 0x2004 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE T1 0x0 -# CHECK-NEXT: 0x2008 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE T2 0x0 -# CHECK-NEXT: 0x2004 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE D0 0x0 -# CHECK-NEXT: 0x2008 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE D1 0x0 -# CHECK-NEXT: 0x2004 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE D4 0x0 -# CHECK-NEXT: 0x2008 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE U1 0x0 -# CHECK-NEXT: } -# CHECK-NEXT: ] - -# CHECK: DynamicSymbols [ -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: @ (0) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Local (0x0) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: T0@ (1) -# CHECK-NEXT: Value: 0x324 -# CHECK-NEXT: Size: 8 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Function (0x2) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: .text (0x5) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: T4@ (7) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D2@ (25) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 4 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: T1@ (16) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Function (0x2) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: T2@ (19) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Function (0x2) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D0@ (4) -# CHECK-NEXT: Value: 0x2004 -# CHECK-NEXT: Size: 8 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: .data (0x8) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D1@ (22) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 4 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D4@ (10) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: U1@ (13) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: ] - -# GOT: Local entries [ -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1010 -# GOT-NEXT: Access: -32736 -# GOT-NEXT: Initial: 0x324 -# GOT-NEXT: Value: 0x324 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: .text (0x5) -# GOT-NEXT: Name: T0@ (1) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1018 -# GOT-NEXT: Access: -32728 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: None (0x0) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T4@ (7) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1020 -# GOT-NEXT: Access: -32720 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Object (0x1) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: D2@ (25) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1028 -# GOT-NEXT: Access: -32712 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T1@ (16) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1030 -# GOT-NEXT: Access: -32704 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T2@ (19) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1038 -# GOT-NEXT: Access: -32696 -# GOT-NEXT: Initial: 0x2004 -# GOT-NEXT: Value: 0x2004 -# GOT-NEXT: Type: Object (0x1) -# GOT-NEXT: Section: .data (0x8) -# GOT-NEXT: Name: D0@ (4) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1040 -# GOT-NEXT: Access: -32688 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Object (0x1) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: D1@ (22) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1048 -# GOT-NEXT: Access: -32680 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: None (0x0) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: D4@ (10) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1050 -# GOT-NEXT: Access: -32672 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: None (0x0) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: U1@ (13) -# GOT-NEXT: } -# GOT-NEXT: ] - -# so.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 4 - - Name: D1 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 4 - - Name: D2 - Section: .data - Type: STT_OBJECT - Value: 0x4 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.data - Type: SHT_RELA - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 # T0 is a defined function - Symbol: T0 - Type: R_MIPS_64 - - Offset: 0x04 # T1 is a function from shared lib - Symbol: T1 - Type: R_MIPS_64 - - Offset: 0x08 # T2 has unknown type and defined in shared lib - Symbol: T2 - Type: R_MIPS_64 - - Offset: 0x00 # T4 is an undefined function - Symbol: T4 - Type: R_MIPS_64 - - Offset: 0x04 # D0 is a defined data object - Symbol: D0 - Type: R_MIPS_64 - - Offset: 0x08 # D1 is a data object from shared lib - Symbol: D1 - Type: R_MIPS_64 - - Offset: 0x00 # D2 has unknown type and defined in shared lib - Symbol: D2 - Type: R_MIPS_64 - - Offset: 0x04 # D4 is an undefined data object - Symbol: D4 - Type: R_MIPS_64 - - Offset: 0x08 # U1 is undefined and has unknown type - Symbol: U1 - Type: R_MIPS_64 - -Symbols: - Local: - - Name: LT0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: LD0 - Section: .data - Type: STT_OBJECT - Value: 0 - Size: 4 - - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 8 - - Name: T1 - Type: STT_FUNC - - Name: T2 - - Name: T4 - Type: STT_FUNC - - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x4 - Size: 8 - - Name: D1 - Type: STT_OBJECT - - Name: D2 - - Name: D4 - Type: STT_OBJECT - - Name: U1 -... diff --git a/test/old-elf/Mips/rel-dynamic-07.test b/test/old-elf/Mips/rel-dynamic-07.test deleted file mode 100644 index 41c31c66a5f3..000000000000 --- a/test/old-elf/Mips/rel-dynamic-07.test +++ /dev/null @@ -1,363 +0,0 @@ -# Conditions: -# a) Linking a shared library. -# b) There ars multiple R_MIPS_32 relocations with various targets. -# Check: -# a) Emitting of R_MIPS_REL32 relocations. -# b) There should be no R_MIPS_REL32 relocations for the _gp_disp symbol. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t1.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -shared --noinhibit-exec \ -# RUN: -o %t2.so %t-o.o %t1.so -# RUN: llvm-readobj -dt -r -sections %t2.so | FileCheck %s -# RUN: llvm-readobj -mips-plt-got %t2.so | FileCheck -check-prefix=GOT %s - -# CHECK: Sections [ -# CHECK: Section { -# CHECK-NOT: Name: .plt ({{[0-9]+}}) - -# CHECK: Relocations [ -# CHECK-NEXT: Section (4) .rel.dyn { -# CHECK-NEXT: 0x2000 R_MIPS_REL32 T0 0x0 -# CHECK-NEXT: 0x2000 R_MIPS_REL32 T4 0x0 -# CHECK-NEXT: 0x2000 R_MIPS_REL32 D2 0x0 -# CHECK-NEXT: 0x2004 R_MIPS_REL32 T1 0x0 -# CHECK-NEXT: 0x2008 R_MIPS_REL32 T2 0x0 -# CHECK-NEXT: 0x2004 R_MIPS_REL32 D0 0x0 -# CHECK-NEXT: 0x2008 R_MIPS_REL32 D1 0x0 -# CHECK-NEXT: 0x2004 R_MIPS_REL32 D4 0x0 -# CHECK-NEXT: 0x2008 R_MIPS_REL32 U1 0x0 -# CHECK-NEXT: } -# CHECK-NEXT: ] - -# CHECK: DynamicSymbols [ -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: @ (0) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Local (0x0) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: T0@ (1) -# CHECK-NEXT: Value: 0x214 -# CHECK-NEXT: Size: 8 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Function (0x2) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: .text (0x5) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: T4@ (7) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D2@ (25) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 4 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: T1@ (16) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Function (0x2) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: T2@ (19) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Function (0x2) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D0@ (4) -# CHECK-NEXT: Value: 0x2004 -# CHECK-NEXT: Size: 8 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: .data (0x8) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D1@ (22) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 4 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D4@ (10) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: U1@ (13) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: ] - -# GOT: Local entries [ -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1008 -# GOT-NEXT: Access: -32744 -# GOT-NEXT: Initial: 0x214 -# GOT-NEXT: Value: 0x214 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: .text (0x5) -# GOT-NEXT: Name: T0@ (1) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x100C -# GOT-NEXT: Access: -32740 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: None (0x0) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T4@ (7) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1010 -# GOT-NEXT: Access: -32736 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Object (0x1) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: D2@ (25) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1014 -# GOT-NEXT: Access: -32732 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T1@ (16) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1018 -# GOT-NEXT: Access: -32728 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T2@ (19) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x101C -# GOT-NEXT: Access: -32724 -# GOT-NEXT: Initial: 0x2004 -# GOT-NEXT: Value: 0x2004 -# GOT-NEXT: Type: Object (0x1) -# GOT-NEXT: Section: .data (0x8) -# GOT-NEXT: Name: D0@ (4) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1020 -# GOT-NEXT: Access: -32720 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Object (0x1) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: D1@ (22) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1024 -# GOT-NEXT: Access: -32716 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: None (0x0) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: D4@ (10) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1028 -# GOT-NEXT: Access: -32712 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: None (0x0) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: U1@ (13) -# GOT-NEXT: } -# GOT-NEXT: ] - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 4 - - Name: D1 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 4 - - Name: D2 - Section: .data - Type: STT_OBJECT - Value: 0x4 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: _gp_disp - Type: R_MIPS_HI16 - - Offset: 0x00 - Symbol: _gp_disp - Type: R_MIPS_LO16 - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 # T0 is a defined function - Symbol: T0 - Type: R_MIPS_32 - - Offset: 0x04 # T1 is a function from shared lib - Symbol: T1 - Type: R_MIPS_32 - - Offset: 0x08 # T2 has unknown type and defined in shared lib - Symbol: T2 - Type: R_MIPS_32 - - Offset: 0x00 # T4 is an undefined function - Symbol: T4 - Type: R_MIPS_32 - - Offset: 0x04 # D0 is a defined data object - Symbol: D0 - Type: R_MIPS_32 - - Offset: 0x08 # D1 is a data object from shared lib - Symbol: D1 - Type: R_MIPS_32 - - Offset: 0x00 # D2 has unknown type and defined in shared lib - Symbol: D2 - Type: R_MIPS_32 - - Offset: 0x04 # D4 is an undefined data object - Symbol: D4 - Type: R_MIPS_32 - - Offset: 0x08 # U1 is undefined and has unknown type - Symbol: U1 - Type: R_MIPS_32 - -Symbols: - Local: - - Name: LT0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: LD0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 4 - - Global: - - Name: _gp_disp - Type: STT_OBJECT - - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 8 - - Name: T1 - Type: STT_FUNC - - Name: T2 - - Name: T4 - Type: STT_FUNC - - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x4 - Size: 8 - - Name: D1 - Type: STT_OBJECT - - Name: D2 - - Name: D4 - Type: STT_OBJECT - - Name: U1 diff --git a/test/old-elf/Mips/rel-dynamic-08-64.test b/test/old-elf/Mips/rel-dynamic-08-64.test deleted file mode 100644 index 019b8e5161a8..000000000000 --- a/test/old-elf/Mips/rel-dynamic-08-64.test +++ /dev/null @@ -1,275 +0,0 @@ -# Conditions: -# a) Linking a non-shared executable file. -# b) There ars multiple R_MIPS_64/R_MIPS_HI16/R_MIPS_LO16 relocations -# with various targets. -# Check: -# a) Emitting of R_MIPS_REL32 relocations. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mips64el -e T0 --noinhibit-exec \ -# RUN: -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -dt -r -sections %t.exe | FileCheck %s -# RUN: llvm-readobj -mips-plt-got %t.exe | FileCheck -check-prefix=GOT %s - -# CHECK: Sections [ -# CHECK: Section { -# CHECK-NOT: Name: .plt ({{[0-9]+}}) - -# CHECK: Relocations [ -# CHECK-NEXT: Section (5) .rel.dyn { -# CHECK-NEXT: 0x120002000 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE D2 0x0 -# CHECK-NEXT: 0x120002004 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE T1 0x0 -# CHECK-NEXT: 0x120002008 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE T2 0x0 -# CHECK-NEXT: 0x120002008 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE D1 0x0 -# CHECK-NEXT: } -# CHECK-NEXT: ] - -# CHECK: DynamicSymbols [ -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: @ (0) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Local (0x0) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D2@ (10) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 4 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: T1@ (1) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Function (0x2) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: T2@ (4) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Function (0x2) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D1@ (7) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 4 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: ] - -# GOT: Local entries [ -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x120001010 -# GOT-NEXT: Access: -32736 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Object (0x1) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: D2@ (10) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x120001018 -# GOT-NEXT: Access: -32728 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T1@ (1) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x120001020 -# GOT-NEXT: Access: -32720 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T2@ (4) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x120001028 -# GOT-NEXT: Access: -32712 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Object (0x1) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: D1@ (7) -# GOT-NEXT: } -# GOT-NEXT: ] - -# so.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 4 - - Name: D1 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 4 - - Name: D2 - Section: .data - Type: STT_OBJECT - Value: 0x4 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_RELA - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: _gp_disp - Type: R_MIPS_HI16 - - Offset: 0x00 - Symbol: _gp_disp - Type: R_MIPS_LO16 - -- Name: .rel.data - Type: SHT_RELA - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 # LT0 is a locally defined function - Symbol: LT0 - Type: R_MIPS_64 - - Offset: 0x00 # LD0 is a locally defined data object - Symbol: LD0 - Type: R_MIPS_64 - - Offset: 0x00 # T0 is a defined function - Symbol: T0 - Type: R_MIPS_64 - - Offset: 0x04 # T1 is a function from shared lib - Symbol: T1 - Type: R_MIPS_64 - - Offset: 0x08 # T2 has unknown type and defined in shared lib - Symbol: T2 - Type: R_MIPS_64 - - Offset: 0x00 # T4 is an undefined function - Symbol: T4 - Type: R_MIPS_64 - - Offset: 0x04 # D0 is a defined data object - Symbol: D0 - Type: R_MIPS_64 - - Offset: 0x08 # D1 is a data object from shared lib - Symbol: D1 - Type: R_MIPS_64 - - Offset: 0x00 # D2 has unknown type and defined in shared lib - Symbol: D2 - Type: R_MIPS_64 - - Offset: 0x04 # D4 is an undefined data object - Symbol: D4 - Type: R_MIPS_64 - - Offset: 0x08 # U1 is undefined and has unknown type - Symbol: U1 - Type: R_MIPS_64 - -Symbols: - Local: - - Name: LT0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: LD0 - Section: .data - Type: STT_OBJECT - Value: 0 - Size: 4 - - Global: - - Name: _gp_disp - Type: STT_OBJECT - - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 8 - - Name: T1 - Type: STT_FUNC - - Name: T2 - - Name: T4 - Type: STT_FUNC - - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x4 - Size: 8 - - Name: D1 - Type: STT_OBJECT - - Name: D2 - - Name: D4 - Type: STT_OBJECT - - Name: U1 -... diff --git a/test/old-elf/Mips/rel-dynamic-08-micro.test b/test/old-elf/Mips/rel-dynamic-08-micro.test deleted file mode 100644 index 2d25b504ee28..000000000000 --- a/test/old-elf/Mips/rel-dynamic-08-micro.test +++ /dev/null @@ -1,278 +0,0 @@ -# Conditions: -# a) Linking a non-shared executable file. -# b) There ars multiple R_MIPS_32/R_MICROMIPS_HI16/R_MICROMIPS_LO16 -# relocations with various targets. -# Check: -# a) Emitting of R_MIPS_REL32 relocations. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 --noinhibit-exec \ -# RUN: -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -dt -r -sections %t.exe | FileCheck %s -# RUN: llvm-readobj -mips-plt-got %t.exe | FileCheck -check-prefix=GOT %s - -# CHECK: Sections [ -# CHECK: Section { -# CHECK-NOT: Name: .plt ({{[0-9]+}}) - -# CHECK: Relocations [ -# CHECK-NEXT: Section (5) .rel.dyn { -# CHECK-NEXT: 0x402000 R_MIPS_REL32 D2 0x0 -# CHECK-NEXT: 0x402004 R_MIPS_REL32 T1 0x0 -# CHECK-NEXT: 0x402008 R_MIPS_REL32 T2 0x0 -# CHECK-NEXT: 0x402008 R_MIPS_REL32 D1 0x0 -# CHECK-NEXT: } -# CHECK-NEXT: ] - -# CHECK: DynamicSymbols [ -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: @ (0) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Local (0x0) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D2@ (10) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 4 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: T1@ (1) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Function (0x2) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: T2@ (4) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Function (0x2) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D1@ (7) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 4 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: ] - -# GOT: Local entries [ -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401008 -# GOT-NEXT: Access: -32744 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Object (0x1) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: D2@ (10) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x40100C -# GOT-NEXT: Access: -32740 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T1@ (1) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401010 -# GOT-NEXT: Access: -32736 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T2@ (4) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401014 -# GOT-NEXT: Access: -32732 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Object (0x1) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: D1@ (7) -# GOT-NEXT: } -# GOT-NEXT: ] - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 4 - - Name: D1 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 4 - - Name: D2 - Section: .data - Type: STT_OBJECT - Value: 0x4 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: _gp_disp - Type: R_MICROMIPS_HI16 - - Offset: 0x00 - Symbol: _gp_disp - Type: R_MICROMIPS_LO16 - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 # LT0 is a locally defined function - Symbol: LT0 - Type: R_MIPS_32 - - Offset: 0x00 # LD0 is a locally defined data object - Symbol: LD0 - Type: R_MIPS_32 - - Offset: 0x00 # T0 is a defined function - Symbol: T0 - Type: R_MIPS_32 - - Offset: 0x04 # T1 is a function from shared lib - Symbol: T1 - Type: R_MIPS_32 - - Offset: 0x08 # T2 has unknown type and defined in shared lib - Symbol: T2 - Type: R_MIPS_32 - - Offset: 0x00 # T4 is an undefined function - Symbol: T4 - Type: R_MIPS_32 - - Offset: 0x04 # D0 is a defined data object - Symbol: D0 - Type: R_MIPS_32 - - Offset: 0x08 # D1 is a data object from shared lib - Symbol: D1 - Type: R_MIPS_32 - - Offset: 0x00 # D2 has unknown type and defined in shared lib - Symbol: D2 - Type: R_MIPS_32 - - Offset: 0x04 # D4 is an undefined data object - Symbol: D4 - Type: R_MIPS_32 - - Offset: 0x08 # U1 is undefined and has unknown type - Symbol: U1 - Type: R_MIPS_32 - -Symbols: - Local: - - Name: LT0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - Other: [ STO_MIPS_MICROMIPS ] - - Name: LD0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 4 - - Global: - - Name: _gp_disp - Type: STT_OBJECT - - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 8 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T1 - Type: STT_FUNC - - Name: T2 - - Name: T4 - Type: STT_FUNC - - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x4 - Size: 8 - - Name: D1 - Type: STT_OBJECT - - Name: D2 - - Name: D4 - Type: STT_OBJECT - - Name: U1 -... diff --git a/test/old-elf/Mips/rel-dynamic-08.test b/test/old-elf/Mips/rel-dynamic-08.test deleted file mode 100644 index a89e6ecf480e..000000000000 --- a/test/old-elf/Mips/rel-dynamic-08.test +++ /dev/null @@ -1,275 +0,0 @@ -# Conditions: -# a) Linking a non-shared executable file. -# b) There ars multiple R_MIPS_32/R_MIPS_HI16/R_MIPS_LO16 relocations -# with various targets. -# Check: -# a) Emitting of R_MIPS_REL32 relocations. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 --noinhibit-exec \ -# RUN: -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -dt -r -sections %t.exe | FileCheck %s -# RUN: llvm-readobj -mips-plt-got %t.exe | FileCheck -check-prefix=GOT %s - -# CHECK: Sections [ -# CHECK: Section { -# CHECK-NOT: Name: .plt ({{[0-9]+}}) - -# CHECK: Relocations [ -# CHECK-NEXT: Section (5) .rel.dyn { -# CHECK-NEXT: 0x402000 R_MIPS_REL32 D2 0x0 -# CHECK-NEXT: 0x402004 R_MIPS_REL32 T1 0x0 -# CHECK-NEXT: 0x402008 R_MIPS_REL32 T2 0x0 -# CHECK-NEXT: 0x402008 R_MIPS_REL32 D1 0x0 -# CHECK-NEXT: } -# CHECK-NEXT: ] - -# CHECK: DynamicSymbols [ -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: @ (0) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Local (0x0) -# CHECK-NEXT: Type: None (0x0) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D2@ (10) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 4 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: T1@ (1) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Function (0x2) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: T2@ (4) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 0 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Function (0x2) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: D1@ (7) -# CHECK-NEXT: Value: 0x0 -# CHECK-NEXT: Size: 4 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: Undefined (0x0) -# CHECK-NEXT: } -# CHECK-NEXT: ] - -# GOT: Local entries [ -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401008 -# GOT-NEXT: Access: -32744 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Object (0x1) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: D2@ (10) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x40100C -# GOT-NEXT: Access: -32740 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T1@ (1) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401010 -# GOT-NEXT: Access: -32736 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T2@ (4) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401014 -# GOT-NEXT: Access: -32732 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Object (0x1) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: D1@ (7) -# GOT-NEXT: } -# GOT-NEXT: ] - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 4 - - Name: D1 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 4 - - Name: D2 - Section: .data - Type: STT_OBJECT - Value: 0x4 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: _gp_disp - Type: R_MIPS_HI16 - - Offset: 0x00 - Symbol: _gp_disp - Type: R_MIPS_LO16 - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 # LT0 is a locally defined function - Symbol: LT0 - Type: R_MIPS_32 - - Offset: 0x00 # LD0 is a locally defined data object - Symbol: LD0 - Type: R_MIPS_32 - - Offset: 0x00 # T0 is a defined function - Symbol: T0 - Type: R_MIPS_32 - - Offset: 0x04 # T1 is a function from shared lib - Symbol: T1 - Type: R_MIPS_32 - - Offset: 0x08 # T2 has unknown type and defined in shared lib - Symbol: T2 - Type: R_MIPS_32 - - Offset: 0x00 # T4 is an undefined function - Symbol: T4 - Type: R_MIPS_32 - - Offset: 0x04 # D0 is a defined data object - Symbol: D0 - Type: R_MIPS_32 - - Offset: 0x08 # D1 is a data object from shared lib - Symbol: D1 - Type: R_MIPS_32 - - Offset: 0x00 # D2 has unknown type and defined in shared lib - Symbol: D2 - Type: R_MIPS_32 - - Offset: 0x04 # D4 is an undefined data object - Symbol: D4 - Type: R_MIPS_32 - - Offset: 0x08 # U1 is undefined and has unknown type - Symbol: U1 - Type: R_MIPS_32 - -Symbols: - Local: - - Name: LT0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: LD0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 4 - - Global: - - Name: _gp_disp - Type: STT_OBJECT - - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 8 - - Name: T1 - Type: STT_FUNC - - Name: T2 - - Name: T4 - Type: STT_FUNC - - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x4 - Size: 8 - - Name: D1 - Type: STT_OBJECT - - Name: D2 - - Name: D4 - Type: STT_OBJECT - - Name: U1 -... diff --git a/test/old-elf/Mips/rel-dynamic-09-micro.test b/test/old-elf/Mips/rel-dynamic-09-micro.test deleted file mode 100644 index 2011ae079645..000000000000 --- a/test/old-elf/Mips/rel-dynamic-09-micro.test +++ /dev/null @@ -1,109 +0,0 @@ -# Conditions: -# a) Linking a non-shared executable file. -# b) Relocations' targets are undefined symbols. -# Check: -# a) There should be no dynamic relocations. -# b) There should be no PLT entries. -# -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target mipsel --noinhibit-exec -e T0 -o %t2-exe %t-obj -# RUN: llvm-readobj -dt -r -s %t2-exe | FileCheck -check-prefix=PLT-SYM %s - -# PLT-SYM: Sections [ -# PLT-SYM: Section { -# PLT-SYM-NOT: Name: .plt ({{[0-9]+}}) - -# PLT-SYM: Relocations [ -# PLT-SYM-NEXT: ] - -# PLT-SYM: DynamicSymbols [ -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: @ (0) -# PLT-SYM-NEXT: Value: 0x0 -# PLT-SYM-NEXT: Size: 0 -# PLT-SYM-NEXT: Binding: Local (0x0) -# PLT-SYM-NEXT: Type: None (0x0) -# PLT-SYM-NEXT: Other: 0 -# PLT-SYM-NEXT: Section: Undefined (0x0) -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: ] - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "0000000000000000" - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Content: "0000000000000000" - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x04 - Symbol: T3 - Type: R_MICROMIPS_26_S1 - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: T1 - Type: R_MICROMIPS_HI16 - - Offset: 0x00 - Symbol: T1 - Type: R_MICROMIPS_LO16 - - Offset: 0x04 - Symbol: T2 - Type: R_MIPS_32 - - - Offset: 0x04 - Symbol: D1 - Type: R_MICROMIPS_HI16 - - Offset: 0x04 - Symbol: D1 - Type: R_MICROMIPS_LO16 - - Offset: 0x04 - Symbol: D2 - Type: R_MIPS_32 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 8 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T1 - Type: STT_FUNC - - Name: T2 - Type: STT_FUNC - - Name: T3 - Type: STT_FUNC - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 8 - - Name: D1 - Type: STT_OBJECT - - Name: D2 - Type: STT_OBJECT diff --git a/test/old-elf/Mips/rel-dynamic-09.test b/test/old-elf/Mips/rel-dynamic-09.test deleted file mode 100644 index 9b02ec1b5707..000000000000 --- a/test/old-elf/Mips/rel-dynamic-09.test +++ /dev/null @@ -1,107 +0,0 @@ -# Conditions: -# a) Linking a non-shared executable file. -# b) Relocations' targets are undefined symbols. -# Check: -# a) There should be no dynamic relocations. -# b) There should be no PLT entries. -# -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target mipsel --noinhibit-exec -e T0 -o %t2-exe %t-obj -# RUN: llvm-readobj -dt -r -s %t2-exe | FileCheck -check-prefix=PLT-SYM %s - -# PLT-SYM: Sections [ -# PLT-SYM: Section { -# PLT-SYM-NOT: Name: .plt ({{[0-9]+}}) - -# PLT-SYM: Relocations [ -# PLT-SYM-NEXT: ] - -# PLT-SYM: DynamicSymbols [ -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: @ (0) -# PLT-SYM-NEXT: Value: 0x0 -# PLT-SYM-NEXT: Size: 0 -# PLT-SYM-NEXT: Binding: Local (0x0) -# PLT-SYM-NEXT: Type: None (0x0) -# PLT-SYM-NEXT: Other: 0 -# PLT-SYM-NEXT: Section: Undefined (0x0) -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: ] - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "0000000000000000" - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Content: "0000000000000000" - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x04 - Symbol: T3 - Type: R_MIPS_26 - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_HI16 - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_LO16 - - Offset: 0x04 - Symbol: T2 - Type: R_MIPS_32 - - - Offset: 0x04 - Symbol: D1 - Type: R_MIPS_HI16 - - Offset: 0x04 - Symbol: D1 - Type: R_MIPS_LO16 - - Offset: 0x04 - Symbol: D2 - Type: R_MIPS_32 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 8 - - Name: T1 - Type: STT_FUNC - - Name: T2 - Type: STT_FUNC - - Name: T3 - Type: STT_FUNC - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 8 - - Name: D1 - Type: STT_OBJECT - - Name: D2 - Type: STT_OBJECT diff --git a/test/old-elf/Mips/rel-dynamic-10-micro.test b/test/old-elf/Mips/rel-dynamic-10-micro.test deleted file mode 100644 index 4600af85c27c..000000000000 --- a/test/old-elf/Mips/rel-dynamic-10-micro.test +++ /dev/null @@ -1,166 +0,0 @@ -# Conditions: -# a) Linking a non-shared executable file. -# b) Relocations' targets are symbols defined in the other object. -# Check: -# a) There should be no dynamic relocations. -# b) There should be no PLT entries. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-o1.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o2.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o1.o %t-o2.o -# RUN: llvm-readobj -dt -r -s %t.exe | FileCheck -check-prefix=PLT-SYM %s - -# PLT-SYM: Sections [ -# PLT-SYM: Section { -# PLT-SYM-NOT: Name: .plt ({{[0-9]+}}) - -# PLT-SYM: Relocations [ -# PLT-SYM-NEXT: ] - -# PLT-SYM: DynamicSymbols [ -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: @ (0) -# PLT-SYM-NEXT: Value: 0x0 -# PLT-SYM-NEXT: Size: 0 -# PLT-SYM-NEXT: Binding: Local (0x0) -# PLT-SYM-NEXT: Type: None (0x0) -# PLT-SYM-NEXT: Other: 0 -# PLT-SYM-NEXT: Section: Undefined (0x0) -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: ] - -# o1.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 4 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T3 - Section: .text - Type: STT_FUNC - Value: 0x8 - Size: 4 - Other: [ STO_MIPS_MICROMIPS ] - - Name: D1 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 4 - - Name: D2 - Section: .data - Type: STT_OBJECT - Value: 0x4 - Size: 4 - -# o2.o ---- -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x04 - Symbol: T3 - Type: R_MICROMIPS_26_S1 - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: T1 - Type: R_MICROMIPS_HI16 - - Offset: 0x00 - Symbol: T1 - Type: R_MICROMIPS_LO16 - - Offset: 0x04 - Symbol: T2 - Type: R_MIPS_32 - - - Offset: 0x04 - Symbol: D1 - Type: R_MICROMIPS_HI16 - - Offset: 0x04 - Symbol: D1 - Type: R_MICROMIPS_LO16 - - Offset: 0x04 - Symbol: D2 - Type: R_MIPS_32 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 8 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T1 - Type: STT_FUNC - - Name: T2 - Type: STT_FUNC - - Name: T3 - Type: STT_FUNC - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 8 - - Name: D1 - Type: STT_OBJECT - - Name: D2 - Type: STT_OBJECT -... diff --git a/test/old-elf/Mips/rel-dynamic-10.test b/test/old-elf/Mips/rel-dynamic-10.test deleted file mode 100644 index 68a311df73e4..000000000000 --- a/test/old-elf/Mips/rel-dynamic-10.test +++ /dev/null @@ -1,160 +0,0 @@ -# Conditions: -# a) Linking a non-shared executable file. -# b) Relocations' targets are symbols defined in the other object. -# Check: -# a) There should be no dynamic relocations. -# b) There should be no PLT entries. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-o1.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o2.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o1.o %t-o2.o -# RUN: llvm-readobj -dt -r -s %t.exe | FileCheck -check-prefix=PLT-SYM %s - -# PLT-SYM: Sections [ -# PLT-SYM: Section { -# PLT-SYM-NOT: Name: .plt ({{[0-9]+}}) - -# PLT-SYM: Relocations [ -# PLT-SYM-NEXT: ] - -# PLT-SYM: DynamicSymbols [ -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: @ (0) -# PLT-SYM-NEXT: Value: 0x0 -# PLT-SYM-NEXT: Size: 0 -# PLT-SYM-NEXT: Binding: Local (0x0) -# PLT-SYM-NEXT: Type: None (0x0) -# PLT-SYM-NEXT: Other: 0 -# PLT-SYM-NEXT: Section: Undefined (0x0) -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: ] - -# o1.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 4 - - Name: T3 - Section: .text - Type: STT_FUNC - Value: 0x8 - Size: 4 - - Name: D1 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 4 - - Name: D2 - Section: .data - Type: STT_OBJECT - Value: 0x4 - Size: 4 - -# o2.o ---- -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x04 - Symbol: T3 - Type: R_MIPS_26 - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_HI16 - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_LO16 - - Offset: 0x04 - Symbol: T2 - Type: R_MIPS_32 - - - Offset: 0x04 - Symbol: D1 - Type: R_MIPS_HI16 - - Offset: 0x04 - Symbol: D1 - Type: R_MIPS_LO16 - - Offset: 0x04 - Symbol: D2 - Type: R_MIPS_32 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 8 - - Name: T1 - Type: STT_FUNC - - Name: T2 - Type: STT_FUNC - - Name: T3 - Type: STT_FUNC - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 8 - - Name: D1 - Type: STT_OBJECT - - Name: D2 - Type: STT_OBJECT -... diff --git a/test/old-elf/Mips/rel-dynamic-11.test b/test/old-elf/Mips/rel-dynamic-11.test deleted file mode 100644 index 01edbd64812f..000000000000 --- a/test/old-elf/Mips/rel-dynamic-11.test +++ /dev/null @@ -1,110 +0,0 @@ -# Conditions: -# a) Linking a shared library. -# b) Relocations' targets are symbols defined in the other shared object. -# Check: -# a) Emitting R_MIPS_REL32 relocations for both symbols. -# b) There should be no PLT entries. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t1.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t2.so %t-o.o %t1.so -# RUN: llvm-readobj -dt -r -s %t2.so | FileCheck -check-prefix=PLT-SYM %s - -# PLT-SYM: Sections [ -# PLT-SYM: Section { -# PLT-SYM-NOT: Name: .plt ({{[0-9]+}}) -# -# PLT-SYM: Relocations [ -# PLT-SYM-NEXT: Section (4) .rel.dyn { -# PLT-SYM-NEXT: 0x150 R_MIPS_REL32 T1 0x0 -# PLT-SYM-NEXT: 0x2000 R_MIPS_REL32 T1 0x0 -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: ] -# -# PLT-SYM: Name: T1@ (7) -# PLT-SYM-NEXT: Value: 0x0 -# PLT-SYM-NEXT: Size: 0 -# PLT-SYM-NEXT: Binding: Global (0x1) -# PLT-SYM-NEXT: Type: Function (0x2) -# PLT-SYM-NEXT: Other: 0 -# PLT-SYM-NEXT: Section: Undefined (0x0) - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_32 - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_32 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: T1 - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 8 -... diff --git a/test/old-elf/Mips/rel-dynamic-12.test b/test/old-elf/Mips/rel-dynamic-12.test deleted file mode 100644 index c684df3f2628..000000000000 --- a/test/old-elf/Mips/rel-dynamic-12.test +++ /dev/null @@ -1,237 +0,0 @@ -# Conditions: -# a) Linking a non-shared executable file. -# b) Relocations' targets are symbols defined in the shared object. -# c) Relocations are R_MIPS_PCHI16 / R_MIPS_PCLO16. -# Check: -# a) Emitting R_MIPS_REL32, R_MIPS_COPY, R_MIPS_JUMP_SLOT relocations. -# b) STO_MIPS_PLT flag in the dynamic symbol table for symbols require -# a pointer equality. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -dt -r %t.exe | FileCheck -check-prefix=PLT-SYM %s -# RUN: llvm-readobj -mips-plt-got %t.exe | FileCheck -check-prefix=GOT %s - -# PLT-SYM: Relocations [ -# PLT-SYM-NEXT: Section (5) .rel.dyn { -# PLT-SYM-NEXT: 0x402014 R_MIPS_REL32 T2 0x0 -# PLT-SYM-NEXT: 0x402014 R_MIPS_REL32 D2 0x0 -# PLT-SYM-NEXT: 0x402020 R_MIPS_COPY D1 0x0 -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: Section (6) .rel.plt { -# PLT-SYM-NEXT: 0x402008 R_MIPS_JUMP_SLOT T3 0x0 -# PLT-SYM-NEXT: 0x40200C R_MIPS_JUMP_SLOT T1 0x0 -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: ] - -# PLT-SYM: DynamicSymbols [ -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: @ (0) -# PLT-SYM-NEXT: Value: 0x0 -# PLT-SYM-NEXT: Size: 0 -# PLT-SYM-NEXT: Binding: Local (0x0) -# PLT-SYM-NEXT: Type: None (0x0) -# PLT-SYM-NEXT: Other: 0 -# PLT-SYM-NEXT: Section: Undefined (0x0) -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: D1@ (1) -# PLT-SYM-NEXT: Value: 0x{{[0-9A-F]+}} -# PLT-SYM-NEXT: Size: 4 -# PLT-SYM-NEXT: Binding: Global (0x1) -# PLT-SYM-NEXT: Type: Object (0x1) -# PLT-SYM-NEXT: Other: 0 -# PLT-SYM-NEXT: Section: .bss -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: T1@ (4) -# PLT-SYM-NEXT: Value: 0x{{[0-9A-F]+}} -# PLT-SYM-NEXT: Size: 0 -# PLT-SYM-NEXT: Binding: Global (0x1) -# PLT-SYM-NEXT: Type: Function (0x2) -# PLT-SYM-NEXT: Other: 8 -# PLT-SYM-NEXT: Section: Undefined (0x0) -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: T3@ (10) -# PLT-SYM-NEXT: Value: 0x0 -# PLT-SYM-NEXT: Size: 0 -# PLT-SYM-NEXT: Binding: Global (0x1) -# PLT-SYM-NEXT: Type: Function (0x2) -# PLT-SYM-NEXT: Other: 0 -# PLT-SYM-NEXT: Section: Undefined (0x0) -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: T2@ (7) -# PLT-SYM-NEXT: Value: 0x0 -# PLT-SYM-NEXT: Size: 0 -# PLT-SYM-NEXT: Binding: Global (0x1) -# PLT-SYM-NEXT: Type: Function (0x2) -# PLT-SYM-NEXT: Other: 0 -# PLT-SYM-NEXT: Section: Undefined (0x0) -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: Symbol { -# PLT-SYM-NEXT: Name: D2@ (13) -# PLT-SYM-NEXT: Value: 0x0 -# PLT-SYM-NEXT: Size: 4 -# PLT-SYM-NEXT: Binding: Global (0x1) -# PLT-SYM-NEXT: Type: Object (0x1) -# PLT-SYM-NEXT: Other: 0 -# PLT-SYM-NEXT: Section: Undefined (0x0) -# PLT-SYM-NEXT: } -# PLT-SYM-NEXT: ] - -# GOT: Local entries [ -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x{{[0-9A-F]+}} -# GOT-NEXT: Access: -32744 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T2@ (7) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x{{[0-9A-F]+}} -# GOT-NEXT: Access: -32740 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Object (0x1) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: D2@ (13) -# GOT-NEXT: } -# GOT-NEXT: ] - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x0C - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 4 - - Name: T3 - Section: .text - Type: STT_FUNC - Value: 0x8 - Size: 4 - - Name: D1 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 4 - - Name: D2 - Section: .data - Type: STT_OBJECT - Value: 0x4 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0x04 - Symbol: T3 - Type: R_MIPS_26 - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_PCHI16 - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_PCLO16 - - Offset: 0x04 - Symbol: T2 - Type: R_MIPS_32 - - - Offset: 0x04 - Symbol: D1 - Type: R_MIPS_PCHI16 - - Offset: 0x04 - Symbol: D1 - Type: R_MIPS_PCLO16 - - Offset: 0x04 - Symbol: D2 - Type: R_MIPS_32 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 8 - - Name: T1 - Type: STT_FUNC - - Name: T2 - Type: STT_FUNC - - Name: T3 - Type: STT_FUNC - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 8 - - Name: D1 - Type: STT_OBJECT - - Name: D2 - Type: STT_OBJECT -... diff --git a/test/old-elf/Mips/rel-dynamic-13.test b/test/old-elf/Mips/rel-dynamic-13.test deleted file mode 100644 index 2bf014e51025..000000000000 --- a/test/old-elf/Mips/rel-dynamic-13.test +++ /dev/null @@ -1,94 +0,0 @@ -# Conditions: -# a) Linking a non-shared 32-bit executable file. -# b) Relocations' targets are symbols defined in the shared object. -# Check: -# a) Emitting R_MIPS_REL32 relocation. -# b) Applying addendum from the original relocation. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=RAW %s -# RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=REL %s - -# RAW: Contents of section .data: -# RAW-NEXT: 402000 01000000 - -# REL: Relocations [ -# REL-NEXT: Section (5) .rel.dyn { -# REL-NEXT: 0x402000 R_MIPS_REL32 T1 0x0 -# REL-NEXT: } -# REL-NEXT: ] - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.data - Type: SHT_RELA - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_32 - Addend: 1 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: T1 - Type: STT_FUNC - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0 - Size: 4 -... diff --git a/test/old-elf/Mips/rel-dynamic-14.test b/test/old-elf/Mips/rel-dynamic-14.test deleted file mode 100644 index 33197ae92b81..000000000000 --- a/test/old-elf/Mips/rel-dynamic-14.test +++ /dev/null @@ -1,94 +0,0 @@ -# Conditions: -# a) Linking a non-shared 64-bit executable file. -# b) Relocations' targets are symbols defined in the shared object. -# Check: -# a) Emitting R_MIPS_REL32/R_MIPS_64 relocation. -# b) Applying addendum from the original relocation. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mips64el -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=RAW %s -# RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=REL %s - -# RAW: Contents of section .data: -# RAW-NEXT: 120002000 04000000 00000000 - -# REL: Relocations [ -# REL-NEXT: Section (5) .rel.dyn { -# REL-NEXT: 0x120002000 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE T1 0x0 -# REL-NEXT: } -# REL-NEXT: ] - -# so.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.data - Type: SHT_RELA - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_64 - Addend: 4 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: T1 - Type: STT_FUNC - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0 - Size: 4 -... diff --git a/test/old-elf/Mips/rel-dynamic-15.test b/test/old-elf/Mips/rel-dynamic-15.test deleted file mode 100644 index 13e2083bfc02..000000000000 --- a/test/old-elf/Mips/rel-dynamic-15.test +++ /dev/null @@ -1,81 +0,0 @@ -# Check that LLD generates dynamic relocation R_MIPS_REL32 for local -# symbols if the symbols referenced by R_MIPS_32 relocation. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o -# RUN: llvm-objdump -s %t.so | FileCheck -check-prefix=RAW %s -# RUN: llvm-readobj -r %t.so | FileCheck -check-prefix=REL %s - -# RAW: Contents of section .text: -# RAW-NEXT: 0120 00000000 00000000 -# RAW: Contents of section .data.rel.local: -# RAW-NEXT: 2000 20010000 00000000 - -# REL: Relocations [ -# REL-NEXT: Section (4) .rel.dyn { -# REL-NEXT: 0x2000 R_MIPS_REL32 - 0x0 -# REL-NEXT: 0x2004 R_MIPS_REL32 T1 0x0 -# REL-NEXT: } -# REL-NEXT: ] - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Size: 8 - - - Name: .data.rel.local - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 4 - Size: 8 - - - Name: .rel.data.rel.local - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .data.rel.local - Relocations: - - Offset: 0 - Symbol: .text - Type: R_MIPS_32 - - Offset: 4 - Symbol: T1 - Type: R_MIPS_32 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: T0 - Type: STT_FUNC - Section: .text - Value: 0 - Size: 4 - - Name: .data.rel.local - Type: STT_SECTION - Section: .data.rel.local - - Global: - - Name: D0 - Type: STT_OBJECT - Section: .data.rel.local - Value: 0 - Size: 8 - - Name: T1 - Type: STT_FUNC - Section: .text - Value: 4 - Size: 4 -... diff --git a/test/old-elf/Mips/rel-eh-01.test b/test/old-elf/Mips/rel-eh-01.test deleted file mode 100644 index 08e5d78683a8..000000000000 --- a/test/old-elf/Mips/rel-eh-01.test +++ /dev/null @@ -1,186 +0,0 @@ -# Check R_MIPS_EH relocation handling: writing result of a relocation -# calculation, adding GOT entries etc. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t.so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t1.o -# RUN: yaml2obj -format=elf -docnum 3 %s > %t2.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t1.o %t2.o %t.so -# RUN: llvm-objdump -s -t %t.exe | FileCheck -check-prefix=RAW %s -# RUN: llvm-readobj -mips-plt-got %t.exe | FileCheck -check-prefix=GOT %s - -# RAW: Contents of section .gnu_extab: -# RAW-NEXT: 400178 001880ff ff000000 1c80ffff 2080ffff -# ^ T1 GOT entry = 0xffff8018 = -32744 -# ^ L1 GOT entry = 0xffff801c = -32740 -# E1 GOT entry = 0xffff8020 = -32736 ^ -# RAW: Contents of section .got: -# RAW-NEXT: 401000 00000000 00000080 60014000 00204000 -# RAW-NEXT: 401010 00000000 - -# RAW: SYMBOL TABLE: -# RAW: 00402000 l .data 00000004 L1 -# RAW: 00400160 g F .text 00000004 T1 - -# GOT: Local entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401008 -# GOT-NEXT: Access: -32744 -# GOT-NEXT: Initial: 0x400160 -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x40100C -# GOT-NEXT: Access: -32740 -# GOT-NEXT: Initial: 0x402000 -# GOT-NEXT: } -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x401010 -# GOT-NEXT: Access: -32736 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: E1@ (1) -# GOT-NEXT: } -# GOT-NEXT: ] -# GOT-NEXT: Number of TLS and multi-GOT entries: 0 - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_CPIC, EF_MIPS_PIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [SHF_ALLOC, SHF_EXECINSTR] - AddressAlign: 16 - Size: 4 - -Symbols: - Global: - - Name: E1 - Type: STT_FUNC - Section: .text - Value: 0 - Size: 4 - -# t1.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_CPIC, EF_MIPS_PIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [SHF_ALLOC, SHF_EXECINSTR] - AddressAlign: 16 - Size: 4 - -Symbols: - Global: - - Name: T1 - Type: STT_FUNC - Section: .text - Value: 0 - Size: 4 - -# t2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_CPIC, EF_MIPS_PIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [SHF_ALLOC, SHF_EXECINSTR] - AddressAlign: 16 - Size: 8 - - - Name: .data - Type: SHT_PROGBITS - Flags: [SHF_WRITE, SHF_ALLOC] - AddressAlign: 16 - Size: 4 - - - Name: .gnu_extab - Type: SHT_PROGBITS - Flags: [SHF_ALLOC] - AddressAlign: 4 - Size: 16 - - - Name: .rel.gnu_extab - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .gnu_extab - Relocations: - - Offset: 1 - Symbol: T1 - Type: R_MIPS_EH - - Offset: 8 - Symbol: L1 - Type: R_MIPS_EH - - Offset: 12 - Symbol: E1 - Type: R_MIPS_EH - - - Name: .eh_frame_entry - Type: SHT_PROGBITS - Flags: [SHF_ALLOC] - AddressAlign: 4 - Content: "0000000100000001" - - - Name: .rel.eh_frame_entry - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .eh_frame_entry - Relocations: - - Offset: 0 - Symbol: .text - Type: R_MIPS_PC32 - - Offset: 4 - Symbol: .gnu_extab - Type: R_MIPS_PC32 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .gnu_extab - Type: STT_SECTION - Section: .gnu_extab - - Name: L1 - Type: STT_OBJECT - Section: .data - Value: 0 - Size: 4 - - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Value: 0 - Size: 8 - - Name: E1 - - Name: T1 -... diff --git a/test/old-elf/Mips/rel-eh-02.test b/test/old-elf/Mips/rel-eh-02.test deleted file mode 100644 index e78c967ed301..000000000000 --- a/test/old-elf/Mips/rel-eh-02.test +++ /dev/null @@ -1,130 +0,0 @@ -# Conditions: -# a) Linking a non-shared executable file. -# b) Relocations' targets are symbols defined in the shared object. -# Check: -# a) The R_MIPS_REL32 relocation is not created for any symbols. -# b) The R_MIPS_COPY relocation is created for the D1 symbol. -# c) No entries in the dynamic symbols table has the STO_MIPS_PLT flag. -# -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so -# RUN: llvm-readobj -dt -r %t.exe | FileCheck -check-prefix=PLT-SYM %s - -# PLT-SYM: Relocations [ -# PLT-SYM-NEXT: Section (5) .rel.dyn { -# PLT-SYM-NEXT: 0x{{[0-9A-F]+}} R_MIPS_COPY D1 0x0 -# PLT-SYM-NEXT: } - -# PLT-SYM: DynamicSymbols [ -# PLT-SYM-NOT: Other: 8 - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 4 - Flags: [SHF_WRITE, SHF_ALLOC] - -Symbols: - Global: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 4 - Size: 4 - - Name: D1 - Section: .data - Type: STT_OBJECT - Value: 0 - Size: 4 - -# o.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_26 - - Offset: 4 - Symbol: D1 - Type: R_MIPS_PC32 - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_EH - - Offset: 4 - Symbol: T2 - Type: R_MIPS_EH - - Offset: 8 - Symbol: D1 - Type: R_MIPS_EH - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 8 - - Name: T1 - Type: STT_FUNC - - Name: T2 - Type: STT_FUNC - - Name: D0 - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 8 - - Name: D1 - Type: STT_OBJECT -... diff --git a/test/old-elf/Mips/rel-eh-03.test b/test/old-elf/Mips/rel-eh-03.test deleted file mode 100644 index 63ed74cd56f8..000000000000 --- a/test/old-elf/Mips/rel-eh-03.test +++ /dev/null @@ -1,128 +0,0 @@ -# Check R_MIPS_EH relocation handling in case of -pcrel-eh-reloc option. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 \ -# RUN: -pcrel-eh-reloc -o %t.exe %t1.o %t2.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck -check-prefix=RAW %s - -# RAW: Contents of section .gnu_extab: -# RAW-NEXT: 400148 00e7ffff ff000000 b01e0000 00000000 -# ^ 0x400130 + 0 - 0x400149 = 0xffffffe7 -# ^ 0x402000 + 0 - 0x400150 = 0x1eb0 -# E1 GOT entry = 0xffff8020 = -32736 ^ -# RAW: Contents of section .got: -# RAW-NEXT: 401000 00000000 00000080 - -# RAW: SYMBOL TABLE: -# RAW: 00402000 l .data 00000004 L1 -# RAW: 00400130 g F .text 00000004 T1 - -# t1.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_CPIC, EF_MIPS_PIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [SHF_ALLOC, SHF_EXECINSTR] - AddressAlign: 16 - Size: 4 - -Symbols: - Global: - - Name: T1 - Type: STT_FUNC - Section: .text - Value: 0 - Size: 4 - -# t2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_CPIC, EF_MIPS_PIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [SHF_ALLOC, SHF_EXECINSTR] - AddressAlign: 16 - Size: 8 - - - Name: .data - Type: SHT_PROGBITS - Flags: [SHF_WRITE, SHF_ALLOC] - AddressAlign: 16 - Size: 4 - - - Name: .gnu_extab - Type: SHT_PROGBITS - Flags: [SHF_ALLOC] - AddressAlign: 4 - Size: 16 - - - Name: .rel.gnu_extab - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .gnu_extab - Relocations: - - Offset: 1 - Symbol: T1 - Type: R_MIPS_EH - - Offset: 8 - Symbol: L1 - Type: R_MIPS_EH - - - Name: .eh_frame_entry - Type: SHT_PROGBITS - Flags: [SHF_ALLOC] - AddressAlign: 4 - Content: "0000000100000001" - - - Name: .rel.eh_frame_entry - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .eh_frame_entry - Relocations: - - Offset: 0 - Symbol: .text - Type: R_MIPS_PC32 - - Offset: 4 - Symbol: .gnu_extab - Type: R_MIPS_PC32 - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .gnu_extab - Type: STT_SECTION - Section: .gnu_extab - - Name: L1 - Type: STT_OBJECT - Section: .data - Value: 0 - Size: 4 - - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Value: 0 - Size: 8 - - Name: T1 -... diff --git a/test/old-elf/Mips/rel-got-hilo-01.test b/test/old-elf/Mips/rel-got-hilo-01.test deleted file mode 100644 index c73d8765cbd5..000000000000 --- a/test/old-elf/Mips/rel-got-hilo-01.test +++ /dev/null @@ -1,109 +0,0 @@ -# Check handling of R_MIPS_GOT_HI16 / R_MIPS_GOT_LO16 relocations. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t1.so %t1.so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t2.so %t2.so.o %t1.so -# RUN: llvm-objdump -s -t %t2.so | FileCheck -check-prefix=RAW %s -# RUN: llvm-readobj -mips-plt-got %t2.so | FileCheck -check-prefix=GOT %s - -# RAW: Contents of section .text: -# RAW-NEXT: 0110 00000000 18800000 00000000 1c800000 -# ^ -32744 ^ -32740 -# RAW-NEXT: 0120 00000000 - -# RAW: SYMBOL TABLE: -# RAW: 00000120 l F .text 00000004 T1 - -# GOT: Local entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1008 -# GOT-NEXT: Access: -32744 -# GOT-NEXT: Initial: 0x120 -# GOT-NEXT: } -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x100C -# GOT-NEXT: Access: -32740 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T2@ (4) -# GOT-NEXT: } -# GOT-NEXT: ] - -# t1.so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 4 - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] - -Symbols: - Global: - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - -# t2.so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 20 - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_GOT_HI16 - - Offset: 4 - Symbol: T1 - Type: R_MIPS_GOT_LO16 - - Offset: 8 - Symbol: T2 - Type: R_MIPS_GOT_HI16 - - Offset: 12 - Symbol: T2 - Type: R_MIPS_GOT_LO16 - -Symbols: - Local: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 16 - Size: 4 - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 16 - - Name: T2 -... diff --git a/test/old-elf/Mips/rel-got-hilo-micro.test b/test/old-elf/Mips/rel-got-hilo-micro.test deleted file mode 100644 index 39dd1848f92e..000000000000 --- a/test/old-elf/Mips/rel-got-hilo-micro.test +++ /dev/null @@ -1,154 +0,0 @@ -# Check handling of R_MICROMIPS_GOT_HI16 / R_MICROMIPS_GOT_LO16 relocations. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t1.so %t1.so.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.so.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t2.so %t2.so.o %t1.so -# RUN: llvm-objdump -s -t %t2.so | FileCheck -check-prefix=RAW %s -# RUN: llvm-readobj -mips-plt-got %t2.so | FileCheck -check-prefix=GOT %s - -# RAW: Contents of section .text: -# RAW-NEXT: 0130 00000000 00001880 00000000 00002080 -# ^ -32744 ^ -32736 -# RAW-NEXT: 0140 00000000 00001c80 00000000 00002480 -# ^ -32740 ^ -32732 -# RAW-NEXT: 0150 00000000 00000000 - -# RAW: SYMBOL TABLE: -# RAW: 00000150 l F .text 00000004 T1 -# RAW: 00000154 l F .text 00000004 M1 - -# GOT: Local entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1008 -# GOT-NEXT: Access: -32744 -# GOT-NEXT: Initial: 0x150 -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x100C -# GOT-NEXT: Access: -32740 -# GOT-NEXT: Initial: 0x155 -# GOT-NEXT: } -# GOT-NEXT: ] -# GOT-NEXT: Global entries [ -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1010 -# GOT-NEXT: Access: -32736 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: T2@ (4) -# GOT-NEXT: } -# GOT-NEXT: Entry { -# GOT-NEXT: Address: 0x1014 -# GOT-NEXT: Access: -32732 -# GOT-NEXT: Initial: 0x0 -# GOT-NEXT: Value: 0x0 -# GOT-NEXT: Type: Function (0x2) -# GOT-NEXT: Section: Undefined (0x0) -# GOT-NEXT: Name: M2@ (7) -# GOT-NEXT: } -# GOT-NEXT: ] - -# t1.so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] - -Symbols: - Global: - - Name: T2 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: M2 - Section: .text - Type: STT_FUNC - Value: 4 - Size: 4 - Other: [STO_MIPS_MICROMIPS] - -# t2.so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 40 - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_EXECINSTR] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MICROMIPS_GOT_HI16 - - Offset: 4 - Symbol: T1 - Type: R_MICROMIPS_GOT_LO16 - - Offset: 8 - Symbol: T2 - Type: R_MICROMIPS_GOT_HI16 - - Offset: 12 - Symbol: T2 - Type: R_MICROMIPS_GOT_LO16 - - Offset: 16 - Symbol: M1 - Type: R_MICROMIPS_GOT_HI16 - - Offset: 20 - Symbol: M1 - Type: R_MICROMIPS_GOT_LO16 - - Offset: 24 - Symbol: M2 - Type: R_MICROMIPS_GOT_HI16 - - Offset: 28 - Symbol: M2 - Type: R_MICROMIPS_GOT_LO16 - -Symbols: - Local: - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 32 - Size: 4 - - Name: M1 - Section: .text - Type: STT_FUNC - Value: 36 - Size: 4 - Other: [STO_MIPS_MICROMIPS] - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 32 - Other: [STO_MIPS_MICROMIPS] - - Name: T2 - - Name: M2 -... diff --git a/test/old-elf/Mips/rel-gprel16-micro-overflow.test b/test/old-elf/Mips/rel-gprel16-micro-overflow.test deleted file mode 100644 index 7b023aecba41..000000000000 --- a/test/old-elf/Mips/rel-gprel16-micro-overflow.test +++ /dev/null @@ -1,57 +0,0 @@ -# Check R_MICROMIPS_GPREL16 relocation overflow handling. -# -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: not lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o 2>&1 \ -# RUN: | FileCheck %s - -# CHECK: Relocation out of range in file {{.*}} reference from +0 to L0+0 of type 136 (R_MICROMIPS_GPREL16) -# CHECK: Relocation out of range in file {{.*}} reference from +4 to G0+0 of type 136 (R_MICROMIPS_GPREL16) - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Type: SHT_PROGBITS - Name: .text - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 8 - -- Type: SHT_PROGBITS - Name: .rodata - Flags: [ SHF_ALLOC ] - AddressAlign: 4 - Size: 8 - -- Type: SHT_REL - Name: .rel.rodata - Link: .symtab - Info: .rodata - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: L0 - Type: R_MICROMIPS_GPREL16 - - Offset: 4 - Symbol: G0 - Type: R_MICROMIPS_GPREL16 - -Symbols: - Local: - - Name: L0 - Section: .text - Value: 0 - Size: 4 - - Name: .rodata - Type: STT_SECTION - Section: .rodata - Global: - - Name: G0 - Section: .text - Value: 4 - Size: 4 diff --git a/test/old-elf/Mips/rel-gprel16-micro.test b/test/old-elf/Mips/rel-gprel16-micro.test deleted file mode 100644 index c0119a51e484..000000000000 --- a/test/old-elf/Mips/rel-gprel16-micro.test +++ /dev/null @@ -1,78 +0,0 @@ -# Check R_MICROMIPS_GPREL16 relocation handling. -# -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o -# RUN: llvm-readobj -symbols %t.so | FileCheck -check-prefix=SYM %s -# RUN: llvm-objdump -s %t.so | FileCheck -check-prefix=SEC %s - -# SYM: Name: L0 -# SYM-NEXT: Value: 0x104 -# SYM-NEXT: Size: 4 - -# SYM: Name: G0 -# SYM-NEXT: Value: 0x108 -# SYM-NEXT: Size: 4 - -# SYM: Name: _gp -# SYM-NEXT: Value: 0x8FF0 -# SYM-NEXT: Size: 0 - -# SEC: Contents of section .rodata: -# SEC-NEXT: 010c 00001071 000017f1 -# ^ 0x104 (L0) + 0x10000 (GP0) - 0x8ff0 (_gp) - 4 = 0x7110 -# ^ 0x108 (G0) - 0x8ff0 (_gp) + 0x7fff = 0xf117 - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Type: SHT_PROGBITS - Name: .text - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 8 - -- Type: SHT_PROGBITS - Name: .rodata - Flags: [ SHF_ALLOC ] - AddressAlign: 4 - Content: 0000fcff0000ff7f - -- Type: SHT_REL - Name: .rel.rodata - Link: .symtab - Info: .rodata - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: L0 - Type: R_MICROMIPS_GPREL16 - - Offset: 4 - Symbol: G0 - Type: R_MICROMIPS_GPREL16 - -- Type: SHT_MIPS_REGINFO - Name: .reginfo - Flags: [ SHF_ALLOC ] - AddressAlign: 1 - Content: 000000000000000000000000000000000000000000000100 - -Symbols: - Local: - - Name: L0 - Section: .text - Value: 0 - Size: 4 - - Name: .rodata - Type: STT_SECTION - Section: .rodata - Global: - - Name: G0 - Section: .text - Value: 4 - Size: 4 diff --git a/test/old-elf/Mips/rel-gprel16-overflow.test b/test/old-elf/Mips/rel-gprel16-overflow.test deleted file mode 100644 index 2943b5d200f4..000000000000 --- a/test/old-elf/Mips/rel-gprel16-overflow.test +++ /dev/null @@ -1,48 +0,0 @@ -# Check R_MIPS_GPREL16 relocation overflow handling. -# -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: not lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o 2>&1 \ -# RUN: | FileCheck %s - -# CHECK: Relocation out of range in file {{.*}} reference from +0 to T1+-32768 of type 7 (R_MIPS_GPREL16) - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Type: SHT_PROGBITS - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 4 - -- Type: SHT_PROGBITS - Name: .rodata - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 4 - Content: 00800000 - -- Type: SHT_REL - Name: .rel.rodata - Type: SHT_REL - Link: .symtab - Info: .rodata - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_GPREL16 - -Symbols: - Global: - - Name: T1 - Section: .text - Value: 0 - Size: 4 diff --git a/test/old-elf/Mips/rel-gprel16.test b/test/old-elf/Mips/rel-gprel16.test deleted file mode 100644 index d7e8a1a92598..000000000000 --- a/test/old-elf/Mips/rel-gprel16.test +++ /dev/null @@ -1,104 +0,0 @@ -# Check R_MIPS_GPREL16 relocation handling. -# -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target mipsel -e G1 -shared -o %t.so %t-obj -# RUN: llvm-readobj -symbols %t.so | FileCheck -check-prefix=SYM %s -# RUN: llvm-objdump -s %t.so | FileCheck -check-prefix=SEC %s - -# SYM: Name: L1 -# SYM-NEXT: Value: 0x104 -# SYM-NEXT: Size: 4 -# SYM-NEXT: Binding: Local (0x0) -# SYM-NEXT: Type: Function (0x2) -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: .text (0x5) - -# SYM: Name: G1 -# SYM-NEXT: Value: 0x108 -# SYM-NEXT: Size: 4 -# SYM-NEXT: Binding: Global (0x1) -# SYM-NEXT: Type: Function (0x2) -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: .text (0x5) - -# SYM: Name: _gp -# SYM-NEXT: Value: 0x8FF0 -# SYM-NEXT: Size: 0 -# SYM-NEXT: Binding: Global (0x1) -# SYM-NEXT: Type: Object (0x1) -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: Absolute (0xFFF1) - -# 0x6110 == 0xfffc (addend) + 0x0104 (L1) + 0xf000 (GP0) - 0x8ff0 (_gp) -# SEC: Contents of section .rodata: -# SEC-NEXT: 010c 10610008 00000000 00000000 00000000 - -!ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] -Sections: -- Type: SHT_PROGBITS - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 - -- Type: SHT_REL - Name: .rel.text - Type: SHT_REL - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0 - Symbol: .rodata - Type: R_MIPS_GOT16 - - Offset: 4 - Symbol: .rodata - Type: R_MIPS_LO16 - -- Type: SHT_PROGBITS - Name: .rodata - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x04 - Content: fcff0008000000000000000000000000 - -- Type: SHT_REL - Name: .rel.rodata - Type: SHT_REL - Link: .symtab - Info: .rodata - AddressAlign: 0x04 - Relocations: - - Offset: 0 - Symbol: L1 - Type: R_MIPS_GPREL16 - -- Type: SHT_MIPS_REGINFO - Name: .reginfo - Type: SHT_MIPS_REGINFO - Flags: [ SHF_ALLOC ] - AddressAlign: 0x01 - Content: 000000000000000000000000000000000000000000f00000 - -Symbols: - Local: - - Name: L1 - Section: .text - Value: 0x00 - Size: 0x04 - - Name: .rodata - Type: STT_SECTION - Section: .rodata - Global: - - Name: G1 - Section: .text - Value: 0x04 - Size: 0x04 diff --git a/test/old-elf/Mips/rel-gprel32-64.test b/test/old-elf/Mips/rel-gprel32-64.test deleted file mode 100644 index 15498a693e4d..000000000000 --- a/test/old-elf/Mips/rel-gprel32-64.test +++ /dev/null @@ -1,84 +0,0 @@ -# Check R_MIPS_GPREL32/R_MIPS_64 relocations handling. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips64el -e T0 -o %t.exe %t.o -# RUN: llvm-readobj -r %t.exe | FileCheck --check-prefix=REL-EXE %s -# RUN: llvm-objdump -s %t.exe | FileCheck %s -# RUN: llvm-nm %t.exe | FileCheck --check-prefix=SYM %s - -# REL-EXE: Relocations [ -# REL-EXE-NEXT: ] - -# CHECK: Contents of section .text: -# CHECK-NEXT: 1200001d0 f871ffff ffffffff f871ffff f871ffff -# CHECK-NEXT: 1200001e0 f871ffff ffffffff 00000000 00000000 - -# SYM: 00000001200001e8 t LT1 -# SYM: 0000000120001000 N _GLOBAL_OFFSET_TABLE_ - -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t.o -# RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=REL-SO %s - -# REL-SO: Relocations [ -# REL-SO-NEXT: ] - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Size: 32 - - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 8 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: LT1 - Type: R_MIPS_GPREL16 - Type2: R_MIPS_64 - Type3: R_MIPS_NONE - - Offset: 0x08 - Symbol: LT1 - Type: R_MIPS_GPREL16 - Type2: R_MIPS_64 - Type3: R_MIPS_NONE - - Offset: 0x0C - Symbol: LT1 - Type: R_MIPS_GPREL32 - Type2: R_MIPS_64 - Type3: R_MIPS_NONE - - Offset: 0x10 - Symbol: LT1 - Type: R_MIPS_GPREL32 - Type2: R_MIPS_64 - Type3: R_MIPS_NONE - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: LT1 - Type: STT_FUNC - Section: .text - Value: 0x18 - Size: 0x8 - - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Value: 0x0 - Size: 0x18 -... diff --git a/test/old-elf/Mips/rel-gprel32.test b/test/old-elf/Mips/rel-gprel32.test deleted file mode 100644 index 14ec8cebcabd..000000000000 --- a/test/old-elf/Mips/rel-gprel32.test +++ /dev/null @@ -1,84 +0,0 @@ -# Check R_MIPS_GPREL32 relocation handling. -# -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target mipsel -o %t-exe %t-obj -# RUN: llvm-readobj -symbols %t-exe | FileCheck -check-prefix=SYM %s -# RUN: llvm-objdump -s %t-exe | FileCheck -check-prefix=SEC %s - -# SYM: Name: $L1 -# SYM-NEXT: Value: 0x400160 -# SYM-NEXT: Size: 4 -# SYM-NEXT: Binding: Local (0x0) -# SYM-NEXT: Type: Function (0x2) -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: .text (0x6) -# -# SYM: Name: _gp -# SYM-NEXT: Value: 0x408FF0 -# SYM-NEXT: Size: 0 -# SYM-NEXT: Binding: Global (0x1) -# SYM-NEXT: Type: Object (0x1) -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: Absolute (0xFFF1) - -# 0x08ff7153 == 0x8000001 (addend) + 0x400140 ($L1) + -# 0x1000002 (GP0) - 0x408FF0 (_gp) -# SEC: Contents of section .rodata: -# SEC-NEXT: 400170 7371ff08 00000000 00000000 00000000 - -!ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] -Sections: -- Type: SHT_PROGBITS - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Content: 00000000000000000000000000000000 - -- Type: SHT_PROGBITS - Name: .rodata - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x04 - Content: 01000008000000000000000000000000 - -- Type: SHT_REL - Name: .rel.rodata - Type: SHT_REL - Link: .symtab - Info: .rodata - AddressAlign: 0x04 - Relocations: - - Offset: 0 - Symbol: $L1 - Type: R_MIPS_GPREL32 - -- Type: SHT_MIPS_REGINFO - Name: .reginfo - Type: SHT_MIPS_REGINFO - Flags: [ SHF_ALLOC ] - AddressAlign: 0x01 - Content: 000000000000000000000000000000000000000002000001 - -Symbols: - Local: - - Name: $L1 - Section: .text - Value: 0x00 - - Name: .rodata - Type: STT_SECTION - Section: .rodata - Global: - - Name: __start - Section: .text - Type: STT_FUNC - Value: 0x04 - Size: 12 - - Name: _gp_disp diff --git a/test/old-elf/Mips/rel-gprel7-micro-overflow.test b/test/old-elf/Mips/rel-gprel7-micro-overflow.test deleted file mode 100644 index 5609786aa04a..000000000000 --- a/test/old-elf/Mips/rel-gprel7-micro-overflow.test +++ /dev/null @@ -1,48 +0,0 @@ -# Check R_MICROMIPS_GPREL7_S2 relocation overflow handling. -# -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: not lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o 2>&1 \ -# RUN: | FileCheck %s - -# CHECK: Relocation out of range in file {{.*}} reference from +0 to L0+-4 of type 172 (R_MICROMIPS_GPREL7_S2) - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Type: SHT_PROGBITS - Name: .text - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 4 - -- Type: SHT_PROGBITS - Name: .rodata - Flags: [ SHF_ALLOC ] - AddressAlign: 4 - Content: 7f000000 - -- Type: SHT_REL - Name: .rel.rodata - Link: .symtab - Info: .rodata - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: L0 - Type: R_MICROMIPS_GPREL7_S2 - -Symbols: - Local: - - Name: L0 - Section: .text - Value: 0 - Size: 4 - - Name: .rodata - Type: STT_SECTION - Section: .rodata diff --git a/test/old-elf/Mips/rel-gprel7-micro.test b/test/old-elf/Mips/rel-gprel7-micro.test deleted file mode 100644 index b7790d9d169c..000000000000 --- a/test/old-elf/Mips/rel-gprel7-micro.test +++ /dev/null @@ -1,65 +0,0 @@ -# Check R_MICROMIPS_GPREL7_S2 relocation handling. -# -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o -# RUN: llvm-readobj -symbols %t.so | FileCheck -check-prefix=SYM %s -# RUN: llvm-objdump -s %t.so | FileCheck -check-prefix=SEC %s - -# SYM: Name: L0 -# SYM-NEXT: Value: 0xF0 -# SYM-NEXT: Size: 4 - -# SYM: Name: _gp -# SYM-NEXT: Value: 0x8FF0 -# SYM-NEXT: Size: 0 - -# SEC: Contents of section .rodata: -# SEC-NEXT: 0f4 3b000000 -# ^ 0xf0 (L0) + 0x8ff0 (GP0) - 0x8ff0 (_gp) - 4 = 0xec >> 2 - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: -- Type: SHT_PROGBITS - Name: .text - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 4 - -- Type: SHT_PROGBITS - Name: .rodata - Flags: [ SHF_ALLOC ] - AddressAlign: 4 - Content: 7f000000 - -- Type: SHT_REL - Name: .rel.rodata - Link: .symtab - Info: .rodata - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: L0 - Type: R_MICROMIPS_GPREL7_S2 - -- Type: SHT_MIPS_REGINFO - Name: .reginfo - Flags: [ SHF_ALLOC ] - AddressAlign: 1 - Content: 0000000000000000000000000000000000000000f08f0000 - -Symbols: - Local: - - Name: L0 - Section: .text - Value: 0 - Size: 4 - - Name: .rodata - Type: STT_SECTION - Section: .rodata diff --git a/test/old-elf/Mips/rel-hi0-lo16-micro.test b/test/old-elf/Mips/rel-hi0-lo16-micro.test deleted file mode 100644 index 82f62954b992..000000000000 --- a/test/old-elf/Mips/rel-hi0-lo16-micro.test +++ /dev/null @@ -1,58 +0,0 @@ -# Check handling of R_MICROMIPS_HI0_LO16 relocation. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: 400130 00000420 -# ^ 0x402000 + 0x4 = 0x402004 - -# CHECK: 00402000 g .data 00000004 D0 - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32, EF_MIPS_MICROMIPS] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Content: "00000400" - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 0 - Symbol: D0 - Type: R_MICROMIPS_HI0_LO16 - - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_WRITE ] - AddressAlign: 16 - Size: 4 - -Symbols: - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Value: 0 - Size: 4 - Other: [STO_MIPS_MICROMIPS] - - Name: D0 - Type: STT_OBJECT - Section: .data - Value: 0 - Size: 4 -... diff --git a/test/old-elf/Mips/rel-high-01.test b/test/old-elf/Mips/rel-high-01.test deleted file mode 100644 index 613fedbe31db..000000000000 --- a/test/old-elf/Mips/rel-high-01.test +++ /dev/null @@ -1,25 +0,0 @@ -# REQUIRES: mips - -# Check handling R_MIPS_HIGHER / R_MIPS_HIGHEST relocations. - -# RUN: llvm-mc -arch=mips64el -filetype=obj -o=%t.o %s -# RUN: lld -flavor old-gnu -target mips64el -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -d %t.exe | FileCheck %s - -# CHECK: Disassembly of section .text: -# CHECK-NEXT: T0: -# CHECK-NEXT: 120000250: 01 00 62 64 daddiu $2, $3, 1 -# CHECK-NEXT: 120000254: 00 00 62 64 daddiu $2, $3, 0 -# -# CHECK: T1: -# CHECK-NEXT: 120000258: 00 00 00 00 nop - - .text - .globl T0 -T0: - daddiu $2, $3, %higher(T1) - daddiu $2, $3, %highest(T1) - - .globl T1 -T1: - nop diff --git a/test/old-elf/Mips/rel-high-02.test b/test/old-elf/Mips/rel-high-02.test deleted file mode 100644 index 7a40a617a680..000000000000 --- a/test/old-elf/Mips/rel-high-02.test +++ /dev/null @@ -1,25 +0,0 @@ -# REQUIRES: mips - -# Check handling R_MICROMIPS_HIGHER / R_MICROMIPS_HIGHEST relocations. - -# RUN: llvm-mc -arch=mips64el -filetype=obj -o=%t.o %s -# RUN: lld -flavor old-gnu -target mips64el -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -d %t.exe | FileCheck %s - -# CHECK: Disassembly of section .text: -# CHECK-NEXT: T0: -# CHECK-NEXT: 120000250: 01 00 62 64 daddiu $2, $3, 1 -# CHECK-NEXT: 120000254: 00 00 62 64 daddiu $2, $3, 0 -# -# CHECK: T1: -# CHECK-NEXT: 120000258: 00 00 00 00 nop - - .text - .globl T0 -T0: - daddiu $2, $3, %higher(T1+0x0000800100000000) - daddiu $2, $3, %highest(T1+0x4001000000000000) - - .globl T1 -T1: - nop diff --git a/test/old-elf/Mips/rel-jalr-01.test b/test/old-elf/Mips/rel-jalr-01.test deleted file mode 100644 index 3c519056e1a9..000000000000 --- a/test/old-elf/Mips/rel-jalr-01.test +++ /dev/null @@ -1,101 +0,0 @@ -# REQUIRES: mips - -# Check handling of the R_MIPS_JALR relocation. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t1.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.o -# RUN: lld -flavor old-gnu -target mipsel -o %t.exe %t2.o %t.so -# RUN: llvm-objdump -d %t.exe | FileCheck %s - -# CHECK: __start: -# CHECK-NEXT: {{[0-9a-f]+}}: 05 00 11 04 bal 24 -# CHECK-NEXT: {{[0-9a-f]+}}: 00 00 00 00 nop -# CHECK-NEXT: {{[0-9a-f]+}}: 04 00 00 10 b 20 -# CHECK-NEXT: {{[0-9a-f]+}}: 00 00 00 00 nop -# CHECK-NEXT: {{[0-9a-f]+}}: 09 f8 20 03 jalr $25 -# CHECK-NEXT: {{[0-9a-f]+}}: 00 00 00 00 nop - -# t1.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Size: 4 - -Symbols: - Global: - - Name: T3 - Type: STT_FUNC - Section: .text - Value: 0 - Size: 4 - -# t2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Content: "09f8200300000000080020030000000009f82003000000000000000000000000" -# ^ jalr T1 ^ j T2 ^ jalr T3 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_JALR - - Offset: 8 - Symbol: T2 - Type: R_MIPS_JALR - - Offset: 16 - Symbol: T3 - Type: R_MIPS_JALR - - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 16 - Size: 0 - -Symbols: - Local: - - Name: T1 - Type: STT_FUNC - Section: .text - Value: 24 - Size: 4 - Global: - - Name: __start - Type: STT_FUNC - Section: .text - Value: 0 - Size: 24 - - Name: T2 - Type: STT_FUNC - Section: .text - Value: 28 - Size: 4 - - Name: T3 -... diff --git a/test/old-elf/Mips/rel-jalr-02.test b/test/old-elf/Mips/rel-jalr-02.test deleted file mode 100644 index e9c74c4c3300..000000000000 --- a/test/old-elf/Mips/rel-jalr-02.test +++ /dev/null @@ -1,68 +0,0 @@ -# REQUIRES: mips - -# Check R_MIPS_JALR relocations do not affect the code -# in case of relocatable targets. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o -# RUN: llvm-objdump -d %t.so | FileCheck %s - -# CHECK: __start: -# CHECK-NEXT: {{[0-9a-f]+}}: 09 f8 20 03 jalr $25 -# CHECK-NEXT: {{[0-9a-f]+}}: 00 00 00 00 nop -# CHECK-NEXT: {{[0-9a-f]+}}: 08 00 20 03 jr $25 -# CHECK-NEXT: {{[0-9a-f]+}}: 00 00 00 00 nop - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Content: "09f820030000000008002003000000000000000000000000" -# ^ jalr ^ jr ^ T1 ^ T2 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_JALR - - Offset: 8 - Symbol: T2 - Type: R_MIPS_JALR - - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 16 - Size: 0 - -Symbols: - Global: - - Name: __start - Type: STT_FUNC - Section: .text - Value: 0 - Size: 16 - - Name: T1 - Type: STT_FUNC - Section: .text - Value: 16 - Size: 4 - - Name: T2 - Type: STT_FUNC - Section: .text - Value: 20 - Size: 4 -... diff --git a/test/old-elf/Mips/rel-lit-micro.test b/test/old-elf/Mips/rel-lit-micro.test deleted file mode 100644 index 783b24f83813..000000000000 --- a/test/old-elf/Mips/rel-lit-micro.test +++ /dev/null @@ -1,59 +0,0 @@ -# Check handling of R_MICROMIPS_LITERAL relocation. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: 400130 00000f10 -# ^ 0x402000 + 0x7fff - 0x408ff0 = 0x100f - -# CHECK: 00402000 g .data 00000004 D0 -# CHECK: 00408ff0 g *ABS* 00000000 _gp_disp - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, - EF_MIPS_ARCH_32, EF_MIPS_MICROMIPS] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Content: "0000ff7f" - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 0 - Symbol: D0 - Type: R_MICROMIPS_LITERAL - - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_WRITE ] - AddressAlign: 16 - Size: 4 - -Symbols: - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Value: 0 - Size: 4 - Other: [STO_MIPS_MICROMIPS] - - Name: D0 - Type: STT_OBJECT - Section: .data - Value: 0 - Size: 4 -... diff --git a/test/old-elf/Mips/rel-lit.test b/test/old-elf/Mips/rel-lit.test deleted file mode 100644 index 19aa68721691..000000000000 --- a/test/old-elf/Mips/rel-lit.test +++ /dev/null @@ -1,57 +0,0 @@ -# Check handling of R_MIPS_LITERAL relocation. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: 400130 0f100000 -# ^ 0x402000 + 0x7fff - 0x408ff0 = 0x100f - -# CHECK: 00402000 g .data 00000004 D0 -# CHECK: 00408ff0 g *ABS* 00000000 _gp_disp - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Content: "ff7f0000" - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 0 - Symbol: D0 - Type: R_MIPS_LITERAL - - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_WRITE ] - AddressAlign: 16 - Size: 4 - -Symbols: - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Value: 0 - Size: 4 - - Name: D0 - Type: STT_OBJECT - Section: .data - Value: 0 - Size: 4 -... diff --git a/test/old-elf/Mips/rel-pc-hilo.test b/test/old-elf/Mips/rel-pc-hilo.test deleted file mode 100644 index 6791926762b2..000000000000 --- a/test/old-elf/Mips/rel-pc-hilo.test +++ /dev/null @@ -1,70 +0,0 @@ -# Check handling of R_MIPS_PCHI16 / R_MIPS_PCLO16 relocations. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: {{[0-9A-F]+}} 01000000 02000000 03000000 00000000 -# ^ -# A = 0x10000 - 1 == 0xffff -# V = (T1 + 0xffff - T0) >> 16 => -# V => 0x1000b >> 16 = 1 -# ^ -# A = 0x20000 - 1 == 0x1ffff -# V = (T1 + 0x1ffff - T0 - 4) >> 16 => -# V => 0x20007 >> 16 = 2 -# ^ -# A = 0xffff == -1 -# V = T1 - 1 - T0 - 8 = 3 - -# CHECK: SYMBOL TABLE: -# CHECK: {{[0-9a-f]+}} g F .text 0000000c T0 -# CHECK: {{[0-9a-f]+}} g F .text 00000004 T1 - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "0100000002000000ffff000000000000" -# ^ T0 -# ^ A := 0x1 == 0x10000 -# ^ A := 0x2 == 0x20000 -# ^ A := 0xffff == -1 -# ^ T1 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_PCHI16 - - Offset: 4 - Symbol: T1 - Type: R_MIPS_PCHI16 - - Offset: 8 - Symbol: T1 - Type: R_MIPS_PCLO16 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 12 - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 12 - Size: 4 diff --git a/test/old-elf/Mips/rel-pc16-align.test b/test/old-elf/Mips/rel-pc16-align.test deleted file mode 100644 index 6366a4d67e92..000000000000 --- a/test/old-elf/Mips/rel-pc16-align.test +++ /dev/null @@ -1,43 +0,0 @@ -# Check incorrect alignment handling for R_MIPS_PC16 relocation. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: not lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o 2>&1 \ -# RUN: | FileCheck %s - -# CHECK: Relocation not aligned in file {{.*}} reference from T0+0 to T1+0 of type 10 (R_MIPS_PC16) - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_PC16 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 8 - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 6 - Size: 2 diff --git a/test/old-elf/Mips/rel-pc16-overflow.test b/test/old-elf/Mips/rel-pc16-overflow.test deleted file mode 100644 index 910482ee6154..000000000000 --- a/test/old-elf/Mips/rel-pc16-overflow.test +++ /dev/null @@ -1,45 +0,0 @@ -# Check R_MIPS_PC16 relocation overflow handling. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: not lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o 2>&1 \ -# RUN: | FileCheck %s - -# CHECK: Relocation out of range in file {{.*}} reference from T0+0 to T1+131068 of type 10 (R_MIPS_PC16) - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "ff7f00000000000000000000" -# ^ T1 -# ^ T0 A := 0x7fff << 2 = 0x1fffc - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_PC16 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 8 - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 8 - Size: 4 diff --git a/test/old-elf/Mips/rel-pc16.test b/test/old-elf/Mips/rel-pc16.test deleted file mode 100644 index f298afd81cd6..000000000000 --- a/test/old-elf/Mips/rel-pc16.test +++ /dev/null @@ -1,53 +0,0 @@ -# Check handling of R_MIPS_PC16 relocation. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: {{[0-9A-F]+}} feff0000 00000000 00000000 -# ^ V -# A = -16 => -# V = (T1 - 16 - T0) >> 2 = -2 - -# CHECK: SYMBOL TABLE: -# CHECK: {{[0-9A-F]+}} g F .text 00000008 T0 -# CHECK: {{[0-9A-F]+}} g F .text 00000004 T1 - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "fcff00000000000000000000" -# ^ T1 -# ^ T0 A := 0xfffc << 2 = -16 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_PC16 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 8 - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 8 - Size: 4 diff --git a/test/old-elf/Mips/rel-pc18-s3-align.test b/test/old-elf/Mips/rel-pc18-s3-align.test deleted file mode 100644 index ca2fa18ecaa0..000000000000 --- a/test/old-elf/Mips/rel-pc18-s3-align.test +++ /dev/null @@ -1,44 +0,0 @@ -# Check incorrect alignment handling for R_MIPS_PC18_S3 relocation target. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: not lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o 2>&1 \ -# RUN: | FileCheck %s - -# CHECK: Relocation not aligned in file {{.*}} reference from T1+0 to T1+0 of type 62 (R_MIPS_PC18_S3) - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "0000000000000000" -# ^ T0 ^ T1 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 4 - Symbol: T1 - Type: R_MIPS_PC18_S3 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 4 - Size: 4 diff --git a/test/old-elf/Mips/rel-pc18-s3-micro.test b/test/old-elf/Mips/rel-pc18-s3-micro.test deleted file mode 100644 index fc143a75e569..000000000000 --- a/test/old-elf/Mips/rel-pc18-s3-micro.test +++ /dev/null @@ -1,56 +0,0 @@ -# Check handling of R_MICROMIPS_PC18_S3 relocation. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: {{[0-9A-F]+}} 00000000 00000100 00000000 00000000 -# ^ V -# A = -1 << 3 = -8 => -# V = (T1 - 8 - (T0|7)^7) >> 3 => -# V => 8 >> 3 = 1 (shuffled) - -# CHECK: SYMBOL TABLE: -# CHECK: {{[0-9A-F]+}} g F .text 00000010 T0 -# CHECK: {{[0-9A-F]+}} g F .text 00000004 T1 - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "000000000300ffff000000000000000000000000" -# ^ T1 -# ^ T0 ^ A := 0x3ffff == -1 (shuffled) - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 4 - Symbol: T1 - Type: R_MICROMIPS_PC18_S3 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 16 - Other: [STO_MIPS_MICROMIPS] - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 16 - Size: 4 - Other: [STO_MIPS_MICROMIPS] diff --git a/test/old-elf/Mips/rel-pc18-s3.test b/test/old-elf/Mips/rel-pc18-s3.test deleted file mode 100644 index d61427448d53..000000000000 --- a/test/old-elf/Mips/rel-pc18-s3.test +++ /dev/null @@ -1,54 +0,0 @@ -# Check handling of R_MIPS_PC18_S3 relocation. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: {{[0-9A-F]+}} 00000000 01000000 00000000 00000000 -# ^ V -# A = -1 << 3 = -8 => -# V = (T1 - 8 - (T0|7)^7) >> 3 => -# V => 8 >> 3 = 1 - -# CHECK: SYMBOL TABLE: -# CHECK: {{[0-9A-F]+}} g F .text 00000010 T0 -# CHECK: {{[0-9A-F]+}} g F .text 00000004 T1 - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000000ffff0300000000000000000000000000" -# ^ T1 -# ^ T0 ^ A := 0x3ffff == -1 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 4 - Symbol: T1 - Type: R_MIPS_PC18_S3 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 16 - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 16 - Size: 4 diff --git a/test/old-elf/Mips/rel-pc19-s2-align.test b/test/old-elf/Mips/rel-pc19-s2-align.test deleted file mode 100644 index 19010a445578..000000000000 --- a/test/old-elf/Mips/rel-pc19-s2-align.test +++ /dev/null @@ -1,44 +0,0 @@ -# Check incorrect alignment handling for R_MIPS_PC19_S2 relocation target. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: not lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o 2>&1 \ -# RUN: | FileCheck %s - -# CHECK: Relocation not aligned in file {{.*}} reference from T0+0 to T1+0 of type 63 (R_MIPS_PC19_S2) - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "0000000000000000" -# ^ T0 ^ T1 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_PC19_S2 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 6 - Size: 2 diff --git a/test/old-elf/Mips/rel-pc19-s2-micro.test b/test/old-elf/Mips/rel-pc19-s2-micro.test deleted file mode 100644 index d9a930e41d88..000000000000 --- a/test/old-elf/Mips/rel-pc19-s2-micro.test +++ /dev/null @@ -1,56 +0,0 @@ -# Check handling of R_MICROMIPS_PC19_S2 relocation. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: {{[0-9A-F]+}} 00000100 00000000 00000000 -# ^ V -# A = -1 << 2 = -4 => -# V = (T1 - 4 - T0) >> 2 => -# V => 4 >> 2 = 1 (shuffled) - -# CHECK: SYMBOL TABLE: -# CHECK: {{[0-9A-F]+}} g F .text 00000008 T0 -# CHECK: {{[0-9A-F]+}} g F .text 00000004 T1 - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "0700ffff0000000000000000" -# ^ T1 -# ^ T0 A := 0x7ffff == -1 (shuffled) - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MICROMIPS_PC19_S2 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 8 - Other: [STO_MIPS_MICROMIPS] - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 8 - Size: 4 - Other: [STO_MIPS_MICROMIPS] diff --git a/test/old-elf/Mips/rel-pc19-s2.test b/test/old-elf/Mips/rel-pc19-s2.test deleted file mode 100644 index da21864a1214..000000000000 --- a/test/old-elf/Mips/rel-pc19-s2.test +++ /dev/null @@ -1,54 +0,0 @@ -# Check handling of R_MIPS_PC19_S2 relocation. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: {{[0-9A-F]+}} 01000000 00000000 00000000 -# ^ V -# A = -1 << 2 = -4 => -# V = (T1 - 4 - T0) >> 2 => -# V => 4 >> 2 = 1 - -# CHECK: SYMBOL TABLE: -# CHECK: {{[0-9A-F]+}} g F .text 00000008 T0 -# CHECK: {{[0-9A-F]+}} g F .text 00000004 T1 - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "ffff07000000000000000000" -# ^ T1 -# ^ T0 A := 0x7ffff == -1 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_PC19_S2 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 8 - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 8 - Size: 4 diff --git a/test/old-elf/Mips/rel-pc21-s2-align.test b/test/old-elf/Mips/rel-pc21-s2-align.test deleted file mode 100644 index a79e1e2a46e0..000000000000 --- a/test/old-elf/Mips/rel-pc21-s2-align.test +++ /dev/null @@ -1,44 +0,0 @@ -# Check incorrect alignment handling for R_MIPS_PC21_S2 relocation target. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: not lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o 2>&1 \ -# RUN: | FileCheck %s - -# CHECK: Relocation not aligned in file {{.*}} reference from T0+0 to T1+0 of type 60 (R_MIPS_PC21_S2) - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "0000000000000000" -# ^ T0 ^ T1 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_PC21_S2 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 6 - Size: 2 diff --git a/test/old-elf/Mips/rel-pc21-s2-micro.test b/test/old-elf/Mips/rel-pc21-s2-micro.test deleted file mode 100644 index 4aa0a7de9489..000000000000 --- a/test/old-elf/Mips/rel-pc21-s2-micro.test +++ /dev/null @@ -1,56 +0,0 @@ -# Check handling of R_MICROMIPS_PC21_S2 relocation. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: {{[0-9A-F]+}} 00000100 00000000 00000000 -# ^ V -# A = -1 << 2 = -4 => -# V = (T1 - 4 - T0) >> 2 => -# V => 4 >> 2 = 1 (shuffled) - -# CHECK: SYMBOL TABLE: -# CHECK: {{[0-9A-F]+}} g F .text 00000008 T0 -# CHECK: {{[0-9A-F]+}} g F .text 00000004 T1 - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "1f00ffff0000000000000000" -# ^ T1 -# ^ T0 A := 0x1fffff (shuffled) - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MICROMIPS_PC21_S2 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 8 - Other: [STO_MIPS_MICROMIPS] - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 8 - Size: 4 - Other: [STO_MIPS_MICROMIPS] diff --git a/test/old-elf/Mips/rel-pc21-s2-overflow.test b/test/old-elf/Mips/rel-pc21-s2-overflow.test deleted file mode 100644 index ad88e0c14b44..000000000000 --- a/test/old-elf/Mips/rel-pc21-s2-overflow.test +++ /dev/null @@ -1,45 +0,0 @@ -# Check R_MIPS_PC21_S2 relocation overflow handling. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: not lld -flavor old-gnu -target mipsel -shared -o %t.exe %t.o 2>&1 \ -# RUN: | FileCheck %s - -# CHECK: Relocation out of range in file {{.*}} reference from T0+0 to T1+4194300 of type 60 (R_MIPS_PC21_S2) - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "ffff0f000000000000000000" -# ^ T1 -# ^ T0 A := 0xfffff - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_PC21_S2 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 8 - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 8 - Size: 4 diff --git a/test/old-elf/Mips/rel-pc21-s2.test b/test/old-elf/Mips/rel-pc21-s2.test deleted file mode 100644 index c2b58c859af9..000000000000 --- a/test/old-elf/Mips/rel-pc21-s2.test +++ /dev/null @@ -1,54 +0,0 @@ -# Check handling of R_MIPS_PC21_S2 relocation. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: {{[0-9A-F]+}} 01000000 00000000 00000000 -# ^ V -# A = -1 << 2 = -4 => -# V = (T1 - 4 - T0) >> 2 => -# V => 4 >> 2 = 1 - -# CHECK: SYMBOL TABLE: -# CHECK: {{[0-9A-F]+}} g F .text 00000008 T0 -# CHECK: {{[0-9A-F]+}} g F .text 00000004 T1 - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "ffff1f000000000000000000" -# ^ T1 -# ^ T0 A := 0x1fffff - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_PC21_S2 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 8 - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 8 - Size: 4 diff --git a/test/old-elf/Mips/rel-pc26-s2-align.test b/test/old-elf/Mips/rel-pc26-s2-align.test deleted file mode 100644 index 23e660848365..000000000000 --- a/test/old-elf/Mips/rel-pc26-s2-align.test +++ /dev/null @@ -1,44 +0,0 @@ -# Check incorrect alignment handling for R_MIPS_PC26_S2 relocation target. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: not lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o 2>&1 \ -# RUN: | FileCheck %s - -# CHECK: Relocation not aligned in file {{.*}} reference from T0+0 to T1+0 of type 61 (R_MIPS_PC26_S2) - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "0000000000000000" -# ^ T0 ^ T1 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_PC26_S2 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 4 - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 6 - Size: 2 diff --git a/test/old-elf/Mips/rel-pc26-s2-micro.test b/test/old-elf/Mips/rel-pc26-s2-micro.test deleted file mode 100644 index 193c328be687..000000000000 --- a/test/old-elf/Mips/rel-pc26-s2-micro.test +++ /dev/null @@ -1,56 +0,0 @@ -# Check handling of R_MICROMIPS_PC26_S2 relocation. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: {{[0-9A-F]+}} 00000100 00000000 00000000 -# ^ V -# A = -1 << 2 = -4 => -# V = (T1 - 4 - T0) >> 2 => -# V => 4 >> 2 = 1 (shuffled) - -# CHECK: SYMBOL TABLE: -# CHECK: {{[0-9A-F]+}} g F .text 00000008 T0 -# CHECK: {{[0-9A-F]+}} g F .text 00000004 T1 - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "ff03ffff0000000000000000" -# ^ T1 -# ^ T0 A := 0x3ffffff == -1 (shuffled) - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MICROMIPS_PC26_S2 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 8 - Other: [STO_MIPS_MICROMIPS] - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 8 - Size: 4 - Other: [STO_MIPS_MICROMIPS] diff --git a/test/old-elf/Mips/rel-pc26-s2.test b/test/old-elf/Mips/rel-pc26-s2.test deleted file mode 100644 index c500f00cb860..000000000000 --- a/test/old-elf/Mips/rel-pc26-s2.test +++ /dev/null @@ -1,54 +0,0 @@ -# Check handling of R_MIPS_PC26_S2 relocation. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: {{[0-9A-F]+}} 01000000 00000000 00000000 -# ^ V -# A = -1 << 2 = -4 => -# V = (T1 - 4 - T0) >> 2 => -# V => 4 >> 2 = 1 - -# CHECK: SYMBOL TABLE: -# CHECK: {{[0-9A-F]+}} g F .text 00000008 T0 -# CHECK: {{[0-9A-F]+}} g F .text 00000004 T1 - -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "ffffff030000000000000000" -# ^ T1 -# ^ T0 A := 0x3ffffff == -1 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_PC26_S2 - -Symbols: - Global: - - Name: T0 - Section: .text - Type: STT_FUNC - Value: 0 - Size: 8 - - Name: T1 - Section: .text - Type: STT_FUNC - Value: 8 - Size: 4 diff --git a/test/old-elf/Mips/rel-pc32.test b/test/old-elf/Mips/rel-pc32.test deleted file mode 100644 index 9faa32efec7b..000000000000 --- a/test/old-elf/Mips/rel-pc32.test +++ /dev/null @@ -1,59 +0,0 @@ -# Check handling of R_MIPS_PC32 relocation. -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target mipsel -o %t-exe %t-obj -# RUN: llvm-objdump -s -t %t-exe | FileCheck %s - -# CHECK: Contents of section .data: -# CHECK-NEXT: {{[0-9A-F]+}} 00000000 05000080 fdffff7f -# ^^ data2 + 0x80000001 - data1 -# ^^ data1 + 0x80000001 - data2 -# CHECK: SYMBOL TABLE: -# CHECK: {{[0-9A-F]+}} g .data 00000004 data1 -# CHECK: {{[0-9A-F]+}} g .data 00000004 data2 - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "00000000" - AddressAlign: 16 - Flags: [SHF_ALLOC] -- Name: .data - Type: SHT_PROGBITS - Content: "000000000100008001000080" - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rel.data - Type: SHT_REL - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x4 - Symbol: data2 - Type: R_MIPS_PC32 - - Offset: 0x8 - Symbol: data1 - Type: R_MIPS_PC32 - -Symbols: - Global: - - Name: __start - Section: .text - Value: 0x0 - Size: 4 - - Name: data1 - Section: .data - Value: 0x4 - Size: 4 - - Name: data2 - Section: .data - Value: 0x8 - Size: 4 diff --git a/test/old-elf/Mips/rel-pc7-10-16-23.test b/test/old-elf/Mips/rel-pc7-10-16-23.test deleted file mode 100644 index 51c4c3a670f1..000000000000 --- a/test/old-elf/Mips/rel-pc7-10-16-23.test +++ /dev/null @@ -1,86 +0,0 @@ -# Check handling of R_MICROMIPS_PC7_S1, R_MICROMIPS_PC10_S1, -# R_MICROMIPS_PC16_S1, and R_MICROMIPS_PC23_S2 relocations. - -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target mipsel -o %t-exe %t-obj -# RUN: llvm-objdump -s -t %t-exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: {{[0-9A-F]+}} 00000000 80780500 a240fcff 000c03cc -# ^^ addiu s1,$pc,20 -# ^^ bnezc v0,400114 <__start+0x4> -# ^^ b 400126 -# CHECK-NEXT: {{[0-9A-F]+}} 000c03ad 00000000 00000000 00000000 -# ^^ bnez v0,40012a -# CHECK: SYMBOL TABLE: -# CHECK: {{[0-9a-f]+}} l F .text 00000002 L0 -# CHECK: {{[0-9a-f]+}} l F .text 00000004 L1 -# CHECK: {{[0-9a-f]+}} l F .text 00000004 L2 -# CHECK: {{[0-9a-f]+}} l F .text 00000002 L3 -# CHECK: {{[0-9a-f]+}} g F .text 00000014 __start - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, - EF_MIPS_MICROMIPS ] - -Sections: -- Name: .text - Type: SHT_PROGBITS -# v nop v nop v L0 - Content: "0000000080780100a240f5ff000cfdcf000c7dad000000000000000000000000" -# ^ PC23 ^ PC16 ^ PC10 ^ PC7 ^ L1 ^ L2 ^ L3 -# 7d << 1 = -6 => L3 + 2 - 6 = L2 -# 3fd << 1 = -6 => L2 + 2 - 6 = L1 -# fff5 << 1 = -22 => L1 + 2 - 22 = __start -# 1 << 2 = 4 => L0 + 4 - 4 = L0 - AddressAlign: 16 - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - -- Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 4 - Symbol: L0 - Type: R_MICROMIPS_PC23_S2 - - Offset: 8 - Symbol: L1 - Type: R_MICROMIPS_PC16_S1 - - Offset: 14 - Symbol: L2 - Type: R_MICROMIPS_PC10_S1 - - Offset: 18 - Symbol: L3 - Type: R_MICROMIPS_PC7_S1 - -Symbols: - Local: - - Name: L0 - Section: .text - Value: 20 - Other: [ STO_MIPS_MICROMIPS ] - - Name: L1 - Section: .text - Value: 22 - Other: [ STO_MIPS_MICROMIPS ] - - Name: L2 - Section: .text - Value: 26 - Other: [ STO_MIPS_MICROMIPS ] - - Name: L3 - Section: .text - Value: 30 - Other: [ STO_MIPS_MICROMIPS ] - Global: - - Name: __start - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 32 - Other: [ STO_MIPS_MICROMIPS ] diff --git a/test/old-elf/Mips/rel-sub-micro.test b/test/old-elf/Mips/rel-sub-micro.test deleted file mode 100644 index 831a020ce2f9..000000000000 --- a/test/old-elf/Mips/rel-sub-micro.test +++ /dev/null @@ -1,62 +0,0 @@ -# Check handling of R_MICROMIPS_SUB relocation. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips64el -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .data: -# CHECK-NEXT: 120002000 0020cc01 01000000 0020d001 0100ffff -# ^^ __start - 4 = 0x1200001cc -# ^^ __start - 0x1000000000000 -# = 0xffff0001200001d0 -# CHECK: SYMBOL TABLE: -# CHECK: 00000001200001d0 g .rodata 00000008 __start - -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64, EF_MIPS_MICROMIPS] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 8 - AddressAlign: 16 - Flags: [SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Size: 16 - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rela.data - Type: SHT_RELA - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: __start - Type: R_MICROMIPS_SUB - Addend: 4 - - Offset: 8 - Symbol: __start - Type: R_MICROMIPS_SUB - Addend: 0x1000000000000 - -Symbols: - Global: - - Name: __start - Section: .text - Value: 0 - Size: 8 - - Name: D1 - Section: .data - Value: 0 - Size: 8 - - Name: D2 - Section: .data - Value: 8 - Size: 8 diff --git a/test/old-elf/Mips/rel-sub.test b/test/old-elf/Mips/rel-sub.test deleted file mode 100644 index 5100406fd5d5..000000000000 --- a/test/old-elf/Mips/rel-sub.test +++ /dev/null @@ -1,61 +0,0 @@ -# Check handling of R_MIPS_SUB relocation. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips64el -o %t.exe %t.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .data: -# CHECK-NEXT: 120002000 cf010020 01000000 d0010020 0100ffff ... ....... .... -# ^^ __start - 1 = 0x1200001cf -# ^^ __start - 0x1000000000000 -# = 0Xffff0001200001d0 -# CHECK: SYMBOL TABLE: -# CHECK: 00000001200001d0 g .rodata 00000008 __start - -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Size: 0x08 - AddressAlign: 16 - Flags: [SHF_ALLOC] -- Name: .data - Type: SHT_PROGBITS - Size: 0x10 - AddressAlign: 16 - Flags: [SHF_ALLOC, SHF_WRITE] - -- Name: .rela.data - Type: SHT_RELA - Info: .data - AddressAlign: 4 - Relocations: - - Offset: 0x0 - Symbol: __start - Type: R_MIPS_SUB - Addend: 1 - - Offset: 0x8 - Symbol: __start - Type: R_MIPS_SUB - Addend: 0x1000000000000 - -Symbols: - Global: - - Name: __start - Section: .text - Value: 0x0 - Size: 8 - - Name: data1 - Section: .data - Value: 0x0 - Size: 8 - - Name: data2 - Section: .data - Value: 0x8 - Size: 8 diff --git a/test/old-elf/Mips/rld_map.test b/test/old-elf/Mips/rld_map.test deleted file mode 100644 index ee063be1d7fc..000000000000 --- a/test/old-elf/Mips/rld_map.test +++ /dev/null @@ -1,42 +0,0 @@ -# REQUIRES: mips - -# Check definition of DT_MIPS_RLD_MAP and DT_MIPS_RLD_MAP_REL dynamic tags, -# .rld_map section, and __RLD_MAP symbol. - -# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o -# RUN: lld -flavor old-gnu -target mips %t.o -o %t.exe -# RUN: llvm-readobj -dynamic-table -s -st %t.exe \ -# RUN: | FileCheck -check-prefix=EXE-DYN %s - -# EXE-DYN: Name: .rld_map -# EXE-DYN-NEXT: Type: SHT_PROGBITS -# EXE-DYN-NEXT: Flags [ -# EXE-DYN-NEXT: SHF_ALLOC -# EXE-DYN-NEXT: SHF_WRITE -# EXE-DYN-NEXT: ] -# EXE-DYN-NEXT: Address: 0x[[ADDR:[0-9A-F]+]] -# EXE-DYN: Size: 4 -# EXE-DYN: AddressAlignment: 4 -# EXE-DYN: Symbols [ -# EXE-DYN-NEXT: Symbol { -# EXE-DYN-NEXT: Name: __RLD_MAP -# EXE-DYN-NEXT: Value: 0x[[ADDR]] -# EXE-DYN-NEXT: Size: 4 -# EXE-DYN-NEXT: Binding: Global -# EXE-DYN-NEXT: Type: Object -# -# EXE-DYN: 0x70000016 MIPS_RLD_MAP 0x[[ADDR]] -# EXE-DYN: 0x70000035 MIPS_RLD_MAP_REL 0x1E48 - -# RUN: lld -flavor old-gnu -target mips -static %t.o -o %t.exe -# RUN: llvm-nm -just-symbol-name %t.exe | FileCheck -check-prefix=EXE-STATIC %s - -# EXE-STATIC-NOT: __RLD_MAP - -# RUN: lld -flavor old-gnu -target mips -shared %t.o -o %t.so -# RUN: llvm-nm -just-symbol-name %t.so | FileCheck -check-prefix=DYNLIB %s - -# DYNLIB-NOT: __RLD_MAP - - .globl __start; -__start: diff --git a/test/old-elf/Mips/sign-rela.test b/test/old-elf/Mips/sign-rela.test deleted file mode 100644 index 3e5341f2c230..000000000000 --- a/test/old-elf/Mips/sign-rela.test +++ /dev/null @@ -1,54 +0,0 @@ -# Check that relocation addend read from RELA record is not sign-extended. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target mips64el -o %t.exe %t.o -# RUN: llvm-objdump -s %t.exe | FileCheck %s - -# CHECK: {{[0-9a-f]+}} 01000000 00000000 ........ - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Size: 0x20008 - - - Name: .rel.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 0x20000 - Symbol: __start - Type: R_MIPS_PC16 - Addend: 0x20000 - - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 16 - Size: 0 - -Symbols: - Local: - - Name: T0 - Type: STT_FUNC - Section: .text - Value: 0 - Size: 4 - Global: - - Name: __start - Type: STT_FUNC - Section: .text - Value: 4 - Size: 0x20004 -... diff --git a/test/old-elf/Mips/st-other.test b/test/old-elf/Mips/st-other.test deleted file mode 100644 index 2bb1f8b96e07..000000000000 --- a/test/old-elf/Mips/st-other.test +++ /dev/null @@ -1,90 +0,0 @@ -# Check STO_MICROMIPS flag handling. microMIPS symbol records in a dynamic -# symbol table should not have STO_MICROMIPS flag but their value field -# must be odd. microMIPS symbol records in a regular symbol table should -# have the STO_MICROMIPS flag. - -# RUN: yaml2obj -format=elf %s > %t-micro.o - -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-micro.o -# RUN: llvm-readobj -dyn-symbols %t.so | FileCheck -check-prefix=SO %s - -# RUN: lld -flavor old-gnu -target mipsel -e S0 -o %t.exe %t-micro.o -# RUN: llvm-readobj -symbols %t.exe | FileCheck -check-prefix=EXE-SYM %s -# RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck -check-prefix=EXE-DSYM %s - -# SO: Symbol { -# SO: Name: S0@ (1) -# SO-NEXT: Value: 0x{{[0-9A-F]+}} -# SO-NEXT: Size: 4 -# SO-NEXT: Binding: Global (0x1) -# SO-NEXT: Type: Function (0x2) -# SO-NEXT: Other: 0 -# SO-NEXT: Section: .text (0x4) -# SO-NEXT: } - -# SO: Symbol { -# SO: Name: S1@ (4) -# SO-NEXT: Value: 0x{{[0-9A-F]+}} -# SO-NEXT: Size: 4 -# SO-NEXT: Binding: Global (0x1) -# SO-NEXT: Type: Function (0x2) -# SO-NEXT: Other: 0 -# SO-NEXT: Section: .text (0x4) -# SO-NEXT: } - -# EXE-SYM: Symbol { -# EXE-SYM: Name: S0 (1) -# EXE-SYM-NEXT: Value: 0x{{[0-9A-F]+}} -# EXE-SYM-NEXT: Size: 4 -# EXE-SYM-NEXT: Binding: Global (0x1) -# EXE-SYM-NEXT: Type: Function (0x2) -# EXE-SYM-NEXT: Other: 0 -# EXE-SYM-NEXT: Section: .text (0x5) -# EXE-SYM-NEXT: } - -# EXE-SYM: Symbol { -# EXE-SYM: Name: S1 (4) -# EXE-SYM-NEXT: Value: 0x{{[0-9A-F]+}} -# EXE-SYM-NEXT: Size: 4 -# EXE-SYM-NEXT: Binding: Global (0x1) -# EXE-SYM-NEXT: Type: Function (0x2) -# EXE-SYM-NEXT: Other: 128 -# EXE-SYM-NEXT: Section: .text (0x5) -# EXE-SYM-NEXT: } - -# EXE-DSYM-NOT: Name: S1 (4) - -# micro.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 - -Symbols: - Global: - - Name: S0 - Type: STT_FUNC - Section: .text - Size: 0x04 - Value: 0x00 - Visibility: STV_DEFAULT - Other: [ ] - - - Name: S1 - Type: STT_FUNC - Section: .text - Size: 0x04 - Value: 0x04 - Visibility: STV_DEFAULT - Other: [ STO_MIPS_MICROMIPS ] -... diff --git a/test/old-elf/Mips/static-01.test b/test/old-elf/Mips/static-01.test deleted file mode 100644 index 77a33469df3f..000000000000 --- a/test/old-elf/Mips/static-01.test +++ /dev/null @@ -1,119 +0,0 @@ -# Check handling relocations against _gp/__gnu_local_gp symbols -# in case of "-static" linking. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.o -# RUN: lld -flavor old-gnu -target mipsel -e T0 -static -o %t.exe %t1.o %t2.o -# RUN: llvm-nm %t.exe | FileCheck %s - -# CHECK: 00401000 N _GLOBAL_OFFSET_TABLE_ -# CHECK: 00408ff0 A __gnu_local_gp -# CHECK: 00408ff0 A _gp -# CHECK: 00408ff0 A _gp_disp - -# o1.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Size: 28 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 0 - Symbol: .data - Type: R_MIPS_HI16 - - Offset: 4 - Symbol: .data - Type: R_MIPS_LO16 - - Offset: 8 - Symbol: T1 - Type: R_MIPS_26 - - Offset: 12 - Symbol: _gp - Type: R_MIPS_HI16 - - Offset: 16 - Symbol: _gp - Type: R_MIPS_LO16 - - Offset: 20 - Symbol: __gnu_local_gp - Type: R_MIPS_HI16 - - Offset: 24 - Symbol: __gnu_local_gp - Type: R_MIPS_LO16 - - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 16 - Size: 4 - - - Name: .pdr - Type: SHT_PROGBITS - AddressAlign: 4 - Size: 4 - - - Name: .rel.pdr - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .pdr - Relocations: - - Offset: 0 - Symbol: T0 - Type: R_MIPS_32 - -Symbols: - Local: - - Type: STT_SECTION - Section: .text - - Type: STT_SECTION - Section: .data - - Type: STT_SECTION - Section: .pdr - - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 28 - - Name: T1 - - Name: _gp - - Name: __gnu_local_gp - -# o2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Size: 4 - -Symbols: - Global: - - Name: T1 - Type: STT_FUNC - Section: .text - Size: 20 -... diff --git a/test/old-elf/Mips/tls-1-micro.test b/test/old-elf/Mips/tls-1-micro.test deleted file mode 100644 index f47592a5ab7d..000000000000 --- a/test/old-elf/Mips/tls-1-micro.test +++ /dev/null @@ -1,65 +0,0 @@ -# Check handling of R_MICROMIPS_TLS_TPREL_HI16 / R_MICROMIPS_TLS_TPREL_LO16 -# relocations. - -# RUN: yaml2obj -format=elf -o %t.o %s -# RUN: lld -flavor old-gnu -target mipsel -e L0 -o %t.exe %t.o -# RUN: llvm-objdump -s %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK: {{[0-9A-F]+}} 00000000 00000100 00000380 00000480 - -!ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Content: '00000100000002000000030000000400' - - Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0x00 - Symbol: L1 - Type: R_MICROMIPS_TLS_TPREL_HI16 - - Offset: 0x04 - Symbol: L2 - Type: R_MICROMIPS_TLS_TPREL_HI16 - - Offset: 0x08 - Symbol: L2 - Type: R_MICROMIPS_TLS_TPREL_LO16 - - Offset: 0x0C - Symbol: L1 - Type: R_MICROMIPS_TLS_TPREL_LO16 - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x04 - Address: 0x1000 - Size: 0x20000 - -Symbols: - Global: - - Name: L0 - Type: STT_FUNC - Section: .text - Size: 0x58 - Other: [ STO_MIPS_MICROMIPS ] - - Name: L1 - Type: STT_TLS - Section: .tdata - Value: 0x00 - Size: 0x04 - - Name: L2 - Type: STT_TLS - Section: .tdata - Value: 0x10000 - Size: 0x04 diff --git a/test/old-elf/Mips/tls-1.test b/test/old-elf/Mips/tls-1.test deleted file mode 100644 index c25a06c1dee9..000000000000 --- a/test/old-elf/Mips/tls-1.test +++ /dev/null @@ -1,63 +0,0 @@ -# Check handling of R_MIPS_TLS_TPREL_HI16 / R_MIPS_TLS_TPREL_LO16 relocations. - -# RUN: yaml2obj -format=elf -o %t.o %s -# RUN: lld -flavor old-gnu -target mipsel -e L0 -o %t.exe %t.o -# RUN: llvm-objdump -s %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK: {{[0-9A-F]+}} 00000000 01000000 03800000 04800000 - -!ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Content: '01000000020000000300000004000000' - - Name: .rel.text - Type: SHT_REL - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0x00 - Symbol: L1 - Type: R_MIPS_TLS_TPREL_HI16 - - Offset: 0x04 - Symbol: L2 - Type: R_MIPS_TLS_TPREL_HI16 - - Offset: 0x08 - Symbol: L2 - Type: R_MIPS_TLS_TPREL_LO16 - - Offset: 0x0C - Symbol: L1 - Type: R_MIPS_TLS_TPREL_LO16 - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x04 - Address: 0x1000 - Size: 0x20000 - -Symbols: - Global: - - Name: L0 - Type: STT_FUNC - Section: .text - Size: 0x58 - - Name: L1 - Type: STT_TLS - Section: .tdata - Value: 0x00 - Size: 0x04 - - Name: L2 - Type: STT_TLS - Section: .tdata - Value: 0x10000 - Size: 0x04 diff --git a/test/old-elf/Mips/tls-2-64-static.test b/test/old-elf/Mips/tls-2-64-static.test deleted file mode 100644 index c8c30ea06c60..000000000000 --- a/test/old-elf/Mips/tls-2-64-static.test +++ /dev/null @@ -1,71 +0,0 @@ -# Check handling of R_MIPS_TLS_GD relocation in case of -static linking. - -# RUN: yaml2obj -format=elf -o %t.o %s -# RUN: lld -flavor old-gnu -target mips64el -e T0 -static -o %t.exe %t.o -# RUN: llvm-objdump -s %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: 120000120 20800000 30800000 -# ^ -32736 ^ -32720 -# CHECK-NEXT: Contents of section .tdata: -# CHECK-NEXT: 120001000 00000000 00000000 -# CHECK-NEXT: Contents of section .got: -# CHECK-NEXT: 120002000 00000000 00000000 00000000 00000080 -# CHECK-NEXT: 120002010 01000000 00000000 0480ffff ffffffff -# CHECK-NEXT: 120002020 01000000 00000000 0c80ffff ffffffff -# D1 0x120001000 + 4 - (0x120001000 + 0x8000) = 0xffff8004 => 0480ffff -# D2 0x120001040 + 8 - (0x120001000 + 0x8000) = 0xffff800c => 0c80ffff - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 8 - - - Name: .rel.text - Type: SHT_RELA - Link: .symtab - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: D1 - Type: R_MIPS_TLS_GD - Addend: 4 - - Offset: 4 - Symbol: D2 - Type: R_MIPS_TLS_GD - Addend: 8 - - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 4 - Size: 8 - -Symbols: - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 8 - - Name: D1 - Type: STT_TLS - Section: .tdata - Value: 0 - Size: 4 - - Name: D2 - Type: STT_TLS - Section: .tdata - Value: 4 - Size: 4 -... diff --git a/test/old-elf/Mips/tls-2-64.test b/test/old-elf/Mips/tls-2-64.test deleted file mode 100644 index 3a6f6b3bedea..000000000000 --- a/test/old-elf/Mips/tls-2-64.test +++ /dev/null @@ -1,69 +0,0 @@ -# Check handling of R_MIPS_TLS_GOTTPREL and R_MIPS_TLS_GD relocations -# and generation of corresponding dynamic relocations R_MIPS_TLS_TPREL64, -# R_MIPS_TLS_DTPMOD64 and R_MIPS_TLS_DTPREL64 in case of shared library. - -# Create a shared library with thread symbol D1. -# RUN: yaml2obj -format=elf -o %t-so.o %s -# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t-so.o - -# Check dynamic relocations and GOT in the shared library. -# RUN: llvm-readobj -r %t.so | FileCheck -check-prefix=REL %s -# RUN: llvm-readobj -dynamic-table %t.so | FileCheck -check-prefix=DYN %s -# RUN: llvm-readobj -dt %t.so | FileCheck -check-prefix=SYM %s -# RUN: llvm-objdump -s %t.so | FileCheck -check-prefix=GOT %s - -# REL: Section (4) .rel.dyn { -# REL-NEXT: 0x2010 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE D1 0x0 -# REL-NEXT: 0x2018 R_MIPS_TLS_DTPREL64/R_MIPS_NONE/R_MIPS_NONE D1 0x0 -# REL-NEXT: } - -# DYN: 0x000000007000000A MIPS_LOCAL_GOTNO 2 -# DYN: 0x0000000070000013 MIPS_GOTSYM 0x3 - -# SYM: Name: T1@ (1) -# SYM: Name: D1@ (4) - -# GOT: Contents of section .got: -# GOT-NEXT: 2000 00000000 00000000 00000000 00000080 ................ -# GOT-NEXT: 2010 00000000 00000000 00000000 00000000 ................ - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 4 - - Name: .rel.text - Type: SHT_RELA - Link: .symtab - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: D1 - Type: R_MIPS_TLS_GD - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 4 - Size: 8 - -Symbols: - Global: - - Name: T1 - Type: STT_FUNC - Section: .text - Size: 4 - - Name: D1 - Type: STT_TLS - Section: .tdata - Size: 8 -... diff --git a/test/old-elf/Mips/tls-2-micro.test b/test/old-elf/Mips/tls-2-micro.test deleted file mode 100644 index 88d8797cd06a..000000000000 --- a/test/old-elf/Mips/tls-2-micro.test +++ /dev/null @@ -1,70 +0,0 @@ -# Check handling of R_MICROMIPS_TLS_GOTTPREL and R_MICROMIPS_TLS_GD relocations -# and generation of corresponding dynamic relocations R_MIPS_TLS_TPREL32, -# R_MIPS_TLS_DTPMOD32 and R_MIPS_TLS_DTPREL32 in case of shared library. - -# Create a shared library with thread symbol D1. -# RUN: yaml2obj -format=elf -o %t-so.o %s -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o - -# Check dynamic relocations and GOT in the shared library. -# RUN: llvm-readobj -r %t.so | FileCheck -check-prefix=REL %s -# RUN: llvm-readobj -dynamic-table %t.so | FileCheck -check-prefix=DYN %s -# RUN: llvm-readobj -dt %t.so | FileCheck -check-prefix=SYM %s -# RUN: llvm-objdump -s %t.so | FileCheck -check-prefix=GOT %s - -# REL: Section (4) .rel.dyn { -# REL-NEXT: 0x2008 R_MIPS_TLS_DTPMOD32 D1 0x0 -# REL-NEXT: 0x200C R_MIPS_TLS_DTPREL32 D1 0x0 -# REL-NEXT: } - -# DYN: 0x7000000A MIPS_LOCAL_GOTNO 2 -# DYN: 0x70000013 MIPS_GOTSYM 0x3 - -# SYM: Name: T1@ (1) -# SYM: Name: D1@ (4) - -# GOT: Contents of section .got: -# GOT-NEXT: 2000 00000000 00000080 00000000 00000000 ................ - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0x00 - Symbol: D1 - Type: R_MICROMIPS_TLS_GD - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: T1 - Type: STT_FUNC - Section: .text - Size: 0x04 - Other: [ STO_MIPS_MICROMIPS ] - - Name: D1 - Type: STT_TLS - Section: .tdata - Size: 0x04 -... diff --git a/test/old-elf/Mips/tls-2-static.test b/test/old-elf/Mips/tls-2-static.test deleted file mode 100644 index 3ac2122628d6..000000000000 --- a/test/old-elf/Mips/tls-2-static.test +++ /dev/null @@ -1,125 +0,0 @@ -# Check handling of R_MIPS_TLS_GD relocation in case of -static linking. - -# RUN: yaml2obj -format=elf -docnum 1 -o %t1.o %s -# RUN: yaml2obj -format=elf -docnum 2 -o %t2.o %s -# RUN: lld -flavor old-gnu -target mipsel -e T0 -static -o %t.exe %t1.o %t2.o -# RUN: llvm-objdump -s %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: 4000b4 18800000 20800000 28800000 30800000 -# ^ -32744 ^ -32736 ^ -32728 ^ -32720 -# CHECK-NEXT: Contents of section .tdata: -# CHECK-NEXT: 401000 00000000 00000000 00000000 00000000 -# CHECK-NEXT: Contents of section .got: -# CHECK-NEXT: 402000 00000000 00000080 01000000 0480ffff -# CHECK-NEXT: 402010 01000000 0c80ffff 01000000 0c80ffff -# CHECK-NEXT: 402020 01000000 1480ffff -# D1 0x401000 + 4 - (0x401000 + 0x8000) = 0xffff8004 => 0480ffff -# D2 0x401004 + 8 - (0x401000 + 0x8000) = 0xffff800c => 0c80ffff -# D3 0x401008 + 4 - (0x401000 + 0x8000) = 0xffff800c => 0c80ffff -# D4 0x40100c + 8 - (0x401000 + 0x8000) = 0xffff8014 => 1480ffff - -# t1.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Content: "0400000008000000" - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: D1 - Type: R_MIPS_TLS_GD - - Offset: 4 - Symbol: D2 - Type: R_MIPS_TLS_GD - - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 4 - Size: 8 - -Symbols: - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 8 - - Name: D1 - Type: STT_TLS - Section: .tdata - Value: 0 - Size: 4 - - Name: D2 - Type: STT_TLS - Section: .tdata - Value: 4 - Size: 4 - -# t2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Content: "0400000008000000" - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: D3 - Type: R_MIPS_TLS_GD - - Offset: 4 - Symbol: D4 - Type: R_MIPS_TLS_GD - - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 4 - Size: 8 - -Symbols: - Global: - - Name: T1 - Type: STT_FUNC - Section: .text - Size: 8 - - Name: D3 - Type: STT_TLS - Section: .tdata - Value: 0 - Size: 4 - - Name: D4 - Type: STT_TLS - Section: .tdata - Value: 4 - Size: 4 -... diff --git a/test/old-elf/Mips/tls-2.test b/test/old-elf/Mips/tls-2.test deleted file mode 100644 index de8fc2a70861..000000000000 --- a/test/old-elf/Mips/tls-2.test +++ /dev/null @@ -1,69 +0,0 @@ -# Check handling of R_MIPS_TLS_GOTTPREL and R_MIPS_TLS_GD relocations -# and generation of corresponding dynamic relocations R_MIPS_TLS_TPREL32, -# R_MIPS_TLS_DTPMOD32 and R_MIPS_TLS_DTPREL32 in case of shared library. - -# Create a shared library with thread symbol D1. -# RUN: yaml2obj -format=elf -o %t-so.o %s -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o - -# Check dynamic relocations and GOT in the shared library. -# RUN: llvm-readobj -r %t.so | FileCheck -check-prefix=REL %s -# RUN: llvm-readobj -dynamic-table %t.so | FileCheck -check-prefix=DYN %s -# RUN: llvm-readobj -dt %t.so | FileCheck -check-prefix=SYM %s -# RUN: llvm-objdump -s %t.so | FileCheck -check-prefix=GOT %s - -# REL: Section (4) .rel.dyn { -# REL-NEXT: 0x2008 R_MIPS_TLS_DTPMOD32 D1 0x0 -# REL-NEXT: 0x200C R_MIPS_TLS_DTPREL32 D1 0x0 -# REL-NEXT: } - -# DYN: 0x7000000A MIPS_LOCAL_GOTNO 2 -# DYN: 0x70000013 MIPS_GOTSYM 0x3 - -# SYM: Name: T1@ (1) -# SYM: Name: D1@ (4) - -# GOT: Contents of section .got: -# GOT-NEXT: 2000 00000000 00000080 00000000 00000000 ................ - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0x00 - Symbol: D1 - Type: R_MIPS_TLS_GD - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: T1 - Type: STT_FUNC - Section: .text - Size: 0x04 - - Name: D1 - Type: STT_TLS - Section: .tdata - Size: 0x04 -... diff --git a/test/old-elf/Mips/tls-3-64-static.test b/test/old-elf/Mips/tls-3-64-static.test deleted file mode 100644 index 2183d1fd6833..000000000000 --- a/test/old-elf/Mips/tls-3-64-static.test +++ /dev/null @@ -1,70 +0,0 @@ -# Check handling of R_MIPS_TLS_GOTTPREL relocation in case of -static linking. - -# RUN: yaml2obj -format=elf -o %t.o %s -# RUN: lld -flavor old-gnu -target mips64el -e T0 -static -o %t.exe %t.o -# RUN: llvm-objdump -s %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: 120000120 20800000 28800000 -# ^ -32736 ^ -32728 -# CHECK-NEXT: Contents of section .tdata: -# CHECK-NEXT: 120001000 00000000 00000000 -# CHECK-NEXT: Contents of section .got: -# CHECK-NEXT: 120002000 00000000 00000000 00000000 00000080 -# CHECK-NEXT: 120002010 0490ffff ffffffff 0c90ffff ffffffff -# D1 0x120001000 + 4 - (0x120001000 + 0x7000) = 0xffff9004 => 0490ffff -# D2 0x120001004 + 8 - (0x120001000 + 0x7000) = 0xffff900c => 0c90ffff - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 8 - - - Name: .rel.text - Type: SHT_RELA - Link: .symtab - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: D1 - Type: R_MIPS_TLS_GOTTPREL - Addend: 4 - - Offset: 4 - Symbol: D2 - Type: R_MIPS_TLS_GOTTPREL - Addend: 8 - - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 4 - Size: 8 - -Symbols: - Global: - - Name: D1 - Type: STT_TLS - Section: .tdata - Value: 0 - Size: 4 - - Name: D2 - Type: STT_TLS - Section: .tdata - Value: 4 - Size: 4 - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 8 -... diff --git a/test/old-elf/Mips/tls-3-micro.test b/test/old-elf/Mips/tls-3-micro.test deleted file mode 100644 index 347332e6633e..000000000000 --- a/test/old-elf/Mips/tls-3-micro.test +++ /dev/null @@ -1,183 +0,0 @@ -# Check handling of R_MICROMIPS_TLS_GOTTPREL and R_MICROMIPS_TLS_GD relocations -# and generation of corresponding dynamic relocations R_MIPS_TLS_TPREL32, -# R_MIPS_TLS_DTPMOD32 and R_MIPS_TLS_DTPREL32 in case of executable linking. - -# Create a shared library with thread symbol D1. -# RUN: yaml2obj -format=elf -docnum 1 -o %t-so.o %s -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o - -# Create executable file linked using two object files and the shared library. -# The object files defines thread symbols D0 and D2. -# RUN: yaml2obj -format=elf -docnum 2 -o %t-o1.o %s -# RUN: yaml2obj -format=elf -docnum 3 -o %t-o2.o %s -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o1.o %t-o2.o %t.so - -# Check dynamic relocations and GOT in the executable file. -# RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=REL %s -# RUN: llvm-readobj -dynamic-table %t.exe | FileCheck -check-prefix=DYN %s -# RUN: llvm-readobj -dt %t.exe | FileCheck -check-prefix=SYM %s -# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=GOT %s - -# REL: Section (5) .rel.dyn { -# REL-NEXT: 0x402008 R_MIPS_TLS_TPREL32 D1 0x0 -# REL-NEXT: 0x40200C R_MIPS_TLS_TPREL32 D2 0x0 -# REL-NEXT: } - -# DYN: 0x7000000A MIPS_LOCAL_GOTNO 2 -# DYN: 0x70000013 MIPS_GOTSYM 0x3 - -# SYM: Name: D2@ (1) -# SYM: Name: D1@ (4) - -# GOT: Contents of section .got: -# GOT-NEXT: 402000 00000000 00000080 00000000 00000000 ................ - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0x00 - Symbol: D1 - Type: R_MICROMIPS_TLS_GD - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: T1 - Type: STT_FUNC - Section: .text - Size: 0x04 - Other: [ STO_MIPS_MICROMIPS ] - - Name: D1 - Type: STT_TLS - Section: .tdata - Size: 0x04 - -# o1.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0x00 - Symbol: D2 - Type: R_MICROMIPS_TLS_TPREL_HI16 - - Offset: 0x04 - Symbol: D2 - Type: R_MICROMIPS_TLS_TPREL_LO16 - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: T2 - Type: STT_FUNC - Section: .text - Size: 0x08 - Other: [ STO_MIPS_MICROMIPS ] - - Name: D2 - Type: STT_TLS - Section: .tdata - Size: 0x04 - -# o2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x10 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0x00 - Symbol: D1 - Type: R_MICROMIPS_TLS_GOTTPREL - Addend: 0 - - Offset: 0x04 - Symbol: D0 - Type: R_MICROMIPS_TLS_TPREL_HI16 - Addend: 0 - - Offset: 0x08 - Symbol: D0 - Type: R_MICROMIPS_TLS_TPREL_LO16 - Addend: 0 - - Offset: 0x0C - Symbol: D2 - Type: R_MICROMIPS_TLS_GOTTPREL - Addend: 0 - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: D0 - Type: STT_TLS - Section: .tdata - Size: 0x04 - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 0x10 - Other: [ STO_MIPS_MICROMIPS ] - - Name: D1 - Type: STT_TLS - - Name: D2 - Type: STT_TLS -... diff --git a/test/old-elf/Mips/tls-3-static.test b/test/old-elf/Mips/tls-3-static.test deleted file mode 100644 index 5d3a7b8bfd6a..000000000000 --- a/test/old-elf/Mips/tls-3-static.test +++ /dev/null @@ -1,67 +0,0 @@ -# Check handling of R_MIPS_TLS_GOTTPREL relocation in case of -static linking. - -# RUN: yaml2obj -format=elf -o %t.o %s -# RUN: lld -flavor old-gnu -target mipsel -e T0 -static -o %t.exe %t.o -# RUN: llvm-objdump -s %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: 4000b4 18800000 1c800000 -# ^ -32744 ^ -32740 -# CHECK-NEXT: Contents of section .tdata: -# CHECK-NEXT: 401000 00000000 00000000 -# CHECK-NEXT: Contents of section .got: -# CHECK-NEXT: 402000 00000000 00000080 0490ffff 0c90ffff -# D1 0x401000 + 4 - (0x401000 + 0x7000) = 0xffff9004 => 0490ffff -# D2 0x401004 + 8 - (0x401000 + 0x7000) = 0xffff900c => 0c90ffff - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Content: "0400000008000000" - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - Info: .text - AddressAlign: 4 - Relocations: - - Offset: 0 - Symbol: D1 - Type: R_MIPS_TLS_GOTTPREL - - Offset: 4 - Symbol: D2 - Type: R_MIPS_TLS_GOTTPREL - - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 4 - Size: 8 - -Symbols: - Global: - - Name: D1 - Type: STT_TLS - Section: .tdata - Value: 0 - Size: 4 - - Name: D2 - Type: STT_TLS - Section: .tdata - Value: 4 - Size: 4 - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 8 -... diff --git a/test/old-elf/Mips/tls-3.test b/test/old-elf/Mips/tls-3.test deleted file mode 100644 index eb9750fee28d..000000000000 --- a/test/old-elf/Mips/tls-3.test +++ /dev/null @@ -1,180 +0,0 @@ -# Check handling of R_MIPS_TLS_GOTTPREL and R_MIPS_TLS_GD relocations -# and generation of corresponding dynamic relocations R_MIPS_TLS_TPREL32, -# R_MIPS_TLS_DTPMOD32 and R_MIPS_TLS_DTPREL32 in case of executable linking. - -# Create a shared library with thread symbol D1. -# RUN: yaml2obj -format=elf -docnum 1 -o %t-so.o %s -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o - -# Create executable file linked using two object files and the shared library. -# The object files defines thread symbols D0 and D2. -# RUN: yaml2obj -format=elf -docnum 2 -o %t-o1.o %s -# RUN: yaml2obj -format=elf -docnum 3 -o %t-o2.o %s -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o1.o %t-o2.o %t.so - -# Check dynamic relocations and GOT in the executable file. -# RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=REL %s -# RUN: llvm-readobj -dynamic-table %t.exe | FileCheck -check-prefix=DYN %s -# RUN: llvm-readobj -dt %t.exe | FileCheck -check-prefix=SYM %s -# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=GOT %s - -# REL: Section (5) .rel.dyn { -# REL-NEXT: 0x402008 R_MIPS_TLS_TPREL32 D1 0x0 -# REL-NEXT: 0x40200C R_MIPS_TLS_TPREL32 D2 0x0 -# REL-NEXT: } - -# DYN: 0x7000000A MIPS_LOCAL_GOTNO 2 -# DYN: 0x70000013 MIPS_GOTSYM 0x3 - -# SYM: Name: D2@ (1) -# SYM: Name: D1@ (4) - -# GOT: Contents of section .got: -# GOT-NEXT: 402000 00000000 00000080 00000000 00000000 ................ - -# so.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0x00 - Symbol: D1 - Type: R_MIPS_TLS_GD - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: T1 - Type: STT_FUNC - Section: .text - Size: 0x04 - - Name: D1 - Type: STT_TLS - Section: .tdata - Size: 0x04 - -# o1.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0x00 - Symbol: D2 - Type: R_MIPS_TLS_TPREL_HI16 - - Offset: 0x04 - Symbol: D2 - Type: R_MIPS_TLS_TPREL_LO16 - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: T2 - Type: STT_FUNC - Section: .text - Size: 0x08 - - Name: D2 - Type: STT_TLS - Section: .tdata - Size: 0x04 - -# o2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x10 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - Info: .text - AddressAlign: 0x04 - Relocations: - - Offset: 0x00 - Symbol: D1 - Type: R_MIPS_TLS_GOTTPREL - Addend: 0 - - Offset: 0x04 - Symbol: D0 - Type: R_MIPS_TLS_TPREL_HI16 - Addend: 0 - - Offset: 0x08 - Symbol: D0 - Type: R_MIPS_TLS_TPREL_LO16 - Addend: 0 - - Offset: 0x0C - Symbol: D2 - Type: R_MIPS_TLS_GOTTPREL - Addend: 0 - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: D0 - Type: STT_TLS - Section: .tdata - Size: 0x04 - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 0x10 - - Name: D1 - Type: STT_TLS - - Name: D2 - Type: STT_TLS -... diff --git a/test/old-elf/Mips/tls-4-64-static.test b/test/old-elf/Mips/tls-4-64-static.test deleted file mode 100644 index 3aa37046d36b..000000000000 --- a/test/old-elf/Mips/tls-4-64-static.test +++ /dev/null @@ -1,71 +0,0 @@ -# Check handling of R_MIPS_TLS_LDM relocation in case of -static linking. - -# RUN: yaml2obj -format=elf -o %t.o %s -# RUN: lld -flavor old-gnu -target mips64el -e T0 -static -o %t.exe %t.o -# RUN: llvm-objdump -s %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: 120000120 20800000 20800000 -# ^ -32736 ^ -32736 -# CHECK-NEXT: Contents of section .tdata: -# CHECK-NEXT: 120001000 00000000 00000000 -# CHECK-NEXT: Contents of section .got: -# CHECK-NEXT: 120002000 00000000 00000000 00000000 00000080 -# CHECK-NEXT: 120002010 01000000 00000000 00000000 00000000 -# ^ R_MIPS_TLS_DTPMOD64 - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 8 - - - Name: .rel.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 0 - Symbol: L1 - Type: R_MIPS_TLS_LDM - Addend: 4 - - Offset: 4 - Symbol: L2 - Type: R_MIPS_TLS_LDM - Addend: 8 - - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 4 - Size: 8 - -Symbols: - Local: - - Name: L1 - Type: STT_TLS - Section: .tdata - Value: 0 - Size: 4 - - Name: L2 - Type: STT_TLS - Section: .tdata - Value: 4 - Size: 4 - - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 8 -... diff --git a/test/old-elf/Mips/tls-4-micro.test b/test/old-elf/Mips/tls-4-micro.test deleted file mode 100644 index 23d8e0a1de31..000000000000 --- a/test/old-elf/Mips/tls-4-micro.test +++ /dev/null @@ -1,126 +0,0 @@ -# Check handling of R_MICROMIPS_TLS_LDM relocation and generation -# of corresponding dynamic relocation R_MICROMIPS_TLS_DTPMOD32. - -# RUN: yaml2obj -format=elf -docnum 1 -o %t-so1.o %s -# RUN: yaml2obj -format=elf -docnum 2 -o %t-so2.o %s -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so1.o %t-so2.o - -# RUN: llvm-readobj -r %t.so | FileCheck -check-prefix=REL %s -# RUN: llvm-readobj -dynamic-table %t.so | FileCheck -check-prefix=DYN %s -# RUN: llvm-readobj -dt %t.so | FileCheck -check-prefix=SYM %s -# RUN: llvm-objdump -s %t.so | FileCheck -check-prefix=GOT %s - -# REL: Section (4) .rel.dyn { -# REL-NEXT: 0x2008 R_MIPS_TLS_DTPMOD32 - 0x0 -# REL-NEXT: } - -# DYN: 0x7000000A MIPS_LOCAL_GOTNO 2 -# DYN: 0x70000013 MIPS_GOTSYM 0x4 - -# SYM: Name: @ (0) -# SYM: Name: T1@ (1) -# SYM: Name: T2@ (4) -# SYM: Name: T3@ (7) - -# GOT: Contents of section .got: -# GOT-NEXT: 2000 00000000 00000080 00000000 00000000 ................ -# Two LDM entries --^--------^ - -# so1.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: L01 - Type: R_MICROMIPS_TLS_LDM - - Offset: 0x04 - Symbol: L01 - Type: R_MICROMIPS_TLS_LDM - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Local: - - Name: L01 - Type: STT_TLS - Section: .tdata - Size: 0x04 - Global: - - Name: T1 - Type: STT_FUNC - Section: .text - Value: 0x00 - Size: 0x04 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T2 - Type: STT_FUNC - Section: .text - Value: 0x04 - Size: 0x04 - Other: [ STO_MIPS_MICROMIPS ] - -# so2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: L02 - Type: R_MICROMIPS_TLS_LDM - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Local: - - Name: L02 - Type: STT_TLS - Section: .tdata - Size: 0x04 - Global: - - Name: T3 - Type: STT_FUNC - Section: .text - Size: 0x04 - Other: [ STO_MIPS_MICROMIPS ] -... diff --git a/test/old-elf/Mips/tls-4-static.test b/test/old-elf/Mips/tls-4-static.test deleted file mode 100644 index 5fdb11df874b..000000000000 --- a/test/old-elf/Mips/tls-4-static.test +++ /dev/null @@ -1,68 +0,0 @@ -# Check handling of R_MIPS_TLS_LDM relocation in case of -static linking. - -# RUN: yaml2obj -format=elf -o %t.o %s -# RUN: lld -flavor old-gnu -target mipsel -e T0 -static -o %t.exe %t.o -# RUN: llvm-objdump -s %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: 4000b4 18800000 18800000 -# ^ -32744 ^ -32744 -# CHECK-NEXT: Contents of section .tdata: -# CHECK-NEXT: 401000 00000000 00000000 -# CHECK-NEXT: Contents of section .got: -# CHECK-NEXT: 402000 00000000 00000080 01000000 00000000 -# ^ R_MIPS_TLS_DTPMOD32 - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Content: "0400000008000000" - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 0 - Symbol: L1 - Type: R_MIPS_TLS_LDM - - Offset: 4 - Symbol: L2 - Type: R_MIPS_TLS_LDM - - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 4 - Size: 8 - -Symbols: - Local: - - Name: L1 - Type: STT_TLS - Section: .tdata - Value: 0 - Size: 4 - - Name: L2 - Type: STT_TLS - Section: .tdata - Value: 4 - Size: 4 - - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 8 -... diff --git a/test/old-elf/Mips/tls-4.test b/test/old-elf/Mips/tls-4.test deleted file mode 100644 index 95df6d67151f..000000000000 --- a/test/old-elf/Mips/tls-4.test +++ /dev/null @@ -1,123 +0,0 @@ -# Check handling of R_MIPS_TLS_LDM relocation and generation of corresponding -# dynamic relocation R_MIPS_TLS_DTPMOD32. - -# RUN: yaml2obj -format=elf -docnum 1 -o %t-so1.o %s -# RUN: yaml2obj -format=elf -docnum 2 -o %t-so2.o %s -# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so1.o %t-so2.o - -# RUN: llvm-readobj -r %t.so | FileCheck -check-prefix=REL %s -# RUN: llvm-readobj -dynamic-table %t.so | FileCheck -check-prefix=DYN %s -# RUN: llvm-readobj -dt %t.so | FileCheck -check-prefix=SYM %s -# RUN: llvm-objdump -s %t.so | FileCheck -check-prefix=GOT %s - -# REL: Section (4) .rel.dyn { -# REL-NEXT: 0x2008 R_MIPS_TLS_DTPMOD32 - 0x0 -# REL-NEXT: } - -# DYN: 0x7000000A MIPS_LOCAL_GOTNO 2 -# DYN: 0x70000013 MIPS_GOTSYM 0x4 - -# SYM: Name: @ (0) -# SYM: Name: T1@ (1) -# SYM: Name: T2@ (4) -# SYM: Name: T3@ (7) - -# GOT: Contents of section .got: -# GOT-NEXT: 2000 00000000 00000080 00000000 00000000 ................ -# Two LDM entries --^--------^ - -# so1.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: L01 - Type: R_MIPS_TLS_LDM - - Offset: 0x04 - Symbol: L01 - Type: R_MIPS_TLS_LDM - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Local: - - Name: L01 - Type: STT_TLS - Section: .tdata - Size: 0x04 - Global: - - Name: T1 - Type: STT_FUNC - Section: .text - Value: 0x00 - Size: 0x04 - - Name: T2 - Type: STT_FUNC - Section: .text - Value: 0x04 - Size: 0x04 - -# so2.o ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x04 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: L02 - Type: R_MIPS_TLS_LDM - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Local: - - Name: L02 - Type: STT_TLS - Section: .tdata - Size: 0x04 - Global: - - Name: T3 - Type: STT_FUNC - Section: .text - Size: 0x04 -... diff --git a/test/old-elf/Mips/tls-5-64.test b/test/old-elf/Mips/tls-5-64.test deleted file mode 100644 index 43e6e6c1cf30..000000000000 --- a/test/old-elf/Mips/tls-5-64.test +++ /dev/null @@ -1,71 +0,0 @@ -# Check that in case of an executable file linking symbol referred -# by the R_MIPS_TLS_GD relocation gets an entry in the dynamic symbol table. - -# RUN: yaml2obj -format=elf -o %t-o.o %s -# RUN: lld -flavor old-gnu -target mips64el -e T0 -o %t.exe %t-o.o - -# Check dynamic relocations: -# RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=REL %s -# Check dynamic symbol table: -# RUN: llvm-readobj -dt %t.exe | FileCheck -check-prefix=SYM %s - -# REL: Relocations [ -# REL-NEXT: Section (5) .rel.dyn { -# REL-NEXT: 0x120002010 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE T1 0x0 -# REL-NEXT: 0x120002018 R_MIPS_TLS_DTPREL64/R_MIPS_NONE/R_MIPS_NONE T1 0x0 -# REL-NEXT: } -# REL-NEXT: ] - -# SYM: Symbol { -# SYM: Name: T1@ (1) -# SYM-NEXT: Value: 0x0 -# SYM-NEXT: Size: 8 -# SYM-NEXT: Binding: Global (0x1) -# SYM-NEXT: Type: TLS (0x6) -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: .tdata (0x7) -# SYM-NEXT: } - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 8 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_TLS_GD - - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 4 - Size: 8 - -Symbols: - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 8 - - Name: T1 - Type: STT_TLS - Section: .tdata - Value: 0 - Size: 8 -... diff --git a/test/old-elf/Mips/tls-5-micro.test b/test/old-elf/Mips/tls-5-micro.test deleted file mode 100644 index 412456417826..000000000000 --- a/test/old-elf/Mips/tls-5-micro.test +++ /dev/null @@ -1,70 +0,0 @@ -# Check that in case of an executable file linking symbol referred by -# the R_MICROMIPS_TLS_GD relocation gets an entry in the dynamic symbol table. - -# RUN: yaml2obj -format=elf -o %t-o.o %s -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o - -# Check dynamic relocations: -# RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=REL %s -# Check dynamic symbol table: -# RUN: llvm-readobj -dt %t.exe | FileCheck -check-prefix=SYM %s - -# REL: Relocations [ -# REL-NEXT: Section (5) .rel.dyn { -# REL-NEXT: 0x402008 R_MIPS_TLS_DTPMOD32 T1 0x0 -# REL-NEXT: 0x40200C R_MIPS_TLS_DTPREL32 T1 0x0 -# REL-NEXT: } -# REL-NEXT: ] - -# SYM: Symbol { -# SYM: Name: T1@ (1) -# SYM-NEXT: Value: 0x0 -# SYM-NEXT: Size: 4 -# SYM-NEXT: Binding: Global (0x1) -# SYM-NEXT: Type: TLS (0x6) -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: .tdata (0x7) -# SYM-NEXT: } - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x04 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: T1 - Type: R_MICROMIPS_TLS_GD - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 0x04 - Other: [ STO_MIPS_MICROMIPS ] - - Name: T1 - Type: STT_TLS - Section: .tdata - Value: 0x00 - Size: 0x04 -... diff --git a/test/old-elf/Mips/tls-5.test b/test/old-elf/Mips/tls-5.test deleted file mode 100644 index cb71e3ac5f9e..000000000000 --- a/test/old-elf/Mips/tls-5.test +++ /dev/null @@ -1,69 +0,0 @@ -# Check that in case of an executable file linking symbol referred -# by the R_MIPS_TLS_GD relocation gets an entry in the dynamic symbol table. - -# RUN: yaml2obj -format=elf -o %t-o.o %s -# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o - -# Check dynamic relocations: -# RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=REL %s -# Check dynamic symbol table: -# RUN: llvm-readobj -dt %t.exe | FileCheck -check-prefix=SYM %s - -# REL: Relocations [ -# REL-NEXT: Section (5) .rel.dyn { -# REL-NEXT: 0x402008 R_MIPS_TLS_DTPMOD32 T1 0x0 -# REL-NEXT: 0x40200C R_MIPS_TLS_DTPREL32 T1 0x0 -# REL-NEXT: } -# REL-NEXT: ] - -# SYM: Symbol { -# SYM: Name: T1@ (1) -# SYM-NEXT: Value: 0x0 -# SYM-NEXT: Size: 4 -# SYM-NEXT: Binding: Global (0x1) -# SYM-NEXT: Type: TLS (0x6) -# SYM-NEXT: Other: 0 -# SYM-NEXT: Section: .tdata (0x7) -# SYM-NEXT: } - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, - EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x10 - Size: 0x04 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: T1 - Type: R_MIPS_TLS_GD - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 0x04 - - Name: T1 - Type: STT_TLS - Section: .tdata - Value: 0x00 - Size: 0x04 -... diff --git a/test/old-elf/Mips/validate-rel-01.test b/test/old-elf/Mips/validate-rel-01.test deleted file mode 100644 index 0b8734c5429e..000000000000 --- a/test/old-elf/Mips/validate-rel-01.test +++ /dev/null @@ -1,82 +0,0 @@ -# Check that the linker does not accept position-dependent relocations -# in case of shared library linking. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t-hi.o -# RUN: not lld -flavor old-gnu -target mipsel -shared -o %t.so %t-hi.o 2>&1 \ -# RUN: | FileCheck -check-prefix=RHI %s - -# RHI: R_MIPS_HI16 (5) relocation cannot be used when making a shared object, recompile {{.*}}validate-rel-01.test.tmp-hi.o with -fPIC - -# RUN: yaml2obj -format=elf -docnum 2 %s > %t-26.o -# RUN: not lld -flavor old-gnu -target mipsel -shared -o %t.so %t-26.o 2>&1 \ -# RUN: | FileCheck -check-prefix=R26 %s - -# R26: R_MIPS_26 (4) relocation cannot be used when making a shared object, recompile {{.*}}validate-rel-01.test.tmp-26.o with -fPIC - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Size: 4 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 0 - Symbol: T0 - Type: R_MIPS_HI16 - - Offset: 0 - Symbol: T0 - Type: R_MIPS_LO16 - -Symbols: - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 4 - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Size: 4 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 0 - Symbol: T1 - Type: R_MIPS_26 - -Symbols: - Global: - - Name: T1 - Type: STT_FUNC - Section: .text - Size: 4 -... diff --git a/test/old-elf/Mips/validate-rel-03.test b/test/old-elf/Mips/validate-rel-03.test deleted file mode 100644 index baf8516c63b0..000000000000 --- a/test/old-elf/Mips/validate-rel-03.test +++ /dev/null @@ -1,56 +0,0 @@ -# Check that the linker does not accept R_MIPS_CALL16 relocation -# against local symbol. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t.o -# RUN: not lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o 2>&1 \ -# RUN: | FileCheck %s - -# CHECK: R_MIPS_CALL16 (11) relocation cannot be used against local symbol L0 in file {{.*}}validate-rel-03.test.tmp.o - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Size: 16 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 8 - Symbol: T0 - Type: R_MIPS_CALL16 - - Offset: 4 - Symbol: L0 - Type: R_MIPS_CALL16 - -Symbols: - Local: - - Name: L0 - Type: STT_FUNC - Section: .text - Value: 0 - Size: 4 - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Value: 4 - Size: 4 - - Name: T1 - Type: STT_FUNC - Section: .text - Value: 8 - Size: 8 -... diff --git a/test/old-elf/X86_64/ExampleTarget/triple.test b/test/old-elf/X86_64/ExampleTarget/triple.test deleted file mode 100644 index aec09eae3a30..000000000000 --- a/test/old-elf/X86_64/ExampleTarget/triple.test +++ /dev/null @@ -1,32 +0,0 @@ -# Check that the Example Target is actually used. - -# RUN: yaml2obj -format=elf %s -o %t.o -# RUN: lld -flavor old-gnu -target x86_64-example-freebsd9 %t.o -o %t.exe -# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s -# -# CHECK: Type: 0xFF00 - -# object - -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E5B864000000C745FC000000005DC366666666662E0F1F840000000000554889E531C05DC3 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: _start - Type: STT_FUNC - Section: .text - Size: 0x0000000000000000 diff --git a/test/old-elf/X86_64/Inputs/constint.c b/test/old-elf/X86_64/Inputs/constint.c deleted file mode 100644 index 9fc0ebcf6591..000000000000 --- a/test/old-elf/X86_64/Inputs/constint.c +++ /dev/null @@ -1 +0,0 @@ -const int b = 20; diff --git a/test/old-elf/X86_64/Inputs/constint.o b/test/old-elf/X86_64/Inputs/constint.o deleted file mode 100644 index 8324b73014d0..000000000000 Binary files a/test/old-elf/X86_64/Inputs/constint.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/debug0.c b/test/old-elf/X86_64/Inputs/debug0.c deleted file mode 100644 index 1ebe50087383..000000000000 --- a/test/old-elf/X86_64/Inputs/debug0.c +++ /dev/null @@ -1,5 +0,0 @@ -int adena(); - -int main() { -return adena(); -} diff --git a/test/old-elf/X86_64/Inputs/debug0.x86-64 b/test/old-elf/X86_64/Inputs/debug0.x86-64 deleted file mode 100644 index 914f5224b9a2..000000000000 Binary files a/test/old-elf/X86_64/Inputs/debug0.x86-64 and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/debug1.c b/test/old-elf/X86_64/Inputs/debug1.c deleted file mode 100644 index 281b8a361dbb..000000000000 --- a/test/old-elf/X86_64/Inputs/debug1.c +++ /dev/null @@ -1,3 +0,0 @@ -int adena() { -return 0; -} diff --git a/test/old-elf/X86_64/Inputs/debug1.x86-64 b/test/old-elf/X86_64/Inputs/debug1.x86-64 deleted file mode 100644 index bfc81458a034..000000000000 Binary files a/test/old-elf/X86_64/Inputs/debug1.x86-64 and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/externtls.c b/test/old-elf/X86_64/Inputs/externtls.c deleted file mode 100644 index 499a645a9217..000000000000 --- a/test/old-elf/X86_64/Inputs/externtls.c +++ /dev/null @@ -1,6 +0,0 @@ -extern __thread int extern_tls; - -int main() { - extern_tls = 1; - return 0; -} diff --git a/test/old-elf/X86_64/Inputs/externtls.x86-64 b/test/old-elf/X86_64/Inputs/externtls.x86-64 deleted file mode 100644 index 3019aa0ca27c..000000000000 Binary files a/test/old-elf/X86_64/Inputs/externtls.x86-64 and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/fn.c b/test/old-elf/X86_64/Inputs/fn.c deleted file mode 100644 index 54939a2426b2..000000000000 --- a/test/old-elf/X86_64/Inputs/fn.c +++ /dev/null @@ -1,4 +0,0 @@ -int fn() -{ - return 0; -} diff --git a/test/old-elf/X86_64/Inputs/fn.o b/test/old-elf/X86_64/Inputs/fn.o deleted file mode 100644 index 4b67d459dfdb..000000000000 Binary files a/test/old-elf/X86_64/Inputs/fn.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/generaltls-so.o.yaml b/test/old-elf/X86_64/Inputs/generaltls-so.o.yaml deleted file mode 100644 index 53a7fb6435e9..000000000000 --- a/test/old-elf/X86_64/Inputs/generaltls-so.o.yaml +++ /dev/null @@ -1,67 +0,0 @@ ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E566488D3D00000000666648E8000000008B005DC3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000008 - Symbol: mynumber - Type: R_X86_64_TLSGD - Addend: -4 - - Offset: 0x0000000000000010 - Symbol: __tls_get_addr - Type: R_X86_64_PLT32 - Addend: -4 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x0000000000000004 - Content: '21000000' -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .tdata - Type: STT_SECTION - Section: .tdata - Global: - - Name: getnumber - Type: STT_FUNC - Section: .text - Size: 0x0000000000000018 - - Name: mynumber - Type: STT_TLS - Section: .tdata - Size: 0x0000000000000004 - - Name: _GLOBAL_OFFSET_TABLE_ - - Name: __tls_get_addr -... diff --git a/test/old-elf/X86_64/Inputs/group/1.c b/test/old-elf/X86_64/Inputs/group/1.c deleted file mode 100644 index f5e618bc4a85..000000000000 --- a/test/old-elf/X86_64/Inputs/group/1.c +++ /dev/null @@ -1,8 +0,0 @@ -int _start() { - return 0; -} - -int main() { -fn(); -return 0; -} diff --git a/test/old-elf/X86_64/Inputs/group/1.o b/test/old-elf/X86_64/Inputs/group/1.o deleted file mode 100644 index 743518eb0fa3..000000000000 Binary files a/test/old-elf/X86_64/Inputs/group/1.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/group/fn.c b/test/old-elf/X86_64/Inputs/group/fn.c deleted file mode 100644 index e443c73a1ee0..000000000000 --- a/test/old-elf/X86_64/Inputs/group/fn.c +++ /dev/null @@ -1,4 +0,0 @@ -int fn() { -fn1(); -return 0; -} diff --git a/test/old-elf/X86_64/Inputs/group/fn.o b/test/old-elf/X86_64/Inputs/group/fn.o deleted file mode 100644 index 1134432449cd..000000000000 Binary files a/test/old-elf/X86_64/Inputs/group/fn.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/group/fn1.c b/test/old-elf/X86_64/Inputs/group/fn1.c deleted file mode 100644 index cca0df7fd277..000000000000 --- a/test/old-elf/X86_64/Inputs/group/fn1.c +++ /dev/null @@ -1,3 +0,0 @@ -int fn1() { -fn2(); -} diff --git a/test/old-elf/X86_64/Inputs/group/fn1.o b/test/old-elf/X86_64/Inputs/group/fn1.o deleted file mode 100644 index 2b02310003db..000000000000 Binary files a/test/old-elf/X86_64/Inputs/group/fn1.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/group/fn2.c b/test/old-elf/X86_64/Inputs/group/fn2.c deleted file mode 100644 index a60370ed1e6b..000000000000 --- a/test/old-elf/X86_64/Inputs/group/fn2.c +++ /dev/null @@ -1,3 +0,0 @@ -int fn2() { -return 0; -} diff --git a/test/old-elf/X86_64/Inputs/group/fn2.o b/test/old-elf/X86_64/Inputs/group/fn2.o deleted file mode 100644 index fabec849a775..000000000000 Binary files a/test/old-elf/X86_64/Inputs/group/fn2.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/group/group.sh b/test/old-elf/X86_64/Inputs/group/group.sh deleted file mode 100755 index 2eba1030160b..000000000000 --- a/test/old-elf/X86_64/Inputs/group/group.sh +++ /dev/null @@ -1,38 +0,0 @@ -cat > 1.c << \! -int _start() { - return 0; -} - -int main() { -fn(); -return 0; -} -! - -cat > fn.c << \! -int fn() { -fn1(); -return 0; -} -! - -cat > fn2.c << \! -int fn2() { -return 0; -} -! - -cat > fn1.c << \! -int fn1() { -fn2(); -} -! - -gcc -c 1.c fn.c fn2.c fn1.c -ar cr libfn.a fn.o fn2.o -ar cr libfn1.a fn1.o -lld -flavor gnu -target x86_64 -shared -o libfn2.so fn2.o -lld -flavor gnu -target x86_64 1.o libfn.a libfn1.a -o x -lld -flavor gnu -target x86_64 1.o --start-group libfn.a libfn1.a --end-group -o x -lld -flavor gnu -target x86_64 1.o --start-group fn.o fn2.o fn1.o --end-group -o x -lld -flavor gnu -target x86_64 1.o --start-group --whole-archive libfn.a --no-whole-archive libfn1.a --end-group -o x diff --git a/test/old-elf/X86_64/Inputs/group/libfn.a b/test/old-elf/X86_64/Inputs/group/libfn.a deleted file mode 100644 index c157c3babed9..000000000000 Binary files a/test/old-elf/X86_64/Inputs/group/libfn.a and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/group/libfn.so b/test/old-elf/X86_64/Inputs/group/libfn.so deleted file mode 100755 index fcbd11fe5519..000000000000 Binary files a/test/old-elf/X86_64/Inputs/group/libfn.so and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/group/libfn1.a b/test/old-elf/X86_64/Inputs/group/libfn1.a deleted file mode 100644 index 69b9c75b5d16..000000000000 Binary files a/test/old-elf/X86_64/Inputs/group/libfn1.a and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/group/libfn2.so b/test/old-elf/X86_64/Inputs/group/libfn2.so deleted file mode 100755 index 7ce867373910..000000000000 Binary files a/test/old-elf/X86_64/Inputs/group/libfn2.so and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/initfini-option.c b/test/old-elf/X86_64/Inputs/initfini-option.c deleted file mode 100644 index e9a6c08c12ac..000000000000 --- a/test/old-elf/X86_64/Inputs/initfini-option.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -void init() { - printf("%s\n", __FUNCTION__); -} - -void fini() { - printf("%s\n", __FUNCTION__); -} - -int main() { -} - diff --git a/test/old-elf/X86_64/Inputs/initfini-option.o b/test/old-elf/X86_64/Inputs/initfini-option.o deleted file mode 100644 index b1ba0557353c..000000000000 Binary files a/test/old-elf/X86_64/Inputs/initfini-option.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/initfini.c b/test/old-elf/X86_64/Inputs/initfini.c deleted file mode 100644 index 9427a86b6c9b..000000000000 --- a/test/old-elf/X86_64/Inputs/initfini.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -void __attribute__ ((constructor)) constructor() { - printf("%s\n", __FUNCTION__); -} - -void __attribute__ ((destructor)) destructor() { - printf("%s\n", __FUNCTION__); -} - -int main() { - return 0; -} - diff --git a/test/old-elf/X86_64/Inputs/initfini.o b/test/old-elf/X86_64/Inputs/initfini.o deleted file mode 100644 index f0e55a90b8b6..000000000000 Binary files a/test/old-elf/X86_64/Inputs/initfini.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/largebss.c b/test/old-elf/X86_64/Inputs/largebss.c deleted file mode 100644 index 157d01755b6a..000000000000 --- a/test/old-elf/X86_64/Inputs/largebss.c +++ /dev/null @@ -1,3 +0,0 @@ -int largebss[1000] = { 0 }; -int largecommon[1000]; -__thread int largetbss[1000] = { 0 }; diff --git a/test/old-elf/X86_64/Inputs/largebss.o b/test/old-elf/X86_64/Inputs/largebss.o deleted file mode 100644 index 377370ec2db2..000000000000 Binary files a/test/old-elf/X86_64/Inputs/largebss.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/layoutpass/1.c b/test/old-elf/X86_64/Inputs/layoutpass/1.c deleted file mode 100644 index fec984503214..000000000000 --- a/test/old-elf/X86_64/Inputs/layoutpass/1.c +++ /dev/null @@ -1,8 +0,0 @@ -int main() { - a(); - return 0; -} - -int b() { - return 0; -} diff --git a/test/old-elf/X86_64/Inputs/layoutpass/1.o b/test/old-elf/X86_64/Inputs/layoutpass/1.o deleted file mode 100644 index 848a5b3321ac..000000000000 Binary files a/test/old-elf/X86_64/Inputs/layoutpass/1.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/layoutpass/2.c b/test/old-elf/X86_64/Inputs/layoutpass/2.c deleted file mode 100644 index fb9dbcc28aa6..000000000000 --- a/test/old-elf/X86_64/Inputs/layoutpass/2.c +++ /dev/null @@ -1,7 +0,0 @@ -int a() { - return 0; -} - -int c() { - return 0; -} diff --git a/test/old-elf/X86_64/Inputs/layoutpass/2.o b/test/old-elf/X86_64/Inputs/layoutpass/2.o deleted file mode 100644 index 4c5ef8679581..000000000000 Binary files a/test/old-elf/X86_64/Inputs/layoutpass/2.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/layoutpass/3.c b/test/old-elf/X86_64/Inputs/layoutpass/3.c deleted file mode 100644 index 054029fe5cfe..000000000000 --- a/test/old-elf/X86_64/Inputs/layoutpass/3.c +++ /dev/null @@ -1,3 +0,0 @@ -int d() { - return 0; -} diff --git a/test/old-elf/X86_64/Inputs/layoutpass/3.o b/test/old-elf/X86_64/Inputs/layoutpass/3.o deleted file mode 100644 index 76ef76e97901..000000000000 Binary files a/test/old-elf/X86_64/Inputs/layoutpass/3.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/layoutpass/lib2.a b/test/old-elf/X86_64/Inputs/layoutpass/lib2.a deleted file mode 100644 index 5f076c869817..000000000000 Binary files a/test/old-elf/X86_64/Inputs/layoutpass/lib2.a and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/libfn.a b/test/old-elf/X86_64/Inputs/libfn.a deleted file mode 100644 index 380844b0838d..000000000000 Binary files a/test/old-elf/X86_64/Inputs/libfn.a and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/libfn.so b/test/old-elf/X86_64/Inputs/libfn.so deleted file mode 100755 index dc02480aa690..000000000000 Binary files a/test/old-elf/X86_64/Inputs/libfn.so and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/main.c b/test/old-elf/X86_64/Inputs/main.c deleted file mode 100644 index 0280c9127076..000000000000 --- a/test/old-elf/X86_64/Inputs/main.c +++ /dev/null @@ -1,4 +0,0 @@ -int main() { - fn(); - return 0; -} diff --git a/test/old-elf/X86_64/Inputs/main.o b/test/old-elf/X86_64/Inputs/main.o deleted file mode 100644 index ec8929f4b51d..000000000000 Binary files a/test/old-elf/X86_64/Inputs/main.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/multi-ovrd.c b/test/old-elf/X86_64/Inputs/multi-ovrd.c deleted file mode 100644 index cf6c0b6ac361..000000000000 --- a/test/old-elf/X86_64/Inputs/multi-ovrd.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -void f(void) -{ - printf("overridden f!\n"); -} - -void g(void) -{ - printf("overridden g!\n"); -} diff --git a/test/old-elf/X86_64/Inputs/multi-ovrd.o b/test/old-elf/X86_64/Inputs/multi-ovrd.o deleted file mode 100644 index e4c4d6037fdd..000000000000 Binary files a/test/old-elf/X86_64/Inputs/multi-ovrd.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/multi-weak.c b/test/old-elf/X86_64/Inputs/multi-weak.c deleted file mode 100644 index 10b9160352d9..000000000000 --- a/test/old-elf/X86_64/Inputs/multi-weak.c +++ /dev/null @@ -1,20 +0,0 @@ -int fn() -{ - return 0; -} - -void __attribute__((weak)) f() -{ - printf("original f..\n"); -} - -void __attribute__((weak)) g() -{ - printf("original f..\n"); -} - -int main(void) -{ - f(); - return 0; -} diff --git a/test/old-elf/X86_64/Inputs/multi-weak.o b/test/old-elf/X86_64/Inputs/multi-weak.o deleted file mode 100644 index d5677b699ac4..000000000000 Binary files a/test/old-elf/X86_64/Inputs/multi-weak.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/multiweaksyms.o b/test/old-elf/X86_64/Inputs/multiweaksyms.o deleted file mode 100644 index 5e2e54d66b0d..000000000000 Binary files a/test/old-elf/X86_64/Inputs/multiweaksyms.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/nmagic.c b/test/old-elf/X86_64/Inputs/nmagic.c deleted file mode 100644 index 3ad15f0c4971..000000000000 --- a/test/old-elf/X86_64/Inputs/nmagic.c +++ /dev/null @@ -1,8 +0,0 @@ -int a = 10; -__thread int b = 20; -__thread int c; -__thread int d; - -int main() { - return 0; -} diff --git a/test/old-elf/X86_64/Inputs/nmagic.o b/test/old-elf/X86_64/Inputs/nmagic.o deleted file mode 100644 index af28e0ada8b3..000000000000 Binary files a/test/old-elf/X86_64/Inputs/nmagic.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/no-interp-section.c b/test/old-elf/X86_64/Inputs/no-interp-section.c deleted file mode 100644 index 3981c038ed33..000000000000 --- a/test/old-elf/X86_64/Inputs/no-interp-section.c +++ /dev/null @@ -1 +0,0 @@ -int c = 10; diff --git a/test/old-elf/X86_64/Inputs/no-interp-section.o b/test/old-elf/X86_64/Inputs/no-interp-section.o deleted file mode 100644 index 063eb3244f22..000000000000 Binary files a/test/old-elf/X86_64/Inputs/no-interp-section.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/note.o b/test/old-elf/X86_64/Inputs/note.o deleted file mode 100644 index d86b0cf85d19..000000000000 Binary files a/test/old-elf/X86_64/Inputs/note.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/note.s b/test/old-elf/X86_64/Inputs/note.s deleted file mode 100644 index 0a0b03da6bb7..000000000000 --- a/test/old-elf/X86_64/Inputs/note.s +++ /dev/null @@ -1,11 +0,0 @@ - .section ".note.ident", "a" - .p2align 2 - .long 1f - 0f # name size (not including padding) - .long 3f - 2f # desc size (not including padding) - .long 0x01234567 # type -0: .asciz "NaMe" # name -1: .p2align 2 -2: .long 0x76543210 # desc - .long 0x89abcdef -3: .p2align 2 - diff --git a/test/old-elf/X86_64/Inputs/note_ro_rw.o b/test/old-elf/X86_64/Inputs/note_ro_rw.o deleted file mode 100644 index 76f2486d2736..000000000000 Binary files a/test/old-elf/X86_64/Inputs/note_ro_rw.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/note_ro_rw.s b/test/old-elf/X86_64/Inputs/note_ro_rw.s deleted file mode 100644 index 2a0eff5dfb2b..000000000000 --- a/test/old-elf/X86_64/Inputs/note_ro_rw.s +++ /dev/null @@ -1,21 +0,0 @@ - .section ".note.ro", "a" - .p2align 2 - .long 1f - 0f # name size (not including padding) - .long 3f - 2f # desc size (not including padding) - .long 0x01234567 # type -0: .asciz "NaMe" # name -1: .p2align 2 -2: .long 0x76543210 # desc - .long 0x89abcdef -3: .p2align 2 - .section ".note.rw", "aw" - .p2align 2 - .long 1f - 0f # name size (not including padding) - .long 3f - 2f # desc size (not including padding) - .long 0x01234567 # type -0: .asciz "NaMe" # name -1: .p2align 2 -2: .long 0x76543210 # desc - .long 0x89abcdef -3: .p2align 2 - diff --git a/test/old-elf/X86_64/Inputs/ovrd.c b/test/old-elf/X86_64/Inputs/ovrd.c deleted file mode 100644 index a3d721dac2aa..000000000000 --- a/test/old-elf/X86_64/Inputs/ovrd.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -void f(void) -{ - printf("overridden f!\n"); -} - diff --git a/test/old-elf/X86_64/Inputs/ovrd.o b/test/old-elf/X86_64/Inputs/ovrd.o deleted file mode 100644 index ea7353d94ed9..000000000000 Binary files a/test/old-elf/X86_64/Inputs/ovrd.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/rodata.c b/test/old-elf/X86_64/Inputs/rodata.c deleted file mode 100644 index 01489fe550c8..000000000000 --- a/test/old-elf/X86_64/Inputs/rodata.c +++ /dev/null @@ -1,3 +0,0 @@ -const char _nl_default_default_domain[] __attribute__ ((visibility ("hidden"))) = "messages"; -const char *_nl_current_default_domain __attribute__ ((visibility ("hidden"))) = _nl_default_default_domain; -const char _nl_default_default_dirname[] = "/usr/local"; diff --git a/test/old-elf/X86_64/Inputs/rodata.o b/test/old-elf/X86_64/Inputs/rodata.o deleted file mode 100644 index 660606cdc9c0..000000000000 Binary files a/test/old-elf/X86_64/Inputs/rodata.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/rodata.s b/test/old-elf/X86_64/Inputs/rodata.s deleted file mode 100644 index e1a2eb702736..000000000000 --- a/test/old-elf/X86_64/Inputs/rodata.s +++ /dev/null @@ -1,24 +0,0 @@ - .file "x.c" - .hidden _nl_default_default_domain - .globl _nl_default_default_domain - .section .rodata._nl_default_default_domain,"ams",@progbits,1 - .type _nl_default_default_domain, @object - .size _nl_default_default_domain, 9 -_nl_default_default_domain: - .string "messages" - .hidden _nl_current_default_domain - .globl _nl_current_default_domain - .section .data._nl_current_default_domain,"aw",@progbits - .align 8 - .type _nl_current_default_domain, @object - .size _nl_current_default_domain, 8 -_nl_current_default_domain: - .quad _nl_default_default_domain - .globl _nl_default_default_dirname - .section .rodata._nl_default_default_dirname,"ams",@progbits,1 - .type _nl_default_default_dirname, @object - .size _nl_default_default_dirname, 11 -_nl_default_default_dirname: - .string "/usr/local" - .ident "GCC: (Ubuntu 4.8.1-2ubuntu1~10.04.1) 4.8.1" - .section .note.GNU-stack,"",@progbits diff --git a/test/old-elf/X86_64/Inputs/rwint.c b/test/old-elf/X86_64/Inputs/rwint.c deleted file mode 100644 index d1cf7d62c801..000000000000 --- a/test/old-elf/X86_64/Inputs/rwint.c +++ /dev/null @@ -1 +0,0 @@ -int a = 10; diff --git a/test/old-elf/X86_64/Inputs/rwint.o b/test/old-elf/X86_64/Inputs/rwint.o deleted file mode 100644 index 9fba51f07add..000000000000 Binary files a/test/old-elf/X86_64/Inputs/rwint.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/sectionmap.c b/test/old-elf/X86_64/Inputs/sectionmap.c deleted file mode 100644 index c4f530148949..000000000000 --- a/test/old-elf/X86_64/Inputs/sectionmap.c +++ /dev/null @@ -1,4 +0,0 @@ -int foo __attribute__((section(".gcc_except_table.foo"))) = 4; -const int bar __attribute__((section(".data.rel.local"))) = 2; -const int baz __attribute__((section(".data.rel.ro"))) = 2; -const int bak __attribute__((section(".data.xyz"))) = 2; diff --git a/test/old-elf/X86_64/Inputs/sectionmap.o b/test/old-elf/X86_64/Inputs/sectionmap.o deleted file mode 100644 index 599cf2cca563..000000000000 Binary files a/test/old-elf/X86_64/Inputs/sectionmap.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/undefcpp.c b/test/old-elf/X86_64/Inputs/undefcpp.c deleted file mode 100644 index ce84c2a592b6..000000000000 --- a/test/old-elf/X86_64/Inputs/undefcpp.c +++ /dev/null @@ -1 +0,0 @@ -int foo() { return _Z3fooPKc(); } diff --git a/test/old-elf/X86_64/Inputs/undefcpp.o b/test/old-elf/X86_64/Inputs/undefcpp.o deleted file mode 100644 index 6b8ebf5b6ab0..000000000000 Binary files a/test/old-elf/X86_64/Inputs/undefcpp.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/weak-zero-sized.o b/test/old-elf/X86_64/Inputs/weak-zero-sized.o deleted file mode 100644 index 7c10c6a509ed..000000000000 Binary files a/test/old-elf/X86_64/Inputs/weak-zero-sized.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/weak.c b/test/old-elf/X86_64/Inputs/weak.c deleted file mode 100644 index ae07ffc745d8..000000000000 --- a/test/old-elf/X86_64/Inputs/weak.c +++ /dev/null @@ -1,14 +0,0 @@ -int fn() -{ - return 0; -} - -void __attribute__((weak)) f() -{ - printf("original f..\n"); -} -int main(void) -{ - f(); - return 0; -} diff --git a/test/old-elf/X86_64/Inputs/weak.o b/test/old-elf/X86_64/Inputs/weak.o deleted file mode 100644 index 41cc88a0c482..000000000000 Binary files a/test/old-elf/X86_64/Inputs/weak.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/weak.s b/test/old-elf/X86_64/Inputs/weak.s deleted file mode 100644 index 64ce779553b6..000000000000 --- a/test/old-elf/X86_64/Inputs/weak.s +++ /dev/null @@ -1,21 +0,0 @@ - .file "weak.s" - .text - .p2align 4,,15 - .globl test - .type test, @function -test: - ret - .size test, .-test - .weak myfn2 - .data - .align 8 - .type myfn2, @object - .size myfn2, 8 -myfn2: - .quad test - .weak myfn1 - .align 8 - .type myfn1, @object - .size myfn1, 8 -myfn1: - .quad test diff --git a/test/old-elf/X86_64/Inputs/zerosizedsection.o b/test/old-elf/X86_64/Inputs/zerosizedsection.o deleted file mode 100644 index a0f2f13a307a..000000000000 Binary files a/test/old-elf/X86_64/Inputs/zerosizedsection.o and /dev/null differ diff --git a/test/old-elf/X86_64/Inputs/zerosizedsection.s b/test/old-elf/X86_64/Inputs/zerosizedsection.s deleted file mode 100644 index 651ee3aab503..000000000000 --- a/test/old-elf/X86_64/Inputs/zerosizedsection.s +++ /dev/null @@ -1,3 +0,0 @@ -.text -.data -.word .text diff --git a/test/old-elf/X86_64/alignoffset.test b/test/old-elf/X86_64/alignoffset.test deleted file mode 100644 index 53e29211af67..000000000000 --- a/test/old-elf/X86_64/alignoffset.test +++ /dev/null @@ -1,118 +0,0 @@ -# Checks that segments are aligned as per ELF spec. The segment virtual address -# modulo page alignment should be equal to offset modulo page alignment. - -# Build executable -# RUN: yaml2obj -format=elf -docnum 1 %s -o %t.o -# RUN: lld -flavor old-gnu -target x86_64 %t.o -o %t.exe -static \ -# RUN: --no-align-segments --rosegment --noinhibit-exec -# RUN: llvm-readobj -program-headers %t.exe | FileCheck %s -# -#CHECK: Offset: 0x15C -#CHECK: VirtualAddress: 0x40015C -#CHECK: PhysicalAddress: 0x40015C -# -# -#const int a = 0; -#int main() { -# foo(); -# return 0; -#} -# -#int foo() { return 0; } - -# object ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E54883EC10C745FC00000000E81C000000B9000000008945F889C84883C4105DC36666662E0F1F840000000000554889E5B8000000005DC3 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .rodata - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '00000000' - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 005562756E747520636C616E672076657273696F6E20332E352E302D73766E3231373330342D317E6578703120286272616E636865732F72656C656173655F33352920286261736564206F6E204C4C564D20332E352E302900 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000037A5200017810011B0C070890010000180000001C000000000000002400000000410E108602430D060000001800000038000000000000000B00000000410E108602430D06000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text - Type: R_X86_64_PC32 - Addend: 0 - - Offset: 0x000000000000003C - Symbol: .text - Type: R_X86_64_PC32 - Addend: 48 -Symbols: - Local: - - Name: 1.c - Type: STT_FILE - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .rodata - Type: STT_SECTION - Section: .rodata - - Name: .comment - Type: STT_SECTION - Section: .comment - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: a - Type: STT_OBJECT - Section: .rodata - Size: 0x0000000000000004 - - Name: foo - Type: STT_FUNC - Section: .text - Value: 0x0000000000000030 - Size: 0x000000000000000B - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x0000000000000024 -... diff --git a/test/old-elf/X86_64/debug.test b/test/old-elf/X86_64/debug.test deleted file mode 100644 index 26ba367da574..000000000000 --- a/test/old-elf/X86_64/debug.test +++ /dev/null @@ -1,57 +0,0 @@ -# Test that debug info is assigned typeNoAlloc and that the output sections have -# a virtual address of 0. -RUN: lld -flavor old-gnu -target x86_64 -e main --output-filetype=yaml \ -RUN: %p/Inputs/debug0.x86-64 %p/Inputs/debug1.x86-64 -o %t -RUN: FileCheck %s -check-prefix YAML < %t - -RUN: lld -flavor old-gnu -target x86_64 -e main %p/Inputs/debug0.x86-64 \ -RUN: %p/Inputs/debug1.x86-64 -o %t1 -RUN: llvm-readobj -sections %t1 | FileCheck %s -check-prefix ELF -# Verify that non SHF_ALLOC sections are relocated correctly. -RUN: llvm-objdump -s %t1 | FileCheck %s -check-prefix RELOC - -YAML: type: no-alloc - -ELF: Section { -ELF: Name: .debug_info -ELF: Type: SHT_PROGBITS (0x1) -ELF: Flags [ (0x0) -ELF: ] -ELF: Address: 0x0 -ELF: } -ELF: Section { -ELF: Name: .debug_abbrev -ELF: Type: SHT_PROGBITS (0x1) -ELF: Flags [ (0x0) -ELF: ] -ELF: Address: 0x0 -ELF: } -ELF: Section { -ELF: Name: .debug_aranges -ELF: Type: SHT_PROGBITS (0x1) -ELF: Flags [ (0x0) -ELF: ] -ELF: Address: 0x0 -ELF: } -ELF: Section { -ELF: Name: .debug_line -ELF: Type: SHT_PROGBITS (0x1) -ELF: Flags [ (0x0) -ELF: ] -ELF: Address: 0x0 -ELF: } -ELF: Section { -ELF: Name: .debug_str -ELF: Type: SHT_PROGBITS (0x1) -ELF: Flags [ (0x0) -ELF: ] -ELF: Address: 0x0 -ELF: } - -RELOC: Contents of section .debug_info: -RELOC: 0000 4e000000 04000000 00000801 3a000000 N...........:... -# ^^ Relocation: ._debug_str + 0x3a -RELOC: 0010 01780000 00000000 00dc0140 00000000 .x.........@.... -# ^^ Relocation: .debug_str + 0x78 -RELOC: 0020 00100000 00000000 00000000 00028100 ................ -# ^^ Relocation: .debug_str + 0x81 diff --git a/test/old-elf/X86_64/defsym.test b/test/old-elf/X86_64/defsym.test deleted file mode 100644 index d98abf39d428..000000000000 --- a/test/old-elf/X86_64/defsym.test +++ /dev/null @@ -1,22 +0,0 @@ -RUN: lld -flavor old-gnu -target x86_64 --defsym=main=fn --noinhibit-exec \ -RUN: %p/Inputs/fn.o -o %t -RUN: llvm-readobj -symbols %t | FileCheck %s - -CHECK: Symbol { -CHECK: Name: main (1) -CHECK: Value: 0x4001E0 -CHECK: Size: 0 -CHECK: Binding: Global (0x1) -CHECK: Type: Function (0x2) -CHECK: Other: 0 -CHECK: Section: .text (0x5) -CHECK: } -CHECK: Symbol { -CHECK: Name: fn (6) -CHECK: Value: 0x4001E0 -CHECK: Size: 6 -CHECK: Binding: Global (0x1) -CHECK: Type: Function (0x2) -CHECK: Other: 0 -CHECK: Section: .text (0x5) -CHECK: } diff --git a/test/old-elf/X86_64/demangle.test b/test/old-elf/X86_64/demangle.test deleted file mode 100644 index caae8256d99a..000000000000 --- a/test/old-elf/X86_64/demangle.test +++ /dev/null @@ -1,12 +0,0 @@ -# XFAIL: win32 -# -# Check that the linker is able to demangle strings properly. -# Once there is a way to add undefined symbols using yaml2obj, the test will be -# changed. - -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/undefcpp.o --noinhibit-exec 2>&1 | FileCheck -check-prefix=DEMANGLE %s -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/undefcpp.o --noinhibit-exec --no-demangle 2>&1 | FileCheck -check-prefix=NODEMANGLE %s -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/undefcpp.o --noinhibit-exec --demangle 2>&1 | FileCheck -check-prefix=DEMANGLE %s - -#DEMANGLE: undefcpp.o: foo(char const*) -#NODEMANGLE: undefcpp.o: _Z3fooPKc diff --git a/test/old-elf/X86_64/dontignorezerosize-sections.test b/test/old-elf/X86_64/dontignorezerosize-sections.test deleted file mode 100644 index f3042b5508fd..000000000000 --- a/test/old-elf/X86_64/dontignorezerosize-sections.test +++ /dev/null @@ -1,9 +0,0 @@ -# This tests that lld is not ignoring zero sized sections -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/zerosizedsection.o \ -RUN: --noinhibit-exec --output-filetype=yaml -o %t -RUN: FileCheck %s < %t - -CHECK: references: -CHECK: - kind: R_X86_64_16 -CHECK: offset: 0 -CHECK: target: L000 diff --git a/test/old-elf/X86_64/dynamicvars.test b/test/old-elf/X86_64/dynamicvars.test deleted file mode 100644 index c6f679038320..000000000000 --- a/test/old-elf/X86_64/dynamicvars.test +++ /dev/null @@ -1,123 +0,0 @@ -# Tests that the dynamic variables created by the linker are set to the right -# values. - -#RUN: yaml2obj --format elf -docnum 1 %s -o %t.o -#RUN: lld -flavor old-gnu -target x86_64 -e main %t.o -o %t1 --noinhibit-exec -#RUN: llvm-readobj -sections -symbols %t1 | FileCheck -check-prefix CHECKSYMS %s - - -#CHECKSYMS: Name: .dynamic -#CHECKSYMS: Type: SHT_DYNAMIC -#CHECKSYMS: Address: [[TARGETA:[0xa-fA-f0-9]+]] -#CHECKSYMS: Name: .got.plt -#CHECKSYMS: Type: SHT_PROGBITS -#CHECKSYMS: Address: [[TARGETB:[0xa-fA-f0-9]+]] -#CHECKSYMS: Name: _DYNAMIC -#CHECKSYMS: Value: [[TARGETA]] -#CHECKSYMS: Section: .dynamic -#CHECKSYMS: Name: _GLOBAL_OFFSET_TABLE_ -#CHECKSYMS: Value: [[TARGETB]] -#CHECKSYMS: Section: .got.plt - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E54883EC10488B0500000000C745FC00000000C7000A000000E80000000031C98945F889C84883C4105DC36690554889E531C05DC3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x000000000000000B - Symbol: a - Type: R_X86_64_GOTPCREL - Addend: -4 - - Offset: 0x000000000000001D - Symbol: foo - Type: R_X86_64_PLT32 - Addend: -4 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 00636C616E672076657273696F6E20332E362E302000 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000037A5200017810011B0C070890010000180000001C000000000000002E00000000410E108602430D060000001800000038000000000000000800000000410E108602430D06000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text - Type: R_X86_64_PC32 - Addend: 0 - - Offset: 0x000000000000003C - Symbol: .text - Type: R_X86_64_PC32 - Addend: 48 -Symbols: - Local: - - Name: 1.c - Type: STT_FILE - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .comment - Type: STT_SECTION - Section: .comment - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: a - Type: STT_OBJECT - Value: 0x0000000000000004 - Size: 0x0000000000000004 - - Name: foo - Type: STT_FUNC - Section: .text - Value: 0x0000000000000030 - Size: 0x0000000000000008 - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x000000000000002E - - Name: _GLOBAL_OFFSET_TABLE_ -... diff --git a/test/old-elf/X86_64/dynlib-nointerp-section.test b/test/old-elf/X86_64/dynlib-nointerp-section.test deleted file mode 100644 index c23d283d2a6d..000000000000 --- a/test/old-elf/X86_64/dynlib-nointerp-section.test +++ /dev/null @@ -1,4 +0,0 @@ -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/no-interp-section.o -o %t -shared -RUN: llvm-objdump -section-headers %t | FileCheck %s - -CHECK-NOT: .interp diff --git a/test/old-elf/X86_64/dynlib-search.test b/test/old-elf/X86_64/dynlib-search.test deleted file mode 100644 index efd7272fb145..000000000000 --- a/test/old-elf/X86_64/dynlib-search.test +++ /dev/null @@ -1,6 +0,0 @@ -# This tests the functionality for finding the shared library libfn.so for ELF -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/main.o -L%p/Inputs/ -lfn -o %t \ -RUN: --noinhibit-exec -t 2> %t1 -RUN: FileCheck %s < %t1 - -CHECK: {{[\/0-9A-Za-z_]+}}libfn.so diff --git a/test/old-elf/X86_64/dynsym-weak.test b/test/old-elf/X86_64/dynsym-weak.test deleted file mode 100644 index 8e1cc9fa8ec9..000000000000 --- a/test/old-elf/X86_64/dynsym-weak.test +++ /dev/null @@ -1,118 +0,0 @@ -# Check that a symbol declared as a week in a shared library gets a dynamic -# symbol table record in an executable file if this executabe file declares the -# symbol as strong. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t.foo.o -# RUN: lld -flavor old-gnu -target x86_64 -shared -o %t.so %t.foo.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t.main.o -# -# Link executable file with strong symbol. Weak symbol is in the shared lib. -# RUN: lld -flavor old-gnu -target x86_64 -e main -o %t1.exe %t.main.o %t.so -# RUN: llvm-readobj -dyn-symbols %t1.exe | FileCheck -check-prefix=EXE %s -# -# Link executable file. Strong and weak symbol come from different object files. -# RUN: lld -flavor old-gnu -target x86_64 -e main -o %t2.exe %t.main.o %t.foo.o -# RUN: llvm-readobj -dyn-symbols %t2.exe | FileCheck -check-prefix=OBJ %s -# -# Link shared library. Weak symbol is in the another shared lib. -# RUN: lld -flavor old-gnu -target x86_64 -shared -o %t.res.so %t.main.o %t.so -# RUN: llvm-readobj -dyn-symbols %t.res.so | FileCheck -check-prefix=SO %s - -# EXE: Symbol { -# EXE: Name: flag@ ({{[0-9]+}}) -# EXE-NEXT: Value: 0x{{[0-9A-F]+}} -# EXE-NEXT: Size: 4 -# EXE-NEXT: Binding: Global (0x1) -# EXE-NEXT: Type: Object (0x1) -# EXE-NEXT: Other: 0 -# EXE-NEXT: Section: .data (0x{{[0-9A-F]+}}) -# EXE-NEXT: } - -# OBJ-NOT: Name: flag@ ({{[0-9]+}}) - -# SO: Symbol { -# SO: Name: flag@ ({{[0-9]+}}) -# SO-NEXT: Value: 0x{{[0-9A-F]+}} -# SO-NEXT: Size: 4 -# SO-NEXT: Binding: Global (0x1) -# SO-NEXT: Type: Object (0x1) -# SO-NEXT: Other: 0 -# SO-NEXT: Section: .data (0x{{[0-9A-F]+}}) -# SO-NEXT: } - -# foo.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x08 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: flag - Type: R_X86_64_GOTPCREL - Addend: -4 - -Symbols: - Global: - - Name: foo - Type: STT_FUNC - Section: .text - Size: 0x08 - Weak: - - Name: flag - -# main.o ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x08 - Info: .text - Relocations: - - Offset: 0x00 - Symbol: foo - Type: R_X86_64_PLT32 - Addend: -4 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x04 - Size: 0x04 - -Symbols: - Global: - - Name: flag - Type: STT_OBJECT - Section: .data - Size: 0x04 - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x08 - - Name: foo -... diff --git a/test/old-elf/X86_64/extern-tls.test b/test/old-elf/X86_64/extern-tls.test deleted file mode 100644 index d22b06057a9a..000000000000 --- a/test/old-elf/X86_64/extern-tls.test +++ /dev/null @@ -1,16 +0,0 @@ -# This tests verifies that TLS variables have correct offsets -# when variables the TLS variables are not defined in the program -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/externtls.x86-64 -static \ -RUN: --output-filetype=yaml --noinhibit-exec | FileCheck %s -check-prefix=CHECKGOT - -# Currently x86_64 relocation pass handles the R_X86_64_GOTTPOFF by -# creatng R_X86_64_TPOFF64 dynamic ones. For output yaml, this is -# not changed. - - name: __got_tls_extern_tls -CHECKGOT: alignment: 4 -CHECKGOT: section-name: .text -CHECKGOT: references: -CHECKGOT: - kind: R_X86_64_GOTTPOFF -CHECKGOT: offset: 7 -CHECKGOT: target: extern_tls -CHECKGOT: addend: -4 diff --git a/test/old-elf/X86_64/general-dynamic-tls.test b/test/old-elf/X86_64/general-dynamic-tls.test deleted file mode 100644 index 12ad1071ae1e..000000000000 --- a/test/old-elf/X86_64/general-dynamic-tls.test +++ /dev/null @@ -1,128 +0,0 @@ -# This test exercises a simple general dynamic TLS access model in X86_64. -# -# It is composed of two parts: a program and a shared library. The shared -# library uses TLS, but the program does not. -# -# The shared library should import __tls_get_addr, since it uses the general -# dynamic TLS access mode (see www.akkadia.org/drepper/tls.pdf). Notice that -# once we support TLS strength reduction, this test should be updated, since -# this can be converted into a local dynamic TLS model. - -# Prepare inputs -#RUN: yaml2obj -format=elf %p/Inputs/generaltls-so.o.yaml -o=%t.o.so -#RUN: lld -flavor old-gnu -target x86_64 -shared %t.o.so -o %T/libgeneraltls.so -#RUN: yaml2obj -format=elf %s -o=%t.o - -# Link - (we supply --defsym=__tls_get_addr to avoid the need to link with -# system libraries) -#RUN: lld -flavor old-gnu -target x86_64 -e main %t.o -L%T -lgeneraltls -o %t1 \ -#RUN: --defsym=__tls_get_addr=0 - -# Check -#RUN: llvm-readobj -dyn-symbols %t1 | FileCheck -check-prefix CHECKPROG %s -#RUN: llvm-readobj -relocations -dyn-symbols %T/libgeneraltls.so | FileCheck \ -#RUN: -check-prefix CHECKDSO %s - -# Test case generated with the following code: -# -# DSO: (file %p/Inputs/generaltls-so.o.yaml) -# -# __thread int mynumber=33; -# -# int getnumber() { -# return mynumber; -# } -# -# Program: (this file). Note: The printf() relocation was removed to simplify -# this test and allow us to test this without libc. -# -# #include -# int getnumber(); -# -# int main() { -# printf("getnumber() = %d\n", getnumber()); -# return 0; -# } -# ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E54883EC10C745FC00000000B000E80000000048BF000000000000000089C6B000E80000000031F68945F889F04883C4105DC3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000012 - Symbol: getnumber - Type: R_X86_64_PC32 - Addend: -4 - - Offset: 0x0000000000000018 - Symbol: .rodata.str1.1 - Type: R_X86_64_64 - Addend: 0 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .rodata.str1.1 - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 6765746E756D6265722829203D2025640A00 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .rodata.str1.1 - Type: STT_SECTION - Section: .rodata.str1.1 - Global: - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x0000000000000036 - - Name: getnumber - -# Program should import the function defined in the shared library -#CHECKPROG: getnumber@ -# Program should not import __tls_get_addr, since it does not directly use TLS -#CHECKPROG-NOT: __tls_get_addr@ - -# Check for the presence of X86_64 TLS relocations in the shared library -#CHECKDSO: R_X86_64_DTPMOD64 -#CHECKDSO: R_X86_64_DTPOFF64 -#CHECKDSO: R_X86_64_JUMP_SLOT - -# The shared library should import __tls_get_addr, since it uses the general -# dynamic TLS access mode. -#CHECKDSO: Name: __tls_get_addr@ -#CHECKDSO-NEXT: Value: 0x0 -#CHECKDSO-NEXT: Size: 0 -#CHECKDSO-NEXT: Binding: Global -#CHECKDSO-NEXT: Type: None -#CHECKDSO-NEXT: Other: 0 -#CHECKDSO-NEXT: Section: Undefined - diff --git a/test/old-elf/X86_64/imagebase.test b/test/old-elf/X86_64/imagebase.test deleted file mode 100644 index 7b6f7318d72d..000000000000 --- a/test/old-elf/X86_64/imagebase.test +++ /dev/null @@ -1,94 +0,0 @@ -# Checks that segments start at the image address specified. - -# Build executable -# RUN: yaml2obj -format=elf -docnum 1 %s -o %t.o -# RUN: lld -flavor old-gnu -target x86_64 %t.o -o %t.exe -static \ -# RUN: --no-align-segments --noinhibit-exec --image-base 0x600000 -# RUN: llvm-readobj -program-headers %t.exe | FileCheck %s -# -#CHECK: VirtualAddress: 0x600000 -#CHECK: PhysicalAddress: 0x600000 -#CHECK: VirtualAddress: 0x600178 -#CHECK: PhysicalAddress: 0x600178 - -# object ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E5B864000000C745FC000000005DC366666666662E0F1F840000000000554889E531C05DC3 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Size: 4 - - Name: .rodata - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '64000000' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000037A5200017810011B0C070890010000180000001C000000000000001200000000410E108602430D060000001800000038000000000000000800000000410E108602430D06000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text - Type: R_X86_64_PC32 - Addend: 0 - - Offset: 0x000000000000003C - Symbol: .text - Type: R_X86_64_PC32 - Addend: 32 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: foo - Type: STT_FUNC - Section: .text - Value: 0x0000000000000020 - Size: 0x0000000000000008 - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x0000000000000012 - - Name: myval - Type: STT_OBJECT - Section: .bss - Size: 0x0000000000000004 - - Name: val - Type: STT_OBJECT - Section: .rodata - Size: 0x0000000000000004 -... diff --git a/test/old-elf/X86_64/initfini-order.test b/test/old-elf/X86_64/initfini-order.test deleted file mode 100644 index e6afcf644346..000000000000 --- a/test/old-elf/X86_64/initfini-order.test +++ /dev/null @@ -1,10 +0,0 @@ -# This tests the functionality that lld is able to emit -# init_array/fini_array sections in the right order. - -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/initfini.o \ -RUN: --noinhibit-exec -o %t -RUN: llvm-objdump -t -section-headers %t | FileCheck %s - -CHECK: {{[0-9]+}} .eh_frame {{[0-9a-z]+}} {{[0-9a-z]+}} DATA -CHECK: {{[0-9]+}} .init_array {{[0-9a-z]+}} {{[0-9a-z]+}} DATA -CHECK: {{[0-9]+}} .fini_array {{[0-9a-z]+}} {{[0-9a-z]+}} DATA diff --git a/test/old-elf/X86_64/initfini.test b/test/old-elf/X86_64/initfini.test deleted file mode 100644 index 09d2bc129c25..000000000000 --- a/test/old-elf/X86_64/initfini.test +++ /dev/null @@ -1,23 +0,0 @@ -# This tests the functionality that lld is able to read -# init_array/fini_array sections in the input ELF. This -# corresponds to the the .init_array/.fini_array sections -# in the output ELF. - -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/initfini.o \ -RUN: --noinhibit-exec --output-filetype=yaml -o %t -RUN: FileCheck %s < %t - -CHECK: - type: data -CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] -CHECK: section-name: .init_array -CHECK: references: -CHECK: - kind: R_X86_64_64 -CHECK: offset: 0 -CHECK: target: constructor -CHECK: - type: data -CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] -CHECK: section-name: .fini_array -CHECK: references: -CHECK: - kind: R_X86_64_64 -CHECK: offset: 0 -CHECK: target: destructor diff --git a/test/old-elf/X86_64/largebss.test b/test/old-elf/X86_64/largebss.test deleted file mode 100644 index 722ec1c72bf9..000000000000 --- a/test/old-elf/X86_64/largebss.test +++ /dev/null @@ -1,20 +0,0 @@ -# This tests the functionality of handling BSS symbols -# BSS symbols don't occupy file content and are associated with typeZeroFill -# Any typeZeroFill content wouldn't have space reserved in the file to store -# its content - -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/largebss.o --output-filetype=yaml --noinhibit-exec | FileCheck %s - -CHECK: - name: largecommon -CHECK: scope: global -CHECK: type: zero-fill -CHECK: size: 4000 -CHECK: merge: as-tentative -CHECK: - name: largebss -CHECK: scope: global -CHECK: type: zero-fill -CHECK: size: 4000 -CHECK: - name: largetbss -CHECK: scope: global -CHECK: type: thread-zero-fill -CHECK: size: 4000 diff --git a/test/old-elf/X86_64/layoutpass-order.test b/test/old-elf/X86_64/layoutpass-order.test deleted file mode 100644 index ec180c970e78..000000000000 --- a/test/old-elf/X86_64/layoutpass-order.test +++ /dev/null @@ -1,14 +0,0 @@ -# This test checks that we follow the command line order of layouting -# symbols in the output file - -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/layoutpass/1.o \ -RUN: %p/Inputs/layoutpass/lib2.a %p/Inputs/layoutpass/3.o -o %t \ -RUN: --noinhibit-exec -static - -RUN: llvm-nm -n %t | FileCheck -check-prefix=SYMBOLSORDER %s - -SYMBOLSORDER: {{[A-Fa-f0-9]+}} T main -SYMBOLSORDER: {{[A-Fa-f0-9]+}} T b -SYMBOLSORDER: {{[A-Fa-f0-9]+}} T a -SYMBOLSORDER: {{[A-Fa-f0-9]+}} T c -SYMBOLSORDER: {{[A-Fa-f0-9]+}} T d diff --git a/test/old-elf/X86_64/maxpagesize.test b/test/old-elf/X86_64/maxpagesize.test deleted file mode 100644 index 303bd86eec0b..000000000000 --- a/test/old-elf/X86_64/maxpagesize.test +++ /dev/null @@ -1,113 +0,0 @@ -# Checks that segments are aligned as per ELF spec when the user specifies -# max-page-size option, and the segment alignment is set to the page size -# specified by the user. - -# Build executable -# RUN: yaml2obj -format=elf -docnum 1 %s -o %t.o -# RUN: not lld -flavor old-gnu -target x86_64 %t.o -o %t.exe -static \ -# RUN: --no-align-segments --noinhibit-exec -z max-page-size=0 -# RUN: not lld -flavor old-gnu -target x86_64 %t.o -o %t.exe -static \ -# RUN: --no-align-segments --noinhibit-exec -z max-page-size=0xFF -# RUN: not lld -flavor old-gnu -target x86_64 %t.o -o %t.exe -static \ -# RUN: --no-align-segments --noinhibit-exec -z max-page-size=0x1010 -# RUN: lld -flavor old-gnu -target x86_64 %t.o -o %t1.exe -static \ -# RUN: --no-align-segments --noinhibit-exec -z max-page-size=0x100000 -# RUN: lld -flavor old-gnu -target x86_64 %t.o -o %t.exe -static \ -# RUN: --no-align-segments --noinhibit-exec -z max-page-size=0x10000 -# RUN: llvm-readobj -program-headers %t.exe | FileCheck %s -# RUN: llvm-readobj -program-headers %t1.exe | FileCheck %s -check-prefix=CHECKLARGE -# -#CHECK: VirtualAddress: 0x400000 -#CHECK: PhysicalAddress: 0x400000 -#CHECK: Alignment: 65536 -#CHECK: VirtualAddress: 0x400178 -#CHECK: PhysicalAddress: 0x400178 -#CHECK: Alignment: 65536 -#CHECKLARGE: VirtualAddress: 0x400000 -#CHECKLARGE: PhysicalAddress: 0x400000 -#CHECKLARGE: Alignment: 1048576 -#CHECKLARGE: VirtualAddress: 0x400178 -#CHECKLARGE: PhysicalAddress: 0x400178 -#CHECKLARGE: Alignment: 1048576 - -# object ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E5B864000000C745FC000000005DC366666666662E0F1F840000000000554889E531C05DC3 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Size: 4 - - Name: .rodata - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '64000000' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000037A5200017810011B0C070890010000180000001C000000000000001200000000410E108602430D060000001800000038000000000000000800000000410E108602430D06000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text - Type: R_X86_64_PC32 - Addend: 0 - - Offset: 0x000000000000003C - Symbol: .text - Type: R_X86_64_PC32 - Addend: 32 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: foo - Type: STT_FUNC - Section: .text - Value: 0x0000000000000020 - Size: 0x0000000000000008 - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x0000000000000012 - - Name: myval - Type: STT_OBJECT - Section: .bss - Size: 0x0000000000000004 - - Name: val - Type: STT_OBJECT - Section: .rodata - Size: 0x0000000000000004 -... diff --git a/test/old-elf/X86_64/mergesimilarstrings.test b/test/old-elf/X86_64/mergesimilarstrings.test deleted file mode 100644 index 2b9b08faa23f..000000000000 --- a/test/old-elf/X86_64/mergesimilarstrings.test +++ /dev/null @@ -1,47 +0,0 @@ -# Check that relocations to section that contains strings is properly handled -# when merging strings is enabled. -# -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target x86_64 %t.o --noinhibit-exec -o %t1.out -# RUN: llvm-readobj -sections %t1.out | FileCheck %s -# RUN: lld -flavor old-gnu -target x86_64 %t.o --noinhibit-exec -o %t2.out --output-filetype=yaml -# RUN: FileCheck %s -check-prefix=CHECKRELOCS < %t2.out - -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Content: 54889e5488d3d00000000e80000000088d3d00000000e800000000b8000000005dc3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x04 - Info: .text - Relocations: - - Offset: 0x07 - Symbol: .rodata - Type: R_X86_64_PC32 - Addend: -4 - - Name: .rodata - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x01 - Content: 48656c6c6f20576f726c6400576f726c6400 -Symbols: - Global: - - Name: .rodata - Section: .rodata - -#CHECK: Name: .rodata -#CHECK: Size: 18 -#CHECKRELOCS: references: -#CHECKRELOCS: - kind: R_X86_64_PC32 -#CHECKRELOCS: offset: 7 -#CHECKRELOCS: target: .rodata -#CHECKRELOCS: addend: -4 diff --git a/test/old-elf/X86_64/multi-weak-layout.test b/test/old-elf/X86_64/multi-weak-layout.test deleted file mode 100644 index 879b4b1b3052..000000000000 --- a/test/old-elf/X86_64/multi-weak-layout.test +++ /dev/null @@ -1,52 +0,0 @@ -# Test that we are able to layout multiple weak symbols -# properly - -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/multiweaksyms.o \ -RUN: --noinhibit-exec -static --output-filetype=yaml -o %t -RUN: FileCheck %s -check-prefix=WEAKSYMS < %t - -WEAKSYMS: - type: data -WEAKSYMS: alignment: 8 -WEAKSYMS: references: -WEAKSYMS: - kind: layout-after -WEAKSYMS: offset: 0 -WEAKSYMS: target: [[L001:[-a-zA-Z0-9_]+]] -WEAKSYMS: - name: myfn2 -WEAKSYMS: scope: global -WEAKSYMS: type: data -WEAKSYMS: merge: as-weak -WEAKSYMS: alignment: 8 -WEAKSYMS: references: -WEAKSYMS: - kind: layout-after -WEAKSYMS: offset: 0 -WEAKSYMS: target: [[L001]] -WEAKSYMS: - ref-name: [[L001]] -WEAKSYMS: scope: global -WEAKSYMS: type: data -WEAKSYMS: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] -WEAKSYMS: alignment: 8 -WEAKSYMS: references: -WEAKSYMS: - kind: R_X86_64_64 -WEAKSYMS: offset: 0 -WEAKSYMS: target: test -WEAKSYMS: - kind: layout-after -WEAKSYMS: offset: 0 -WEAKSYMS: target: [[L003:[-a-zA-Z0-9_]+]] -WEAKSYMS: - name: myfn1 -WEAKSYMS: scope: global -WEAKSYMS: type: data -WEAKSYMS: merge: as-weak -WEAKSYMS: alignment: 8 -WEAKSYMS: references: -WEAKSYMS: - kind: layout-after -WEAKSYMS: offset: 0 -WEAKSYMS: target: [[L003]] -WEAKSYMS: - ref-name: [[L003]] -WEAKSYMS: scope: global -WEAKSYMS: type: data -WEAKSYMS: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] -WEAKSYMS: alignment: 8 -WEAKSYMS: references: -WEAKSYMS: - kind: R_X86_64_64 -WEAKSYMS: offset: 0 -WEAKSYMS: target: test diff --git a/test/old-elf/X86_64/multi-weak-override.test b/test/old-elf/X86_64/multi-weak-override.test deleted file mode 100644 index 75c86e7e405f..000000000000 --- a/test/old-elf/X86_64/multi-weak-override.test +++ /dev/null @@ -1,16 +0,0 @@ -# Test for weak symbol getting overridden -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/multi-weak.o \ -RUN: %p/Inputs/multi-ovrd.o -o %t -e main --noinhibit-exec -RUN: llvm-nm -n %t | FileCheck -check-prefix=WEAKORDER %s -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/multi-weak.o \ -RUN: %p/Inputs/multi-ovrd.o --output-filetype=yaml -o %t2 --noinhibit-exec -RUN: FileCheck -check-prefix=WEAKATOMSORDER %s < %t2 - -WEAKORDER: {{[0-9a-f]+}} T f -WEAKORDER: {{[0-9a-f]+}} T g - -WEAKATOMSORDER: - ref-name: {{[A-Z0-9]+}} -WEAKATOMSORDER: - ref-name: {{[A-Z0-9]+}} -WEAKATOMSORDER: - name: f -WEAKATOMSORDER: - name: g - diff --git a/test/old-elf/X86_64/multi-weak-syms-order.test b/test/old-elf/X86_64/multi-weak-syms-order.test deleted file mode 100644 index a8e21e13f870..000000000000 --- a/test/old-elf/X86_64/multi-weak-syms-order.test +++ /dev/null @@ -1,13 +0,0 @@ -# Test for weak symbol getting overridden -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/multi-weak.o -o %t --noinhibit-exec -RUN: llvm-nm -n %t | FileCheck -check-prefix=WEAKORDER %s -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/multi-weak.o -o %t2 --output-filetype=yaml --noinhibit-exec -RUN: FileCheck -check-prefix=WEAKATOMSORDER %s < %t2 - -WEAKORDER: {{[0-9a-f]+}} T fn -WEAKORDER: {{[0-9a-f]+}} T f -WEAKORDER: {{[0-9a-f]+}} T g -WEAKORDER: {{[0-9a-f]+}} T main - -WEAKATOMSORDER: - name: f -WEAKATOMSORDER: - name: g diff --git a/test/old-elf/X86_64/nmagic.test b/test/old-elf/X86_64/nmagic.test deleted file mode 100644 index 3ed9228fa787..000000000000 --- a/test/old-elf/X86_64/nmagic.test +++ /dev/null @@ -1,91 +0,0 @@ -# This tests verifies functionality of NMAGIC that we create only two segments, -# PT_LOAD, PT_TLS -# The data segment should be aligned to a page boundary -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/nmagic.o \ -RUN: --noinhibit-exec -o %t --nmagic -static -RUN: llvm-readobj -sections %t | FileCheck -check-prefix=NMAGICSECTIONS %s -RUN: llvm-readobj -program-headers %t | FileCheck -check-prefix=NMAGICPROGRAMHEADERS %s - -NMAGICSECTIONS: Section { -NMAGICSECTIONS: Index: 0 -NMAGICSECTIONS: Name: (0) -NMAGICSECTIONS: Type: SHT_NULL (0x0) -NMAGICSECTIONS: } -NMAGICSECTIONS: Section { -NMAGICSECTIONS: Name: .text -NMAGICSECTIONS: Type: SHT_PROGBITS (0x1) -NMAGICSECTIONS: } -NMAGICSECTIONS: Section { -NMAGICSECTIONS: Name: .eh_frame -NMAGICSECTIONS: Type: SHT_PROGBITS (0x1) -NMAGICSECTIONS: } -NMAGICSECTIONS: Section { -NMAGICSECTIONS: Name: .tdata -NMAGICSECTIONS: Type: SHT_PROGBITS (0x1) -NMAGICSECTIONS: } -NMAGICSECTIONS: Section { -NMAGICSECTIONS: Name: .tbss -NMAGICSECTIONS: Type: SHT_NOBITS (0x8) -NMAGICSECTIONS: } -NMAGICSECTIONS: Section { -NMAGICSECTIONS: Name: .got.plt -NMAGICSECTIONS: Type: SHT_PROGBITS (0x1) -NMAGICSECTIONS: } -NMAGICSECTIONS: Section { -NMAGICSECTIONS: Name: .data -NMAGICSECTIONS: Type: SHT_PROGBITS (0x1) -NMAGICSECTIONS: } -NMAGICSECTIONS: Section { -NMAGICSECTIONS: Name: .bss -NMAGICSECTIONS: Type: SHT_NOBITS (0x8) -NMAGICSECTIONS: } -NMAGICSECTIONS: Section { -NMAGICSECTIONS: Name: .comment -NMAGICSECTIONS: Type: SHT_PROGBITS (0x1) -NMAGICSECTIONS: } -NMAGICSECTIONS: Section { -NMAGICSECTIONS: Name: .note.GNU-stack -NMAGICSECTIONS: Type: SHT_PROGBITS (0x1) -NMAGICSECTIONS: } -NMAGICSECTIONS: Section { -NMAGICSECTIONS: Name: .shstrtab -NMAGICSECTIONS: Type: SHT_STRTAB (0x3) -NMAGICSECTIONS: } -NMAGICSECTIONS: Section { -NMAGICSECTIONS: Name: .symtab -NMAGICSECTIONS: Type: SHT_SYMTAB (0x2) -NMAGICSECTIONS: } -NMAGICSECTIONS: Section { -NMAGICSECTIONS: Name: .strtab -NMAGICSECTIONS: Type: SHT_STRTAB (0x3) -NMAGICSECTIONS: } - -NMAGICPROGRAMHEADERS: ProgramHeaders [ -NMAGICPROGRAMHEADERS: ProgramHeader { -NMAGICPROGRAMHEADERS: Type: PT_LOAD (0x1) -NMAGICPROGRAMHEADERS: Offset: 0x0 -NMAGICPROGRAMHEADERS: VirtualAddress: 0x400000 -NMAGICPROGRAMHEADERS: PhysicalAddress: 0x400000 -NMAGICPROGRAMHEADERS: FileSize: 4108 -NMAGICPROGRAMHEADERS: MemSize: 4108 -NMAGICPROGRAMHEADERS: Flags [ (0x7) -NMAGICPROGRAMHEADERS: PF_R (0x4) -NMAGICPROGRAMHEADERS: PF_W (0x2) -NMAGICPROGRAMHEADERS: PF_X (0x1) -NMAGICPROGRAMHEADERS: ] -NMAGICPROGRAMHEADERS: Alignment: 8 -NMAGICPROGRAMHEADERS: } -NMAGICPROGRAMHEADERS: ProgramHeader { -NMAGICPROGRAMHEADERS: Type: PT_TLS (0x7) -NMAGICPROGRAMHEADERS: Offset: 0x1000 -NMAGICPROGRAMHEADERS: VirtualAddress: 0x401000 -NMAGICPROGRAMHEADERS: PhysicalAddress: 0x401000 -NMAGICPROGRAMHEADERS: FileSize: 4 -NMAGICPROGRAMHEADERS: MemSize: 12 -NMAGICPROGRAMHEADERS: Flags [ (0x6) -NMAGICPROGRAMHEADERS: PF_R (0x4) -NMAGICPROGRAMHEADERS: PF_W (0x2) -NMAGICPROGRAMHEADERS: ] -NMAGICPROGRAMHEADERS: Alignment: 4 -NMAGICPROGRAMHEADERS: } -NMAGICPROGRAMHEADERS: ] diff --git a/test/old-elf/X86_64/noalignsegments.test b/test/old-elf/X86_64/noalignsegments.test deleted file mode 100644 index 4963575b674b..000000000000 --- a/test/old-elf/X86_64/noalignsegments.test +++ /dev/null @@ -1,95 +0,0 @@ -# Checks that segments are aligned as per ELF spec than aligning each -# segment fileoffset / virtual address to a page. - -# Build executable -# RUN: yaml2obj -format=elf -docnum 1 %s -o %t.o -# RUN: lld -flavor old-gnu -target x86_64 %t.o -o %t.exe -static \ -# RUN: --no-align-segments --noinhibit-exec -# RUN: llvm-readobj -program-headers %t.exe | FileCheck %s -# -#CHECK: VirtualAddress: 0x400000 -#CHECK: PhysicalAddress: 0x400000 -#CHECK: VirtualAddress: 0x400178 -#CHECK: PhysicalAddress: 0x400178 - -# object ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E5B864000000C745FC000000005DC366666666662E0F1F840000000000554889E531C05DC3 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Size: 4 - - Name: .rodata - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '64000000' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000037A5200017810011B0C070890010000180000001C000000000000001200000000410E108602430D060000001800000038000000000000000800000000410E108602430D06000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text - Type: R_X86_64_PC32 - Addend: 0 - - Offset: 0x000000000000003C - Symbol: .text - Type: R_X86_64_PC32 - Addend: 32 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: foo - Type: STT_FUNC - Section: .text - Value: 0x0000000000000020 - Size: 0x0000000000000008 - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x0000000000000012 - - Name: myval - Type: STT_OBJECT - Section: .bss - Size: 0x0000000000000004 - - Name: val - Type: STT_OBJECT - Section: .rodata - Size: 0x0000000000000004 -... diff --git a/test/old-elf/X86_64/note-sections-ro_plus_rw.test b/test/old-elf/X86_64/note-sections-ro_plus_rw.test deleted file mode 100644 index b4eafaf277c4..000000000000 --- a/test/old-elf/X86_64/note-sections-ro_plus_rw.test +++ /dev/null @@ -1,42 +0,0 @@ -# This tests the functionality that lld is able to recreate the note sections -# if they appear in the input, it looks like we need to differentiate RO note -# sections from RW note sections, and each creating a segment of its own - -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/note_ro_rw.o \ -RUN: --noinhibit-exec -o %t -static -RUN: llvm-readobj -sections %t | FileCheck -check-prefix=NOTESECTIONS %s -RUN: llvm-readobj -program-headers %t | FileCheck -check-prefix=NOTESEGMENT %s - -NOTESECTIONS: Section { -NOTESECTIONS: Name: .note.ro (1) -NOTESECTIONS: Type: SHT_NOTE (0x7) -NOTESECTIONS: Flags [ (0x2) -NOTESECTIONS: SHF_ALLOC (0x2) -NOTESECTIONS: ] -NOTESECTIONS: AddressAlignment: 4 -NOTESECTIONS: } -NOTESECTIONS: Section { -NOTESECTIONS: Name: .note.rw (31) -NOTESECTIONS: Type: SHT_NOTE (0x7) -NOTESECTIONS: Flags [ (0x3) -NOTESECTIONS: SHF_ALLOC (0x2) -NOTESECTIONS: SHF_WRITE (0x1) -NOTESECTIONS: ] -NOTESECTIONS: Size: 28 -NOTESECTIONS: AddressAlignment: 4 -NOTESECTIONS: } -NOTESEGMENT: ProgramHeader { -NOTESEGMENT: Type: PT_NOTE (0x4) -NOTESEGMENT: Flags [ (0x4) -NOTESEGMENT: PF_R (0x4) -NOTESEGMENT: ] -NOTESEGMENT: Alignment: 4 -NOTESEGMENT: } -NOTESEGMENT: ProgramHeader { -NOTESEGMENT: Type: PT_NOTE (0x4) -NOTESEGMENT: Flags [ (0x6) -NOTESEGMENT: PF_R (0x4) -NOTESEGMENT: PF_W (0x2) -NOTESEGMENT: ] -NOTESEGMENT: Alignment: 4 -NOTESEGMENT: } diff --git a/test/old-elf/X86_64/note-sections.test b/test/old-elf/X86_64/note-sections.test deleted file mode 100644 index b831e7e192b4..000000000000 --- a/test/old-elf/X86_64/note-sections.test +++ /dev/null @@ -1,23 +0,0 @@ -# This tests the functionality that lld is able to recreate the note sections -# if they appear in the input - -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/note.o \ -RUN: --noinhibit-exec -o %t -static -RUN: llvm-readobj -sections %t | FileCheck -check-prefix=NOTESECTIONS %s -RUN: llvm-readobj -program-headers %t | FileCheck -check-prefix=NOTESEGMENT %s - - -NOTESECTIONS: Section { -NOTESECTIONS: Index: 1 -NOTESECTIONS: Name: .note.ident (1) -NOTESECTIONS: Type: SHT_NOTE (0x7) -NOTESECTIONS: Size: 28 -NOTESECTIONS: AddressAlignment: 4 -NOTESECTIONS: } - -NOTESEGMENT: ProgramHeader { -NOTESEGMENT: Type: PT_NOTE (0x4) -NOTESEGMENT: FileSize: 28 -NOTESEGMENT: MemSize: 28 -NOTESEGMENT: Alignment: 4 -NOTESEGMENT: } diff --git a/test/old-elf/X86_64/omagic.test b/test/old-elf/X86_64/omagic.test deleted file mode 100644 index fe2633e67a95..000000000000 --- a/test/old-elf/X86_64/omagic.test +++ /dev/null @@ -1,237 +0,0 @@ -# This tests verifies functionality of omagic that we create only two segments, -# PT_LOAD, PT_TLS -# The data segment should not be aligned to a page boundary -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/nmagic.o \ -RUN: --noinhibit-exec -o %t --omagic -static -RUN: llvm-readobj -sections %t | FileCheck -check-prefix=OMAGICSECTIONS %s -RUN: llvm-readobj -program-headers %t | FileCheck -check-prefix=OMAGICPROGRAMHEADERS %s - -OMAGICSECTIONS: Section { -OMAGICSECTIONS: Name: (0) -OMAGICSECTIONS: Type: SHT_NULL (0x0) -OMAGICSECTIONS: Flags [ (0x0) -OMAGICSECTIONS: ] -OMAGICSECTIONS: Address: 0x0 -OMAGICSECTIONS: Offset: 0x0 -OMAGICSECTIONS: Size: 0 -OMAGICSECTIONS: Link: 0 -OMAGICSECTIONS: Info: 0 -OMAGICSECTIONS: AddressAlignment: 0 -OMAGICSECTIONS: EntrySize: 0 -OMAGICSECTIONS: } -OMAGICSECTIONS: Section { -OMAGICSECTIONS: Name: .text -OMAGICSECTIONS: Type: SHT_PROGBITS (0x1) -OMAGICSECTIONS: Flags [ (0x6) -OMAGICSECTIONS: SHF_ALLOC (0x2) -OMAGICSECTIONS: SHF_EXECINSTR (0x4) -OMAGICSECTIONS: ] -OMAGICSECTIONS: Address: 0x4000E8 -OMAGICSECTIONS: Offset: 0xE8 -OMAGICSECTIONS: Size: 11 -OMAGICSECTIONS: Link: 0 -OMAGICSECTIONS: Info: 0 -OMAGICSECTIONS: AddressAlignment: 4 -OMAGICSECTIONS: EntrySize: 0 -OMAGICSECTIONS: } -OMAGICSECTIONS: Section { -OMAGICSECTIONS: Name: .eh_frame -OMAGICSECTIONS: Type: SHT_PROGBITS (0x1) -OMAGICSECTIONS: Flags [ (0x2) -OMAGICSECTIONS: SHF_ALLOC (0x2) -OMAGICSECTIONS: ] -OMAGICSECTIONS: Address: 0x4000F8 -OMAGICSECTIONS: Offset: 0xF8 -OMAGICSECTIONS: Size: 56 -OMAGICSECTIONS: Link: 0 -OMAGICSECTIONS: Info: 0 -OMAGICSECTIONS: AddressAlignment: 8 -OMAGICSECTIONS: EntrySize: 0 -OMAGICSECTIONS: } -OMAGICSECTIONS: Section { -OMAGICSECTIONS: Name: .eh_frame_hdr -OMAGICSECTIONS: Type: SHT_PROGBITS (0x1) -OMAGICSECTIONS: Flags [ (0x2) -OMAGICSECTIONS: SHF_ALLOC (0x2) -OMAGICSECTIONS: ] -OMAGICSECTIONS: Address: 0x400130 -OMAGICSECTIONS: Offset: 0x130 -OMAGICSECTIONS: Size: 8 -OMAGICSECTIONS: Link: 0 -OMAGICSECTIONS: Info: 0 -OMAGICSECTIONS: AddressAlignment: 8 -OMAGICSECTIONS: EntrySize: 0 -OMAGICSECTIONS: } -OMAGICSECTIONS: Section { -OMAGICSECTIONS: Name: .tdata -OMAGICSECTIONS: Type: SHT_PROGBITS (0x1) -OMAGICSECTIONS: Flags [ (0x403) -OMAGICSECTIONS: SHF_ALLOC (0x2) -OMAGICSECTIONS: SHF_TLS (0x400) -OMAGICSECTIONS: SHF_WRITE (0x1) -OMAGICSECTIONS: ] -OMAGICSECTIONS: Address: 0x400138 -OMAGICSECTIONS: Offset: 0x138 -OMAGICSECTIONS: Size: 4 -OMAGICSECTIONS: Link: 0 -OMAGICSECTIONS: Info: 0 -OMAGICSECTIONS: AddressAlignment: 4 -OMAGICSECTIONS: EntrySize: 0 -OMAGICSECTIONS: } -OMAGICSECTIONS: Section { -OMAGICSECTIONS: Name: .tbss -OMAGICSECTIONS: Type: SHT_NOBITS (0x8) -OMAGICSECTIONS: Flags [ (0x403) -OMAGICSECTIONS: SHF_ALLOC (0x2) -OMAGICSECTIONS: SHF_TLS (0x400) -OMAGICSECTIONS: SHF_WRITE (0x1) -OMAGICSECTIONS: ] -OMAGICSECTIONS: Address: 0x40013C -OMAGICSECTIONS: Offset: 0x13C -OMAGICSECTIONS: Size: 8 -OMAGICSECTIONS: Link: 0 -OMAGICSECTIONS: Info: 0 -OMAGICSECTIONS: AddressAlignment: 4 -OMAGICSECTIONS: EntrySize: 0 -OMAGICSECTIONS: } -OMAGICSECTIONS: Section { -OMAGICSECTIONS: Name: .got.plt -OMAGICSECTIONS: Type: SHT_PROGBITS (0x1) -OMAGICSECTIONS: Flags [ (0x3) -OMAGICSECTIONS: SHF_ALLOC (0x2) -OMAGICSECTIONS: SHF_WRITE (0x1) -OMAGICSECTIONS: ] -OMAGICSECTIONS: Address: 0x400140 -OMAGICSECTIONS: Offset: 0x140 -OMAGICSECTIONS: Size: 0 -OMAGICSECTIONS: Link: 0 -OMAGICSECTIONS: Info: 0 -OMAGICSECTIONS: AddressAlignment: 8 -OMAGICSECTIONS: EntrySize: 0 -OMAGICSECTIONS: } -OMAGICSECTIONS: Section { -OMAGICSECTIONS: Name: .data -OMAGICSECTIONS: Type: SHT_PROGBITS (0x1) -OMAGICSECTIONS: Flags [ (0x3) -OMAGICSECTIONS: SHF_ALLOC (0x2) -OMAGICSECTIONS: SHF_WRITE (0x1) -OMAGICSECTIONS: ] -OMAGICSECTIONS: Address: 0x400140 -OMAGICSECTIONS: Offset: 0x140 -OMAGICSECTIONS: Size: 4 -OMAGICSECTIONS: Link: 0 -OMAGICSECTIONS: Info: 0 -OMAGICSECTIONS: AddressAlignment: 4 -OMAGICSECTIONS: EntrySize: 0 -OMAGICSECTIONS: } -OMAGICSECTIONS: Section { -OMAGICSECTIONS: Name: .bss -OMAGICSECTIONS: Type: SHT_NOBITS (0x8) -OMAGICSECTIONS: Flags [ (0x3) -OMAGICSECTIONS: SHF_ALLOC (0x2) -OMAGICSECTIONS: SHF_WRITE (0x1) -OMAGICSECTIONS: ] -OMAGICSECTIONS: Address: 0x400144 -OMAGICSECTIONS: Offset: 0x144 -OMAGICSECTIONS: Size: 0 -OMAGICSECTIONS: Link: 0 -OMAGICSECTIONS: Info: 0 -OMAGICSECTIONS: AddressAlignment: 4 -OMAGICSECTIONS: EntrySize: 0 -OMAGICSECTIONS: } -OMAGICSECTIONS: Section { -OMAGICSECTIONS: Name: .comment -OMAGICSECTIONS: Type: SHT_PROGBITS (0x1) -OMAGICSECTIONS: Flags [ (0x0) -OMAGICSECTIONS: ] -OMAGICSECTIONS: Address: 0x0 -OMAGICSECTIONS: Offset: 0x144 -OMAGICSECTIONS: Size: 43 -OMAGICSECTIONS: Link: 0 -OMAGICSECTIONS: Info: 0 -OMAGICSECTIONS: AddressAlignment: 1 -OMAGICSECTIONS: EntrySize: 0 -OMAGICSECTIONS: } -OMAGICSECTIONS: Section { -OMAGICSECTIONS: Name: .note.GNU-stack -OMAGICSECTIONS: Type: SHT_PROGBITS (0x1) -OMAGICSECTIONS: Flags [ (0x0) -OMAGICSECTIONS: ] -OMAGICSECTIONS: Address: 0x0 -OMAGICSECTIONS: Offset: 0x16F -OMAGICSECTIONS: Size: 0 -OMAGICSECTIONS: Link: 0 -OMAGICSECTIONS: Info: 0 -OMAGICSECTIONS: AddressAlignment: 1 -OMAGICSECTIONS: EntrySize: 0 -OMAGICSECTIONS: } -OMAGICSECTIONS: Section { -OMAGICSECTIONS: Name: .shstrtab -OMAGICSECTIONS: Type: SHT_STRTAB (0x3) -OMAGICSECTIONS: Flags [ (0x0) -OMAGICSECTIONS: ] -OMAGICSECTIONS: Address: 0x0 -OMAGICSECTIONS: Offset: 0x16F -OMAGICSECTIONS: Size: 115 -OMAGICSECTIONS: Link: 0 -OMAGICSECTIONS: Info: 0 -OMAGICSECTIONS: AddressAlignment: 1 -OMAGICSECTIONS: EntrySize: 0 -OMAGICSECTIONS: } -OMAGICSECTIONS: Section { -OMAGICSECTIONS: Name: .symtab -OMAGICSECTIONS: Type: SHT_SYMTAB (0x2) -OMAGICSECTIONS: Flags [ (0x0) -OMAGICSECTIONS: ] -OMAGICSECTIONS: Address: 0x0 -OMAGICSECTIONS: Offset: 0x1E8 -OMAGICSECTIONS: Size: 504 -OMAGICSECTIONS: Link: 13 -OMAGICSECTIONS: Info: 8 -OMAGICSECTIONS: AddressAlignment: 8 -OMAGICSECTIONS: EntrySize: 24 -OMAGICSECTIONS: } -OMAGICSECTIONS: Section { -OMAGICSECTIONS: Name: .strtab -OMAGICSECTIONS: Type: SHT_STRTAB (0x3) -OMAGICSECTIONS: Flags [ (0x0) -OMAGICSECTIONS: ] -OMAGICSECTIONS: Address: 0x0 -OMAGICSECTIONS: Offset: 0x3E0 -OMAGICSECTIONS: Size: 231 -OMAGICSECTIONS: Link: 0 -OMAGICSECTIONS: Info: 0 -OMAGICSECTIONS: AddressAlignment: 1 -OMAGICSECTIONS: EntrySize: 0 -OMAGICSECTIONS: } -OMAGICSECTIONS: ] - -OMAGICPROGRAMHEADERS: ProgramHeaders [ -OMAGICPROGRAMHEADERS: ProgramHeader { -OMAGICPROGRAMHEADERS: Type: PT_LOAD (0x1) -OMAGICPROGRAMHEADERS: Offset: 0x0 -OMAGICPROGRAMHEADERS: VirtualAddress: 0x400000 -OMAGICPROGRAMHEADERS: PhysicalAddress: 0x400000 -OMAGICPROGRAMHEADERS: FileSize: 324 -OMAGICPROGRAMHEADERS: MemSize: 324 -OMAGICPROGRAMHEADERS: Flags [ (0x7) -OMAGICPROGRAMHEADERS: PF_R (0x4) -OMAGICPROGRAMHEADERS: PF_W (0x2) -OMAGICPROGRAMHEADERS: PF_X (0x1) -OMAGICPROGRAMHEADERS: ] -OMAGICPROGRAMHEADERS: Alignment: 8 -OMAGICPROGRAMHEADERS: } -OMAGICPROGRAMHEADERS: ProgramHeader { -OMAGICPROGRAMHEADERS: Type: PT_TLS (0x7) -OMAGICPROGRAMHEADERS: Offset: 0x138 -OMAGICPROGRAMHEADERS: VirtualAddress: 0x400138 -OMAGICPROGRAMHEADERS: PhysicalAddress: 0x400138 -OMAGICPROGRAMHEADERS: FileSize: 4 -OMAGICPROGRAMHEADERS: MemSize: 12 -OMAGICPROGRAMHEADERS: Flags [ (0x6) -OMAGICPROGRAMHEADERS: PF_R (0x4) -OMAGICPROGRAMHEADERS: PF_W (0x2) -OMAGICPROGRAMHEADERS: ] -OMAGICPROGRAMHEADERS: Alignment: 4 -OMAGICPROGRAMHEADERS: } -OMAGICPROGRAMHEADERS: ] diff --git a/test/old-elf/X86_64/outputsegments.test b/test/old-elf/X86_64/outputsegments.test deleted file mode 100644 index 1c76b6eb855c..000000000000 --- a/test/old-elf/X86_64/outputsegments.test +++ /dev/null @@ -1,188 +0,0 @@ -# Tests that lld does not create separate segment if the input sections are part -# of the same output section - -# Build executable -# RUN: yaml2obj -format=elf -docnum 1 %s -o %t.o -# RUN: lld -flavor old-gnu -target x86_64 %t.o -o %t1.exe -static \ -# RUN: --no-align-segments --noinhibit-exec -# RUN: lld -flavor old-gnu -target x86_64 %t.o -o %t2.exe -static \ -# RUN: --noinhibit-exec -# RUN: llvm-readobj -program-headers %t1.exe | FileCheck %s -check-prefix=SEGMENTS -# RUN: llvm-readobj -program-headers %t2.exe | FileCheck %s -check-prefix=SEGMENTS -# -#SEGMENTS: VirtualAddress: 0x400000 -#SEGMENTS: PhysicalAddress: 0x400000 -#SEGMENTS: FileSize: 288 -#SEGMENTS: MemSize: 288 -#SEGMENTS: VirtualAddress: 0x404000 -#SEGMENTS: PhysicalAddress: 0x404000 -#SEGMENTS: FileSize: 16608 -#SEGMENTS: MemSize: 16608 -#SEGMENTS: Alignment: 16384 -# -# object ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .text.foo - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000002000 - Content: 554889E54883EC1048BF0000000000000000B000E800000000B9000000008945FC89C84883C4105DC3 - - Name: .rela.text.foo - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text.foo - Relocations: - - Offset: 0x000000000000000A - Symbol: .rodata.str1.1 - Type: R_X86_64_64 - Addend: 0 - - Offset: 0x0000000000000015 - Symbol: printf - Type: R_X86_64_PC32 - Addend: -4 - - Name: .text.bar - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000004000 - Content: 554889E54883EC1048BF0000000000000000B000E800000000B9000000008945FC89C84883C4105DC3 - - Name: .rela.text.bar - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text.bar - Relocations: - - Offset: 0x000000000000000A - Symbol: .rodata.str1.1 - Type: R_X86_64_64 - Addend: 7 - - Offset: 0x0000000000000015 - Symbol: printf - Type: R_X86_64_PC32 - Addend: -4 - - Name: .text.main - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E54883EC10C745FC00000000E8000000008945F8E8000000008B4DF801C189C84883C4105DC3 - - Name: .rela.text.main - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text.main - Relocations: - - Offset: 0x0000000000000010 - Symbol: foo - Type: R_X86_64_PC32 - Addend: -4 - - Offset: 0x0000000000000018 - Symbol: bar - Type: R_X86_64_PC32 - Addend: -4 - - Name: .rodata.str1.1 - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 48656C6C6F0A00576F726C640A00 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 005562756E747520636C616E672076657273696F6E20332E352E302D73766E3231373330342D317E6578703120286272616E636865732F72656C656173655F33352920286261736564206F6E204C4C564D20332E352E302900 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000037A5200017810011B0C070890010000180000001C000000000000002900000000410E108602430D060000001800000038000000000000002900000000410E108602430D060000001C00000054000000000000002900000000410E108602430D0600000000000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text.foo - Type: R_X86_64_PC32 - Addend: 0 - - Offset: 0x000000000000003C - Symbol: .text.bar - Type: R_X86_64_PC32 - Addend: 0 - - Offset: 0x0000000000000058 - Symbol: .text.main - Type: R_X86_64_PC32 - Addend: 0 -Symbols: - Local: - - Name: 1.c - Type: STT_FILE - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .text.foo - Type: STT_SECTION - Section: .text.foo - - Name: .text.bar - Type: STT_SECTION - Section: .text.bar - - Name: .text.main - Type: STT_SECTION - Section: .text.main - - Name: .rodata.str1.1 - Type: STT_SECTION - Section: .rodata.str1.1 - - Name: .comment - Type: STT_SECTION - Section: .comment - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: bar - Type: STT_FUNC - Section: .text.bar - Size: 0x0000000000000029 - - Name: foo - Type: STT_FUNC - Section: .text.foo - Size: 0x0000000000000029 - - Name: main - Type: STT_FUNC - Section: .text.main - Size: 0x0000000000000029 - - Name: printf -... diff --git a/test/old-elf/X86_64/reloc_r_x86_64_16.test b/test/old-elf/X86_64/reloc_r_x86_64_16.test deleted file mode 100644 index 093fbeb4f137..000000000000 --- a/test/old-elf/X86_64/reloc_r_x86_64_16.test +++ /dev/null @@ -1,59 +0,0 @@ -# Tests that lld can handle relocations of type R_X86_64_16 -#RUN: yaml2obj -format=elf -docnum 1 %s -o %t1.o -#RUN: lld -flavor old-gnu -target x86_64 %t1.o --noinhibit-exec -o %t2.out -static -#RUN: llvm-objdump -s %t2.out | FileCheck %s -#CHECK: Contents of section .data: -#CHECK: 401000 0210 ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: '0000' - - Name: .rela.data - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .data - Relocations: - - Offset: 0x0000000000000000 - Symbol: foo - Type: R_X86_64_16 - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Global: - - Name: bar - Type: STT_OBJECT - Section: .data - Size: 0x0000000000000008 - - Name: foo - Type: STT_OBJECT - Section: .data - Value: 0x0000000000000002 - Size: 0x0000000000000002 -... diff --git a/test/old-elf/X86_64/reloc_r_x86_64_pc16.test b/test/old-elf/X86_64/reloc_r_x86_64_pc16.test deleted file mode 100644 index c6e53ad636e8..000000000000 --- a/test/old-elf/X86_64/reloc_r_x86_64_pc16.test +++ /dev/null @@ -1,60 +0,0 @@ -# Tests that lld can handle relocations of type R_X86_64_PC16 -#RUN: yaml2obj -format=elf -docnum 1 %s -o %t1.o -#RUN: lld -flavor old-gnu -target x86_64 %t1.o --noinhibit-exec -o %t2.out -static -#RUN: llvm-objdump -s %t2.out | FileCheck %s -#CHECK: Contents of section .data: -#CHECK: 401000 0700 ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: '0000' - - Name: .rela.data - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .data - Relocations: - - Offset: 0x0000000000000000 - Symbol: foo - Type: R_X86_64_PC16 - Addend: 5 - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Global: - - Name: bar - Type: STT_OBJECT - Section: .data - Size: 0x0000000000000008 - - Name: foo - Type: STT_OBJECT - Section: .data - Value: 0x0000000000000002 - Size: 0x0000000000000002 -... diff --git a/test/old-elf/X86_64/reloc_r_x86_64_pc64.test b/test/old-elf/X86_64/reloc_r_x86_64_pc64.test deleted file mode 100644 index a7c5e88965c5..000000000000 --- a/test/old-elf/X86_64/reloc_r_x86_64_pc64.test +++ /dev/null @@ -1,60 +0,0 @@ -# Tests that lld can handle relocations of type R_X86_64_PC64 -#RUN: yaml2obj -format=elf -docnum 1 %s -o %t1.o -#RUN: lld -flavor old-gnu -target x86_64 %t1.o --noinhibit-exec -o %t2.out -static -#RUN: llvm-objdump -s %t2.out | FileCheck %s -#CHECK: Contents of section .data: -#CHECK: 401000 0a00 ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: '0000' - - Name: .rela.data - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .data - Relocations: - - Offset: 0x0000000000000000 - Symbol: foo - Type: R_X86_64_PC64 - Addend: 8 - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Global: - - Name: bar - Type: STT_OBJECT - Section: .data - Size: 0x0000000000000008 - - Name: foo - Type: STT_OBJECT - Section: .data - Value: 0x0000000000000002 - Size: 0x0000000000000002 -... diff --git a/test/old-elf/X86_64/rodata.test b/test/old-elf/X86_64/rodata.test deleted file mode 100644 index 6f85ac0423fd..000000000000 --- a/test/old-elf/X86_64/rodata.test +++ /dev/null @@ -1,9 +0,0 @@ -# This tests that the ordinals for all merge atoms and defined atoms have been -# set properly - -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/rodata.o --noinhibit-exec \ -RUN: --merge-strings -static -o %t1 -RUN: llvm-nm -n %t1 | FileCheck %s - -CHECK: {{[0-9a-f]+}} R _nl_default_default_domain -CHECK: {{[0-9a-f]+}} R _nl_default_default_dirname diff --git a/test/old-elf/X86_64/sectionchoice.test b/test/old-elf/X86_64/sectionchoice.test deleted file mode 100644 index 7ff838fed98d..000000000000 --- a/test/old-elf/X86_64/sectionchoice.test +++ /dev/null @@ -1,7 +0,0 @@ -# This tests that we are able to properly set the sectionChoice for DefinedAtoms -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/zerosizedsection.o \ -RUN: --noinhibit-exec -o %t --output-filetype=yaml -RUN: FileCheck %s < %t - -CHECK-NOT: section-choice: sectionCustomRequired - diff --git a/test/old-elf/X86_64/sectionmap.test b/test/old-elf/X86_64/sectionmap.test deleted file mode 100644 index 5fa04bd87051..000000000000 --- a/test/old-elf/X86_64/sectionmap.test +++ /dev/null @@ -1,22 +0,0 @@ -# This tests that we are able to merge the section .gcc_except_table, -# .data.rel.local, .data.rel.ro, any other sections that belong to .data -# into appropriate output sections -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/sectionmap.o \ -RUN: --noinhibit-exec -o %t -RUN: llvm-readobj -sections %t | FileCheck %s -check-prefix=VERIFYSECTIONHEADERS - -VERIFYSECTIONHEADERS: Section { -VERIFYSECTIONHEADERS: Name: .data -VERIFYSECTIONHEADERS: } -VERIFYSECTIONHEADERS: Section { -VERIFYSECTIONHEADERS: Name: .gcc_except_table -VERIFYSECTIONHEADERS: } -VERIFYSECTIONHEADERS: Section { -VERIFYSECTIONHEADERS: Name: .data.rel.local -VERIFYSECTIONHEADERS: } -VERIFYSECTIONHEADERS: Section { -VERIFYSECTIONHEADERS: Name: .data.rel.ro -VERIFYSECTIONHEADERS: } -VERIFYSECTIONHEADERS: Section { -VERIFYSECTIONHEADERS: Name: .bss -VERIFYSECTIONHEADERS: } diff --git a/test/old-elf/X86_64/startGroupEndGroup.test b/test/old-elf/X86_64/startGroupEndGroup.test deleted file mode 100644 index e79e436a6513..000000000000 --- a/test/old-elf/X86_64/startGroupEndGroup.test +++ /dev/null @@ -1,48 +0,0 @@ -# This tests functionality of --start-group, --end-group - -# This link should fail with unresolve symbol -RUN: not lld -flavor old-gnu -target x86_64 %p/Inputs/group/1.o \ -RUN: %p/Inputs/group/libfn.a %p/Inputs/group/libfn1.a -o x 2> %t.err - -# Test group -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/group/1.o --start-group \ -RUN: %p/Inputs/group/libfn.a %p/Inputs/group/libfn1.a --end-group -o %t1 - -# Mix object files in group -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/group/1.o --start-group \ -RUN: %p/Inputs/group/fn.o %p/Inputs/group/fn2.o \ -RUN: %p/Inputs/group/fn1.o --end-group -o %t2 - -# Mix Whole archive input, the group should not iterate the file libfn.a -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/group/1.o --start-group \ -RUN: --whole-archive %p/Inputs/group/libfn.a --no-whole-archive \ -RUN: %p/Inputs/group/libfn1.a --end-group -o %t3 - -# Defined symbols in a shared library. -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/group/1.o --start-group \ -RUN: %p/Inputs/group/libfn2.so %p/Inputs/group/fn1.o %p/Inputs/group/fn.o \ -RUN: --end-group -o %t4 - -# Test alias options too, as they are more widely used -# Test group -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/group/1.o '-(' \ -RUN: %p/Inputs/group/libfn.a %p/Inputs/group/libfn1.a '-)' -o %t1.alias - -# Mix object files in group -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/group/1.o '-(' \ -RUN: %p/Inputs/group/fn.o %p/Inputs/group/fn2.o \ -RUN: %p/Inputs/group/fn1.o '-)' -o %t2.alias - -# Mix Whole archive input, the group should not iterate the file libfn.a -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/group/1.o '-(' \ -RUN: --whole-archive %p/Inputs/group/libfn.a --no-whole-archive \ -RUN: %p/Inputs/group/libfn1.a '-)' -o %t3.alias - -RUN: llvm-nm %t1 | FileCheck -check-prefix=RESOLVEDEXTERNAL %s -RUN: llvm-nm %t2 | FileCheck -check-prefix=RESOLVEDEXTERNAL %s -RUN: llvm-nm %t3 | FileCheck -check-prefix=RESOLVEDEXTERNAL %s -RUN: llvm-nm %t1.alias | FileCheck -check-prefix=RESOLVEDEXTERNAL %s -RUN: llvm-nm %t2.alias | FileCheck -check-prefix=RESOLVEDEXTERNAL %s -RUN: llvm-nm %t3.alias | FileCheck -check-prefix=RESOLVEDEXTERNAL %s - -RESOLVEDEXTERNAL: {{[0-9a-z]+}} T fn2 diff --git a/test/old-elf/X86_64/startGroupEndGroupWithDynlib.test b/test/old-elf/X86_64/startGroupEndGroupWithDynlib.test deleted file mode 100644 index 30bfe1530f8e..000000000000 --- a/test/old-elf/X86_64/startGroupEndGroupWithDynlib.test +++ /dev/null @@ -1,10 +0,0 @@ -# This tests functionality of --start-group, --end-group with a dynamic library - -# Mix dynamic libraries/object files in group -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/group/1.o --start-group \ -RUN: %p/Inputs/group/libfn.so %p/Inputs/group/fn2.o \ -RUN: %p/Inputs/group/fn1.o --end-group -o %t1 - -RUN: llvm-nm %t1 | FileCheck -check-prefix=RESOLVEDEXTERNAL %s - -RESOLVEDEXTERNAL: {{[0-9a-z]+}} T fn2 diff --git a/test/old-elf/X86_64/staticlib-search.test b/test/old-elf/X86_64/staticlib-search.test deleted file mode 100644 index b84bd299f385..000000000000 --- a/test/old-elf/X86_64/staticlib-search.test +++ /dev/null @@ -1,6 +0,0 @@ -# This tests the functionality for finding the static library libfn.a for ELF -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/main.o -L%p/Inputs/ -lfn -o %t \ -RUN: --noinhibit-exec -static -t 2> %t1 -RUN: FileCheck %s < %t1 - -CHECK: {{[\/0-9A-Za-z_]+}}libfn.a diff --git a/test/old-elf/X86_64/undef.test b/test/old-elf/X86_64/undef.test deleted file mode 100644 index f948286a339b..000000000000 --- a/test/old-elf/X86_64/undef.test +++ /dev/null @@ -1,18 +0,0 @@ -# This tests the functionality that an undefined symbol thats defined in the -# commmand line pulls in the required object file from the archive library -# which is usually the usecase for it -RUN: lld -flavor old-gnu -target x86_64 -u fn %p/Inputs/libfn.a -o %t --noinhibit-exec -RUN: llvm-readobj -symbols %t | FileCheck -check-prefix=SYMFROMARCHIVE %s -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/libfn.a -o %t --noinhibit-exec -RUN: llvm-readobj -symbols %t | FileCheck %s - -SYMFROMARCHIVE: Symbol { -SYMFROMARCHIVE: Name: fn ({{[0-9]+}} -SYMFROMARCHIVE: Size: 11 -SYMFROMARCHIVE: Binding: Global (0x1) -SYMFROMARCHIVE: Type: Function (0x2) -SYMFROMARCHIVE: Other: 0 -SYMFROMARCHIVE: Section: .text -SYMFROMARCHIVE: } - -CHECK-NOT: Name: fn diff --git a/test/old-elf/X86_64/underscore-end.test b/test/old-elf/X86_64/underscore-end.test deleted file mode 100644 index 4ca0c94013ea..000000000000 --- a/test/old-elf/X86_64/underscore-end.test +++ /dev/null @@ -1,81 +0,0 @@ -# This tests verifies that the value of _end symbol is point to the right value -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/nmagic.o \ -RUN: --noinhibit-exec -o %t --nmagic -RUN: llvm-readobj -symbols %t | FileCheck -check-prefix=NMAGICABSSYMBOLS %s -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/nmagic.o \ -RUN: --noinhibit-exec -o %t --omagic -RUN: llvm-readobj -symbols %t | FileCheck -check-prefix=OMAGICABSSYMBOLS %s - -NMAGICABSSYMBOLS: Symbol { -NMAGICABSSYMBOLS: Name: __bss_start ({{[0-9]+}} -NMAGICABSSYMBOLS: Value: 0x40100C -NMAGICABSSYMBOLS: Size: 0 -NMAGICABSSYMBOLS: Binding: Global (0x1) -NMAGICABSSYMBOLS: Type: Object (0x1) -NMAGICABSSYMBOLS: Other: 0 -NMAGICABSSYMBOLS: Section: Absolute (0xFFF1) -NMAGICABSSYMBOLS: } -NMAGICABSSYMBOLS: Symbol { -NMAGICABSSYMBOLS: Name: __bss_end ({{[0-9]+}} -NMAGICABSSYMBOLS: Value: 0x40100C -NMAGICABSSYMBOLS: Size: 0 -NMAGICABSSYMBOLS: Binding: Global (0x1) -NMAGICABSSYMBOLS: Type: Object (0x1) -NMAGICABSSYMBOLS: Other: 0 -NMAGICABSSYMBOLS: Section: Absolute (0xFFF1) -NMAGICABSSYMBOLS: } -NMAGICABSSYMBOLS: Symbol { -NMAGICABSSYMBOLS: Name: _end ({{[0-9]+}} -NMAGICABSSYMBOLS: Value: 0x40100C -NMAGICABSSYMBOLS: Size: 0 -NMAGICABSSYMBOLS: Binding: Global (0x1) -NMAGICABSSYMBOLS: Type: Object (0x1) -NMAGICABSSYMBOLS: Other: 0 -NMAGICABSSYMBOLS: Section: Absolute (0xFFF1) -NMAGICABSSYMBOLS: } -NMAGICABSSYMBOLS: Symbol { -NMAGICABSSYMBOLS: Name: end ({{[0-9]+}} -NMAGICABSSYMBOLS: Value: 0x40100C -NMAGICABSSYMBOLS: Size: 0 -NMAGICABSSYMBOLS: Binding: Global (0x1) -NMAGICABSSYMBOLS: Type: Object (0x1) -NMAGICABSSYMBOLS: Other: 0 -NMAGICABSSYMBOLS: Section: Absolute (0xFFF1) -NMAGICABSSYMBOLS: } - -OMAGICABSSYMBOLS: Symbol { -OMAGICABSSYMBOLS: Name: __bss_start ({{[0-9]+}}) -OMAGICABSSYMBOLS: Value: 0x400144 -OMAGICABSSYMBOLS: Size: 0 -OMAGICABSSYMBOLS: Binding: Global (0x1) -OMAGICABSSYMBOLS: Type: Object (0x1) -OMAGICABSSYMBOLS: Other: 0 -OMAGICABSSYMBOLS: Section: Absolute (0xFFF1) -OMAGICABSSYMBOLS: } -OMAGICABSSYMBOLS: Symbol { -OMAGICABSSYMBOLS: Name: __bss_end ({{[0-9]+}} -OMAGICABSSYMBOLS: Value: 0x400144 -OMAGICABSSYMBOLS: Size: 0 -OMAGICABSSYMBOLS: Binding: Global (0x1) -OMAGICABSSYMBOLS: Type: Object (0x1) -OMAGICABSSYMBOLS: Other: 0 -OMAGICABSSYMBOLS: Section: Absolute (0xFFF1) -OMAGICABSSYMBOLS: } -OMAGICABSSYMBOLS: Symbol { -OMAGICABSSYMBOLS: Name: _end ({{[0-9]+}} -OMAGICABSSYMBOLS: Value: 0x400144 -OMAGICABSSYMBOLS: Size: 0 -OMAGICABSSYMBOLS: Binding: Global (0x1) -OMAGICABSSYMBOLS: Type: Object (0x1) -OMAGICABSSYMBOLS: Other: 0 -OMAGICABSSYMBOLS: Section: Absolute (0xFFF1) -OMAGICABSSYMBOLS: } -OMAGICABSSYMBOLS: Symbol { -OMAGICABSSYMBOLS: Name: end ({{[0-9]+}} -OMAGICABSSYMBOLS: Value: 0x400144 -OMAGICABSSYMBOLS: Size: 0 -OMAGICABSSYMBOLS: Binding: Global (0x1) -OMAGICABSSYMBOLS: Type: Object (0x1) -OMAGICABSSYMBOLS: Other: 0 -OMAGICABSSYMBOLS: Section: Absolute (0xFFF1) -OMAGICABSSYMBOLS: } diff --git a/test/old-elf/X86_64/weak-override.test b/test/old-elf/X86_64/weak-override.test deleted file mode 100644 index 25cb9d5d687f..000000000000 --- a/test/old-elf/X86_64/weak-override.test +++ /dev/null @@ -1,45 +0,0 @@ -# Test for weak symbol getting overridden -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/weak.o %p/Inputs/ovrd.o \ -RUN: -o %t --noinhibit-exec -RUN: llvm-nm %t | FileCheck -check-prefix=WEAKORDER %s -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/weak.o \ -RUN: %p/Inputs/ovrd.o -o %t2 --output-filetype=yaml --noinhibit-exec -RUN: FileCheck -check-prefix=WEAKATOMSORDER %s < %t2 - -WEAKORDER: {{[0-9a-c]+}} T f - -WEAKATOMSORDER: references: -WEAKATOMSORDER: - kind: layout-after -WEAKATOMSORDER: offset: 0 -WEAKATOMSORDER: target: fn -WEAKATOMSORDER: - name: fn -WEAKATOMSORDER: references: -WEAKATOMSORDER: - kind: layout-after -WEAKATOMSORDER: offset: 0 -WEAKATOMSORDER: target: [[CONSTSTRA:[-a-zA-Z0-9_]+]] -WEAKATOMSORDER: - ref-name: [[CONSTSTRA]] -WEAKATOMSORDER: scope: global -WEAKATOMSORDER: content: [ 55, 48, 89, E5, BF, 00, 00, 00, 00, E8, 00, 00, -WEAKATOMSORDER: 00, 00, 5D, C3 ] -WEAKATOMSORDER: references: -WEAKATOMSORDER: - kind: layout-after -WEAKATOMSORDER: offset: 0 -WEAKATOMSORDER: target: main -WEAKATOMSORDER: - name: main -WEAKATOMSORDER: scope: global -WEAKATOMSORDER: content: [ 55, 48, 89, E5, B8, 00, 00, 00, 00, E8, 00, 00, -WEAKATOMSORDER: 00, 00, B8, 00, 00, 00, 00, 5D, C3 ] -WEAKATOMSORDER: references: -WEAKATOMSORDER: - kind: R_X86_64_PC32 -WEAKATOMSORDER: offset: 10 -WEAKATOMSORDER: target: f -WEAKATOMSORDER: addend: -4 -WEAKATOMSORDER: - ref-name: {{[0-9A-Z]+}} -WEAKATOMSORDER: references: -WEAKATOMSORDER: - kind: layout-after -WEAKATOMSORDER: offset: 0 -WEAKATOMSORDER: target: f -WEAKATOMSORDER: - name: f -WEAKATOMSORDER: scope: global -WEAKATOMSORDER: content: [ 55, 48, 89, E5, BF, 00, 00, 00, 00, E8, 00, 00, -WEAKATOMSORDER: 00, 00, 5D, C3 ] diff --git a/test/old-elf/X86_64/weak-zero-sized.test b/test/old-elf/X86_64/weak-zero-sized.test deleted file mode 100644 index 93e27a355d64..000000000000 --- a/test/old-elf/X86_64/weak-zero-sized.test +++ /dev/null @@ -1,26 +0,0 @@ -# Test for zero sized weak atoms, there is only a single weak atom -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/weak-zero-sized.o -o %t \ -RUN: --noinhibit-exec -RUN: llvm-nm %t | FileCheck -check-prefix=WEAKORDER %s -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/weak-zero-sized.o \ -RUN: --output-filetype=yaml -o %t2 --noinhibit-exec -RUN: FileCheck -check-prefix=WEAKATOMSORDER %s < %t2 - -WEAKORDER: 004001a4 T _start - -WEAKATOMSORDER: alignment: 4 -WEAKATOMSORDER: - kind: layout-after -WEAKATOMSORDER: offset: 0 -WEAKATOMSORDER: target: [[TARGETC:[-a-zA-Z0-9_]+]] -WEAKATOMSORDER: - name: [[TARGETA:[-a-zA-Z0-9_]+]] -WEAKATOMSORDER: scope: global -WEAKATOMSORDER: merge: as-weak -WEAKATOMSORDER: alignment: 4 -WEAKATOMSORDER: references: -WEAKATOMSORDER: - kind: layout-after -WEAKATOMSORDER: offset: 0 -WEAKATOMSORDER: target: [[TARGETC]] -WEAKATOMSORDER: - ref-name: [[TARGETC]] -WEAKATOMSORDER: scope: global -WEAKATOMSORDER: content: [ C3 ] -WEAKATOMSORDER: alignment: 4 diff --git a/test/old-elf/X86_64/weaksym.test b/test/old-elf/X86_64/weaksym.test deleted file mode 100644 index 9e4f2da9bdba..000000000000 --- a/test/old-elf/X86_64/weaksym.test +++ /dev/null @@ -1,77 +0,0 @@ -# Tests that an executable with a weak undefine will put this symbol in the -# dynamic symbol table if the executable has a dynamic relocation against this -# symbol. - -#RUN: yaml2obj --format elf %s -o %t.o -#RUN: lld -flavor old-gnu -target x86_64 -e main %t.o -o %t1 -#RUN: llvm-readobj -dt %t1 | FileCheck -check-prefix CHECKSYMS %s - -#CHECKSYMS: Name: x@ -#CHECKSYMS-NEXT: Value: 0x0 -#CHECKSYMS-NEXT: Size: 0 -#CHECKSYMS-NEXT: Binding: Weak (0x2) -#CHECKSYMS-NEXT: Type: None (0x0) -#CHECKSYMS-NEXT: Other: 0 -#CHECKSYMS-NEXT: Section: Undefined (0x0) - -# The object file above corresponds to the following C program compiled with -# -fPIC: -# extern int *x __attribute__((weak)); -# -# int main() { -# if (x) -# return 1; -# return 0; -# } - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E5488B0500000000C745FC00000000488138000000000F840C000000C745FC01000000E907000000C745FC000000008B45FC5DC3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000007 - Symbol: x - Type: R_X86_64_GOTPCREL - Addend: -4 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Global: - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x0000000000000037 - - Name: _GLOBAL_OFFSET_TABLE_ - Weak: - - Name: x diff --git a/test/old-elf/X86_64/yamlinput.test b/test/old-elf/X86_64/yamlinput.test deleted file mode 100644 index 1c51811eec95..000000000000 --- a/test/old-elf/X86_64/yamlinput.test +++ /dev/null @@ -1,166 +0,0 @@ -# This tests the functionality that lld is able to read -# an input YAML from a previous link - -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/initfini.o \ -RUN: --noinhibit-exec --output-filetype=yaml -o %t.objtxt -RUN: lld -flavor old-gnu -target x86_64-linux %t.objtxt \ -RUN: --noinhibit-exec -o %t1 -RUN: llvm-readobj -sections %t1 | FileCheck %s -check-prefix=SECTIONS - -SECTIONS: Section { -SECTIONS: Index: 0 -SECTIONS: Name: (0) -SECTIONS: Type: SHT_NULL (0x0) -SECTIONS: Flags [ (0x0) -SECTIONS: ] -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 1 -SECTIONS: Name: .interp -SECTIONS: Type: SHT_PROGBITS (0x1) -SECTIONS: Flags [ (0x2) -SECTIONS: SHF_ALLOC (0x2) -SECTIONS: ] -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 2 -SECTIONS: Name: .hash -SECTIONS: Type: SHT_HASH (0x5) -SECTIONS: Flags [ (0x2) -SECTIONS: SHF_ALLOC (0x2) -SECTIONS: ] -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 3 -SECTIONS: Name: .dynsym -SECTIONS: Type: SHT_DYNSYM (0xB) -SECTIONS: Flags [ (0x2) -SECTIONS: SHF_ALLOC (0x2) -SECTIONS: ] -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 4 -SECTIONS: Name: .dynstr -SECTIONS: Type: SHT_STRTAB (0x3) -SECTIONS: Flags [ (0x2) -SECTIONS: SHF_ALLOC (0x2) -SECTIONS: ] -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 5 -SECTIONS: Name: .text -SECTIONS: Type: SHT_PROGBITS (0x1) -SECTIONS: Flags [ (0x6) -SECTIONS: SHF_ALLOC (0x2) -SECTIONS: SHF_EXECINSTR (0x4) -SECTIONS: ] -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 6 -SECTIONS: Name: .rodata -SECTIONS: Type: SHT_PROGBITS (0x1) -SECTIONS: Flags [ (0x2) -SECTIONS: SHF_ALLOC (0x2) -SECTIONS: ] -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 7 -SECTIONS: Name: .eh_frame -SECTIONS: Type: SHT_PROGBITS (0x1) -SECTIONS: Flags [ (0x2) -SECTIONS: SHF_ALLOC (0x2) -SECTIONS: ] -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 8 -SECTIONS: Name: .eh_frame_hdr -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 9 -SECTIONS: Name: .init_array -SECTIONS: Type: SHT_PROGBITS (0x1) -SECTIONS: Flags [ (0x3) -SECTIONS: SHF_ALLOC (0x2) -SECTIONS: SHF_WRITE (0x1) -SECTIONS: ] -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 10 -SECTIONS: Name: .fini_array -SECTIONS: Type: SHT_PROGBITS (0x1) -SECTIONS: Flags [ (0x3) -SECTIONS: SHF_ALLOC (0x2) -SECTIONS: SHF_WRITE (0x1) -SECTIONS: ] -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 11 -SECTIONS: Name: .dynamic -SECTIONS: Type: SHT_DYNAMIC (0x6) -SECTIONS: Flags [ (0x3) -SECTIONS: SHF_ALLOC (0x2) -SECTIONS: SHF_WRITE (0x1) -SECTIONS: ] -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 12 -SECTIONS: Name: .got.plt -SECTIONS: Type: SHT_PROGBITS (0x1) -SECTIONS: Flags [ (0x3) -SECTIONS: SHF_ALLOC (0x2) -SECTIONS: SHF_WRITE (0x1) -SECTIONS: ] -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 13 -SECTIONS: Name: .data -SECTIONS: Type: SHT_PROGBITS (0x1) -SECTIONS: Flags [ (0x3) -SECTIONS: SHF_ALLOC (0x2) -SECTIONS: SHF_WRITE (0x1) -SECTIONS: ] -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 14 -SECTIONS: Name: .bss -SECTIONS: Type: SHT_NOBITS (0x8) -SECTIONS: Flags [ (0x3) -SECTIONS: SHF_ALLOC (0x2) -SECTIONS: SHF_WRITE (0x1) -SECTIONS: ] -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 15 -SECTIONS: Name: .comment -SECTIONS: Type: SHT_PROGBITS (0x1) -SECTIONS: Flags [ (0x0) -SECTIONS: ] -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 16 -SECTIONS: Name: .note.GNU-stack -SECTIONS: Type: SHT_PROGBITS (0x1) -SECTIONS: Flags [ (0x0) -SECTIONS: ] -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 17 -SECTIONS: Name: .shstrtab -SECTIONS: Type: SHT_STRTAB (0x3) -SECTIONS: Flags [ (0x0) -SECTIONS: ] -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 18 -SECTIONS: Name: .symtab -SECTIONS: Type: SHT_SYMTAB (0x2) -SECTIONS: Flags [ (0x0) -SECTIONS: ] -SECTIONS: } -SECTIONS: Section { -SECTIONS: Index: 19 -SECTIONS: Name: .strtab -SECTIONS: Type: SHT_STRTAB (0x3) -SECTIONS: Flags [ (0x0) -SECTIONS: ] -SECTIONS: } diff --git a/test/old-elf/abs-dup.objtxt b/test/old-elf/abs-dup.objtxt deleted file mode 100644 index c662c9b44b4a..000000000000 --- a/test/old-elf/abs-dup.objtxt +++ /dev/null @@ -1,19 +0,0 @@ -# Tests handling an absolute symbol with no name -# RUN: lld -flavor old-gnu -target x86_64 -r %s \ -# RUN: --output-filetype=yaml | FileCheck %s - -absolute-atoms: - - name: abs - scope: static - value: 0x10 - - name: '' - scope: static - value: 0x15 - -# CHECK: absolute-atoms: -# CHECK: - name: abs -# CHECK: scope: static -# CHECK: value: 0x0000000000000010 -# CHECK: - name: '' -# CHECK: scope: static -# CHECK: value: 0x0000000000000015 diff --git a/test/old-elf/abs.test b/test/old-elf/abs.test deleted file mode 100644 index f542582bfa85..000000000000 --- a/test/old-elf/abs.test +++ /dev/null @@ -1,19 +0,0 @@ -# -# Source File: -# .local absGlobalSymbol -# .set absLocalSymbol,0xC0000 -# .type absLocalSymbol, @object -# .globl absGlobalSymbol -# .set absGlobalSymbol,0xD0000 -# .type absGlobalSymbol, @object - -# built using: "gcc -m32" -# -RUN: lld -flavor old-gnu -target i386 --output-filetype=yaml -r %p/Inputs/abs-test.i386 | FileCheck -check-prefix=YAML %s - -YAML: absolute-atoms: -YAML: - name: absLocalSymbol -YAML: value: {{0x[0]+C0000}} -YAML: - name: absGlobalSymbol -YAML: scope: global -YAML: value: {{0x[0]+D0000}} diff --git a/test/old-elf/allowduplicates.objtxt b/test/old-elf/allowduplicates.objtxt deleted file mode 100644 index b2f263148b60..000000000000 --- a/test/old-elf/allowduplicates.objtxt +++ /dev/null @@ -1,41 +0,0 @@ -# RUN: lld -flavor old-gnu -target x86_64 --allow-multiple-definition %s \ -# RUN: %p/Inputs/allowduplicates.objtxt \ -# RUN: --output-filetype=yaml --noinhibit-exec | FileCheck %s -# -# RUN: not lld -flavor old-gnu -target x86_64 %s %p/Inputs/allowduplicates.objtxt \ -# RUN: --output-filetype=yaml \ -# RUN: --noinhibit-exec 2>&1 | FileCheck -check-prefix=ERROR %s -# -# RUN: lld -flavor old-gnu -target x86_64 -z muldefs %s \ -# RUN: %p/Inputs/allowduplicates.objtxt \ -# RUN: --noinhibit-exec --output-filetype=yaml | FileCheck %s - ---- -defined-atoms: - - name: .text - alignment: 16 - section-choice: custom-required - section-name: .text - - name: main - scope: global - content: [ B8, 00, 00, 00, 00, C7, 44, 24, FC, 00, 00, 00, - 00, C3 ] - alignment: 16 - section-choice: custom-required - section-name: .text ---- - -# CHECK: defined-atoms: -# CHECK: - name: .text -# CHECK: alignment: 16 -# CHECK: section-choice: custom-required -# CHECK: section-name: .text -# CHECK: - name: main -# CHECK: scope: global -# CHECK: content: [ B8, 00, 00, 00, 00, C7, 44, 24, FC, 00, 00, 00, -# CHECK: 00, C3 ] -# CHECK: alignment: 16 -# CHECK: section-choice: custom-required -# CHECK: section-name: .text - -# ERROR: duplicate symbol error diff --git a/test/old-elf/archive-elf-forceload.test b/test/old-elf/archive-elf-forceload.test deleted file mode 100644 index db5ba6cdfaa2..000000000000 --- a/test/old-elf/archive-elf-forceload.test +++ /dev/null @@ -1,43 +0,0 @@ -# Tests the functionality of archive libraries reading -# and resolution -# Note: The binary files would not be required once we have support to generate -# binary archives from textual(yaml) input -# -# Tests generated using the source files below -# main file -# int main() -# { -# fn(); -# return 0; -# } -# -# archive file -# int fn() -# { -# return 0; -# } -# -# int fn1() -# { -# return 0; -# } -# gcc -c main.c fn.c fn1.c - -RUN: lld -flavor old-gnu -target x86_64-linux -e main %p/Inputs/mainobj.x86_64 \ -RUN: --whole-archive %p/Inputs/libfnarchive.a --no-whole-archive --output-filetype=yaml \ -RUN: | FileCheck -check-prefix FORCELOAD %s - -FORCELOAD: defined-atoms: -FORCELOAD: - name: fn1 -FORCELOAD: scope: global -FORCELOAD: content: [ 55, 48, 89, E5, B8, 00, 00, 00, 00, 5D, C3 ] -FORCELOAD: - name: fn -FORCELOAD: scope: global -FORCELOAD: content: [ 55, 48, 89, E5, B8, 00, 00, 00, 00, 5D, C3 ] -FORCELOAD: absolute-atoms: -FORCELOAD: - name: main.c -FORCELOAD: value: 0x0 -FORCELOAD: - name: fn1.c -FORCELOAD: value: 0x0 -FORCELOAD: - name: fn.c -FORCELOAD: value: 0x0 diff --git a/test/old-elf/archive-elf.test b/test/old-elf/archive-elf.test deleted file mode 100644 index 7784eb9279dc..000000000000 --- a/test/old-elf/archive-elf.test +++ /dev/null @@ -1,38 +0,0 @@ -# Tests the functionality of archive libraries reading -# and resolution -# Note: The binary files would not be required once we have support to generate -# binary archives from textual(yaml) input -# -# Tests generated using the source files below -# main file -# int main() -# { -# fn(); -# return 0; -# } -# -# archive file -# int fn() -# { -# return 0; -# } -# -# int fn1() -# { -# return 0; -# } -# gcc -c main.c fn.c fn1.c - -RUN: lld -flavor old-gnu -target x86_64-linux --output-filetype=yaml -r \ -RUN: %p/Inputs/mainobj.x86_64 %p/Inputs/libfnarchive.a | \ -RUN: FileCheck -check-prefix NOFORCELOAD %s - -NOFORCELOAD: defined-atoms: -NOFORCELOAD: - name: fn -NOFORCELOAD: scope: global -NOFORCELOAD: content: [ 55, 48, 89, E5, B8, 00, 00, 00, 00, 5D, C3 ] -NOFORCELOAD: absolute-atoms: -NOFORCELOAD: - name: main.c -NOFORCELOAD: value: 0x0 -NOFORCELOAD: - name: fn.c -NOFORCELOAD: value: 0x0 diff --git a/test/old-elf/as-needed.test b/test/old-elf/as-needed.test deleted file mode 100644 index bcebfbac2f24..000000000000 --- a/test/old-elf/as-needed.test +++ /dev/null @@ -1,15 +0,0 @@ -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/use-shared.x86-64 \ -RUN: --as-needed %p/Inputs/shared.so-x86-64 %p/Inputs/libifunc.x86-64.so \ -RUN: -o %t1 -e main --allow-shlib-undefined -RUN: llvm-readobj -dynamic-table %t1 | FileCheck %s -check-prefix AS_NEEDED - -AS_NEEDED: NEEDED SharedLibrary (shared.so-x86-64) -AS_NEEDED-NOT: NEEDED SharedLibrary (libifunc.x86-64.so) - -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/use-shared.x86-64 \ -RUN: %p/Inputs/shared.so-x86-64 %p/Inputs/libifunc.x86-64.so \ -RUN: -o %t2 -e main --allow-shlib-undefined -RUN: llvm-readobj -dynamic-table %t2 | FileCheck %s -check-prefix NO_AS_NEEDED - -NO_AS_NEEDED: NEEDED SharedLibrary (shared.so-x86-64) -NO_AS_NEEDED: NEEDED SharedLibrary (libifunc.x86-64.so) diff --git a/test/old-elf/branch.test b/test/old-elf/branch.test deleted file mode 100644 index 116fd0f07c5e..000000000000 --- a/test/old-elf/branch.test +++ /dev/null @@ -1,34 +0,0 @@ -RUN: lld -flavor old-gnu -target hexagon -static --output-filetype=yaml \ -RUN: %p/Inputs/branch-test.hexagon %p/Inputs/target-test.hexagon --noinhibit-exec | FileCheck %s -check-prefix hexagon-yaml -RUN: lld -flavor old-gnu -target hexagon -e target -o %t1 \ -RUN: %p/Inputs/branch-test.hexagon %p/Inputs/target-test.hexagon --noinhibit-exec -RUN: llvm-readobj -h %t1 | FileCheck -check-prefix=hexagon-readobj %s - -hexagon-yaml: - name: back -hexagon-yaml: scope: global -hexagon-yaml: content: [ 00, C0, 00, 7F, 00, C0, 00, 5A, 00, 00, 00, 00, -hexagon-yaml: 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 ] -hexagon-yaml: references: -hexagon-yaml: - kind: -hexagon-yaml: offset: 4 -hexagon-yaml: target: target - -hexagon-yaml: - name: target -hexagon-yaml: scope: global -hexagon-yaml: content: [ 00, C0, 00, 5A ] -hexagon-yaml: references: -hexagon-yaml: - kind: -hexagon-yaml: offset: 0 -hexagon-yaml: target: back - - -hexagon-readobj: ElfHeader { -hexagon-readobj: Ident { -hexagon-readobj: Class: 32-bit (0x1) -hexagon-readobj: DataEncoding: LittleEndian (0x1) -hexagon-readobj: FileVersion: 1 -hexagon-readobj: OS/ABI: SystemV (0x0) -hexagon-readobj: ABIVersion: 0 -hexagon-readobj: } -hexagon-readobj: Type: Executable (0x2) -hexagon-readobj: Machine: EM_HEXAGON (0xA4) diff --git a/test/old-elf/check.test b/test/old-elf/check.test deleted file mode 100644 index 3fc11728e12d..000000000000 --- a/test/old-elf/check.test +++ /dev/null @@ -1,39 +0,0 @@ -# This tests the basic functionality of ordering data and functions as they -# appear in the inputs -RUN: lld -flavor old-gnu -target i386 -e global_func --noinhibit-exec --output-filetype=yaml \ -RUN: %p/Inputs/object-test.elf-i386 -o %t -RUN: FileCheck %s -check-prefix ELF-i386 < %t -RUN: lld -flavor old-gnu -target hexagon -e global_func --noinhibit-exec --output-filetype=yaml \ -RUN: %p/Inputs/object-test.elf-hexagon -o %t1 -RUN: FileCheck %s -check-prefix ELF-hexagon < %t1 - -ELF-i386: defined-atoms: -ELF-i386: - name: global_func -ELF-i386: - name: static_func -ELF-i386: - name: weak_func -ELF-i386: - name: hidden_func -ELF-i386: - name: no_dead_strip -ELF-i386: - name: no_special_section_func -ELF-i386: - name: global_variable -ELF-i386: - name: uninitialized_static_variable -ELF-i386: - name: special_section_func -ELF-i386: undefined-atoms: -ELF-i386: - name: puts -ELF-i386: absolute-atoms: -ELF-i386: - name: sample.c - -ELF-hexagon: - name: global_func -ELF-hexagon: - name: static_func -ELF-hexagon: - name: weak_func -ELF-hexagon: - name: hidden_func -ELF-hexagon: - name: no_dead_strip -ELF-hexagon: - name: no_special_section_func -ELF-hexagon: - name: global_variable -ELF-hexagon: - name: uninitialized_static_variable -ELF-hexagon: - name: special_section_func -ELF-hexagon: undefined-atoms: -ELF-hexagon: - name: puts -ELF-hexagon: absolute-atoms: -ELF-hexagon: - name: sample.c -ELF-hexagon: scope: static -ELF-hexagon: value: 0x0000000000000000 diff --git a/test/old-elf/checkrodata.test b/test/old-elf/checkrodata.test deleted file mode 100644 index 71304a443b8b..000000000000 --- a/test/old-elf/checkrodata.test +++ /dev/null @@ -1,9 +0,0 @@ - -RUN: lld -flavor old-gnu -target i386 -o %t1 %p/Inputs/rodata-test.i386 --noinhibit-exec -RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix=i386 %s -RUN: lld -flavor old-gnu -target hexagon -o %t2 %p/Inputs/rodata-test.hexagon --noinhibit-exec -RUN: llvm-objdump -section-headers %t2 | FileCheck -check-prefix=hexagon %s - -i386: .rodata 00000004 0000000000000114 DATA - -hexagon: .rodata 00000004 0000000000000114 DATA diff --git a/test/old-elf/common.test b/test/old-elf/common.test deleted file mode 100644 index e337ac399140..000000000000 --- a/test/old-elf/common.test +++ /dev/null @@ -1,10 +0,0 @@ -RUN: lld -flavor old-gnu -target x86_64-linux -o %t %p/Inputs/relocs.x86-64 \ -RUN: -e _start -static -RUN: llvm-readobj -t %t | FileCheck %s - -CHECK: Symbol { -CHECK: Name: i -CHECK-NEXT: Value: -CHECK-NEXT: Size: -CHECK-NEXT: Binding: -CHECK-NEXT: Type: Object diff --git a/test/old-elf/consecutive-weak-sym-defs.test b/test/old-elf/consecutive-weak-sym-defs.test deleted file mode 100644 index 0120aa126551..000000000000 --- a/test/old-elf/consecutive-weak-sym-defs.test +++ /dev/null @@ -1,81 +0,0 @@ -#Tests that multiple consecutive weak symbol definitions do not confuse the -#ELF reader. For example: -# -# my_weak_func1: -# my_weak_func2: -# my_weak_func3: -# code -# -#If my_weak_func2 is merged to other definition, this should not disturb the -#definition my_weak_func1 to "code". -# -# -#RUN: yaml2obj -format=elf %p/Inputs/consecutive-weak-defs.o.yaml -o=%t1.o -#RUN: yaml2obj -format=elf %p/Inputs/main-with-global-def.o.yaml -o=%t2.o -#RUN: lld -flavor old-gnu -target x86_64 %t1.o %t2.o -e=main -o %t1 -#RUN: obj2yaml %t1 | FileCheck -check-prefix CHECKLAYOUT %s -# -# Check that the layout has not been changed: -# -#CHECKLAYOUT: Name: .text -#CHECKLAYOUT-NEXT: Type: -#CHECKLAYOUT-NEXT: Flags: -#CHECKLAYOUT-NEXT: Address: -#CHECKLAYOUT-NEXT: AddressAlign: -#CHECKLAYOUT-NEXT: Content: 554889E5E8020000005DC3554889E5B8640000005DC3 -# ^~~> my_func ^~~> my_weak_func -# -# -# -#Our two input files were produced by the following code: -# -#Inputs/consecutive-weak-defs.o.yaml (this one is in assembly to allow us to -# easily define multiple labels) -# -# .text -# .globl my_func -# .type my_func,@function -# my_func: -# pushq %rbp -# movq %rsp, %rbp -# callq my_weak_func -# popq %rbp -# retq -# .Ltmp0: -# .size my_func, .Ltmp0-my_func -# -# .text -# .weak my_weak_func -# .type my_weak_func,@function -# .weak my_weak_func2 -# .type my_weak_func2,@function -# .weak my_weak_func3 -# .type my_weak_func3,@function -# my_weak_func: -# my_weak_func2: -# my_weak_func3: -# pushq %rbp -# movq %rsp, %rbp -# movl $100, %eax -# popq %rbp -# retq -# .Ltmp1: -# .size my_weak_func, .Ltmp1-my_weak_func -# .size my_weak_func2, .Ltmp1-my_weak_func2 -# .size my_weak_func3, .Ltmp1-my_weak_func3 -# -#Inputs/main-with-global-def.o.yaml: -# -# int my_func(); -# -# int my_weak_func2() { -# return 200; -# } -# -# int main() { -# return my_func(); -# } -# -#------------------------------------------------------------------------------- -# The net effect is that this program should return 100. - diff --git a/test/old-elf/defsym.objtxt b/test/old-elf/defsym.objtxt deleted file mode 100644 index 7fdc20d4dd93..000000000000 --- a/test/old-elf/defsym.objtxt +++ /dev/null @@ -1,31 +0,0 @@ -# RUN: lld -flavor old-gnu -target x86_64 --defsym=foo=0x1234 -r %s \ -# RUN: --output-filetype=yaml | FileCheck -check-prefix=ABS %s - -# RUN: lld -flavor old-gnu -target x86_64 --defsym=foo=main -r %s \ -# RUN: --output-filetype=yaml | FileCheck -check-prefix=ALIAS %s - -# RUN: lld -flavor old-gnu -target x86_64 --defsym foo=main -r %s \ -# RUN: --output-filetype=yaml | FileCheck -check-prefix=ALIAS %s - -defined-atoms: - - name: main - scope: global - content: [ B8, 00, 00, 00, 00, C7, 44, 24, FC, 00, 00, 00, 00, C3 ] - alignment: 16 - section-choice: custom-required - section-name: .text - -# ABS: absolute-atoms: -# ABS: - name: foo -# ABS: scope: global -# ABS: value: 0x0000000000001234 - -# ALIAS: defined-atoms: -# ALIAS: - name: foo -# ALIAS: scope: global -# ALIAS: section-choice: custom-required -# ALIAS: section-name: .text -# ALIAS: references: -# ALIAS: - kind: layout-after -# ALIAS: offset: 0 -# ALIAS: target: main diff --git a/test/old-elf/discard-all.test b/test/old-elf/discard-all.test deleted file mode 100644 index 7fca435008ab..000000000000 --- a/test/old-elf/discard-all.test +++ /dev/null @@ -1,88 +0,0 @@ -# Test that -x/--discard all works. -# -#RUN: yaml2obj -format=elf %s -o=%t.o -#RUN: lld -flavor old-gnu -target x86_64 %t.o -e=main -x -o %t1 -#RUN: llvm-objdump -t %t1 | FileCheck %s - -#CHECK-NOT: 0000000000400210 l F .text 00000009 local - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_FREEBSD - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E54883EC10C745FC00000000E81C000000B9000000008945F889C84883C4105DC36666662E0F1F840000000000554889E58B45FC5DC3 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 004672656542534420636C616E672076657273696F6E20332E342E312028746167732F52454C454153455F33342F646F74312D66696E616C203230383033322920323031343035313200 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000017A5200017810011B0C070890010000180000001C000000000000002400000000410E108602430D060000001800000038000000000000000900000000410E108602430D06000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text - Type: R_X86_64_PC32 - - Offset: 0x000000000000003C - Symbol: .text - Type: R_X86_64_PC32 - Addend: 48 -Symbols: - Local: - - Name: local - Type: STT_FUNC - Section: .text - Value: 0x0000000000000030 - Size: 0x0000000000000009 - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .comment - Type: STT_SECTION - Section: .comment - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x0000000000000024 -... diff --git a/test/old-elf/discard-locals.test b/test/old-elf/discard-locals.test deleted file mode 100644 index d1a0918949ad..000000000000 --- a/test/old-elf/discard-locals.test +++ /dev/null @@ -1,65 +0,0 @@ -# Test that -X/--discard-locals works. -# -#RUN: yaml2obj -format=elf %s -o=%t.o -#RUN: lld -flavor old-gnu -target x86_64 %t.o -shared -X -o %t1 -#RUN: llvm-objdump -t %t1 | FileCheck %s - -#CHECK-NOT: 0000000000400121 l .rodata 00000000 .Lsym8 - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_FREEBSD - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 00000000F20F100D00000000C3 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .rodata.str1.1 - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000008 - Symbol: .Lsym8 - Type: R_X86_64_PC32 - Addend: -4 -Symbols: - Local: - - Name: .Lsym8 - Section: .rodata.str1.1 - - Name: test - Section: .text - Value: 0x000000000000000C - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .rodata.str1.1 - Type: STT_SECTION - Section: .rodata.str1.1 -... diff --git a/test/old-elf/dynamic-segorder.test b/test/old-elf/dynamic-segorder.test deleted file mode 100644 index e9143d83f0f6..000000000000 --- a/test/old-elf/dynamic-segorder.test +++ /dev/null @@ -1,17 +0,0 @@ -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/tls.x86-64 \ -RUN: %p/Inputs/shared.so-x86-64 -o %t -e main --allow-shlib-undefined \ -RUN: --defsym=__tls_get_addr=0 -RUN: llvm-objdump -p %t | FileCheck %s - -CHECK: PHDR -CHECK: flags r-x -CHECK: INTERP -CHECK: flags r-- -CHECK: LOAD -CHECK: flags r-x -CHECK: LOAD -CHECK: flags rw- -CHECK: DYNAMIC -CHECK: flags rw- -CHECK: TLS -CHECK: flags rw- diff --git a/test/old-elf/dynamic-undef.test b/test/old-elf/dynamic-undef.test deleted file mode 100644 index fc661684b19b..000000000000 --- a/test/old-elf/dynamic-undef.test +++ /dev/null @@ -1,38 +0,0 @@ -# -# This test creates a executable and tests the options that are used to -# to create an executable and a shared library -# -# This test will fail because there are unresolved symbols from the shared -# library and we are passing --no-allow-shlib-undefined -RUN: not lld -flavor old-gnu -target x86_64-linux %p/Inputs/tls.x86-64 \ -RUN: %p/Inputs/shared.so-x86-64 -o %t -e main --no-allow-shlib-undefined 2> %t1 -RUN: FileCheck -check-prefix=EXEC %s < %t1 -# This test will pass because of --allow-shlib-undefined -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/tls.x86-64 \ -RUN: %p/Inputs/shared.so-x86-64 -o %t -e main --allow-shlib-undefined \ -RUN: --defsym=__tls_get_addr=0 -# This test will pass becase --allow-shlib-undefined is the default. -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/tls.x86-64 \ -RUN: %p/Inputs/shared.so-x86-64 -o %t -e main \ -RUN: --defsym=__tls_get_addr=0 -# Building shared libraries should not fail when there is a undefined symbol. -# Test creation of shared library, this should pass because we are using -# shared option and by default, dynamic library wouldn't create undefined atoms -# from the input shared library -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/tls.x86-64 \ -RUN: %p/Inputs/shared.so-x86-64 -o %t.usenoundefines -e main -shared -RUN: llvm-readobj -symbols %t.usenoundefines | FileCheck %s -check-prefix=SHLIB-NOUNDEF -# Test creation of shared library, this should fail because we are using -# shared option setting the options to use the shared library undefines to -# create undefined atoms from the input shared library -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/tls.x86-64 \ -RUN: %p/Inputs/shared.so-x86-64 -o %t.useundefines -e main -shared \ -RUN: --use-shlib-undefines --no-allow-shlib-undefined 2> %t2 -RUN: llvm-readobj -symbols %t.useundefines | FileCheck -check-prefix=SHLIB-UNDEF-SYMBOLS %s - -EXEC: Undefined symbol: {{.+[\\/]}}shared.so-x86-64: puts -SHLIB: Undefined symbol: {{.+[\\/]}}shared.so-x86-64: puts -EXEC-NOT: Undefined symbol: {{.+[\\/]}}shared.so-x86-64: weakfoo -SHLIB-NOT: Undefined symbol: {{.+[\\/]}}shared.so-x86-64: weakfoo -SHLIB-NOUNDEF-NOT: Name: puts -SHLIB-UNDEF-SYMBOLS: Name: puts diff --git a/test/old-elf/dynamic.test b/test/old-elf/dynamic.test deleted file mode 100644 index 2b548a7aaf5e..000000000000 --- a/test/old-elf/dynamic.test +++ /dev/null @@ -1,80 +0,0 @@ -# Checks functionality of dynamic executables -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/use-shared.x86-64 \ -RUN: %p/Inputs/shared.so-x86-64 -o %t -e main --allow-shlib-undefined \ -RUN: -rpath /l1:/l2 -rpath /l3 -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/use-shared.x86-64 \ -RUN: %p/Inputs/shared.so-x86-64 --output-filetype=yaml -o %t2 --allow-shlib-undefined \ -RUN: --noinhibit-exec -RUN: llvm-objdump -p %t >> %t2 -RUN: llvm-readobj -s -dyn-symbols -dynamic-table %t >> %t2 -RUN: FileCheck %s < %t2 - -CHECK: name: main -CHECK: kind: R_X86_64_PC32 -CHECK: offset: 18 -CHECK: target: [[PLTNAME:[-a-zA-Z0-9_]+]] - -CHECK: name: [[PLTNAME]] -CHECK: type: stub - -CHECK: type: got -CHECK: references: -CHECK: kind: R_X86_64_JUMP_SLOT - -CHECK: shared-library-atoms: -CHECK: name: foo -CHECK: load-name: shared.so-x86-64 - -CHECK: PHDR off 0x{{0+}}40 -CHECK: INTERP -CHECK: flags r-- - -CHECK: Section { -CHECK: Name: .hash -CHECK-NEXT: Type: SHT_HASH -CHECK-NEXT: Flags [ -CHECK-NEXT: SHF_ALLOC -CHECK-NEXT: ] -CHECK-NEXT: Address: -CHECK-NEXT: Offset: -CHECK-NEXT: Size: 32 -CHECK-NEXT: Link: -CHECK-NEXT: Info: -CHECK-NEXT: AddressAlignment: 8 -CHECK-NEXT: EntrySize: -CHECK-NEXT: } - -CHECK: DynamicSymbols [ -CHECK: Symbol { -CHECK: Name: foo -CHECK-NEXT: Value: 0 -CHECK-NEXT: Size: -CHECK-NEXT: Binding: Global -CHECK-NEXT: Type: Function -CHECK: } -CHECK: Symbol { -CHECK: Name: i -CHECK-NEXT: Value: 0 -CHECK-NEXT: Size: -CHECK-NEXT: Binding: Global -CHECK-NEXT: Type: Object -CHECK: } - -CHECK: DynamicSection [ (15 entries) -CHECK: Tag Type Name/Value -CHECK: 0x0000000000000004 HASH -CHECK: 0x0000000000000005 STRTAB -CHECK: 0x0000000000000006 SYMTAB -CHECK: 0x000000000000000A STRSZ -CHECK: 0x000000000000000B SYMENT 24 -CHECK: 0x0000000000000007 RELA -CHECK: 0x0000000000000008 RELASZ 24 -CHECK: 0x0000000000000009 RELAENT 24 -CHECK: 0x0000000000000002 PLTRELSZ 24 -CHECK: 0x0000000000000003 PLTGOT -CHECK: 0x0000000000000014 PLTREL RELA -CHECK: 0x0000000000000017 JMPREL -CHECK: 0x0000000000000001 NEEDED SharedLibrary (shared.so-x86-64) -CHECK: 0x000000000000000F RPATH /l1:/l2:/l3 -CHECK: 0x0000000000000000 NULL 0x0 -CHECK: ] diff --git a/test/old-elf/eh_frame_hdr.test b/test/old-elf/eh_frame_hdr.test deleted file mode 100644 index 74383b8dbc5b..000000000000 --- a/test/old-elf/eh_frame_hdr.test +++ /dev/null @@ -1,30 +0,0 @@ -#RUN: yaml2obj -format=elf %s > %t -#RUN: lld -flavor old-gnu -target x86_64-linux %t --noinhibit-exec \ -#RUN: -o %t1 -#RUN: llvm-objdump -s %t1 | FileCheck %s - -!ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - -Sections: -- Name: .eh_frame - Type: SHT_PROGBITS - Content: "00" - AddressAlign: 8 - Flags: [SHF_ALLOC] - -Symbols: - Local: - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - -# CHECK: Contents of section .eh_frame: -# CHECK-NEXT: 4001e0 00 -# CHECK-NEXT: Contents of section .eh_frame_hdr: -# CHECK-NEXT: 4001e8 011bffff f4ffffff -# ^ 0x4001e0 - 0x4001e8 - 4 = 0xfffffff4 diff --git a/test/old-elf/entry.objtxt b/test/old-elf/entry.objtxt deleted file mode 100644 index 6590d139c417..000000000000 --- a/test/old-elf/entry.objtxt +++ /dev/null @@ -1,58 +0,0 @@ -# Tests entry point handling -# -# Test generated using the source file below: -# -# int main() -# { -# return 0; -# } -# - -# RUN: lld -flavor old-gnu -target x86_64 %s -e _entrypoint --noinhibit-exec -o %t1 -# RUN: llvm-nm -n %t1 | FileCheck %s -# -# CHECK: U _entrypoint -# CHECK: 004001e0 T main -# CHECK: 00401000 D _DYNAMIC -# CHECK: 00401060 A _end -# CHECK: 00401060 A end - -defined-atoms: - - name: .text - alignment: 16 - section-choice: custom-required - section-name: .text - - name: main - scope: global - content: [ B8, 00, 00, 00, 00, C7, 44, 24, FC, 00, 00, 00, - 00, C3 ] - alignment: 16 - section-choice: custom-required - section-name: .text - - name: .data - type: data - alignment: 4 - section-choice: custom-required - section-name: .data - - name: .bss - type: zero-fill - alignment: 4 - section-choice: custom-required - section-name: .bss - - name: .note.GNU-stack - section-choice: custom-required - section-name: .note.GNU-stack - permissions: r-- - - name: .eh_frame - content: [ 14, 00, 00, 00, 00, 00, 00, 00, 01, 7A, 52, 00, - 01, 78, 10, 01, 1B, 0C, 07, 08, 90, 01, 00, 00, - 14, 00, 00, 00, 1C, 00, 00, 00, 00, 00, 00, 00, - 0E, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 ] - alignment: 8 - section-choice: custom-required - section-name: .eh_frame - permissions: r-- - references: - - kind: R_X86_64_PC32 - offset: 32 - target: .text diff --git a/test/old-elf/export-dynamic.test b/test/old-elf/export-dynamic.test deleted file mode 100644 index b88961597ea0..000000000000 --- a/test/old-elf/export-dynamic.test +++ /dev/null @@ -1,98 +0,0 @@ -# Tests the --export-dynamic (-E) flag. When creating a dynamic executable and -# receiving this flag, the linker should export all globally visible symbols in -# its dynamic symbol table. - -#RUN: yaml2obj -format=elf %s -o=%t.o -#RUN: lld -flavor old-gnu -target x86_64 -E %t.o -e=main -o %t1 -#RUN: llvm-readobj -dt %t1 | FileCheck -check-prefix CHECKSYMS %s - -#CHECKSYMS: myfunc1@ -#CHECKSYMS: main@ -#CHECKSYMS: myvar1@ - -# The object file below was generated with the following code: -# -# (command line clang -c prog.c -o prog.o) -# -# int myvar1 = 22; -# -# static int mysecretvar = 11; -# -# int myfunc1() { -# return 23; -# } -# -# static int mysecretfunc() { -# return 42; -# } -# -# int main() { -# return mysecretfunc() + mysecretvar; -# } ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E5B8170000005DC30F1F440000554889E54883EC10C745FC00000000E81C000000030425000000004883C4105DC36666666666662E0F1F840000000000554889E5B82A0000005DC3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000027 - Symbol: .data - Type: R_X86_64_32S - Addend: 4 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: 160000000B000000 - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 -Symbols: - Local: - - Name: mysecretfunc - Type: STT_FUNC - Section: .text - Value: 0x0000000000000040 - Size: 0x000000000000000B - - Name: mysecretvar - Type: STT_OBJECT - Section: .data - Value: 0x0000000000000004 - Size: 0x0000000000000004 - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Global: - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000010 - Size: 0x0000000000000021 - - Name: myfunc1 - Type: STT_FUNC - Section: .text - Size: 0x000000000000000B - - Name: myvar1 - Type: STT_OBJECT - Section: .data - Size: 0x0000000000000004 diff --git a/test/old-elf/filenotfound.test b/test/old-elf/filenotfound.test deleted file mode 100644 index 5020e9cf9b74..000000000000 --- a/test/old-elf/filenotfound.test +++ /dev/null @@ -1,3 +0,0 @@ -# Check that a file that cannot be found results in a proper error message -RUN: not lld -flavor old-gnu -target x86_64 %p/Inputs/nofile.o 2>&1 | FileCheck %s -#CHECK: lld: cannot find file {{.+[\\/]}}nofile.o diff --git a/test/old-elf/gnulinkonce/gnulinkonce-report-discarded-reference.test b/test/old-elf/gnulinkonce/gnulinkonce-report-discarded-reference.test deleted file mode 100644 index c05a06fab32b..000000000000 --- a/test/old-elf/gnulinkonce/gnulinkonce-report-discarded-reference.test +++ /dev/null @@ -1,145 +0,0 @@ -# Tests that the linker is able to read .gnu.linkonce sections and link them -# appropriately. The testcase has been created by using the following source -# code. -# TODO: This test should produce a discarded reference error message which it -# does not currently. -# linkoncea.s -# .section .gnu.linkonce.d.dummy,"aw" -#bar: -# .long 0 -# linkonceb.s -# .section .gnu.linkonce.d.dummy,"aw" -#foo: -# .long 0 -# .section .blah, "aw" -# .long foo -#RUN: yaml2obj -format=elf -docnum 1 %s -o %t.linkonce1a.o -#RUN: yaml2obj -format=elf -docnum 2 %s -o %t.linkonce1b.o -#RUN: lld -flavor old-gnu -target x86_64 %t.linkonce1a.o %t.linkonce1b.o \ -#RUN: --noinhibit-exec --output-filetype=yaml -o %t2.out.yaml -#RUN: lld -flavor old-gnu -target x86_64 %t.linkonce1a.o %t.linkonce1b.o \ -#RUN: --noinhibit-exec -o %t2.out -#RUN: FileCheck %s -check-prefix=CHECKGNULINKONCE < %t2.out.yaml -#RUN: llvm-readobj -sections %t2.out | FileCheck %s -check-prefix=CHECKGNULINKONCESECTIONS -#CHECKGNULINKONCE: - name: .gnu.linkonce.d.dummy -#CHECKGNULINKONCE: scope: global -#CHECKGNULINKONCE: type: gnu-linkonce -#CHECKGNULINKONCE: section-choice: custom-required -#CHECKGNULINKONCE: section-name: .gnu.linkonce.d.dummy -#CHECKGNULINKONCE: permissions: rw- -#CHECKGNULINKONCE: references: -#CHECKGNULINKONCE: - kind: group-child -#CHECKGNULINKONCE: offset: 0 -#CHECKGNULINKONCE: target: bar -#CHECKGNULINKONCESECTIONS: Section { -#CHECKGNULINKONCESECTIONS: Name: .gnu.linkonce.d.dummy -#CHECKGNULINKONCESECTIONS: Type: SHT_PROGBITS -#CHECKGNULINKONCESECTIONS: Flags [ (0x3) -#CHECKGNULINKONCESECTIONS: SHF_ALLOC (0x2) -#CHECKGNULINKONCESECTIONS: SHF_WRITE (0x1) -#CHECKGNULINKONCESECTIONS: ] -#CHECKGNULINKONCESECTIONS: Size: 4 -#CHECKGNULINKONCESECTIONS: } ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .gnu.linkonce.d.dummy - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '00000000' -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .gnu.linkonce.d.dummy - Type: STT_SECTION - Section: .gnu.linkonce.d.dummy - - Name: bar - Section: .gnu.linkonce.d.dummy -... ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .gnu.linkonce.d.dummy - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '00000000' - - Name: .blah - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '00000000' - - Name: .rela.blah - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .blah - Relocations: - - Offset: 0x0000000000000000 - Symbol: foo - Type: R_X86_64_32 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .gnu.linkonce.d.dummy - Type: STT_SECTION - Section: .gnu.linkonce.d.dummy - - Name: foo - Section: .gnu.linkonce.d.dummy - - Name: .blah - Type: STT_SECTION - Section: .blah -... diff --git a/test/old-elf/gnulinkonce/gnulinkonce-report-undef.test b/test/old-elf/gnulinkonce/gnulinkonce-report-undef.test deleted file mode 100644 index f91123f0efad..000000000000 --- a/test/old-elf/gnulinkonce/gnulinkonce-report-undef.test +++ /dev/null @@ -1,127 +0,0 @@ -# Tests that the linker is able to read .gnu.linkonce sections and link them -# appropriately. The testcase has been created by using the following source -# code. This test checks that the linker produces an undefined error. -# linkoncea.s -# .section .gnu.linkonce.d.dummy,"aw" -#bar: -# .long 0 -# linkonceb.s -# .section .gnu.linkonce.d.dummy,"aw" -# .global foo -#foo: -# .long 0 -# .section .blah, "aw" -# .long foo -#RUN: yaml2obj -format=elf -docnum 1 %s -o %t.linkonce1a.o -#RUN: yaml2obj -format=elf -docnum 2 %s -o %t.linkonce1b.o -#RUN: not lld -flavor old-gnu -target x86_64 %t.linkonce1a.o %t.linkonce1b.o \ -#RUN: --output-filetype=yaml -o %t2.out.yaml 2>&1 | FileCheck \ -#RUN: -check-prefix=UNDEFS %s -#RUN: not lld -flavor old-gnu -target x86_64 %t.linkonce1a.o %t.linkonce1b.o \ -#RUN: -o %t2.out 2>&1 | FileCheck -check-prefix=UNDEFS %s -#UNDEFS: Undefined symbol: {{.*}} foo ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .gnu.linkonce.d.dummy - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '00000000' -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .gnu.linkonce.d.dummy - Type: STT_SECTION - Section: .gnu.linkonce.d.dummy - - Name: bar - Section: .gnu.linkonce.d.dummy -... ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .gnu.linkonce.d.dummy - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '00000000' - - Name: .blah - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '00000000' - - Name: .rela.blah - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .blah - Relocations: - - Offset: 0x0000000000000000 - Symbol: foo - Type: R_X86_64_32 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .gnu.linkonce.d.dummy - Type: STT_SECTION - Section: .gnu.linkonce.d.dummy - - Name: .blah - Type: STT_SECTION - Section: .blah - Global: - - Name: foo - Section: .gnu.linkonce.d.dummy -... diff --git a/test/old-elf/gnulinkonce/gnulinkonce.test b/test/old-elf/gnulinkonce/gnulinkonce.test deleted file mode 100644 index eacd41d6ded5..000000000000 --- a/test/old-elf/gnulinkonce/gnulinkonce.test +++ /dev/null @@ -1,149 +0,0 @@ -# Tests that the linker is able to read .gnu.linkonce sections and link them -# appropriately. The testcase has been created by using the following source -# code -# linkonce1a.s -# ------------ -# .section .gnu.linkonce.d.dummy,"aw" -#bar: -# .long 0 -# linkonce1b.s -# ------------ -# .globl main -# .globl start -# .globl _start -# .globl __start -# .text -#main: -#start: -#_start: -#__start: -# .long 0 -# -# .section .gnu.linkonce.d.dummy,"aw" -#foo: -# .long 0 -#RUN: yaml2obj -format=elf -docnum 1 %s -o %t.linkonce1a.o -#RUN: yaml2obj -format=elf -docnum 2 %s -o %t.linkonce1b.o -#RUN: lld -flavor old-gnu -target x86_64 %t.linkonce1a.o %t.linkonce1b.o \ -#RUN: --noinhibit-exec --output-filetype=yaml -o %t2.out.yaml -#RUN: lld -flavor old-gnu -target x86_64 %t.linkonce1a.o %t.linkonce1b.o \ -#RUN: --noinhibit-exec -o %t2.out -#RUN: FileCheck %s -check-prefix=CHECKGNULINKONCE < %t2.out.yaml -#RUN: llvm-readobj -sections %t2.out | FileCheck %s -check-prefix=CHECKGNULINKONCESECTIONS -#CHECKGNULINKONCE: - name: .gnu.linkonce.d.dummy -#CHECKGNULINKONCE: scope: global -#CHECKGNULINKONCE: type: gnu-linkonce -#CHECKGNULINKONCE: section-choice: custom-required -#CHECKGNULINKONCE: section-name: .gnu.linkonce.d.dummy -#CHECKGNULINKONCE: permissions: rw- -#CHECKGNULINKONCE: references: -#CHECKGNULINKONCE: - kind: group-child -#CHECKGNULINKONCE: offset: 0 -#CHECKGNULINKONCE: target: bar -#CHECKGNULINKONCE: - kind: group-child -#CHECKGNULINKONCE: offset: 0 -#CHECKGNULINKONCESECTIONS: Section { -#CHECKGNULINKONCESECTIONS: Name: .gnu.linkonce.d.dummy -#CHECKGNULINKONCESECTIONS: Type: SHT_PROGBITS -#CHECKGNULINKONCESECTIONS: Flags [ (0x3) -#CHECKGNULINKONCESECTIONS: SHF_ALLOC (0x2) -#CHECKGNULINKONCESECTIONS: SHF_WRITE (0x1) -#CHECKGNULINKONCESECTIONS: ] -#CHECKGNULINKONCESECTIONS: Size: 4 -#CHECKGNULINKONCESECTIONS: } ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .gnu.linkonce.d.dummy - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '00000000' -Symbols: - Local: - - Name: bar - Section: .gnu.linkonce.d.dummy - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .gnu.linkonce.d.dummy - Type: STT_SECTION - Section: .gnu.linkonce.d.dummy -... ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '00000000' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .gnu.linkonce.d.dummy - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '00000000' -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .gnu.linkonce.d.dummy - Type: STT_SECTION - Section: .gnu.linkonce.d.dummy - - Name: foo - Section: .gnu.linkonce.d.dummy - Global: - - Name: main - Section: .text - - Name: start - Section: .text - - Name: _start - Section: .text - - Name: __start - Section: .text -... diff --git a/test/old-elf/gotpcrel.test b/test/old-elf/gotpcrel.test deleted file mode 100644 index b8695f1aedfb..000000000000 --- a/test/old-elf/gotpcrel.test +++ /dev/null @@ -1,21 +0,0 @@ -# This test checks that GOTPCREL entries are being handled properly -RUN: lld -flavor old-gnu -target x86_64-linux -static -e main --output-filetype=yaml \ -RUN: --noinhibit-exec %p/Inputs/gotpcrel.x86-64 \ -RUN: | FileCheck %s -check-prefix=YAML - -YAML: name: main -YAML: references: -YAML: kind: R_X86_64_GOTPCREL -YAML: offset: 3 -YAML: target: [[NULLGOT:[a-zA-Z0-9_]+]] -YAML: kind: R_X86_64_GOTPCREL -YAML: offset: 10 -YAML: target: [[MAINGOT:[a-zA-Z0-9_]+]] - -YAML: name: [[NULLGOT]] -YAML: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] -YAML-NOT: references: - -YAML: name: [[MAINGOT]] -YAML: kind: R_X86_64_64 -YAML: target: main diff --git a/test/old-elf/gottpoff.test b/test/old-elf/gottpoff.test deleted file mode 100644 index 969874e538a5..000000000000 --- a/test/old-elf/gottpoff.test +++ /dev/null @@ -1,119 +0,0 @@ -# Test that GOTTPOFF reloc generates an outstanding R_X86_64_TPOFF64 -# to be processed at startup time. -# Reference: Ulrich Drepper's "ELF Handling for Thread-Local storage" - -#RUN: yaml2obj -format=elf %s -o %t.o -#RUN: lld -flavor old-gnu -target x86_64 %t.o -o %t -e=main --defsym=__tls_get_addr=0 -#RUN: llvm-readobj -r %t | FileCheck %s -# -#CHECK: Section (5) .rela.dyn { -#CHECK: 0x401098 R_X86_64_TPOFF64 tls2 0x0 -#CHECK: } - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_FREEBSD - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: E819000000640304250000000064030425000000006403042500000000C3488B0500000000648B00C3488D3D00000000E800000000488D8000000000C3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000009 - Symbol: tls1 - Type: R_X86_64_TPOFF32 - - Offset: 0x0000000000000011 - Symbol: tls0 - Type: R_X86_64_TPOFF32 - - Offset: 0x0000000000000019 - Symbol: tls2 - Type: R_X86_64_TPOFF32 - - Offset: 0x0000000000000021 - Symbol: tls2 - Type: R_X86_64_GOTTPOFF - Addend: -4 - - Offset: 0x000000000000002C - Symbol: tls0 - Type: R_X86_64_TLSLD - Addend: -4 - - Offset: 0x0000000000000031 - Symbol: __tls_get_addr - Type: R_X86_64_PLT32 - Addend: -4 - - Offset: 0x0000000000000038 - Symbol: tls0 - Type: R_X86_64_DTPOFF32 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Size: 8 - - Name: .tbss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x0000000000000004 - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x0000000000000004 - Content: '01000000' -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .tbss - Type: STT_SECTION - Section: .tbss - - Name: .tdata - Type: STT_SECTION - Section: .tdata - Global: - - Name: GOTTPOFF - Type: STT_FUNC - Section: .text - Value: 0x000000000000001E - - Name: TLSLD - Type: STT_FUNC - Section: .text - Value: 0x0000000000000029 - - Name: main - Type: STT_FUNC - Section: .text - - Name: tls0 - Type: STT_TLS - Section: .tbss - Size: 0x0000000000000004 - - Name: tls1 - Type: STT_TLS - Section: .tbss - Value: 0x0000000000000004 - Size: 0x0000000000000004 - - Name: tls2 - Type: STT_TLS - Section: .tdata - Size: 0x0000000000000004 - - Name: _GLOBAL_OFFSET_TABLE_ - - Name: __tls_get_addr -... diff --git a/test/old-elf/group-cmd-search.test b/test/old-elf/group-cmd-search.test deleted file mode 100644 index 1d7f5ee43367..000000000000 --- a/test/old-elf/group-cmd-search.test +++ /dev/null @@ -1,134 +0,0 @@ -/* - XFAIL: win32 - - This test does not pass on Windows because a path starting with - "/" is not considered as an absolute path. (It needs a drive - letter.) -*/ - -/* - In general the linker scripts's GROUP command works like a pair - of command line options --start-group/--end-group. But there is - a difference in the files look up algorithm. - - The --start-group/--end-group commands use a trivial approach: - a) If the path has '-l' prefix, add 'lib' prefix and '.a'/'.so' - suffix and search the path through library search directories. - b) Otherwise, use the path 'as-is'. - - The GROUP command implements more compicated approach: - a) If the path has '-l' prefix, add 'lib' prefix and '.a'/'.so' - suffix and search the path through library search directories. - b) If the path does not have '-l' prefix, and sysroot is configured, - and the path starts with the / character, and the script being - processed is located inside the sysroot, search the path under - the sysroot. Otherwise, try to open the path in the current - directory. If it is not found, search through library search - directories. -*/ - -/* - This link should finish successfully. The --start-group/--end-group - contains an existing absolute path to the file. - -RUN: lld -flavor old-gnu -target x86_64 -shared \ -RUN: -L%p/Inputs %p/Inputs/use-shared.x86-64 \ -RUN: --start-group %p/Inputs/shared.so-x86-64 --end-group -o %t1 -*/ - -/* - This link should fail with unknown input file format error. - There is no shared.so-x86-64 file in the current directory. - -RUN: not \ -RUN: lld -flavor old-gnu -target x86_64 -shared \ -RUN: -L%p/Inputs %p/Inputs/use-shared.x86-64 \ -RUN: --start-group shared.so-x86-64 --end-group -o %t2 -*/ - -/* - This link should fail with unknown input file format error. - The absolute path /shared.so-x86-64 does not exist and the linker - should not attempt to search it under the sysroot directory. - -RUN: not \ -RUN: lld -flavor old-gnu -target x86_64 -shared --sysroot=%p/Inputs \ -RUN: -L%p/Inputs %p/Inputs/use-shared.x86-64 \ -RUN: --start-group /shared.so-x86-64 --end-group -o %t3 -*/ - -/* - This link should finish successfully. The group-cmd-search-1.ls - script contains "GROUP ( shared.so-x86-64 )" command and the linker - has to search shared.so-x86-64 through the library search paths. - -RUN: lld -flavor old-gnu -target x86_64 -shared \ -RUN: -L%p/Inputs %p/Inputs/use-shared.x86-64 \ -RUN: %p/Inputs/group-cmd-search-1.ls -o %t4 -*/ - -/* - This link should fail with unknown input file format error. - The group-cmd-search-2.ls script contains GROUP command with - a non-existing absolute path but there is no --sysroot argument. - -RUN: not \ -RUN: lld -flavor old-gnu -target x86_64 -shared \ -RUN: -L%p/Inputs %p/Inputs/use-shared.x86-64 \ -RUN: %p/Inputs/group-cmd-search-2.ls -o %t5 -*/ - -/* - This link should finish successfully. The group-cmd-search-2.ls - script contains GROUP command with an absolute path and the sysroot - directory is provided. The linker has to search the absolute path - under the sysroot directory. - -RUN: lld -flavor old-gnu -target x86_64 -shared --sysroot=%p/Inputs \ -RUN: -L%p/Inputs %p/Inputs/use-shared.x86-64 \ -RUN: %p/Inputs/group-cmd-search-2.ls -o %t6 -*/ - -/* - This link should finish successfully. The group-cmd-search-2.ls - script contains GROUP command with an absolute path and the sysroot - directory is provided. The linker has to search the absolute path - under the sysroot directory. - -RUN: lld -flavor old-gnu -target x86_64 -shared --sysroot=%p/Inputs/../Inputs \ -RUN: -L%p/Inputs %p/Inputs/use-shared.x86-64 \ -RUN: %p/Inputs/group-cmd-search-2.ls -o %t6 -*/ - -/* - This link should finish successfully. The group-cmd-search-3.ls - script contains GROUP command with two elements. The first one - has a -l: form and should be found by iterating through - lib dirs and searching the 'path' name exactly. The second element - has a -l form and should be found by constructing a full - library name lib.a and iterating through lib dirs. - -RUN: lld -flavor old-gnu -target x86_64 -shared \ -RUN: -L%p/Inputs %p/Inputs/use-shared.x86-64 \ -RUN: %p/Inputs/group-cmd-search-3.ls -o %t8 -*/ - -/* - This link should fail with unknown input file format error. - The linker script from this file contains GROUP with an absolute - path which can be found under provided sysroot directory. - But the linker script itself is not under the sysroot. - -RUN: not \ -RUN: lld -flavor old-gnu -target x86_64 -shared --sysroot=%p/Inputs \ -RUN: -L%p/Inputs %p/Inputs/use-shared.x86-64 \ -RUN: %s -o %t7 -*/ - -/* -RUN: lld -flavor old-gnu -target x86_64 -shared \ -RUN: -L%p/Inputs %p/Inputs/use-shared.x86-64 \ -RUN: -l:group-cmd-search-1.ls -o %t9 -*/ - -GROUP ( /shared.so-x86-64 ) diff --git a/test/old-elf/hexagon-quickdata-sort.test b/test/old-elf/hexagon-quickdata-sort.test deleted file mode 100644 index 98488b75ceb7..000000000000 --- a/test/old-elf/hexagon-quickdata-sort.test +++ /dev/null @@ -1,12 +0,0 @@ -RUN: lld -flavor old-gnu -target hexagon %p/Inputs/quickdata-sort-test.o.elf-hexagon -o %t1 --noinhibit-exec -RUN: llvm-nm -n %t1 | FileCheck %s -check-prefix=quickdataSort - -quickdataSort: 00002000 D A1 -quickdataSort: 00002001 D AA1 -quickdataSort: 00002002 D B1 -quickdataSort: 00002004 D BB1 -quickdataSort: 00002008 D C1 -quickdataSort: 0000200c D CC1 -quickdataSort: 00002010 D D1 -quickdataSort: 00002018 D DD1 - diff --git a/test/old-elf/hexagon-quickdata-sortcommon.test b/test/old-elf/hexagon-quickdata-sortcommon.test deleted file mode 100644 index d4d7d6a617e6..000000000000 --- a/test/old-elf/hexagon-quickdata-sortcommon.test +++ /dev/null @@ -1,16 +0,0 @@ -RUN: lld -flavor old-gnu -target hexagon -o %t1 --noinhibit-exec \ -RUN: %p/Inputs/quickdata-sortcommon-test.o.elf-hexagon -RUN: llvm-nm -n %t1 | FileCheck %s -check-prefix=quickdataSortCommon - -quickdataSortCommon: 00002000 D A1 -quickdataSortCommon: 00002001 D AA1 -quickdataSortCommon: 00002002 D AAA1 -quickdataSortCommon: 00002004 D B1 -quickdataSortCommon: 00002006 D BB1 -quickdataSortCommon: 00002008 D BBB1 -quickdataSortCommon: 0000200c D C1 -quickdataSortCommon: 00002010 D CC1 -quickdataSortCommon: 00002014 D CCC1 -quickdataSortCommon: 00002018 D D1 -quickdataSortCommon: 00002020 D DD1 -quickdataSortCommon: 00002028 D DDD1 diff --git a/test/old-elf/ifunc.test b/test/old-elf/ifunc.test deleted file mode 100644 index 0aa317a24e6f..000000000000 --- a/test/old-elf/ifunc.test +++ /dev/null @@ -1,69 +0,0 @@ -# REQUIRES: x86 - -# This test checks that IRELATIVE relocations are created for symbols that -# need relocation even for static links. -RUN: lld -flavor old-gnu -target x86_64-linux --output-filetype=yaml -r \ -RUN: %p/Inputs/ifunc.x86-64 | FileCheck %s - -RUN: lld -flavor old-gnu -target x86_64-linux --output-filetype=yaml --noinhibit-exec \ -RUN: %p/Inputs/ifunc.x86-64 %p/Inputs/ifunc.cpp.x86-64 \ -RUN: | FileCheck %s --check-prefix=PLT - -RUN: lld -flavor old-gnu -target x86_64-linux -o %t %p/Inputs/ifunc.x86-64 \ -RUN: -e main -static %p/Inputs/ifunc.cpp.x86-64 -RUN: llvm-objdump -d -s %t| FileCheck %s --check-prefix=BIN -RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=RELATIVEADDEND - -# Test that STT_GNU_IFUNC symbols have type Code in SharedLibraryAtom. -RUN: lld -flavor old-gnu -target x86_64-linux --output-filetype=yaml \ -RUN: --noinhibit-exec %p/Inputs/ifunc.cpp.x86-64 -L%p/Inputs -lifunc.x86-64 \ -RUN: | FileCheck %s --check-prefix=SHARED - -PLT: defined-atoms: - -PLT: name: plt -PLT: scope: global -PLT: references: -PLT: kind: R_X86_64_PC32 -PLT: target: [[PLTNAME:[-a-zA-Z0-9_]+]] - -PLT: name: main -PLT: scope: global -PLT: references: -PLT: kind: R_X86_64_PC32 -PLT: target: [[PLTNAME]] - -// Make sure the target of main's relocation is a stub with a PC32 relocation. -// This relocation is to the got atom, but you can't really write that check in -// FileCheck. -PLT: name: -PLT: type: stub -PLT: references -PLT: kind: R_X86_64_PC32 - -// Make sure there's a got entry with a IRELATIVE relocation. -PLT: type: got -PLT: references: -PLT: kind: R_X86_64_IRELATIVE -PLT: target: hey - -CHECK: name: hey -CHECK: scope: global -CHECK: type: resolver - - -// This is a horribly brittle test. We need a way to do arithmetic on captured -// variables. -BIN: {{[0-9a-f]+}}: ff 25 {{[0-9a-f]+}} {{[0-9a-f]+}} 00 00 jmpq *{{[0-9]+}}(%rip) -BIN: .got.plt: -BIN-NEXT: {{[0-9a-f]+}} 00000000 00000000 - -RELATIVEADDEND: Relocations [ -RELATIVEADDEND-NEXT: Section (1) .rela.plt { -RELATIVEADDEND-NEXT: 0x401000 R_X86_64_IRELATIVE - 0x400110 -RELATIVEADDEND-NEXT: } -RELATIVEADDEND-NEXT: ] - -SHARED: shared-library-atoms -SHARED: name: hey -SHARED-NOT: data diff --git a/test/old-elf/ignore-unknownoption.test b/test/old-elf/ignore-unknownoption.test deleted file mode 100644 index aa03a2eb4e73..000000000000 --- a/test/old-elf/ignore-unknownoption.test +++ /dev/null @@ -1,5 +0,0 @@ -# This test tests that lld is able to print unknown options that are not -# recognized. -RUN: not lld -flavor old-gnu -target x86_64 --gc-sections 2> %t -RUN: FileCheck %s < %t -CHECK: warning: ignoring unknown argument: --gc-sections diff --git a/test/old-elf/init_array-order.test b/test/old-elf/init_array-order.test deleted file mode 100644 index 2b8bcb65c3e4..000000000000 --- a/test/old-elf/init_array-order.test +++ /dev/null @@ -1,67 +0,0 @@ -#RUN: yaml2obj -format=elf %s > %t -#RUN: lld -flavor old-gnu -target x86_64-linux %t --noinhibit-exec \ -#RUN: -o %t1.out -#RUN: llvm-objdump -s %t1.out | FileCheck %s - -!ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "1100000000000000" - AddressAlign: 8 - Flags: [SHF_ALLOC, SHF_EXECINSTR] -- Name: .init_array.2 - Type: SHT_INIT_ARRAY - Content: "0200000000000000" - AddressAlign: 8 - Flags: [SHF_ALLOC] -- Name: .init_array.3 - Type: SHT_INIT_ARRAY - Content: "0300000000000000" - AddressAlign: 8 - Flags: [SHF_ALLOC] -- Name: .init_array - Type: SHT_INIT_ARRAY - Content: "9900000000000000" - AddressAlign: 8 - Flags: [SHF_ALLOC] -- Name: .data - Type: SHT_PROGBITS - Content: "2200000000000000" - AddressAlign: 8 - Flags: [SHF_ALLOC, SHF_WRITE] -- Name: .init_array.1 - Type: SHT_INIT_ARRAY - Content: "0100000000000000" - AddressAlign: 8 - Flags: [SHF_ALLOC] - -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .init_array.3 - Type: STT_SECTION - Section: .init_array.3 - - Name: .init_array.2 - Type: STT_SECTION - Section: .init_array.2 - - Name: .init_array.1 - Type: STT_SECTION - Section: .init_array.1 - - Name: .init_array - Type: STT_SECTION - Section: .init_array - -#CHECK: {{[0xa-f0-9]+}} 01000000 00000000 02000000 00000000 -#CHECK: {{[0xa-f0-9]+}} 03000000 00000000 99000000 00000000 diff --git a/test/old-elf/init_array.test b/test/old-elf/init_array.test deleted file mode 100644 index f7f48445621e..000000000000 --- a/test/old-elf/init_array.test +++ /dev/null @@ -1,127 +0,0 @@ -# Test .init_array. -# Generated from the following C code: -# -# static void -# init () {} -# -# static void (*const init_array []) () -# __attribute__ ((used, section (".init_array"), aligned (sizeof (void *)))) -# = { init }; -# -# int -# main() { return (0); } -# -# Note: both STT_OBJECT and STT_SECTION for .init_array are commented in yaml -# declaration to check if lld correct adds the object's .init_array when the -# section has no symbol (some compilers may create object with this behavior, -# specially for C++ global constructors). - -#RUN: yaml2obj -format=elf %s -o=%t.o -#RUN: lld -flavor old-gnu -target x86_64 %t.o -o %t -e=main -#RUN: llvm-objdump -t -section-headers %t | FileCheck %s - -#CHECK: .init_array {{[0-9]+}} [[ADDR:[0-9]+]] -#CHECK: [[ADDR]] l *ABS* {{[0-9]+}} .hidden __init_array_start - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_FREEBSD - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E5B800000000C745FC000000005DC366666666662E0F1F840000000000554889E55DC3 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .init_array - Type: SHT_INIT_ARRAY - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: '0000000000000000' - - Name: .rela.init_array - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .init_array - Relocations: - - Offset: 0x0000000000000000 - Symbol: .text - Type: R_X86_64_64 - Addend: 32 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 004672656542534420636C616E672076657273696F6E20332E342E312028746167732F52454C454153455F33342F646F74312D66696E616C203230383033322920323031343035313200 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000017A5200017810011B0C070890010000180000001C000000000000001200000000410E108602430D060000001800000038000000000000000600000000410E108602430D06000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text - Type: R_X86_64_PC32 - - Offset: 0x000000000000003C - Symbol: .text - Type: R_X86_64_PC32 - Addend: 32 -Symbols: - Local: - - Name: init - Type: STT_FUNC - Section: .text - Value: 0x0000000000000020 - Size: 0x0000000000000006 -# - Name: init_array -# Type: STT_OBJECT -# Section: .init_array -# Size: 0x0000000000000008 - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss -# - Name: .init_array -# Type: STT_SECTION -# Section: .init_array - - Name: .comment - Type: STT_SECTION - Section: .comment - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x0000000000000012 -... diff --git a/test/old-elf/initfini-options.test-1.test b/test/old-elf/initfini-options.test-1.test deleted file mode 100644 index f8571a637197..000000000000 --- a/test/old-elf/initfini-options.test-1.test +++ /dev/null @@ -1,33 +0,0 @@ -# Check that if there are no -init/-fini options and _init/_fini symbols -# are undefined the linker does not emit DT_INIT/DT_FINI tags. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target x86_64 -shared --noinhibit-exec -o %t.so %t.o -# RUN: llvm-readobj -dynamic-table %t.so | FileCheck %s - -# CHECK-NOT: 0x000000000000000C INIT 0x{{[0-9A-F]+}} -# CHECK-NOT: 0x000000000000000D FINI 0x{{[0-9A-F]+}} - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x08 - -Symbols: - Global: - - Name: _start - Type: STT_FUNC - Section: .text - Size: 0x08 - - Name: _init - - Name: _fini -... diff --git a/test/old-elf/initfini-options.test-2.test b/test/old-elf/initfini-options.test-2.test deleted file mode 100644 index 35361c76d973..000000000000 --- a/test/old-elf/initfini-options.test-2.test +++ /dev/null @@ -1,47 +0,0 @@ -# Check that if _init/_fini symbols are defined the linker emits -# DT_INIT/DT_FINI tags point to these symbols. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target x86_64 -shared -o %t.so %t.o -# RUN: llvm-readobj -symbols -dynamic-table %t.so | FileCheck %s - -# CHECK: Name: _init (8) -# CHECK-NEXT: Value: {{[0x0-9a-f]+}} -# CHECK: Name: _fini (14) -# CHECK-NEXT: Value: {{[0x0-9a-f]+}} -# -# CHECK: 0x000000000000000C INIT {{[0x0-9a-f]+}} -# CHECK: 0x000000000000000D FINI {{[0x0-9a-f]+}} - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x18 - -Symbols: - Global: - - Name: _start - Type: STT_FUNC - Section: .text - Value: 0x0 - Size: 0x8 - - Name: _init - Type: STT_FUNC - Section: .text - Value: 0x8 - Size: 0x8 - - Name: _fini - Type: STT_FUNC - Section: .text - Value: 0xF - Size: 0x8 -... diff --git a/test/old-elf/initfini-options.test-3.test b/test/old-elf/initfini-options.test-3.test deleted file mode 100644 index 2c9ab3cceb94..000000000000 --- a/test/old-elf/initfini-options.test-3.test +++ /dev/null @@ -1,53 +0,0 @@ -# Check that -init/-fini command line options override default function names -# and the linker uses these name to search symbols and setup DT_INIT/DT_FINI. - -# RUN: yaml2obj -format=elf %s > %t.o -# RUN: lld -flavor old-gnu -target x86_64 -shared -o %t.so %t.o \ -# RUN: -init _init -init _start -fini _fini -fini _stop -# RUN: llvm-readobj -symbols -dynamic-table %t.so | FileCheck %s - -# CHECK: Name: _start (1) -# CHECK-NEXT: Value: {{[0x0-9a-f]+}} -# CHECK: Name: _stop (8) -# CHECK-NEXT: Value: {{[0x0-9a-f]+}} -# -# CHECK: 0x000000000000000C INIT {{[0x0-9a-f]+}} -# CHECK: 0x000000000000000D FINI {{[0x0-9a-f]+}} - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x04 - Size: 0x20 - -Symbols: - Global: - - Name: _start - Type: STT_FUNC - Section: .text - Value: 0x0 - Size: 0x8 - - Name: _stop - Type: STT_FUNC - Section: .text - Value: 0x8 - Size: 0x8 - - Name: _init - Type: STT_FUNC - Section: .text - Value: 0xF - Size: 0x8 - - Name: _fini - Type: STT_FUNC - Section: .text - Value: 0x18 - Size: 0x8 -... diff --git a/test/old-elf/librarynotfound.test b/test/old-elf/librarynotfound.test deleted file mode 100644 index 9b1b8f2cffc4..000000000000 --- a/test/old-elf/librarynotfound.test +++ /dev/null @@ -1,5 +0,0 @@ -# Tests the functionality of library not found -RUN: not lld -flavor old-gnu -lfn 2> %t1 -RUN: FileCheck %s < %t1 - -CHECK: Unable to find library -lfn diff --git a/test/old-elf/linker-as-ld.test b/test/old-elf/linker-as-ld.test deleted file mode 100644 index 8b07ae9d1a71..000000000000 --- a/test/old-elf/linker-as-ld.test +++ /dev/null @@ -1,16 +0,0 @@ -REQUIRES: system-linker-elf - -RUN: mkdir -p %t.dir && cp `which lld` %t.dir/ld -RUN: %t.dir/ld -o %t %p/Inputs/relocs.x86-64 \ -RUN: -e _start -static -RUN: llvm-readobj -t %t | FileCheck %s - -# Test linker run as "ld" on elf based system works like gnu linker. - - -CHECK: Symbol { -CHECK: Name: i -CHECK-NEXT: Value: -CHECK-NEXT: Size: -CHECK-NEXT: Binding: -CHECK-NEXT: Type: Object diff --git a/test/old-elf/linkerscript/Inputs/externs.ls b/test/old-elf/linkerscript/Inputs/externs.ls deleted file mode 100644 index 20fdc0c3f980..000000000000 --- a/test/old-elf/linkerscript/Inputs/externs.ls +++ /dev/null @@ -1,3 +0,0 @@ -/* A simple valid linker script used for testing the EXTERN command. - */ -EXTERN(_foo bar __baz) diff --git a/test/old-elf/linkerscript/Inputs/invalid.ls b/test/old-elf/linkerscript/Inputs/invalid.ls deleted file mode 100644 index 894d4bef2732..000000000000 --- a/test/old-elf/linkerscript/Inputs/invalid.ls +++ /dev/null @@ -1 +0,0 @@ -GROUP( diff --git a/test/old-elf/linkerscript/Inputs/prog1.o.yaml b/test/old-elf/linkerscript/Inputs/prog1.o.yaml deleted file mode 100644 index f450048ab37b..000000000000 --- a/test/old-elf/linkerscript/Inputs/prog1.o.yaml +++ /dev/null @@ -1,87 +0,0 @@ ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E5B000E800000000BF01000000BA0E0000004889C6E80000000031C05DC3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000007 - Symbol: prog2 - Type: R_X86_64_PC32 - Addend: -4 - - Offset: 0x0000000000000019 - Symbol: write - Type: R_X86_64_PC32 - Addend: -4 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 00636C616E672076657273696F6E20332E372E302028687474703A2F2F6C6C766D2E6F72672F6769742F636C616E672E6769742036336134646334616430343938646139623934386330383263623735336430353735323938346638292028687474703A2F2F6C6C766D2E6F72672F6769742F6C6C766D2E67697420623838363135326664656538376564653738613565643965616638663664313839343033616266312900 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000037A5200017810011B0C0708900100001C0000001C000000000000002100000000410E108602430D0600000000000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text - Type: R_X86_64_PC32 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .comment - Type: STT_SECTION - Section: .comment - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x0000000000000021 - - Name: prog2 - - Name: write -... diff --git a/test/old-elf/linkerscript/Inputs/prog2.o.yaml b/test/old-elf/linkerscript/Inputs/prog2.o.yaml deleted file mode 100644 index 4d1bbd5754ea..000000000000 --- a/test/old-elf/linkerscript/Inputs/prog2.o.yaml +++ /dev/null @@ -1,88 +0,0 @@ ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E548B800000000000000005DC3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000006 - Symbol: .rodata.str1.1 - Type: R_X86_64_64 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .rodata.str1.1 - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 48656C6C6F2C20776F726C64210A00 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 00636C616E672076657273696F6E20332E372E302028687474703A2F2F6C6C766D2E6F72672F6769742F636C616E672E6769742036336134646334616430343938646139623934386330383263623735336430353735323938346638292028687474703A2F2F6C6C766D2E6F72672F6769742F6C6C766D2E67697420623838363135326664656538376564653738613565643965616638663664313839343033616266312900 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000037A5200017810011B0C0708900100001C0000001C000000000000001000000000410E108602430D0600000000000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text - Type: R_X86_64_PC32 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .rodata.str1.1 - Type: STT_SECTION - Section: .rodata.str1.1 - - Name: .comment - Type: STT_SECTION - Section: .comment - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: prog2 - Type: STT_FUNC - Section: .text - Size: 0x0000000000000010 -... diff --git a/test/old-elf/linkerscript/Inputs/prog3.o.yaml b/test/old-elf/linkerscript/Inputs/prog3.o.yaml deleted file mode 100644 index 2402be4d42b6..000000000000 --- a/test/old-elf/linkerscript/Inputs/prog3.o.yaml +++ /dev/null @@ -1,51 +0,0 @@ ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: B8010000000F05C3E800000000B83C0000000F05C3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000009 - Symbol: main - Type: R_X86_64_PC32 - Addend: -4 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Global: - - Name: _start - Section: .text - Value: 0x0000000000000008 - - Name: write - Section: .text - - Name: main -... diff --git a/test/old-elf/linkerscript/Inputs/simple-pic.o.yaml b/test/old-elf/linkerscript/Inputs/simple-pic.o.yaml deleted file mode 100644 index f826034053c3..000000000000 --- a/test/old-elf/linkerscript/Inputs/simple-pic.o.yaml +++ /dev/null @@ -1,32 +0,0 @@ -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 16 - - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 4 - Size: 16 - -Symbols: - Local: - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: foo - Type: STT_FUNC - Section: .text - Size: 16 diff --git a/test/old-elf/linkerscript/Inputs/simple.o.yaml b/test/old-elf/linkerscript/Inputs/simple.o.yaml deleted file mode 100644 index fc9cd4c5f67d..000000000000 --- a/test/old-elf/linkerscript/Inputs/simple.o.yaml +++ /dev/null @@ -1,51 +0,0 @@ ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: B80100000048C7C70100000048C7C60000000048C7C20E0000000F05C3E8DEFFFFFFB83C0000000F05C3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x000000000000000F - Symbol: .data - Type: R_X86_64_32S - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: 48656C6C6F2C20576F726C64210A00 - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 -Symbols: - Local: - - Name: main - Section: .text - - Name: msg - Section: .data - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Global: - - Name: _start - Section: .text - Value: 0x000000000000001D -... diff --git a/test/old-elf/linkerscript/Inputs/valid.ls b/test/old-elf/linkerscript/Inputs/valid.ls deleted file mode 100644 index 43593602d3fb..000000000000 --- a/test/old-elf/linkerscript/Inputs/valid.ls +++ /dev/null @@ -1,6 +0,0 @@ -/* A simple valid linker script used for testing the -T/--script options. - * - * An unresolved symbol named '_entry_point' can be scanned for by the tests - * to determine that the linker script was processed. - */ -ENTRY(_entry_point) diff --git a/test/old-elf/linkerscript/externs.objtxt b/test/old-elf/linkerscript/externs.objtxt deleted file mode 100644 index d79c56a142c9..000000000000 --- a/test/old-elf/linkerscript/externs.objtxt +++ /dev/null @@ -1,21 +0,0 @@ -# Check symbols defined with the EXTERN command are added as undefined -# symbols. - -# RUN: lld -flavor old-gnu -target x86_64 -T %p/Inputs/externs.ls -r %s \ -# RUN: --output-filetype=yaml | FileCheck %s - -defined-atoms: - - name: main - scope: global - content: [ B8, 00, 00, 00, 00, C7, 44, 24, FC, 00, 00, 00, 00, C3 ] - alignment: 16 - section-choice: custom-required - section-name: .text - -# CHECK: undefined-atoms: -# CHECK: - name: _foo -# CHECK: can-be-null: at-buildtime -# CHECK: - name: bar -# CHECK: can-be-null: at-buildtime -# CHECK: - name: __baz -# CHECK: can-be-null: at-buildtime diff --git a/test/old-elf/linkerscript/filename-with-wildcards.test b/test/old-elf/linkerscript/filename-with-wildcards.test deleted file mode 100644 index 9376d5a5cfb4..000000000000 --- a/test/old-elf/linkerscript/filename-with-wildcards.test +++ /dev/null @@ -1,49 +0,0 @@ -/* -Tests a linker script that uses the SECTIONS command with rules containing -wildcards that matching input object files. -*/ - -ENTRY(_start) - -SECTIONS -{ - . = 0x500000; - .foo : { *p1-wc.o(.text .rodata*) } - .bar : { *(.text .rodata*) } -} - -/* -RUN: mkdir -p %T -RUN: yaml2obj -format=elf %p/Inputs/prog1.o.yaml -o=%T/p1-wc.o -RUN: yaml2obj -format=elf %p/Inputs/prog2.o.yaml -o=%T/p2-wc.o -RUN: yaml2obj -format=elf %p/Inputs/prog3.o.yaml -o=%T/p3-wc.o -RUN: cd %T - -RUN: lld -flavor old-gnu -target x86_64 -T %s p1-wc.o p2-wc.o p3-wc.o \ -RUN: -static -o %t1 -RUN: llvm-readobj -s %t1 | FileCheck -check-prefix CHECKSECTIONS %s - -CHECKSECTIONS: Index: 1 -CHECKSECTIONS: Name: .foo -CHECKSECTIONS: Address: 0x500000 -CHECKSECTIONS: Size: 33 - -CHECKSECTIONS: Index: 2 -CHECKSECTIONS: Name: .bar -CHECKSECTIONS: Address: 0x500030 -CHECKSECTIONS: Size: 52 - -RUN: llvm-readobj -symbols %t1 | FileCheck -check-prefix CHECKSYMS %s - -CHECKSYMS: Name: main -CHECKSYMS-NEXT: Value: 0x500000 - -CHECKSYMS: Name: prog2 -CHECKSYMS-NEXT: Value: 0x500030 - -CHECKSYMS: Name: write -CHECKSYMS-NEXT: Value: 0x500040 - -CHECKSYMS: Name: _start -CHECKSYMS-NEXT: Value: 0x500048 -*/ diff --git a/test/old-elf/linkerscript/invalid-script-cli-1.test b/test/old-elf/linkerscript/invalid-script-cli-1.test deleted file mode 100644 index 72d2edebb4d5..000000000000 --- a/test/old-elf/linkerscript/invalid-script-cli-1.test +++ /dev/null @@ -1,10 +0,0 @@ -# Check that the -T/--script options issue an error when passed -# filenames for files that do not exist. - -RUN: not lld -flavor old-gnu -target x86_64 -T idonotexist.ls 2> %t.err -RUN: FileCheck %s < %t.err - -RUN: not lld -flavor old-gnu -target x86_64 --script=idonotexist.ls 2> %t.err -RUN: FileCheck %s < %t.err - -CHECK: {{.*}}lld: cannot find file {{.*}}idonotexist.ls diff --git a/test/old-elf/linkerscript/invalid-script-cli-2.test b/test/old-elf/linkerscript/invalid-script-cli-2.test deleted file mode 100644 index cc76f0e55a81..000000000000 --- a/test/old-elf/linkerscript/invalid-script-cli-2.test +++ /dev/null @@ -1,6 +0,0 @@ -# Check that linker script are *not* picked up with -lscript.ls. - -RUN: not lld -flavor old-gnu -target x86_64 -L%p/Inputs/ -lvalid.ls 2> %t.err -RUN: FileCheck %s < %t.err - -CHECK: {{.*}}: Unable to find library -lvalid.ls diff --git a/test/old-elf/linkerscript/invalid.test b/test/old-elf/linkerscript/invalid.test deleted file mode 100644 index a00a200225dc..000000000000 --- a/test/old-elf/linkerscript/invalid.test +++ /dev/null @@ -1,5 +0,0 @@ -# Check for errors from invalid linker scripts -RUN: not lld -flavor old-gnu -target x86_64 %p/Inputs/invalid.ls 2> %t.err -RUN: FileCheck %s < %t.err - -CHECK: {{.*}}invalid.ls: Error parsing linker script diff --git a/test/old-elf/linkerscript/phdrs-all-none.test b/test/old-elf/linkerscript/phdrs-all-none.test deleted file mode 100644 index 45baf188d8d8..000000000000 --- a/test/old-elf/linkerscript/phdrs-all-none.test +++ /dev/null @@ -1,26 +0,0 @@ -/* -Test when all segments are marked as NONE. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix NONE-ALL-PHDRS %s -*/ - -ENTRY(_start) - -PHDRS -{ - text PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :NONE - .data : { *(.data) } -} - -/* -NONE-ALL-PHDRS: .text {{[0-9a-f]+}} 0000000000000000 -NONE-ALL-PHDRS: .data {{[0-9a-f]+}} 000000000000002c -*/ diff --git a/test/old-elf/linkerscript/phdrs-custom-none.test b/test/old-elf/linkerscript/phdrs-custom-none.test deleted file mode 100644 index e3672cf8fd30..000000000000 --- a/test/old-elf/linkerscript/phdrs-custom-none.test +++ /dev/null @@ -1,36 +0,0 @@ -/* -Test when PHDRS contains custom NONE segment. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix CUSTOM-NONE-SECS %s -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix CUSTOM-NONE-HDRS %s -*/ - -ENTRY(_start) - -PHDRS -{ - NONE PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :NONE - .data : { *(.data) } -} - -/* -CUSTOM-NONE-SECS: .text {{[0-9a-f]+}} 00000000004000b0 -CUSTOM-NONE-SECS: .data {{[0-9a-f]+}} 00000000004000dc - -CUSTOM-NONE-HDRS: ProgramHeader { -CUSTOM-NONE-HDRS: Type: PT_LOAD (0x1) -CUSTOM-NONE-HDRS: VirtualAddress: 0x400000 -CUSTOM-NONE-HDRS: Flags [ (0x5) -CUSTOM-NONE-HDRS: PF_R (0x4) -CUSTOM-NONE-HDRS: PF_X (0x1) -CUSTOM-NONE-HDRS: ] -CUSTOM-NONE-HDRS: } -*/ diff --git a/test/old-elf/linkerscript/phdrs-default.test b/test/old-elf/linkerscript/phdrs-default.test deleted file mode 100644 index 8c493d020504..000000000000 --- a/test/old-elf/linkerscript/phdrs-default.test +++ /dev/null @@ -1,82 +0,0 @@ -/* -This group of tests checks usage of default headers during linking, -when PHDRS command is not defined or defined empty in linker scripts. - -This test uses a single X86-64 input object, simple.o, created with the -following X86-64 assembly code: - -*** simple.S: - -(command line clang -c simple.S -o simple.o) - - .text - main: - mov $1, %eax - movq $1, %rdi - movq $msg, %rsi - movq $14, %rdx - syscall - ret - - .globl _start - _start: - call main - mov $60, %eax - syscall - ret - - .data - msg: .asciz "Hello, World!\n" -*/ - -/* -Prepare the object file to test on. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o -*/ - -/* -Test when no linker script passed. - -RUN: lld -flavor old-gnu -target x86_64 %t.o -static -o %t1 -RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix SECTIONS %s -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix HEADERS %s - -SECTIONS: .text {{[0-9a-f]+}} 00000000004000b0 -SECTIONS: .data {{[0-9a-f]+}} 0000000000401000 - -HEADERS: ProgramHeader { -HEADERS: Type: PT_LOAD (0x1) -HEADERS: VirtualAddress: 0x400000 -HEADERS: } -HEADERS: ProgramHeader { -HEADERS: Type: PT_LOAD (0x1) -HEADERS: VirtualAddress: 0x401000 -HEADERS: } -*/ - -/* -Test when linker script doesn't contain PHDRS and sections are not assigned to any segments. - -RUN: lld -flavor old-gnu -target x86_64 -T %p/phdrs/sections-no-phdrs.script %t.o -static -o %t2 -RUN: llvm-objdump -section-headers %t2 | FileCheck -check-prefix SECTIONS %s -RUN: llvm-readobj -program-headers %t2 | FileCheck -check-prefix HEADERS %s -*/ - -/* -Test when linker script contains empty PHDRS and sections are not assigned to any segments. - -RUN: lld -flavor old-gnu -target x86_64 -T %p/phdrs/sections-empty-phdrs.script %t.o -static -o %t3 -RUN: llvm-objdump -section-headers %t3 | FileCheck -check-prefix SECTIONS %s -RUN: llvm-readobj -program-headers %t3 | FileCheck -check-prefix HEADERS %s -*/ - -/* -Test when linker script contains empty PHDRS and sections are only assigned to NONE segments -or not assigned at all. -NOTE: Segments with the name NONE are ignored in such a case. - -RUN: lld -flavor old-gnu -target x86_64 -T %p/phdrs/sections-none-phdrs.script %t.o -static -o %t4 -RUN: llvm-objdump -section-headers %t4 | FileCheck -check-prefix SECTIONS %s -RUN: llvm-readobj -program-headers %t4 | FileCheck -check-prefix HEADERS %s -*/ diff --git a/test/old-elf/linkerscript/phdrs-different.test b/test/old-elf/linkerscript/phdrs-different.test deleted file mode 100644 index 7fe14dd543d1..000000000000 --- a/test/old-elf/linkerscript/phdrs-different.test +++ /dev/null @@ -1,45 +0,0 @@ -/* -Test sections put to different segments. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix DIFF-PHDRS-SECS %s -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix DIFF-PHDRS-HDRS %s -*/ - -ENTRY(_start) - -PHDRS -{ - text PT_LOAD; - data PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } :data -} - -/* -DIFF-PHDRS-SECS: .text {{[0-9a-f]+}} 00000000004000e8 -DIFF-PHDRS-SECS: .data {{[0-9a-f]+}} 0000000000401000 - -DIFF-PHDRS-HDRS: ProgramHeader { -DIFF-PHDRS-HDRS: Type: PT_LOAD (0x1) -DIFF-PHDRS-HDRS: VirtualAddress: 0x400000 -DIFF-PHDRS-HDRS: Flags [ (0x5) -DIFF-PHDRS-HDRS: PF_R (0x4) -DIFF-PHDRS-HDRS: PF_X (0x1) -DIFF-PHDRS-HDRS: ] -DIFF-PHDRS-HDRS: } -DIFF-PHDRS-HDRS: ProgramHeader { -DIFF-PHDRS-HDRS: Type: PT_LOAD (0x1) -DIFF-PHDRS-HDRS: VirtualAddress: 0x401000 -DIFF-PHDRS-HDRS: Flags [ (0x6) -DIFF-PHDRS-HDRS: PF_R (0x4) -DIFF-PHDRS-HDRS: PF_W (0x2) -DIFF-PHDRS-HDRS: ] -DIFF-PHDRS-HDRS: } -*/ diff --git a/test/old-elf/linkerscript/phdrs-extra-program.test b/test/old-elf/linkerscript/phdrs-extra-program.test deleted file mode 100644 index 3bf27dcb1f5a..000000000000 --- a/test/old-elf/linkerscript/phdrs-extra-program.test +++ /dev/null @@ -1,27 +0,0 @@ -/* -Test extra program header generates error. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: not lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 &> %t1-error -RUN: FileCheck -check-prefix EXTRA-PROGRAM-PHDR %s < %t1-error -*/ - -ENTRY(_start) - -PHDRS -{ - header PT_PHDR PHDRS; - header2 PT_PHDR PHDRS; - text PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :NONE - .data : { *(.data) } -} - -/* -EXTRA-PROGRAM-PHDR: Extra program header is found -*/ diff --git a/test/old-elf/linkerscript/phdrs-flags.test b/test/old-elf/linkerscript/phdrs-flags.test deleted file mode 100644 index 0fac53e75302..000000000000 --- a/test/old-elf/linkerscript/phdrs-flags.test +++ /dev/null @@ -1,46 +0,0 @@ -/* -Test sections put to different segments with FLAGS attribute set. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix FLAGS-PHDRS-SECS %s -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix FLAGS-PHDRS-HDRS %s -*/ - -ENTRY(_start) - -PHDRS -{ - text PT_LOAD FLAGS(0x5); - data PT_LOAD FLAGS(0x7); -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } :data -} - -/* -FLAGS-PHDRS-SECS: .text {{[0-9a-f]+}} 0000000000401000 -FLAGS-PHDRS-SECS: .data {{[0-9a-f]+}} 00000000004000e8 - -FLAGS-PHDRS-HDRS: ProgramHeader { -FLAGS-PHDRS-HDRS: Type: PT_LOAD (0x1) -FLAGS-PHDRS-HDRS: VirtualAddress: 0x400000 -FLAGS-PHDRS-HDRS: Flags [ (0x7) -FLAGS-PHDRS-HDRS: PF_R (0x4) -FLAGS-PHDRS-HDRS: PF_W (0x2) -FLAGS-PHDRS-HDRS: PF_X (0x1) -FLAGS-PHDRS-HDRS: ] -FLAGS-PHDRS-HDRS: } -FLAGS-PHDRS-HDRS: ProgramHeader { -FLAGS-PHDRS-HDRS: Type: PT_LOAD (0x1) -FLAGS-PHDRS-HDRS: VirtualAddress: 0x401000 -FLAGS-PHDRS-HDRS: Flags [ (0x5) -FLAGS-PHDRS-HDRS: PF_R (0x4) -FLAGS-PHDRS-HDRS: PF_X (0x1) -FLAGS-PHDRS-HDRS: ] -FLAGS-PHDRS-HDRS: } -*/ diff --git a/test/old-elf/linkerscript/phdrs-has-program.test b/test/old-elf/linkerscript/phdrs-has-program.test deleted file mode 100644 index 83fe94c70614..000000000000 --- a/test/old-elf/linkerscript/phdrs-has-program.test +++ /dev/null @@ -1,33 +0,0 @@ -/* -Test when program segment is set it's generated. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix PROGRAM-PHDR %s -*/ - -ENTRY(_start) - -PHDRS -{ - header PT_PHDR FILEHDR PHDRS; - text PT_LOAD PHDRS; -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } -} - -/* -PROGRAM-PHDR: ProgramHeader { -PROGRAM-PHDR: Type: PT_PHDR (0x6) -PROGRAM-PHDR: VirtualAddress: 0x400040 -PROGRAM-PHDR: Flags [ (0x5) -PROGRAM-PHDR: PF_R (0x4) -PROGRAM-PHDR: PF_X (0x1) -PROGRAM-PHDR: ] -PROGRAM-PHDR: } -*/ diff --git a/test/old-elf/linkerscript/phdrs-invalid.test b/test/old-elf/linkerscript/phdrs-invalid.test deleted file mode 100644 index c1426e8ffa5f..000000000000 --- a/test/old-elf/linkerscript/phdrs-invalid.test +++ /dev/null @@ -1,63 +0,0 @@ -/* -This group of tests checks invalid cases of defining and using PHDRS -command in linker scripts. - -This test uses a single X86-64 input object, simple.o, created with the -following X86-64 assembly code: - -*** simple.S: - -(command line clang -c simple.S -o simple.o) - - .text - main: - mov $1, %eax - movq $1, %rdi - movq $msg, %rsi - movq $14, %rdx - syscall - ret - - .globl _start - _start: - call main - mov $60, %eax - syscall - ret - - .data - msg: .asciz "Hello, World!\n" -*/ - -/* -Prepare the object file to test on. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o -*/ - -/* -Test undefined header used when no PHDRS defined. - -RUN: not lld -flavor old-gnu -target x86_64 -T %p/phdrs/undef-no-phdrs.script %t.o -static -o %t1 &> %t1-error -RUN: FileCheck -check-prefix UNDEF-NO-PHDRS %s < %t1-error - -UNDEF-NO-PHDRS: Unknown header identifiers (missing in PHDRS command) are used -*/ - -/* -Test undefined header used when PHDRS is empty. - -RUN: not lld -flavor old-gnu -target x86_64 -T %p/phdrs/undef-empty-phdrs.script %t.o -static -o %t2 &> %t2-error -RUN: FileCheck -check-prefix UNDEF-EMPTY-PHDRS %s < %t2-error - -UNDEF-EMPTY-PHDRS: Unknown header identifiers (missing in PHDRS command) are used -*/ - -/* -Test undefined header used when PHDRS contains definitions. - -RUN: not lld -flavor old-gnu -target x86_64 -T %p/phdrs/undef-id-phdrs.script %t.o -static -o %t3 &> %t3-error -RUN: FileCheck -check-prefix UNDEF-ID-PHDRS %s < %t3-error - -UNDEF-ID-PHDRS: Unknown header identifiers (missing in PHDRS command) are used -*/ diff --git a/test/old-elf/linkerscript/phdrs-misplaced-program.test b/test/old-elf/linkerscript/phdrs-misplaced-program.test deleted file mode 100644 index 0fb669d818c4..000000000000 --- a/test/old-elf/linkerscript/phdrs-misplaced-program.test +++ /dev/null @@ -1,26 +0,0 @@ -/* -Test misplaced program header generates error. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: not lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 &> %t1-error -RUN: FileCheck -check-prefix MISPLACED-PROGRAM-PHDR %s < %t1-error -*/ - -ENTRY(_start) - -PHDRS -{ - text PT_LOAD; - header PT_PHDR PHDRS; -} - -SECTIONS -{ - .text : { *(.text) } :NONE - .data : { *(.data) } -} - -/* -MISPLACED-PROGRAM-PHDR: Program header must precede load segments -*/ diff --git a/test/old-elf/linkerscript/phdrs-no-program.test b/test/old-elf/linkerscript/phdrs-no-program.test deleted file mode 100644 index e461d5061019..000000000000 --- a/test/old-elf/linkerscript/phdrs-no-program.test +++ /dev/null @@ -1,25 +0,0 @@ -/* -Test when no program segment set it's not generated. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix PROGRAM-PHDR %s -*/ - -ENTRY(_start) - -PHDRS -{ - text PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } -} - -/* -PROGRAM-PHDR-NOT: Type: PT_PHDR (0x6) -*/ diff --git a/test/old-elf/linkerscript/phdrs-one-none.test b/test/old-elf/linkerscript/phdrs-one-none.test deleted file mode 100644 index a1c84e59fc60..000000000000 --- a/test/old-elf/linkerscript/phdrs-one-none.test +++ /dev/null @@ -1,36 +0,0 @@ -/* -Test when one segment is marked as NONE. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix NONE-PHDRS-SECS %s -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix NONE-PHDRS-HDRS %s -*/ - -ENTRY(_start) - -PHDRS -{ - text PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } :NONE -} - -/* -NONE-PHDRS-SECS: .text {{[0-9a-f]+}} 00000000004000b0 -NONE-PHDRS-SECS: .data {{[0-9a-f]+}} 0000000000000000 - -NONE-PHDRS-HDRS: ProgramHeader { -NONE-PHDRS-HDRS: Type: PT_LOAD (0x1) -NONE-PHDRS-HDRS: VirtualAddress: 0x400000 -NONE-PHDRS-HDRS: Flags [ (0x5) -NONE-PHDRS-HDRS: PF_R (0x4) -NONE-PHDRS-HDRS: PF_X (0x1) -NONE-PHDRS-HDRS: ] -NONE-PHDRS-HDRS: } -*/ diff --git a/test/old-elf/linkerscript/phdrs-program-flags.test b/test/old-elf/linkerscript/phdrs-program-flags.test deleted file mode 100644 index 2a719a6cb296..000000000000 --- a/test/old-elf/linkerscript/phdrs-program-flags.test +++ /dev/null @@ -1,33 +0,0 @@ -/* -Test when program segment contains only FLAGS attribute. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix PROGRAM-FLAGS-PHDR %s -*/ - -ENTRY(_start) - -PHDRS -{ - header PT_PHDR PHDRS FLAGS(0x7); - text PT_LOAD FILEHDR PHDRS; -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } -} - -/* -PROGRAM-FLAGS-PHDR: ProgramHeader { -PROGRAM-FLAGS-PHDR: Type: PT_PHDR (0x6) -PROGRAM-FLAGS-PHDR: Flags [ (0x7) -PROGRAM-FLAGS-PHDR: PF_R (0x4) -PROGRAM-FLAGS-PHDR: PF_W (0x2) -PROGRAM-FLAGS-PHDR: PF_X (0x1) -PROGRAM-FLAGS-PHDR: ] -PROGRAM-FLAGS-PHDR: } -*/ diff --git a/test/old-elf/linkerscript/phdrs-program-good-phdrs.test b/test/old-elf/linkerscript/phdrs-program-good-phdrs.test deleted file mode 100644 index 373facc380ba..000000000000 --- a/test/old-elf/linkerscript/phdrs-program-good-phdrs.test +++ /dev/null @@ -1,34 +0,0 @@ -/* -Test when program segment contains only PHDRS attribute. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix PROGRAM-PHDRS-PHDR %s -*/ - -ENTRY(_start) - -PHDRS -{ - header PT_PHDR PHDRS; - text PT_LOAD PHDRS; -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } -} - -/* -PROGRAM-PHDRS-PHDR: ProgramHeader { -PROGRAM-PHDRS-PHDR: Type: PT_PHDR (0x6) -PROGRAM-PHDRS-PHDR: VirtualAddress: 0x400040 -PROGRAM-PHDRS-PHDR: MemSize: 168 -PROGRAM-PHDRS-PHDR: Flags [ (0x5) -PROGRAM-PHDRS-PHDR: PF_R (0x4) -PROGRAM-PHDRS-PHDR: PF_X (0x1) -PROGRAM-PHDRS-PHDR: ] -PROGRAM-PHDRS-PHDR: } -*/ diff --git a/test/old-elf/linkerscript/phdrs-program-no-phdrs.test b/test/old-elf/linkerscript/phdrs-program-no-phdrs.test deleted file mode 100644 index 3e639bdb0f43..000000000000 --- a/test/old-elf/linkerscript/phdrs-program-no-phdrs.test +++ /dev/null @@ -1,26 +0,0 @@ -/* -Test when program segment doesn't contain PHDRS attribute. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: not lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 &> %t1-error -RUN: FileCheck -check-prefix PROGRAM-PHDR-NO-PHDRS %s < %t1-error -*/ - -ENTRY(_start) - -PHDRS -{ - header PT_PHDR; - text PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } -} - -/* -PROGRAM-PHDR-NO-PHDRS: Program header has invalid PHDRS attribute -*/ diff --git a/test/old-elf/linkerscript/phdrs-program-wrong-phdrs.test b/test/old-elf/linkerscript/phdrs-program-wrong-phdrs.test deleted file mode 100644 index c27b23d85876..000000000000 --- a/test/old-elf/linkerscript/phdrs-program-wrong-phdrs.test +++ /dev/null @@ -1,26 +0,0 @@ -/* -Test when program segment contains PHDRS attribute not mapped to load segment. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: not lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 &> %t1-error -RUN: FileCheck -check-prefix PROGRAM-PHDR-WRONG-PHDRS %s < %t1-error -*/ - -ENTRY(_start) - -PHDRS -{ - header PT_PHDR PHDRS; - text PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } -} - -/* -PROGRAM-PHDR-WRONG-PHDRS: Program header has invalid PHDRS attribute -*/ diff --git a/test/old-elf/linkerscript/phdrs-same-flags.test b/test/old-elf/linkerscript/phdrs-same-flags.test deleted file mode 100644 index e39f61881033..000000000000 --- a/test/old-elf/linkerscript/phdrs-same-flags.test +++ /dev/null @@ -1,35 +0,0 @@ -/* -Test sections put to same segment with FLAGS attribute set. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix FLAGS-PHDRS-SECS %s -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix FLAGS-PHDRS-HDRS %s -*/ - -ENTRY(_start) - -PHDRS -{ - text PT_LOAD FLAGS(0x4); -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } -} - -/* -FLAGS-PHDRS-SECS: .text {{[0-9a-f]+}} 00000000004000b0 -FLAGS-PHDRS-SECS: .data {{[0-9a-f]+}} 00000000004000dc - -FLAGS-PHDRS-HDRS: ProgramHeader { -FLAGS-PHDRS-HDRS: Type: PT_LOAD (0x1) -FLAGS-PHDRS-HDRS: VirtualAddress: 0x400000 -FLAGS-PHDRS-HDRS: Flags [ (0x4) -FLAGS-PHDRS-HDRS: PF_R (0x4) -FLAGS-PHDRS-HDRS: ] -FLAGS-PHDRS-HDRS: } -*/ diff --git a/test/old-elf/linkerscript/phdrs-same.test b/test/old-elf/linkerscript/phdrs-same.test deleted file mode 100644 index 92b3ad3909c3..000000000000 --- a/test/old-elf/linkerscript/phdrs-same.test +++ /dev/null @@ -1,36 +0,0 @@ -/* -Test sections put to same segment. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix SAME-PHDRS-SECS %s -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix SAME-PHDRS-HDRS %s -*/ - -ENTRY(_start) - -PHDRS -{ - text PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } -} - -/* -SAME-PHDRS-SECS: .text {{[0-9a-f]+}} 00000000004000b0 -SAME-PHDRS-SECS: .data {{[0-9a-f]+}} 00000000004000dc - -SAME-PHDRS-HDRS: ProgramHeader { -SAME-PHDRS-HDRS: Type: PT_LOAD (0x1) -SAME-PHDRS-HDRS: VirtualAddress: 0x400000 -SAME-PHDRS-HDRS: Flags [ (0x5) -SAME-PHDRS-HDRS: PF_R (0x4) -SAME-PHDRS-HDRS: PF_X (0x1) -SAME-PHDRS-HDRS: ] -SAME-PHDRS-HDRS: } -*/ diff --git a/test/old-elf/linkerscript/phdrs/sections-empty-phdrs.script b/test/old-elf/linkerscript/phdrs/sections-empty-phdrs.script deleted file mode 100644 index ac30df78d5e1..000000000000 --- a/test/old-elf/linkerscript/phdrs/sections-empty-phdrs.script +++ /dev/null @@ -1,11 +0,0 @@ -ENTRY(_start) - -PHDRS -{ -} - -SECTIONS -{ - .text : { *(.text) } - .data : { *(.data) } -} diff --git a/test/old-elf/linkerscript/phdrs/sections-no-phdrs.script b/test/old-elf/linkerscript/phdrs/sections-no-phdrs.script deleted file mode 100644 index b8848cd3ab0d..000000000000 --- a/test/old-elf/linkerscript/phdrs/sections-no-phdrs.script +++ /dev/null @@ -1,7 +0,0 @@ -ENTRY(_start) - -SECTIONS -{ - .text : { *(.text) } - .data : { *(.data) } -} diff --git a/test/old-elf/linkerscript/phdrs/sections-none-phdrs.script b/test/old-elf/linkerscript/phdrs/sections-none-phdrs.script deleted file mode 100644 index 4b240245d2b2..000000000000 --- a/test/old-elf/linkerscript/phdrs/sections-none-phdrs.script +++ /dev/null @@ -1,11 +0,0 @@ -ENTRY(_start) - -PHDRS -{ -} - -SECTIONS -{ - .text : { *(.text) } :NONE - .data : { *(.data) } -} diff --git a/test/old-elf/linkerscript/phdrs/undef-empty-phdrs.script b/test/old-elf/linkerscript/phdrs/undef-empty-phdrs.script deleted file mode 100644 index f92b452d2346..000000000000 --- a/test/old-elf/linkerscript/phdrs/undef-empty-phdrs.script +++ /dev/null @@ -1,11 +0,0 @@ -ENTRY(_start) - -PHDRS -{ -} - -SECTIONS -{ - .text : { *(.text) } - .data : { *(.data) } :phdr -} diff --git a/test/old-elf/linkerscript/phdrs/undef-id-phdrs.script b/test/old-elf/linkerscript/phdrs/undef-id-phdrs.script deleted file mode 100644 index 8ac56695f00a..000000000000 --- a/test/old-elf/linkerscript/phdrs/undef-id-phdrs.script +++ /dev/null @@ -1,12 +0,0 @@ -ENTRY(_start) - -PHDRS -{ - phdr PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :phdr_wrong - .data : { *(.data) } -} diff --git a/test/old-elf/linkerscript/phdrs/undef-no-phdrs.script b/test/old-elf/linkerscript/phdrs/undef-no-phdrs.script deleted file mode 100644 index d3ee5bdebe41..000000000000 --- a/test/old-elf/linkerscript/phdrs/undef-no-phdrs.script +++ /dev/null @@ -1,7 +0,0 @@ -ENTRY(_start) - -SECTIONS -{ - .text : { *(.text) } :phdr - .data : { *(.data) } -} diff --git a/test/old-elf/linkerscript/sections-order.test b/test/old-elf/linkerscript/sections-order.test deleted file mode 100644 index 4d23f5eb9d54..000000000000 --- a/test/old-elf/linkerscript/sections-order.test +++ /dev/null @@ -1,113 +0,0 @@ -/* -Tests a simple linker script that changes the order of output sections and -also changes the address of output sections by using simple expressions. - -This test uses three X86-64 input objects, prog1.o, prog2.o and prog3.o, -which were created with the following C or assembly code: - -*** prog1.o: - -(command line clang -c prog1.c -o prog1.o) - -const char *prog2(); -void write(int, const char *, int); - -int main() { - write(1, prog2(), 14); -} - -*** prog2.o: - -(command line clang -c prog2.c -o prog2.o) - -const char *prog2() { - return "Hello, world!\n"; -} - -*** prog3.o: - -(command line clang -c prog3.S -o prog3.o) - - .globl write -write: - mov $1, %eax - syscall - ret - - .globl _start -_start: - call main - mov $60, %eax - syscall - ret - -We use the following linker script for this test: -*/ - -ENTRY(_start) - -SECTIONS -{ - . = 0x500000; - .text : { prog1.o(.text) } - .mystring : { prog2.o(.rodata.str1.1) } - . = . + 0x6000; - .text.2 : {prog3.o(.text) prog2.o(.text) } -} - -/* -RUN: mkdir -p %T -RUN: yaml2obj -format=elf %p/Inputs/prog1.o.yaml -o=%T/prog1.o -RUN: yaml2obj -format=elf %p/Inputs/prog2.o.yaml -o=%T/prog2.o -RUN: yaml2obj -format=elf %p/Inputs/prog3.o.yaml -o=%T/prog3.o -RUN: cd %T - -RUN: lld -flavor old-gnu -target x86_64 -T %s prog1.o prog2.o prog3.o \ -RUN: -static -o %t1 -RUN: llvm-readobj -s %t1 | FileCheck -check-prefix CHECKSECTIONS %s - -CHECKSECTIONS: Index: 1 -CHECKSECTIONS: Name: .text -CHECKSECTIONS: Address: 0x500000 -CHECKSECTIONS: Size: 33 - -CHECKSECTIONS: Index: 2 -CHECKSECTIONS: Name: .mystring -CHECKSECTIONS: Address: 0x500021 -CHECKSECTIONS: Size: 15 - -CHECKSECTIONS: Index: 3 -CHECKSECTIONS: Name: .text.2 -CHECKSECTIONS: Address: 0x506030 -CHECKSECTIONS: Size: 48 - -RUN: llvm-readobj -symbols %t1 | FileCheck -check-prefix CHECKSYMS %s - -CHECKSYMS: Name: main -CHECKSYMS-NEXT: Value: 0x500000 - -CHECKSYMS: Name: write -CHECKSYMS-NEXT: Value: 0x506030 - -CHECKSYMS: Name: _start -CHECKSYMS-NEXT: Value: 0x506038 - -CHECKSYMS: Name: prog2 -CHECKSYMS-NEXT: Value: 0x506050 - -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix CHECKPHDRS %s - -CHECKPHDRS: Type: PT_LOAD (0x1) -CHECKPHDRS: Offset: 0x1000 -CHECKPHDRS-NEXT: VirtualAddress: 0x500000 -CHECKPHDRS-NEXT: PhysicalAddress: 0x500000 -CHECKPHDRS-NEXT: FileSize: 48 -CHECKPHDRS-NEXT: MemSize: 48 - -CHECKPHDRS: Type: PT_LOAD (0x1) -CHECKPHDRS: Offset: 0x2030 -CHECKPHDRS-NEXT: VirtualAddress: 0x506030 -CHECKPHDRS-NEXT: PhysicalAddress: 0x506030 -CHECKPHDRS-NEXT: FileSize: 168 -CHECKPHDRS-NEXT: MemSize: 168 -*/ diff --git a/test/old-elf/linkerscript/sections-with-wildcards.test b/test/old-elf/linkerscript/sections-with-wildcards.test deleted file mode 100644 index a390a2b2d36a..000000000000 --- a/test/old-elf/linkerscript/sections-with-wildcards.test +++ /dev/null @@ -1,88 +0,0 @@ -/* -Tests a linker script that uses the SECTIONS command with rules containing -wildcards and simple SORT directives. It also tests that the linker script -evaluates the expressions in the same order as the one written in the script -file. - -This test uses three X86-64 input objects, prog1.o, prog2.o and prog3.o, -which were created with the following C or assembly code: - -*** prog1.o: - -(command line clang -c prog1.c -o prog1.o) - -const char *prog2(); -void write(int, const char *, int); - -int main() { - write(1, prog2(), 14); -} - -*** prog2.o: - -(command line clang -c prog2.c -o prog2.o) - -const char *prog2() { - return "Hello, world!\n"; -} - -*** prog3.o: - -(command line clang -c prog3.S -o prog3.o) - - .globl write -write: - mov $1, %eax - syscall - ret - - .globl _start -_start: - call main - mov $60, %eax - syscall - ret - -We use the following linker script for this test: -*/ - -ENTRY(_start) - -SECTIONS -{ - my_start_addr = 0x500000; - my_symbol = my_start_addr; - . = my_symbol; - .foo : { SORT(*)(.text .rodata*) } -} - -/* -RUN: mkdir -p %T -RUN: yaml2obj -format=elf %p/Inputs/prog1.o.yaml -o=%T/p1.o -RUN: yaml2obj -format=elf %p/Inputs/prog2.o.yaml -o=%T/p2.o -RUN: yaml2obj -format=elf %p/Inputs/prog3.o.yaml -o=%T/p3.o -RUN: cd %T - -RUN: lld -flavor old-gnu -target x86_64 -T %s p1.o p2.o p3.o \ -RUN: -static -o %t1 -RUN: llvm-readobj -s %t1 | FileCheck -check-prefix CHECKSECTIONS %s - -CHECKSECTIONS: Index: 1 -CHECKSECTIONS: Name: .foo -CHECKSECTIONS: Address: 0x500000 -CHECKSECTIONS: Size: 101 - -RUN: llvm-readobj -symbols %t1 | FileCheck -check-prefix CHECKSYMS %s - -CHECKSYMS: Name: main -CHECKSYMS-NEXT: Value: 0x500000 - -CHECKSYMS: Name: prog2 -CHECKSYMS-NEXT: Value: 0x500030 - -CHECKSYMS: Name: write -CHECKSYMS-NEXT: Value: 0x500050 - -CHECKSYMS: Name: _start -CHECKSYMS-NEXT: Value: 0x500058 -*/ diff --git a/test/old-elf/linkerscript/symbol-definition-so.test b/test/old-elf/linkerscript/symbol-definition-so.test deleted file mode 100644 index 15b22f6f581f..000000000000 --- a/test/old-elf/linkerscript/symbol-definition-so.test +++ /dev/null @@ -1,32 +0,0 @@ -/* -We test whether we can define symbols in a linker script and have them exported -to the output file symbol table. This test is the same as symbol-definition.test -but make checking in case of shared library linking. - -We use the following linker script for this test: -*/ - -SECTIONS -{ - .text : { *(.text) } - MYSTRING = .; - .data : { *(.data) } -} - -/* -RUN: yaml2obj -format=elf %p/Inputs/simple-pic.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -shared -T %s %t.o -o %t.so -RUN: llvm-readobj -s -symbols %t.so | FileCheck -check-prefix CHECKSYMS %s - -CHECKSYMS: Name: .data -CHECKSYMS-NEXT: Type: SHT_PROGBITS -CHECKSYMS-NEXT: Flags [ -CHECKSYMS-NEXT: SHF_ALLOC -CHECKSYMS-NEXT: SHF_WRITE -CHECKSYMS-NEXT: ] -CHECKSYMS-NEXT: Address: 0x401060 - -CHECKSYMS: Name: MYSTRING -CHECKSYMS-NEXT: Value: 0x401060 -*/ diff --git a/test/old-elf/linkerscript/symbol-definition.test b/test/old-elf/linkerscript/symbol-definition.test deleted file mode 100644 index daa3b17e9965..000000000000 --- a/test/old-elf/linkerscript/symbol-definition.test +++ /dev/null @@ -1,54 +0,0 @@ -/* -We test whether we can define symbols in a linker script and have them exported -to the output file symbol table. - -This test uses a single X86-64 input object, simple.o, created with the -following X86-64 assembly code: - -*** simple.S: - -(command line clang -c simple.S -o simple.o) - - .text - main: - mov $1, %eax - movq $1, %rdi - movq $msg, %rsi - movq $14, %rdx - syscall - ret - - .globl _start - _start: - call main - mov $60, %eax - syscall - ret - - .data - msg: .asciz "Hello, World!\n" - - -We use the following linker script for this test: -*/ - -ENTRY(_start) - -SECTIONS -{ - . = 0x500000; - .text : { *(.text) } - MYSTRING = .; - .data : { *(.data) } -} - -/* -RUN: mkdir -p %T -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%T/simple.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %T/simple.o -static -o %t1 -RUN: llvm-readobj -symbols %t1 | FileCheck -check-prefix CHECKSYMS %s - -CHECKSYMS: Name: MYSTRING -CHECKSYMS-NEXT: Value: 0x501000 -*/ diff --git a/test/old-elf/linkerscript/valid-script-cli.objtxt b/test/old-elf/linkerscript/valid-script-cli.objtxt deleted file mode 100644 index a7342c41f529..000000000000 --- a/test/old-elf/linkerscript/valid-script-cli.objtxt +++ /dev/null @@ -1,23 +0,0 @@ -# Check that the linker script inputs are accepted properly. - -# RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/valid.ls -r %s \ -# RUN: --output-filetype=yaml | FileCheck %s - -# RUN: lld -flavor old-gnu -target x86_64 -T %p/Inputs/valid.ls -r %s \ -# RUN: --output-filetype=yaml | FileCheck %s - -# RUN: lld -flavor old-gnu -target x86_64 --script=%p/Inputs/valid.ls -r %s \ -# RUN: --output-filetype=yaml | FileCheck %s - -# RUN: lld -flavor old-gnu -target x86_64 -L%p/Inputs/ -l:valid.ls -r %s \ -# RUN: --output-filetype=yaml | FileCheck %s - -defined-atoms: - - name: main - scope: global - content: [ B8, 00, 00, 00, 00, C7, 44, 24, FC, 00, 00, 00, 00, C3 ] - alignment: 16 - section-choice: custom-required - section-name: .text - -# CHECK: _entry_point diff --git a/test/old-elf/loginputfiles.test b/test/old-elf/loginputfiles.test deleted file mode 100644 index f1b78558e9c5..000000000000 --- a/test/old-elf/loginputfiles.test +++ /dev/null @@ -1,28 +0,0 @@ -# Tests functionality of -t -# -# Tests generated using the source files below -# main file -# int main() -# { -# fn(); -# return 0; -# } -# -# archive file -# int fn() -# { -# return 0; -# } -# -# int fn1() -# { -# return 0; -# } -# gcc -c main.c fn.c fn1.c - -RUN: lld -flavor old-gnu -target x86_64-linux \ -RUN: %p/Inputs/mainobj.x86_64 %p/Inputs/libfnarchive.a -t --noinhibit-exec 2>&1 | \ -RUN: FileCheck -check-prefix INPUTFILES %s - -#INPUTFILES: mainobj.x86_64 -#INPUTFILES: libfnarchive.a(fn.o) diff --git a/test/old-elf/mergeatoms.test b/test/old-elf/mergeatoms.test deleted file mode 100644 index ec83ac2b8849..000000000000 --- a/test/old-elf/mergeatoms.test +++ /dev/null @@ -1,6 +0,0 @@ -# Tests that atoms are merged by testing it with --merge-strings option -RUN: lld -flavor old-gnu -target x86_64-linux --merge-strings -o %t1 \ -RUN: %p/Inputs/foo.o.x86-64 %p/Inputs/bar.o.x86-64 -e bar1 -RUN: llvm-objdump -s %t1 | FileCheck -check-prefix=mergeAtoms %s - -mergeAtoms: 62617200 666f6f00 bar.foo. diff --git a/test/old-elf/mergeconstants.test b/test/old-elf/mergeconstants.test deleted file mode 100644 index 719ae8a8b24e..000000000000 --- a/test/old-elf/mergeconstants.test +++ /dev/null @@ -1,20 +0,0 @@ -# The test checks for mergeable strings that appear in the object file -RUN: lld -flavor old-gnu --merge-strings --output-filetype=yaml -target x86_64 \ -RUN: %p/Inputs/constants-merge.x86-64 --noinhibit-exec \ -RUN: | FileCheck -check-prefix=mergeAtoms %s - -mergeAtoms: - ref-name: [[CONSTANT:[-a-zA-Z0-9_]+]] -mergeAtoms: type: constant -mergeAtoms: content: [ 62, 61, 72, 66, 6F, 6F, 00 ] -mergeAtoms: merge: by-content -mergeAtoms: section-choice: custom-required -mergeAtoms: section-name: .rodata.str1.1 -mergeAtoms: - name: foo -mergeAtoms: scope: global -mergeAtoms: type: data -mergeAtoms: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] -mergeAtoms: alignment: 8 -mergeAtoms: references: -mergeAtoms: - kind: R_X86_64_64 -mergeAtoms: offset: 3 -mergeAtoms: target: [[CONSTANT]] diff --git a/test/old-elf/mergeglobalatoms.test b/test/old-elf/mergeglobalatoms.test deleted file mode 100644 index bf8dbf7593f0..000000000000 --- a/test/old-elf/mergeglobalatoms.test +++ /dev/null @@ -1,11 +0,0 @@ -# ELF files can have mergeable strings which are global!, treat them as global -# defined atoms -RUN: lld -flavor old-gnu --output-filetype=yaml %p/Inputs/globalconst.o.x86-64 \ -RUN: --noinhibit-exec -target x86_64 | FileCheck -check-prefix=globalatoms %s - -globalatoms: - name: mystr -globalatoms: scope: global -globalatoms: type: constant -globalatoms: content: [ 66, 6F, 6F, 62, 61, 72, 00 ] -globalatoms: section-choice: custom-required -globalatoms: section-name: .rodata.str1.1 diff --git a/test/old-elf/no-unique-section-names.test b/test/old-elf/no-unique-section-names.test deleted file mode 100644 index 4c5f79588dbe..000000000000 --- a/test/old-elf/no-unique-section-names.test +++ /dev/null @@ -1,19 +0,0 @@ -# Check handling object files with non-unique named sections. - -RUN: lld -flavor old-gnu -target x86_64-linux -shared -o %t \ -RUN: %p/Inputs/no-unique-section-names.x86-64 -RUN: llvm-objdump -s %p/Inputs/no-unique-section-names.x86-64 %t \ -RUN: | FileCheck %s - -CHECK: Contents of section .group: -CHECK-NEXT: 0000 01000000 08000000 -CHECK-NEXT: Contents of section .text: -CHECK-NEXT: 0000 [[A1:[0-9a-f]+]] [[A2:[0-9a-f]+]] [[A3:[0-9a-f]+]] -CHECK-NEXT: Contents of section .group: -CHECK-NEXT: 0000 01000000 0a000000 -CHECK-NEXT: Contents of section .text: -CHECK-NEXT: 0000 [[B1:[0-9a-f]+]] [[B2:[0-9a-f]+]] [[B3:[0-9a-f]+]] - -CHECK: Contents of section .text: -CHECK: {{[0-9a-f]+}} [[A1]] [[A2]] [[A3]] -CHECK-NEXT: {{[0-9a-f]+}} [[B1]] [[B2]] [[B3]] diff --git a/test/old-elf/note.test b/test/old-elf/note.test deleted file mode 100644 index aff01c3e5b2a..000000000000 --- a/test/old-elf/note.test +++ /dev/null @@ -1,50 +0,0 @@ -# Check that the linker is not ignoring input sections. -# RUN: yaml2obj -format=elf %s > %t.obj -# RUN: lld -flavor old-gnu -target x86_64 %t.obj -o %t.exe --noinhibit-exec -# RUN: llvm-readobj -s %t.exe | FileCheck %s - -# CHECK: Section { -# CHECK: Name: .note -# CHECK-NEXT: Type: SHT_NOTE - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .note - Type: SHT_NOTE - AddressAlign: 0x0000000000000001 - Content: '00' -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .note - Type: STT_SECTION - Section: .note -... diff --git a/test/old-elf/options/dynamic-linker.test b/test/old-elf/options/dynamic-linker.test deleted file mode 100644 index 6b56f17c677d..000000000000 --- a/test/old-elf/options/dynamic-linker.test +++ /dev/null @@ -1,17 +0,0 @@ -# This tests the functionality of specifying dynamic-linker argument in the -# command line -RUN: lld -flavor old-gnu -target x86_64 --dynamic-linker="/xyz.so" \ -RUN: %p/../Inputs/foo.o.x86-64 --noinhibit-exec -o %t -RUN: llvm-objdump -s %t | FileCheck -check-prefix=DYNAMICINTERP1 %s -RUN: lld -flavor old-gnu -target x86_64 --dynamic-linker="" \ -RUN: %p/../Inputs/foo.o.x86-64 --noinhibit-exec -o %t1 -RUN: llvm-objdump -s %t1 | FileCheck -check-prefix=DYNAMICINTERP2 %s -RUN: lld -flavor old-gnu -target x86_64 -dynamic-linker /xyz.so \ -RUN: %p/../Inputs/foo.o.x86-64 --noinhibit-exec -o %t2 -RUN: llvm-objdump -s %t2 | FileCheck -check-prefix=DYNAMICINTERP1 %s - -DYNAMICINTERP1:Contents of section .interp: -DYNAMICINTERP1: 400158 2f78797a 2e736f00 /xyz.so. -DYNAMICINTERP2:Contents of section .interp: -DYNAMICINTERP2: 400158 00 - diff --git a/test/old-elf/options/target-specific-args.test b/test/old-elf/options/target-specific-args.test deleted file mode 100644 index ec5edf0ad62e..000000000000 --- a/test/old-elf/options/target-specific-args.test +++ /dev/null @@ -1,5 +0,0 @@ -# Test of target specific options -# RUN: lld -flavor old-gnu -target x86_64 --target1-rel \ -# RUN: %p/../Inputs/foo.o.x86-64 --noinhibit-exec -o %t 2>&1 | FileCheck %s - -# CHECK: warning: ignoring unsupported ARM/ELF specific argument: --target1-rel diff --git a/test/old-elf/phdr.test b/test/old-elf/phdr.test deleted file mode 100644 index c8b3664d025f..000000000000 --- a/test/old-elf/phdr.test +++ /dev/null @@ -1,99 +0,0 @@ -# This test checks emission for program header for ELF binaries -RUN: lld -flavor old-gnu -target i386-linux -o %t1 -e main %p/Inputs/phdr.i386 \ -RUN: && llvm-readobj -program-headers %t1 | FileCheck -check-prefix=I386 %s -RUN: lld -flavor old-gnu -target x86_64-linux -o %t1 -e _start %p/Inputs/relocs.x86-64 -static \ -RUN: && llvm-objdump -p %t1 | FileCheck %s -check-prefix=X86_64 - - -I386: ProgramHeaders [ -I386-NEXT: ProgramHeader { -I386-NEXT: Type: PT_PHDR (0x6) -I386-NEXT: Offset: 0x34 -I386-NEXT: VirtualAddress: 0x34 -I386-NEXT: PhysicalAddress: 0x34 -I386-NEXT: FileSize: 224 -I386-NEXT: MemSize: 224 -I386-NEXT: Flags [ (0x5) -I386-NEXT: PF_R (0x4) -I386-NEXT: PF_X (0x1) -I386-NEXT: ] -I386-NEXT: Alignment: 8 -I386-NEXT: } -I386-NEXT: ProgramHeader { -I386-NEXT: Type: PT_INTERP (0x3) -I386-NEXT: Offset: 0x114 -I386-NEXT: VirtualAddress: 0x114 -I386-NEXT: PhysicalAddress: 0x114 -I386-NEXT: FileSize: 28 -I386-NEXT: MemSize: 28 -I386-NEXT: Flags [ (0x4) -I386-NEXT: PF_R (0x4) -I386-NEXT: ] -I386-NEXT: Alignment: 1 -I386-NEXT: } -I386-NEXT: ProgramHeader { -I386-NEXT: Type: PT_LOAD (0x1) -I386-NEXT: Offset: 0x0 -I386-NEXT: VirtualAddress: 0x0 -I386-NEXT: PhysicalAddress: 0x0 -I386-NEXT: FileSize: 556 -I386-NEXT: MemSize: 556 -I386-NEXT: Flags [ (0x5) -I386-NEXT: PF_R (0x4) -I386-NEXT: PF_X (0x1) -I386-NEXT: ] -I386-NEXT: Alignment: 4096 -I386-NEXT: } -I386-NEXT: ProgramHeader { -I386-NEXT: Type: PT_LOAD (0x1) -I386-NEXT: Offset: 0x1000 -I386-NEXT: VirtualAddress: 0x1000 -I386-NEXT: PhysicalAddress: 0x1000 -I386-NEXT: FileSize: 260 -I386-NEXT: MemSize: 260 -I386-NEXT: Flags [ (0x6) -I386-NEXT: PF_R (0x4) -I386-NEXT: PF_W (0x2) -I386-NEXT: ] -I386-NEXT: Alignment: 4096 -I386-NEXT: } -I386-NEXT: ProgramHeader { -I386-NEXT: Type: PT_LOAD (0x1) -I386-NEXT: Offset: 0x4000 -I386-NEXT: VirtualAddress: 0x4000 -I386-NEXT: PhysicalAddress: 0x4000 -I386-NEXT: FileSize: 4 -I386-NEXT: MemSize: 8 -I386-NEXT: Flags [ (0x6) -I386-NEXT: PF_R (0x4) -I386-NEXT: PF_W (0x2) -I386-NEXT: ] -I386-NEXT: Alignment: 16384 -I386-NEXT: } -I386-NEXT: ProgramHeader { -I386-NEXT: Type: PT_DYNAMIC (0x2) -I386-NEXT: Offset: 0x1FC -I386-NEXT: VirtualAddress: 0x1FC -I386-NEXT: PhysicalAddress: 0x1FC -I386-NEXT: FileSize: 48 -I386-NEXT: MemSize: 48 -I386-NEXT: Flags [ (0x4) -I386-NEXT: PF_R (0x4) -I386-NEXT: ] -I386-NEXT: Alignment: 4 -I386-NEXT: } -I386-NEXT: ProgramHeader { -I386-NEXT: Type: PT_GNU_EH_FRAME (0x6474E550) -I386-NEXT: Offset: 0x1F4 -I386-NEXT: VirtualAddress: 0x1F4 -I386-NEXT: PhysicalAddress: 0x1F4 -I386-NEXT: FileSize: 8 -I386-NEXT: MemSize: 8 -I386-NEXT: Flags [ (0x4) -I386-NEXT: PF_R (0x4) -I386-NEXT: ] -I386-NEXT: Alignment: 4 -I386-NEXT: } - -X86_64: LOAD off 0x0000000000000000 -X86_64: LOAD off 0x0000000000001000 diff --git a/test/old-elf/quickdata.test b/test/old-elf/quickdata.test deleted file mode 100644 index 85ad23d0b8e9..000000000000 --- a/test/old-elf/quickdata.test +++ /dev/null @@ -1,15 +0,0 @@ -RUN: lld -flavor old-gnu -target hexagon --output-filetype=yaml %p/Inputs/quickdata-test.elf-hexagon \ -RUN: --noinhibit-exec | FileCheck %s -check-prefix hexagon - -hexagon: - name: ac1 -hexagon: scope: global -hexagon: type: zero-fill-quick -hexagon: size: 1 -hexagon: merge: as-tentative -hexagon: - name: init -hexagon: scope: global -hexagon: type: quick-data -hexagon: - name: bss1 -hexagon: scope: global -hexagon: type: zero-fill-quick - diff --git a/test/old-elf/reloc.test b/test/old-elf/reloc.test deleted file mode 100644 index f8cb056e03da..000000000000 --- a/test/old-elf/reloc.test +++ /dev/null @@ -1,38 +0,0 @@ -RUN: lld -flavor old-gnu -target i386 --merge-strings -r --output-filetype=yaml \ -RUN: %p/Inputs/reloc-test.elf-i386 | FileCheck %s -check-prefix ELF-i386 - -ELF-i386: defined-atoms: -ELF-i386: - ref-name: [[STRNAMEA:[-a-zA-Z0-9_]+]] -ELF-i386: type: constant -ELF-i386: content: [ 68, 65, 6C, 6C, 6F, 20, 77, 6F, 72, 6C, 64, 00 ] -ELF-i386: merge: by-content -ELF-i386: - ref-name: [[STRNAMEB:[-a-zA-Z0-9_]+]] -ELF-i386: alignment: 16 -ELF-i386: section-choice: custom-required -ELF-i386: section-name: .text.startup -ELF-i386: references: -ELF-i386: - kind: layout-after -ELF-i386: offset: 0 -ELF-i386: target: main -ELF-i386: - name: main -ELF-i386: scope: global -ELF-i386: content: [ 55, 89, E5, 83, E4, F0, 83, EC, 10, C7, 04, 24, -ELF-i386: 00, 00, 00, 00, E8, FC, FF, FF, FF, 31, C0, C9, -ELF-i386: C3 ] -ELF-i386: alignment: 16 -ELF-i386: section-choice: custom-required -ELF-i386: section-name: .text.startup -ELF-i386: references: -ELF-i386: - kind: R_386_32 -ELF-i386: offset: 12 -ELF-i386: target: [[STRNAMEA]] -ELF-i386: - kind: R_386_PC32 -ELF-i386: offset: 17 -ELF-i386: target: puts -ELF-i386: addend: 252 -ELF-i386: undefined-atoms: -ELF-i386: - name: puts -ELF-i386: absolute-atoms: -ELF-i386: - name: test.c -ELF-i386: scope: static -ELF-i386: value: 0x0000000000000000 diff --git a/test/old-elf/responsefile.test b/test/old-elf/responsefile.test deleted file mode 100644 index 89e9ffd015bd..000000000000 --- a/test/old-elf/responsefile.test +++ /dev/null @@ -1,6 +0,0 @@ -# RUN: not lld -flavor old-gnu --abc @%p/Inputs/responsefile --baz >& %t.log -# RUN: FileCheck %s < %t.log - -CHECK: warning: ignoring unknown argument: --abc -CHECK: warning: ignoring unknown argument: --inresponsefile -CHECK: warning: ignoring unknown argument: --baz diff --git a/test/old-elf/rodata.test b/test/old-elf/rodata.test deleted file mode 100644 index 12d9abb2a194..000000000000 --- a/test/old-elf/rodata.test +++ /dev/null @@ -1,5 +0,0 @@ -RUN: lld -flavor old-gnu -target x86_64-linux -o %t %p/Inputs/constdata.x86-64 \ -RUN: -static -e _start -RUN: llvm-objdump -s %t | FileCheck %s - -CHECK: Hellooooooooo diff --git a/test/old-elf/rosegment.test b/test/old-elf/rosegment.test deleted file mode 100644 index 675dc3861867..000000000000 --- a/test/old-elf/rosegment.test +++ /dev/null @@ -1,26 +0,0 @@ -# Tests that the option --rosegment produces an output file with a separate -# segment created for read only data. -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/rodata.o -o %t1.elf \ -RUN: --noinhibit-exec -RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/rodata.o --rosegment -o %t2.elf \ -RUN: --noinhibit-exec -RUN: llvm-readobj -program-headers %t1.elf | FileCheck %s -check-prefix=NORO-SEGMENT -RUN: llvm-readobj -program-headers %t2.elf | FileCheck %s -check-prefix=RO-SEGMENT - -#NORO-SEGMENT: Type: PT_PHDR -#NORO-SEGMENT: Type: PT_INTERP -#NORO-SEGMENT: Type: PT_LOAD -#NORO-SEGMENT: Type: PT_LOAD -#NORO-SEGMENT: Type: PT_DYNAMIC -#NORO-SEGMENT: Type: PT_GNU_EH_FRAME - -#RO-SEGMENT: Type: PT_PHDR -#RO-SEGMENT: Type: PT_INTERP -#RO-SEGMENT: Type: PT_LOAD -#RO-SEGMENT: Type: PT_LOAD -#RO-SEGMENT: Flags [ -#RO-SEGMENT: PF_R (0x4) -#RO-SEGMENT: ] -#RO-SEGMENT: Type: PT_LOAD -#RO-SEGMENT: Type: PT_DYNAMIC -#RO-SEGMENT: Type: PT_GNU_EH_FRAME diff --git a/test/old-elf/sectionGroups/sectiongroup-new-members.test b/test/old-elf/sectionGroups/sectiongroup-new-members.test deleted file mode 100644 index dff1a96b07ee..000000000000 --- a/test/old-elf/sectionGroups/sectiongroup-new-members.test +++ /dev/null @@ -1,151 +0,0 @@ -# Checks that the linker picks the first group in the output file when the file -# have some members dont appear in the first group. -# 1a.s -# ------ -# -# .section .text,"axG",%progbits,foo_group,comdat -# .weak foo -#foo: -# .word 0 -# 1b.s -# ----- -# .section .text,"axG",%progbits,foo_group,comdat -# .global foo -# .global bar -#foo: -# .word 0 -#bar: -#RUN: yaml2obj -format=elf -docnum 1 %s -o %t.group1a.o -#RUN: yaml2obj -format=elf -docnum 2 %s -o %t.group1b.o -#RUN: lld -flavor old-gnu -target x86_64 %t.group1a.o %t.group1b.o \ -#RUN: --noinhibit-exec --output-filetype=yaml -o %t2.out.yaml -#RUN: lld -flavor old-gnu -target x86_64 %t.group1a.o %t.group1b.o \ -#RUN: --noinhibit-exec -o %t2.out -#RUN: FileCheck %s -check-prefix=CHECKGROUP < %t2.out.yaml -#RUN: llvm-readobj -sections %t2.out | FileCheck %s -check-prefix=CHECKGROUPSECTIONS -#RUN: llvm-readobj -symbols %t2.out | FileCheck %s -check-prefix=CHECKSYMBOLS -#CHECKGROUP: - name: foo -#CHECKGROUP: scope: global -#CHECKGROUP: merge: as-weak -#CHECKGROUP: section-name: .text -#CHECKGROUP: - name: foo_group -#CHECKGROUP: scope: global -#CHECKGROUP: type: group-comdat -#CHECKGROUP: section-choice: custom-required -#CHECKGROUP: section-name: .group -#CHECKGROUP: permissions: --- -#CHECKGROUP: references: -#CHECKGROUP: - kind: group-child -#CHECKGROUP: offset: 0 -#CHECKGROUP: target: foo -#CHECKGROUPSECTIONS: Section { -#CHECKGROUPSECTIONS: Name: .text -#CHECKGROUPSECTIONS: Type: SHT_PROGBITS -#CHECKGROUPSECTIONS: Flags [ (0x6) -#CHECKGROUPSECTIONS: SHF_ALLOC (0x2) -#CHECKGROUPSECTIONS: SHF_EXECINSTR (0x4) -#CHECKGROUPSECTIONS: ] -#CHECKGROUPSECTIONS: Size: 2 -#CHECKGROUPSECTIONS: AddressAlignment: 1 -#CHECKGROUPSECTIONS: } -#CHECKSYMBOLS: Name: foo -#CHECKSYMBOLS: Type: Function -#CHECKSYMBOLS: Section: .text -#CHECKSYMBOLS-NOT: Name: bar ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .group - Type: SHT_GROUP - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: foo_group - Members: - - SectionOrType: GRP_COMDAT - - SectionOrType: .text - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ] - AddressAlign: 0x0000000000000001 - Content: '0000' -Symbols: - Local: - - Name: foo_group - Section: .group - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Weak: - - Name: foo - Section: .text -... ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .group - Type: SHT_GROUP - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: foo_group - Members: - - SectionOrType: GRP_COMDAT - - SectionOrType: .text - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ] - AddressAlign: 0x0000000000000001 - Content: '0000' -Symbols: - Local: - - Name: foo_group - Section: .group - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Global: - - Name: bar - Section: .text - Value: 0x0000000000000002 - - Name: foo - Section: .text -... diff --git a/test/old-elf/sectionGroups/sectiongroup-simple.test b/test/old-elf/sectionGroups/sectiongroup-simple.test deleted file mode 100644 index 57707f84475e..000000000000 --- a/test/old-elf/sectionGroups/sectiongroup-simple.test +++ /dev/null @@ -1,144 +0,0 @@ -# Checks that the linker picks the first group in the output file when the file -# have some members dont appear in the first group. -# 1a.s -# ------ -# .section .text,"axG",%progbits,foo_group,comdat -# .weak foo -#foo: -# .word 0 -# 1b.s -# ----- -# .section .text,"axG",%progbits,foo_group,comdat -# .global bar -#bar: -#RUN: yaml2obj -format=elf -docnum 1 %s -o %t.group1a.o -#RUN: yaml2obj -format=elf -docnum 2 %s -o %t.group1b.o -#RUN: lld -flavor old-gnu -target x86_64 %t.group1a.o %t.group1b.o \ -#RUN: --noinhibit-exec --output-filetype=yaml -o %t2.out.yaml -#RUN: lld -flavor old-gnu -target x86_64 %t.group1a.o %t.group1b.o \ -#RUN: --noinhibit-exec -o %t2.out -#RUN: FileCheck %s -check-prefix=CHECKGROUP < %t2.out.yaml -#RUN: llvm-readobj -sections %t2.out | FileCheck %s -check-prefix=CHECKGROUPSECTIONS -#RUN: llvm-readobj -symbols %t2.out | FileCheck %s -check-prefix=CHECKSYMBOLS -#CHECKGROUP: - name: foo -#CHECKGROUP: scope: global -#CHECKGROUP: merge: as-weak -#CHECKGROUP: section-name: .text -#CHECKGROUP: - name: foo_group -#CHECKGROUP: scope: global -#CHECKGROUP: type: group-comdat -#CHECKGROUP: section-choice: custom-required -#CHECKGROUP: section-name: .group -#CHECKGROUP: permissions: --- -#CHECKGROUP: references: -#CHECKGROUP: - kind: group-child -#CHECKGROUP: offset: 0 -#CHECKGROUP: target: foo -#CHECKGROUPSECTIONS: Section { -#CHECKGROUPSECTIONS: Name: .text -#CHECKGROUPSECTIONS: Type: SHT_PROGBITS -#CHECKGROUPSECTIONS: Flags [ (0x6) -#CHECKGROUPSECTIONS: SHF_ALLOC (0x2) -#CHECKGROUPSECTIONS: SHF_EXECINSTR (0x4) -#CHECKGROUPSECTIONS: ] -#CHECKGROUPSECTIONS: Size: 2 -#CHECKGROUPSECTIONS: AddressAlignment: 1 -#CHECKGROUPSECTIONS: } -#CHECKSYMBOLS: Name: foo -#CHECKSYMBOLS: Type: Function -#CHECKSYMBOLS: Section: .text - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .group - Type: SHT_GROUP - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: foo_group - Members: - - SectionOrType: GRP_COMDAT - - SectionOrType: .text - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ] - AddressAlign: 0x0000000000000001 - Content: '0000' -Symbols: - Local: - - Name: foo_group - Section: .group - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Weak: - - Name: foo - Section: .text -... ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .group - Type: SHT_GROUP - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: foo_group - Members: - - SectionOrType: GRP_COMDAT - - SectionOrType: .text - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ] - AddressAlign: 0x0000000000000001 - Content: '' -Symbols: - Local: - - Name: foo_group - Section: .group - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Global: - - Name: bar - Section: .text -... diff --git a/test/old-elf/sectionGroups/sectiongroup-undef-member-other.test b/test/old-elf/sectionGroups/sectiongroup-undef-member-other.test deleted file mode 100644 index 56595e59d8d6..000000000000 --- a/test/old-elf/sectionGroups/sectiongroup-undef-member-other.test +++ /dev/null @@ -1,156 +0,0 @@ -# Tests that linker throws an error for an undefined symbol in the section -# group, which is the same as the signature in the next input file. -# comdat1.s -# ------------ -# .section .foo,"axG",@progbits,g1,comdat -# .word g1 -#comdat2.s -#----------- -# .global g1 -# .section .bar,"axG",@progbits,g1,comdat -#g2: -# nop -# .section .car,"axG",@progbits,g1,comdat -#g3: -# nop -# -#RUN: yaml2obj -format=elf -docnum 1 %s -o %t.group1a.o -#RUN: yaml2obj -format=elf -docnum 2 %s -o %t.group1b.o -#RUN: lld -flavor old-gnu -target x86_64 %t.group1a.o %t.group1b.o \ -#RUN: --noinhibit-exec -o %t2.out 2>&1 | FileCheck %s -#CHECK: Undefined symbol: {{.*}} g1 ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .group - Type: SHT_GROUP - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: g1 - Members: - - SectionOrType: GRP_COMDAT - - SectionOrType: .foo - - SectionOrType: .rela.foo - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .foo - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ] - AddressAlign: 0x0000000000000001 - Content: '0000' - - Name: .rela.foo - Type: SHT_RELA - Flags: [ SHF_GROUP ] - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .foo - Relocations: - - Offset: 0x0000000000000000 - Symbol: g1 - Type: R_X86_64_16 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .foo - Type: STT_SECTION - Section: .foo - - Name: .group - Type: STT_SECTION - Section: .group - Global: - - Name: g1 -... ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .group - Type: SHT_GROUP - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: g1 - Members: - - SectionOrType: GRP_COMDAT - - SectionOrType: .bar - - SectionOrType: .car - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .bar - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ] - AddressAlign: 0x0000000000000001 - Content: '90' - - Name: .car - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ] - AddressAlign: 0x0000000000000001 - Content: '90' -Symbols: - Local: - - Name: g2 - Section: .bar - - Name: g3 - Section: .car - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .bar - Type: STT_SECTION - Section: .bar - - Name: .car - Type: STT_SECTION - Section: .car - - Name: .group - Type: STT_SECTION - Section: .group - Global: - - Name: g1 - Section: .group -... diff --git a/test/old-elf/sectionGroups/sectiongroup-undef-member.test b/test/old-elf/sectionGroups/sectiongroup-undef-member.test deleted file mode 100644 index 65e9ec7632bf..000000000000 --- a/test/old-elf/sectionGroups/sectiongroup-undef-member.test +++ /dev/null @@ -1,142 +0,0 @@ -# Tests that linker throws an error for an undefined symbol in the section -# group. -# -#comdata.s -#------------ -# .section .foo,"axG",@progbits,g1,comdat -# .word g1 -# -#comdatb.s -#------------ -# .global g1 -# .section .foo,"axG",@progbits,g1,comdat -#g1: -# nop -# -#RUN: yaml2obj -format=elf -docnum 1 %s -o %t.group1a.o -#RUN: yaml2obj -format=elf -docnum 2 %s -o %t.group1b.o -#RUN: lld -flavor old-gnu -target x86_64 %t.group1a.o %t.group1b.o \ -#RUN: --noinhibit-exec -o %t2.out 2>&1 | FileCheck %s -#CHECK: Undefined symbol: {{.*}} g1 ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .group - Type: SHT_GROUP - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: g1 - Members: - - SectionOrType: GRP_COMDAT - - SectionOrType: .foo - - SectionOrType: .rela.foo - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .foo - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ] - AddressAlign: 0x0000000000000001 - Content: '0000' - - Name: .rela.foo - Type: SHT_RELA - Flags: [ SHF_GROUP ] - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .foo - Relocations: - - Offset: 0x0000000000000000 - Symbol: g1 - Type: R_X86_64_16 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .foo - Type: STT_SECTION - Section: .foo - - Name: .group - Type: STT_SECTION - Section: .group - Global: - - Name: g1 -... ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .group - Type: SHT_GROUP - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: g1 - Members: - - SectionOrType: GRP_COMDAT - - SectionOrType: .foo - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .foo - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ] - AddressAlign: 0x0000000000000001 - Content: '90' -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .foo - Type: STT_SECTION - Section: .foo - - Name: .group - Type: STT_SECTION - Section: .group - Global: - - Name: g1 - Section: .foo -... diff --git a/test/old-elf/sectionGroups/sectiongroup-with-globalsymbols.test b/test/old-elf/sectionGroups/sectiongroup-with-globalsymbols.test deleted file mode 100644 index 9f8f80c23605..000000000000 --- a/test/old-elf/sectionGroups/sectiongroup-with-globalsymbols.test +++ /dev/null @@ -1,250 +0,0 @@ -# This tests that comdat weak symbol can be overridden by a global symbol. -# comdat1.s -#------------------------ -# .weak g1 -# .section .foo,"axG",@progbits,g1,comdat -#g1: -# nop -# .global g2 -#g2: -# nop -#! -# -#comdat2.s << \! -#----------------- -# .global g1 -# .section .foo,"axG",@progbits,g1,comdat -#g1: -# nop -# .global g2 -#g2: -# nop -# -#cat > g1.c << \! -#int g1() { -# return 0; -#} -# -#RUN: yaml2obj -format=elf -docnum 1 %s -o %t.comdat1.o -#RUN: yaml2obj -format=elf -docnum 2 %s -o %t.comdat2.o -#RUN: yaml2obj -format=elf -docnum 3 %s -o %t.g1.o -#RUN: lld -flavor old-gnu -target x86_64 %t.comdat1.o %t.comdat2.o \ -#RUN: %t.g1.o --noinhibit-exec --output-filetype=yaml -o %t2.out.yaml -#RUN: lld -flavor old-gnu -target x86_64 %t.comdat1.o %t.comdat2.o \ -#RUN: %t.g1.o --noinhibit-exec -o %t2.out -#RUN: FileCheck %s -check-prefix=CHECKGROUP < %t2.out.yaml -#RUN: llvm-readobj -sections %t2.out | FileCheck %s -check-prefix=CHECKGROUPSECTIONS -#RUN: llvm-readobj -symbols %t2.out | FileCheck %s -check-prefix=CHECKSYMBOLS -#CHECKGROUP: - name: g2 -#CHECKGROUP: content: [ 90 ] -#CHECKGROUP: section-choice: custom-required -#CHECKGROUP: section-name: .foo -#CHECKGROUP: - name: g1 -#CHECKGROUP: scope: global -#CHECKGROUP: content: [ 55, 48, 89, E5, 31, C0, 5D, C3 ] -#CHECKGROUP: alignment: 16 -#CHECKGROUP: section-name: .text -#CHECKGROUPSECTIONS: Name: .text -#CHECKGROUPSECTIONS: Type: SHT_PROGBITS -#CHECKGROUPSECTIONS: Flags [ -#CHECKGROUPSECTIONS: SHF_ALLOC -#CHECKGROUPSECTIONS: SHF_EXECINSTR -#CHECKGROUPSECTIONS: ] -#CHECKGROUPSECTIONS: Size: 8 -#CHECKGROUPSECTIONS: Name: .foo -#CHECKGROUPSECTIONS: Type: SHT_PROGBITS -#CHECKGROUPSECTIONS: Flags [ -#CHECKGROUPSECTIONS: SHF_ALLOC -#CHECKGROUPSECTIONS: SHF_EXECINSTR -#CHECKGROUPSECTIONS: ] -#CHECKGROUPSECTIONS: Size: 2 -#CHECKSYMBOLS: Name: g2 -#CHECKSYMBOLS: Section: .foo -#CHECKSYMBOLS: Name: g1 -#CHECKSYMBOLS: Section: .text ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .group - Type: SHT_GROUP - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: g1 - Members: - - SectionOrType: GRP_COMDAT - - SectionOrType: .foo - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .foo - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ] - AddressAlign: 0x0000000000000001 - Content: '9090' -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .foo - Type: STT_SECTION - Section: .foo - Global: - - Name: g2 - Section: .foo - Value: 0x0000000000000001 - Weak: - - Name: g1 - Section: .foo -... ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .group - Type: SHT_GROUP - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: g1 - Members: - - SectionOrType: GRP_COMDAT - - SectionOrType: .foo - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .foo - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ] - AddressAlign: 0x0000000000000001 - Content: '9090' -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .foo - Type: STT_SECTION - Section: .foo - Global: - - Name: g1 - Section: .foo - - Name: g2 - Section: .foo - Value: 0x0000000000000001 -... ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E531C05DC3 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 00636C616E672076657273696F6E20332E372E3020287472756E6B203232393535372920286C6C766D2F7472756E6B203232393536332900 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000037A5200017810011B0C0708900100001C0000001C000000000000000800000000410E108602430D0600000000000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text - Type: R_X86_64_PC32 -Symbols: - Local: - - Name: g1.c - Type: STT_FILE - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .comment - Type: STT_SECTION - Section: .comment - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: g1 - Type: STT_FUNC - Section: .text - Size: 0x0000000000000008 -... diff --git a/test/old-elf/sectionGroups/sectiongroup-with-undef-external-reference.test b/test/old-elf/sectionGroups/sectiongroup-with-undef-external-reference.test deleted file mode 100644 index 0c5d65ad544f..000000000000 --- a/test/old-elf/sectionGroups/sectiongroup-with-undef-external-reference.test +++ /dev/null @@ -1,236 +0,0 @@ -# This tests that comdat undef symbol is overridden by a global symbol. -# comdat1.s -#------------------------ -# .global g1 -# .section .foo,"axG",@progbits,g1,comdat -#g1: -# .word 5 -# -#comdat2.s << \! -#----------------- -# .global g1 -# .section .foo,"axG",@progbits,g1,comdat -#g1: -# nop -# -#g1.c -#----------- -#extern int g1; -#int fn() { return g1;} -# -#RUN: yaml2obj -format=elf -docnum 1 %s -o %t.comdat1.o -#RUN: yaml2obj -format=elf -docnum 2 %s -o %t.comdat2.o -#RUN: yaml2obj -format=elf -docnum 3 %s -o %t.g1.o -#RUN: lld -flavor old-gnu -target x86_64 %t.comdat1.o %t.comdat2.o \ -#RUN: %t.g1.o --noinhibit-exec --output-filetype=yaml -o %t2.out.yaml -#RUN: lld -flavor old-gnu -target x86_64 %t.comdat1.o %t.comdat2.o \ -#RUN: %t.g1.o --noinhibit-exec -o %t2.out -#RUN: FileCheck %s -check-prefix=CHECKGROUP < %t2.out.yaml -#RUN: llvm-readobj -sections %t2.out | FileCheck %s -check-prefix=CHECKGROUPSECTIONS -#RUN: llvm-readobj -symbols %t2.out | FileCheck %s -check-prefix=CHECKSYMBOLS -#CHECKGROUP: - name: g1 -#CHECKGROUP: scope: global -#CHECKGROUP: content: [ 05, 00 ] -#CHECKGROUP: section-name: .foo -#CHECKGROUPSECTIONS: Section { -#CHECKGROUPSECTIONS: Name: .foo -#CHECKGROUPSECTIONS: Type: SHT_PROGBITS -#CHECKGROUPSECTIONS: Flags [ -#CHECKGROUPSECTIONS: SHF_ALLOC -#CHECKGROUPSECTIONS: SHF_EXECINSTR -#CHECKGROUPSECTIONS: ] -#CHECKGROUPSECTIONS: Size: 2 -#CHECKGROUPSECTIONS: } -#CHECKSYMBOLS: Name: g1 -#CHECKSYMBOLS: Section: .foo -#CHECKSYMBOLS: Name: fn -#CHECKSYMBOLS: Section: .text ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .group - Type: SHT_GROUP - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: g1 - Members: - - SectionOrType: GRP_COMDAT - - SectionOrType: .foo - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .foo - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ] - AddressAlign: 0x0000000000000001 - Content: '0500' -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .foo - Type: STT_SECTION - Section: .foo - Global: - - Name: g1 - Section: .foo -... ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .group - Type: SHT_GROUP - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: g1 - Members: - - SectionOrType: GRP_COMDAT - - SectionOrType: .foo - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .foo - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ] - AddressAlign: 0x0000000000000001 - Content: '90' -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .foo - Type: STT_SECTION - Section: .foo - Global: - - Name: g1 - Section: .foo -... ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E58B0425000000005DC3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000007 - Symbol: g1 - Type: R_X86_64_32S - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 00636C616E672076657273696F6E20332E372E3020287472756E6B203232393535372920286C6C766D2F7472756E6B203232393536332900 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000037A5200017810011B0C0708900100001C0000001C000000000000000D00000000410E108602430D0600000000000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text - Type: R_X86_64_PC32 -Symbols: - Local: - - Name: global-g1.c - Type: STT_FILE - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .comment - Type: STT_SECTION - Section: .comment - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: fn - Type: STT_FUNC - Section: .text - Size: 0x000000000000000D - - Name: g1 -... diff --git a/test/old-elf/sectionGroups/sectiongroup-with-undef-signature.test b/test/old-elf/sectionGroups/sectiongroup-with-undef-signature.test deleted file mode 100644 index 83a69a3828b2..000000000000 --- a/test/old-elf/sectionGroups/sectiongroup-with-undef-signature.test +++ /dev/null @@ -1,219 +0,0 @@ -# This tests that comdat undef symbol is overridden by a global symbol. -# comdat1.s -#------------------------ -# .section .foo,"axG",@progbits,g1,comdat -# word g1 -# -#comdat2.s << \! -#----------------- -# .global g1 -# .section .foo,"axG",@progbits,g1,comdat -#g1: -# nop -# -#global-g1.c -#----------- -#int g1=10; -# -#RUN: yaml2obj -format=elf -docnum 1 %s -o %t.comdat1.o -#RUN: yaml2obj -format=elf -docnum 2 %s -o %t.comdat2.o -#RUN: yaml2obj -format=elf -docnum 3 %s -o %t.g1.o -#RUN: lld -flavor old-gnu -target x86_64 %t.comdat1.o %t.comdat2.o \ -#RUN: %t.g1.o --noinhibit-exec --output-filetype=yaml -o %t2.out.yaml -#RUN: lld -flavor old-gnu -target x86_64 %t.comdat1.o %t.comdat2.o \ -#RUN: %t.g1.o --noinhibit-exec -o %t2.out -#RUN: FileCheck %s -check-prefix=CHECKGROUP < %t2.out.yaml -#RUN: llvm-readobj -sections %t2.out | FileCheck %s -check-prefix=CHECKGROUPSECTIONS -#RUN: llvm-readobj -symbols %t2.out | FileCheck %s -check-prefix=CHECKSYMBOLS -#CHECKGROUP: - name: g1 -#CHECKGROUP: scope: global -#CHECKGROUP: content: [ 0A, 00, 00, 00 ] -#CHECKGROUP: section-name: .data -#CHECKGROUPSECTIONS: Name: .foo -#CHECKGROUPSECTIONS: Type: SHT_PROGBITS -#CHECKGROUPSECTIONS: Flags [ -#CHECKGROUPSECTIONS: SHF_ALLOC -#CHECKGROUPSECTIONS: SHF_EXECINSTR -#CHECKGROUPSECTIONS: ] -#CHECKGROUPSECTIONS: Size: 2 -#CHECKGROUPSECTIONS: Name: .data -#CHECKGROUPSECTIONS: Type: SHT_PROGBITS -#CHECKGROUPSECTIONS: Flags [ -#CHECKGROUPSECTIONS: SHF_ALLOC -#CHECKGROUPSECTIONS: SHF_WRITE -#CHECKGROUPSECTIONS: ] -#CHECKGROUPSECTIONS: Size: 4 -#CHECKSYMBOLS: Name: g1 -#CHECKSYMBOLS: Section: .data ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .group - Type: SHT_GROUP - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: g1 - Members: - - SectionOrType: GRP_COMDAT - - SectionOrType: .foo - - SectionOrType: .rela.foo - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .foo - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ] - AddressAlign: 0x0000000000000001 - Content: '0000' - - Name: .rela.foo - Type: SHT_RELA - Flags: [ SHF_GROUP ] - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .foo - Relocations: - - Offset: 0x0000000000000000 - Symbol: g1 - Type: R_X86_64_16 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .foo - Type: STT_SECTION - Section: .foo - Global: - - Name: g1 -... ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .group - Type: SHT_GROUP - Link: .symtab - AddressAlign: 0x0000000000000004 - Info: g1 - Members: - - SectionOrType: GRP_COMDAT - - SectionOrType: .foo - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .foo - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ] - AddressAlign: 0x0000000000000001 - Content: '90' -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .foo - Type: STT_SECTION - Section: .foo - Global: - - Name: g1 - Section: .foo -... ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: 0A000000 - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 00636C616E672076657273696F6E20332E372E3020287472756E6B203232393535372920286C6C766D2F7472756E6B203232393536332900 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' -Symbols: - Local: - - Name: global-g1.c - Type: STT_FILE - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .comment - Type: STT_SECTION - Section: .comment - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - Global: - - Name: g1 - Type: STT_OBJECT - Section: .data - Size: 0x0000000000000004 -... diff --git a/test/old-elf/sections.test b/test/old-elf/sections.test deleted file mode 100644 index f36cad619186..000000000000 --- a/test/old-elf/sections.test +++ /dev/null @@ -1,142 +0,0 @@ -# This test checks if sections are created properly in the output that appear in -# the input -RUN: lld -flavor old-gnu -target i386 -o %t1 %p/Inputs/section-test.i386 \ -RUN: -static -e baz -RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix=OBJDUMP %s -RUN: llvm-readobj -h -s -t %t1 | FileCheck -check-prefix=READOBJ %s - -OBJDUMP: 0 00000000 0000000000000000 -OBJDUMP: 1 .text 0000000a 0000000000000074 TEXT DATA -OBJDUMP: 2 .data 00000004 0000000000001000 DATA -OBJDUMP: 3 .special 00000004 0000000000001004 DATA -OBJDUMP: 4 .anotherspecial 00000004 0000000000001008 DATA -OBJDUMP: 5 .bss 00000004 000000000000100c BSS -OBJDUMP: 6 .shstrtab {{[0-9a-f]+}} 0000000000000000 -OBJDUMP: 7 .symtab {{[0-9a-f]+}} 0000000000000000 -OBJDUMP: 8 .strtab {{[0-9a-f]+}} 0000000000000000 - -READOBJ: Format: ELF32-i386 -READOBJ: Arch: i386 -READOBJ: AddressSize: 32bit -READOBJ: ElfHeader { -READOBJ: Ident { -READOBJ: DataEncoding: LittleEndian (0x1) -READOBJ: } -READOBJ: Machine: EM_386 -READOBJ: } - -READOBJ: Sections [ -READOBJ: Section { -READOBJ: Index: 0 -READOBJ: Name: (0) -READOBJ: Type: SHT_NULL -READOBJ: Flags [ (0x0) -READOBJ: ] -READOBJ: Address: 0x0 -READOBJ: Size: 0 -READOBJ: } -READOBJ: Section { -READOBJ: Index: 1 -READOBJ: Name: .text -READOBJ: Type: SHT_PROGBITS -READOBJ: Flags [ (0x6) -READOBJ: SHF_ALLOC -READOBJ: SHF_EXECINSTR -READOBJ: ] -READOBJ: Address: 0x74 -READOBJ: Size: 10 -READOBJ: AddressAlignment: 4 -READOBJ: } -READOBJ: Section { -READOBJ: Index: 2 -READOBJ: Name: .data -READOBJ: Type: SHT_PROGBITS -READOBJ: Flags [ (0x3) -READOBJ: SHF_ALLOC -READOBJ: SHF_WRITE -READOBJ: ] -READOBJ: Address: 0x1000 -READOBJ: Size: 4 -READOBJ: AddressAlignment: 4 -READOBJ: } -READOBJ: Section { -READOBJ: Index: 3 -READOBJ: Name: .special -READOBJ: Type: SHT_PROGBITS -READOBJ: Flags [ (0x3) -READOBJ: SHF_ALLOC -READOBJ: SHF_WRITE -READOBJ: ] -READOBJ: Address: 0x1004 -READOBJ: Size: 4 -READOBJ: } -READOBJ: Section { -READOBJ: Index: 4 -READOBJ: Name: .anotherspecial -READOBJ: Type: SHT_PROGBITS -READOBJ: Flags [ (0x3) -READOBJ: SHF_ALLOC -READOBJ: SHF_WRITE -READOBJ: ] -READOBJ: Address: 0x1008 -READOBJ: Size: 4 -READOBJ: } -READOBJ: Section { -READOBJ: Index: 5 -READOBJ: Name: .bss -READOBJ: Type: SHT_NOBITS -READOBJ: Flags [ (0x3) -READOBJ: SHF_ALLOC -READOBJ: SHF_WRITE -READOBJ: ] -READOBJ: Address: 0x100C -READOBJ: Size: 4 -READOBJ: } -READOBJ: Section { -READOBJ: Index: 6 -READOBJ: Name: .shstrtab -READOBJ: Type: SHT_STRTAB -READOBJ: Flags [ (0x0) -READOBJ: ] -READOBJ: Address: 0x0 -READOBJ: Link: 0 -READOBJ: AddressAlignment: 1 -READOBJ: } -READOBJ: Section { -READOBJ: Index: 7 -READOBJ: Name: .symtab -READOBJ: Type: SHT_SYMTAB -READOBJ: Flags [ (0x0) -READOBJ: ] -READOBJ: Address: 0x0 -READOBJ: Link: 8 -READOBJ: AddressAlignment: 4 -READOBJ: EntrySize: 16 -READOBJ: } -READOBJ: Section { -READOBJ: Index: 8 -READOBJ: Name: .strtab -READOBJ: Type: SHT_STRTAB -READOBJ: Flags [ (0x0) -READOBJ: ] -READOBJ: Address: 0x0 -READOBJ: } -READOBJ: ] - -READOBJ: Symbols [ -READOBJ: Symbol { -READOBJ: Name: baz -READOBJ: Value: 0x74 -READOBJ: Size: 10 -READOBJ: Binding: Global -READOBJ: Type: Function -READOBJ: Section: .text -READOBJ: } -READOBJ: Symbol { -READOBJ: Name: y -READOBJ: Value: 0x1004 -READOBJ: Size: 4 -READOBJ: Binding: Global -READOBJ: Type: Object -READOBJ: Section: .special -READOBJ: } diff --git a/test/old-elf/sh_addralign.test b/test/old-elf/sh_addralign.test deleted file mode 100644 index 97ddd5f1030a..000000000000 --- a/test/old-elf/sh_addralign.test +++ /dev/null @@ -1,37 +0,0 @@ -# Check handling of section alignment. -# RUN: yaml2obj -format=elf %s > %t-obj -# RUN: lld -flavor old-gnu -target arm64 -o %t-exe %t-obj -# RUN: llvm-objdump -h %t-exe | FileCheck %s - -# CHECK: 8 .data 00000000 0000000000402000 DATA - -!ELF -FileHeader: !FileHeader - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_AARCH64 - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: '' - AddressAlign: 0 - Flags: [SHF_ALLOC, SHF_EXECINSTR] -- Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 1 - Size: 0x1000 -- Name: .data - Type: SHT_PROGBITS - Content: '' - AddressAlign: 4096 - Flags: [SHF_ALLOC, SHF_WRITE] - -Symbols: - Global: - - Name: _start - Section: .text - Value: 0x0 - Size: 4 diff --git a/test/old-elf/shndx.test b/test/old-elf/shndx.test deleted file mode 100644 index c86fa3349b5f..000000000000 --- a/test/old-elf/shndx.test +++ /dev/null @@ -1,18 +0,0 @@ -Test that we can handle shndx. The test file has a shndx despite having only -a few sections. One might consider it invalid, but it has a clear interpretation -and avoids needing 65K sections to test the corresponding code path. - -RUN: lld -target x86_64-pc-linux -flavor old-gnu %p/Inputs/shndx.o-x86_64 -o %t.so -shared -RUN: llvm-readobj -s -t %t.so | FileCheck %s - -CHECK: Name: .text -CHECK-NEXT: Type: SHT_PROGBITS (0x1) -CHECK-NEXT: Flags [ (0x6) -CHECK-NEXT: SHF_ALLOC (0x2) -CHECK-NEXT: SHF_EXECINSTR (0x4) -CHECK-NEXT: ] -CHECK-NEXT: Address: [[ADDR:.*]] - -// CHECK: Symbol { -// CHECK: Name: foo -// CHECK-NEXT: Value: [[ADDR]] diff --git a/test/old-elf/soname.test b/test/old-elf/soname.test deleted file mode 100644 index b4dce9746d48..000000000000 --- a/test/old-elf/soname.test +++ /dev/null @@ -1,6 +0,0 @@ -RUN: lld -flavor old-gnu -shared -target i386 -e main %p/Inputs/writersyms.o \ -RUN: -o %t -soname libtest.so -RUN: llvm-readobj -dynamic-table %t | FileCheck %s - -CHECK: LoadName: libtest.so -CHECK: 0x0000000E SONAME LibrarySoname (libtest.so) diff --git a/test/old-elf/start-stop-sym.test b/test/old-elf/start-stop-sym.test deleted file mode 100644 index 62c16a91ee69..000000000000 --- a/test/old-elf/start-stop-sym.test +++ /dev/null @@ -1,108 +0,0 @@ -# Check __start_XXX and __stop_XXX symbols handling where XXX -# is a section name which can be represented as a C identifier. - -# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.o -# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.o -# RUN: lld -flavor old-gnu -target mipsel -static -e T0 -o %t.exe %t1.o %t2.o -# RUN: llvm-objdump -s -t %t.exe | FileCheck %s - -# CHECK: Contents of section .text: -# CHECK-NEXT: 400080 a0004000 b4004000 00000000 00000000 -# ^ start of _csec section -# ^ end of _csec section -# CHECK-NEXT: 400090 a0004000 b4004000 -# CHECK-NEXT: Contents of section _csec: -# CHECK-NEXT: 4000a0 00000000 00000000 00000000 00000000 -# CHECK-NEXT: 4000b0 00000000 - -# CHECK: 004000a0 g *ABS* 00000000 __start__csec -# CHECK: 004000b4 g *ABS* 00000000 __stop__csec - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Size: 8 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 0 - Symbol: __start__csec - Type: R_MIPS_32 - - Offset: 4 - Symbol: __stop__csec - Type: R_MIPS_32 - - - Name: _csec - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 16 - Size: 4 - -Symbols: - Weak: - - Name: __start__csec - - Name: __stop__csec - Global: - - Name: T0 - Type: STT_FUNC - Section: .text - Size: 8 - ---- -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Size: 8 - - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 4 - Info: .text - Relocations: - - Offset: 0 - Symbol: __start__csec - Type: R_MIPS_32 - - Offset: 4 - Symbol: __stop__csec - Type: R_MIPS_32 - - - Name: _csec - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 16 - Size: 4 - -Symbols: - Weak: - - Name: __start__csec - - Name: __stop__csec - Global: - - Name: T1 - Type: STT_FUNC - Section: .text - Size: 8 -... diff --git a/test/old-elf/strip-all.test b/test/old-elf/strip-all.test deleted file mode 100644 index faf30349ec84..000000000000 --- a/test/old-elf/strip-all.test +++ /dev/null @@ -1,108 +0,0 @@ -# Tests the --strip-all (-s) flag. -# We expect that .symtab and .strtab are stripped from the final executable. -# -# The following code was used to generate the object. -# $ clang -c blah.c -o blah -# -# void -# callMeMaybe(int *v) -# { -# *v += 1; -# } -# -# int -# main(void) -# { -# -# int blah = 42; -# callMeMaybe(&blah); -# } - -#RUN: yaml2obj -format=elf %s -o=%t.o -#RUN: lld -flavor old-gnu -target x86_64 %t.o -e=main --strip-all -o %t1 -#RUN: llvm-objdump -section-headers %t1 | FileCheck %s - -#CHECK: 14 .shstrtab 0000007d 0000000000000000 -#CHECK-NOT: 15 .symtab 00000198 0000000000000000 -#CHECK-NOT: 16 .strtab 000000e4 0000000000000000 - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_FREEBSD - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E548897DF8488B7DF88B07050100000089075DC3660F1F840000000000554889E54883EC10488D7DFCC745FC2A000000E8C8FFFFFFB8000000004883C4105DC3 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 004672656542534420636C616E672076657273696F6E20332E342E312028746167732F52454C454153455F33342F646F74312D66696E616C203230383033322920323031343035313200 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000017A5200017810011B0C070890010000180000001C000000000000001700000000410E108602430D060000001800000038000000000000002300000000410E108602430D06000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text - Type: R_X86_64_PC32 - - Offset: 0x000000000000003C - Symbol: .text - Type: R_X86_64_PC32 - Addend: 32 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .comment - Type: STT_SECTION - Section: .comment - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: callMeMaybe - Type: STT_FUNC - Section: .text - Size: 0x0000000000000017 - - Name: main - Type: STT_FUNC - Section: .text - Value: 0x0000000000000020 - Size: 0x0000000000000023 -... diff --git a/test/old-elf/stripped-empty.test b/test/old-elf/stripped-empty.test deleted file mode 100644 index ddf3b3899d10..000000000000 --- a/test/old-elf/stripped-empty.test +++ /dev/null @@ -1,4 +0,0 @@ -RUN: lld -flavor old-gnu -shared -o test.so \ -RUN: -target x86_64 %p/Inputs/stripped-empty.x86_64 - -test that we handle files without a symbol table. diff --git a/test/old-elf/symbols.test b/test/old-elf/symbols.test deleted file mode 100644 index bcf399e86eb8..000000000000 --- a/test/old-elf/symbols.test +++ /dev/null @@ -1,33 +0,0 @@ -# Tests the functionality of archive libraries reading -# and resolution -# Note: The binary files would not be required once we have support to generate -# binary archives from textual(yaml) input -# -# Tests generated using the source files below -# main file -# -#extern int __bss_start __attribute__ ((weak)); -#int a; -#int main() -#{ -# return 0; -#} -# - -RUN: lld -flavor old-gnu -target i386 -e main %p/Inputs/writersyms.o -o %t1 -RUN: llvm-nm -n %t1 | FileCheck -check-prefix CHECKSYMS %s -RUN: lld -flavor old-gnu -shared -target i386 -e main %p/Inputs/writersyms.o -o %t1 -RUN: llvm-nm -n %t1 | FileCheck -check-prefix CHECKSHAREDSYMS %s - -CHECKSYMS: {{[0-9a-f]+}} a 1.c -CHECKSYMS: {{[0-9a-f]+}} T main -CHECKSYMS: {{[0-9a-f]+}} A __bss_start -CHECKSYMS: {{[0-9a-f]+}} B a -CHECKSYMS: {{[0-9a-f]+}} A __bss_end -CHECKSYMS: {{[0-9a-f]+}} A _end -CHECKSYMS: {{[0-9a-f]+}} A end - -CHECKSHAREDSYMS: {{[0-9a-f]+}} a 1.c -CHECKSHAREDSYMS: {{[0-9a-f]+}} T main -CHECKSHAREDSYMS: {{[0-9a-f]+}} B a -CHECKSHAREDSYMS: {{[0-9a-f]+}} A _end diff --git a/test/old-elf/tls-tbss-size.test b/test/old-elf/tls-tbss-size.test deleted file mode 100644 index a7fd86cb7b43..000000000000 --- a/test/old-elf/tls-tbss-size.test +++ /dev/null @@ -1,176 +0,0 @@ -# This test verify if external TLS non initialized variables (tbss) are -# accounted in TBSS segment size - -# The input file 'test/elf/Inputs/tls-tbss-size.yaml' declares: -# -# __thread int t0; -# __thread int t1; -# __thread int t2; -# __thread int t3; -# -# And the 'test/elf/tls-tbss-size.test' defines: -# -# __thread int t4; -# __thread int t5; -# __thread int t6; -# __thread int t7; -# -# __thread int t8 = 3; -# __thread int t9 = 4; -# __thread int t10 = 5; -# __thread int t11 = 6; - -#RUN: yaml2obj -format=elf -o=%t-t1.o %p/Inputs/tls-tbss-size.yaml -#RUN: yaml2obj -format=elf -o=%t-t0.o %s -#RUN: lld -flavor old-gnu -target x86_64-linux --noinhibit-exec -o %t.exe %t-t0.o %t-t1.o -#RUN: llvm-readobj --sections %t.exe | FileCheck %s - -#CHECK: Sections [ -#CHECK: Section { -#CHECK: Index: 9 -#CHECK: Name: .tdata (71) -#CHECK: Size: 16 -#CHECK: } -#CHECK: Section { -#CHECK: Index: 10 -#CHECK: Name: .tbss (78) -#CHECK: Size: 32 -#CHECK: } - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 488B050000000064C70001000000488B050000000064C70002000000488B050000000064C70003000000488B050000000064C7000400000064C70425000000000500000064C70425000000000600000064C70425000000000700000064C70425000000000800000031C0C3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000003 - Symbol: t0 - Type: R_X86_64_GOTTPOFF - Addend: -4 - - Offset: 0x0000000000000011 - Symbol: t1 - Type: R_X86_64_GOTTPOFF - Addend: -4 - - Offset: 0x000000000000001F - Symbol: t2 - Type: R_X86_64_GOTTPOFF - Addend: -4 - - Offset: 0x000000000000002D - Symbol: t3 - Type: R_X86_64_GOTTPOFF - Addend: -4 - - Offset: 0x000000000000003C - Symbol: t4 - Type: R_X86_64_TPOFF32 - - Offset: 0x0000000000000048 - Symbol: t5 - Type: R_X86_64_TPOFF32 - - Offset: 0x0000000000000054 - Symbol: t6 - Type: R_X86_64_TPOFF32 - - Offset: 0x0000000000000060 - Symbol: t7 - Type: R_X86_64_TPOFF32 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .tdata - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x0000000000000004 - Content: '03000000040000000500000006000000' - - Name: .tbss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] - AddressAlign: 0x0000000000000004 - Size: 16 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000017A5200017810011B0C070890010000140000001C000000000000006B0000000000000000000000 -Symbols: - Local: - - Name: .tbss - Type: STT_TLS - Section: .tbss - - Name: .tdata - Type: STT_TLS - Section: .tdata - - Type: STT_SECTION - Section: .text - Global: - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x000000000000006B - - Name: t0 - Type: STT_TLS - - Name: t1 - Type: STT_TLS - - Name: t10 - Type: STT_TLS - Section: .tdata - Value: 0x0000000000000008 - Size: 0x0000000000000004 - - Name: t11 - Type: STT_TLS - Section: .tdata - Value: 0x000000000000000C - Size: 0x0000000000000004 - - Name: t2 - Type: STT_TLS - - Name: t3 - Type: STT_TLS - - Name: t4 - Type: STT_TLS - Section: .tbss - Size: 0x0000000000000004 - - Name: t5 - Type: STT_TLS - Section: .tbss - Value: 0x0000000000000004 - Size: 0x0000000000000004 - - Name: t6 - Type: STT_TLS - Section: .tbss - Value: 0x0000000000000008 - Size: 0x0000000000000004 - - Name: t7 - Type: STT_TLS - Section: .tbss - Value: 0x000000000000000C - Size: 0x0000000000000004 - - Name: t8 - Type: STT_TLS - Section: .tdata - Size: 0x0000000000000004 - - Name: t9 - Type: STT_TLS - Section: .tdata - Value: 0x0000000000000004 - Size: 0x0000000000000004 -... diff --git a/test/old-elf/tls.test b/test/old-elf/tls.test deleted file mode 100644 index 6fb33941a88c..000000000000 --- a/test/old-elf/tls.test +++ /dev/null @@ -1,43 +0,0 @@ -# REQUIRES: x86 - -# This tests verifies that TLS variables have correct offsets -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/tls.x86-64 -static \ -RUN: --output-filetype=yaml --noinhibit-exec | FileCheck %s -check-prefix=YAML - -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/tls.x86-64 -o %t \ -RUN: --noinhibit-exec -e main -static && llvm-objdump -d %t | FileCheck %s - -// Verify that the TLS accesses have the correct offsets. - -YAML: name: main -YAML: references: -YAML: kind: R_X86_64_TPOFF32 -YAML: offset: 9 -YAML: target: tls1 -YAML: kind: R_X86_64_TPOFF32 -YAML: offset: 17 -YAML: target: tls0 -YAML: kind: R_X86_64_TPOFF32 -YAML: offset: 25 -YAML: target: tls2 - -YAML: name: GOTTPOFF -YAML: kind: R_X86_64_GOTTPOFF -YAML: target: [[GOTNAME:[a-zA-Z0-9_]+]] - -YAML: type: got -YAML: references: -YAML: kind: R_X86_64_TPOFF64 -YAML: target: tls2 - -// main -CHECK: addl %fs:-4 -CHECK: addl %fs:-8 -CHECK: addl %fs:-12 - -// GOTTPOFF -CHECK: movq {{[0-9]+}}(%rip) - -// TLSLD -CHECK: movq %fs:0, %rax -CHECK: leaq -8(%rax), %rax diff --git a/test/old-elf/tlsAddr.test b/test/old-elf/tlsAddr.test deleted file mode 100644 index bcb089c504ed..000000000000 --- a/test/old-elf/tlsAddr.test +++ /dev/null @@ -1,7 +0,0 @@ -# This tests verifies that TLS variables have correct offsets -# and that TBSS doesn't occupy memory -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/tlsAddr.x86-64 -static \ -RUN: -o %t --noinhibit-exec -RUN: llvm-objdump -section-headers %t | FileCheck -check-prefix=CHECKADDR %s - -CHECKADDR: {{[0-9]+}} .data 00000000 0000000000401008 DATA diff --git a/test/old-elf/undef-from-dso-to-main.test b/test/old-elf/undef-from-dso-to-main.test deleted file mode 100644 index c19a0197061e..000000000000 --- a/test/old-elf/undef-from-dso-to-main.test +++ /dev/null @@ -1,52 +0,0 @@ -# Tests that a reference from a DSO to a regular object -# forces the final executable to export the symbol. - -#RUN: yaml2obj -format=elf %p/Inputs/undef2-so.o.yaml -o=%t.o.so -#RUN: lld -flavor old-gnu -target x86_64 -shared %t.o.so -o %T/libundef2.so -#RUN: yaml2obj -format=elf %s -o=%t.o -#RUN: lld -flavor old-gnu -target x86_64 %t.o -L%T -lundef2 -o %t1 -#RUN: llvm-readobj -dyn-symbols %t1 | FileCheck -check-prefix CHECKSYMS %s - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000001 - Content: C3 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Size: 4 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Global: - - Name: myexportedsymbol - Type: STT_OBJECT - Section: .bss - Size: 0x0000000000000004 - - Name: _start - Section: .text - Size: 0x0000000000000001 - -#CHECKSYMS: myexportedsymbol diff --git a/test/old-elf/undef-from-main-dso.test b/test/old-elf/undef-from-main-dso.test deleted file mode 100644 index 8722a55f672c..000000000000 --- a/test/old-elf/undef-from-main-dso.test +++ /dev/null @@ -1,43 +0,0 @@ -RUN: lld -flavor old-gnu -target x86_64 -e main -o %t -L%p/Inputs \ -RUN: %p/Inputs/undef.o -lundef -RUN: llvm-readobj -relocations -symbols -dyn-symbols %t | FileCheck %s - -RUN: lld -flavor old-gnu -target x86_64 -e main -o %t -L%p/Inputs \ -RUN: %p/Inputs/undef-pc32.o -lundef -RUN: llvm-readobj -relocations -symbols -dyn-symbols %t | FileCheck %s - -# DSO source code: -# int x[2] = { 1, 2 }; -# -# Main binary source code: -# -# extern int x[2]; -# -# int main(void) -# { -# x[0] = 2; -# } -# - -CHECK: Relocations [ -CHECK-NEXT: Section ({{[0-9]+}}) .rela.dyn { -CHECK-NEXT: 0x{{[1-9A-F][0-9A-F]*}} R_X86_64_COPY x 0x0 -CHECK-NEXT: } -CHECK-NEXT: ] - -CHECK: Name: x ({{[0-9]+}} -CHECK-NEXT: Value: 0x{{[1-9A-F][0-9A-F]*}} -CHECK-NEXT: Size: 8 -CHECK-NEXT: Binding: Global (0x1) -CHECK-NEXT: Type: Object (0x1) -CHECK-NEXT: Other: 0 -CHECK-NEXT: Section: .bss - -CHECK: Name: x@ ({{[0-9]+}} -CHECK-NEXT: Value: 0x{{[1-9A-F][0-9A-F]*}} -CHECK-NEXT: Size: 8 -CHECK-NEXT: Binding: Global (0x1) -CHECK-NEXT: Type: Object (0x1) -CHECK-NEXT: Other: 0 -CHECK-NEXT: Section: .bss - diff --git a/test/old-elf/weaksym.test b/test/old-elf/weaksym.test deleted file mode 100644 index 59d997edc64c..000000000000 --- a/test/old-elf/weaksym.test +++ /dev/null @@ -1,7 +0,0 @@ -# Tests that a weak reference remains a weak reference, -# even if a shared library defines the symbol weak as well. - -RUN: lld -flavor old-gnu -target x86_64 -shared %p/Inputs/weaksym.o -L%p/Inputs -lweaksym -o %t1 -RUN: llvm-nm -n %t1 | FileCheck -check-prefix CHECKSYMS %s - -CHECKSYMS: w weaksym diff --git a/test/old-elf/wrap.test b/test/old-elf/wrap.test deleted file mode 100644 index 427764970be8..000000000000 --- a/test/old-elf/wrap.test +++ /dev/null @@ -1,276 +0,0 @@ -# This tests the functionality of using the --wrap option. -# The test case is extracted by compiling and linking the following code. -# -#cat > main.c << \! -#int main() { -# foo(); -# return 0; -#} -#! -# -#cat > wrapfoo.c << \! -#int __wrap_foo() { -# __real_foo(); -# return 0; -#} -#! -# -#cat > realfoo.c << \! -#int foo() { -# return 0; -#} -#! -# -#clang main.c wrapfoo.c realfoo.c -Xlinker --wrap -Xlinker foo -#RUN: yaml2obj -format=elf -docnum 1 %s -o %t.main.o -#RUN: yaml2obj -format=elf -docnum 2 %s -o %t.wrapfoo.o -#RUN: yaml2obj -format=elf -docnum 3 %s -o %t.realfoo.o -#RUN: lld -flavor old-gnu -target x86_64 %t.main.o %t.wrapfoo.o %t.realfoo.o \ -#RUN: --wrap foo --wrap foo --noinhibit-exec --output-filetype=yaml -o %t2.out -#RUN: lld -flavor old-gnu -target x86_64 %t.main.o %t.wrapfoo.o \ -#RUN: --wrap foo --wrap foo --noinhibit-exec --output-filetype=yaml -o %t2.out.undef 2>&1 | \ -#RUN: FileCheck %s -check-prefix=CHECKUNDEF -#CHECKWRAP: - name: main -#CHECKWRAP: references: -#CHECKWRAP: - kind: R_X86_64_PC32 -#CHECKWRAP: target: __wrap_foo -#CHECKWRAP: - name: __wrap_foo -#CHECKWRAP: references: -#CHECKWRAP: - kind: R_X86_64_PC32 -#CHECKWRAP: target: foo -#CHECKUNDEF: Undefined symbol: {{.*}}main.o: foo ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 5031C0E80000000031C05AC3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000004 - Symbol: foo - Type: R_X86_64_PC32 - Addend: -4 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 00636C616E672076657273696F6E20332E372E3020287472756E6B203232383733392920286C6C766D2F7472756E6B203232383734382900 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000037A5200017810011B0C070890010000140000001C000000000000000C00000000410E1000000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text - Type: R_X86_64_PC32 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .comment - Type: STT_SECTION - Section: .comment - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x000000000000000C - - Name: foo -... ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 5031C0E80000000031C05AC3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000004 - Symbol: __real_foo - Type: R_X86_64_PC32 - Addend: -4 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 00636C616E672076657273696F6E20332E372E3020287472756E6B203232383733392920286C6C766D2F7472756E6B203232383734382900 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000037A5200017810011B0C070890010000140000001C000000000000000C00000000410E1000000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text - Type: R_X86_64_PC32 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .comment - Type: STT_SECTION - Section: .comment - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: __wrap_foo - Type: STT_FUNC - Section: .text - Size: 0x000000000000000C - - Name: __real_foo -... ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 31C0C3 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 00636C616E672076657273696F6E20332E372E3020287472756E6B203232383733392920286C6C766D2F7472756E6B203232383734382900 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000037A5200017810011B0C070890010000140000001C00000000000000030000000000000000000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text - Type: R_X86_64_PC32 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .comment - Type: STT_SECTION - Section: .comment - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: foo - Type: STT_FUNC - Section: .text - Size: 0x0000000000000003 -... diff --git a/test/old-elf/x86-64-dynamic-relocs.test b/test/old-elf/x86-64-dynamic-relocs.test deleted file mode 100644 index c5572d0aa3a3..000000000000 --- a/test/old-elf/x86-64-dynamic-relocs.test +++ /dev/null @@ -1,26 +0,0 @@ -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/relocs-dynamic.x86-64 \ -RUN: --output-filetype=yaml --noinhibit-exec | FileCheck %s - -path: -defined-atoms: - - name: main - scope: global - content: [ E8, 00, 00, 00, 00, C3 ] - alignment: 16 - section-choice: custom-required - section-name: .text - references: - - kind: R_X86_64_PLT32 - offset: 1 - target: foo - addend: -4 - - name: foo - scope: global - content: [ C3 ] - alignment: 6 mod 16 - section-choice: custom-required - section-name: .text - -# Don't generate a PLT/GOT entry for a PLT32 relocation to a non-shared symbol. -CHECK-NOT: got -CHECK-NOT: stub diff --git a/test/old-elf/x86-64-dynamic.test b/test/old-elf/x86-64-dynamic.test deleted file mode 100644 index d957e6ee85ee..000000000000 --- a/test/old-elf/x86-64-dynamic.test +++ /dev/null @@ -1,79 +0,0 @@ -# Checks that linking an object file with a shared object creates the necessary -# PLT/GOT Entries -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/use-shared.x86-64 \ -RUN: %p/Inputs/shared.so-x86-64 --output-filetype=yaml -o %t1 --noinhibit-exec -RUN: FileCheck %s < %t1 - -RUN: lld -flavor old-gnu -target x86_64-linux %p/Inputs/use-shared-32s.x86-64 \ -RUN: %p/Inputs/shared.so-x86-64 --output-filetype=yaml --noinhibit-exec \ -RUN: | FileCheck %s --check-prefix=32S - -CHECK: - name: main -CHECK: scope: global -CHECK: references: -CHECK: - kind: R_X86_64_PC32 -CHECK: offset: 18 -CHECK: target: [[PLTNAME:[-a-zA-Z0-9_]+]] -CHECK: addend: -4 -CHECK: - kind: R_X86_64_GOTPCREL -CHECK: offset: 25 -CHECK: target: [[GOTNAME:[-a-zA-Z0-9_]+]] -CHECK: addend: -4 - - - name: .PLT0 -CHECK: type: stub -CHECK: content: [ FF, 35, 00, 00, 00, 00, FF, 25, 00, 00, 00, 00, -CHECK: 90, 90, 90, 90 ] -CHECK: alignment: 16 -CHECK: section-choice: custom-required -CHECK: section-name: .plt -CHECK: references: -CHECK: - kind: R_X86_64_PC32 -CHECK: offset: 2 - target: __got0 -CHECK: addend: -4 -CHECK: - kind: R_X86_64_PC32 -CHECK: offset: 8 - target: __got1 -CHECK: addend: -4 - - name: [[PLTNAME]] -CHECK: type: stub -CHECK: content: [ FF, 25, 00, 00, 00, 00, 68, 00, 00, 00, 00, E9, -CHECK: 00, 00, 00, 00 ] -CHECK: alignment: 16 -CHECK: section-choice: custom-required -CHECK: section-name: .plt -CHECK: references: -CHECK: - kind: R_X86_64_PC32 -CHECK: offset: 2 - target: __got_foo -CHECK: addend: -4 -CHECK: - kind: LLD_R_X86_64_GOTRELINDEX -CHECK: offset: 7 - target: __got_foo -CHECK: - kind: R_X86_64_PC32 -CHECK: offset: 12 - target: .PLT0 -CHECK: addend: -4 - -// Don't check the GOT and PLT names as they are only present in assert builds. -CHECK: type: got -CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] -CHECK: section-choice: custom-required -CHECK: section-name: .got -CHECK: permissions: rw- -CHECK: references: -CHECK: - kind: R_X86_64_GLOB_DAT -CHECK: offset: 0 -CHECK: target: i - -CHECK:shared-library-atoms: -CHECK: - name: foo -CHECK: load-name: shared.so-x86-64 - -32S: name: main -32S: kind: R_X86_64_PC32 -32S: target: func -32S: kind: R_X86_64_32S -32S: kind: R_X86_64_PC32 -32S: type: stub diff --git a/test/old-elf/x86.test b/test/old-elf/x86.test deleted file mode 100644 index 3bc4a6963a50..000000000000 --- a/test/old-elf/x86.test +++ /dev/null @@ -1,38 +0,0 @@ -# Source for input file: reloc-xb.x86 -# xb.S: -# .section .text, "ax", @progbits -# .align 0x4 -# .globl _start -# _start: -# .globl back -# back: -# call target -# -# Source for input file: reloc-xt.x86 -# xt.S: -# .section .text, "ax", @progbits -# -# .globl target -# target: -# call back -# -# Assembled with: "as --32" - -RUN: lld -flavor old-gnu -target i386 -e back --output-filetype=yaml %p/Inputs/reloc-xb.x86 %p/Inputs/reloc-xt.x86 | FileCheck %s -check-prefix x86-yaml - -x86-yaml: - name: back -x86-yaml: scope: global -x86-yaml: content: [ E8, FC, FF, FF, FF ] -x86-yaml: references: -x86-yaml: - kind: R_386_PC32 -x86-yaml: offset: 1 -x86-yaml: target: target - -x86-yaml: - name: target -x86-yaml: scope: global -x86-yaml: content: [ E8, FC, FF, FF, FF ] -x86-yaml: references: -x86-yaml: - kind: R_386_PC32 -x86-yaml: offset: 1 -x86-yaml: target: back - diff --git a/test/old-elf/x86_64-kinds.test b/test/old-elf/x86_64-kinds.test deleted file mode 100644 index 111cea53bf0c..000000000000 --- a/test/old-elf/x86_64-kinds.test +++ /dev/null @@ -1,23 +0,0 @@ -REQUIRES: x86 - -RUN: lld -flavor old-gnu -target x86_64-linux -o %t1 %p/Inputs/relocs.x86-64 \ -RUN: -e _start -static -RUN: llvm-objdump -d %t1 | FileCheck %s -check-prefix=RELOCS - -RUN: lld -flavor old-gnu -target x86_64-linux --output-filetype=yaml -e _start -static \ -RUN: %p/Inputs/relocs.x86-64 | FileCheck %s -check-prefix=X86_64 - -RELOCS: ELF64-x86-64 - -// R_X86_64_32S -RELOCS: c7 04 25 -RELOCS-NOT: 00 00 00 00 -RELOCS: 05 00 00 00 movl - -// R_X86_64_PC32 -RELOCS: e8 -RELOCS-NOT: 00 00 00 00 -RELOCS: callq - -X86_64: R_X86_64_32S -X86_64: R_X86_64_PC32 diff --git a/test/old-elf/zoption_dtflags.test b/test/old-elf/zoption_dtflags.test deleted file mode 100644 index 274981bb1360..000000000000 --- a/test/old-elf/zoption_dtflags.test +++ /dev/null @@ -1,89 +0,0 @@ -# Test that -z {origin, now} options work. -# -#RUN: yaml2obj -format=elf %s -o=%t.o -#RUN: lld -flavor old-gnu -target x86_64 %t.o -e=main -z now -z origin -o %t1 -#RUN: llvm-readobj -dynamic-table %t1 | FileCheck %s -# -#CHECK: 0x000000000000001E FLAGS ORIGIN BIND_NOW -#CHECK: 0x000000006FFFFFFB FLAGS_1 NOW ORIGIN - ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_FREEBSD - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E54883EC10C745FC00000000E81C000000B9000000008945F889C84883C4105DC36666662E0F1F840000000000554889E58B45FC5DC3 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 004672656542534420636C616E672076657273696F6E20332E342E312028746167732F52454C454153455F33342F646F74312D66696E616C203230383033322920323031343035313200 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000017A5200017810011B0C070890010000180000001C000000000000002400000000410E108602430D060000001800000038000000000000000900000000410E108602430D06000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text - Type: R_X86_64_PC32 - - Offset: 0x000000000000003C - Symbol: .text - Type: R_X86_64_PC32 - Addend: 48 -Symbols: - Local: - - Name: local - Type: STT_FUNC - Section: .text - Value: 0x0000000000000030 - Size: 0x0000000000000009 - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .comment - Type: STT_SECTION - Section: .comment - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x0000000000000024 -... -- cgit v1.3