[PATCH] D38407: [ELF] - Do --hash-style=both by default.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 5 10:04:53 PDT 2017


Fine with me.

Cheers,
Rafael

George Rimar via Phabricator <reviews at reviews.llvm.org> writes:

> grimar updated this revision to Diff 117784.
> grimar added a comment.
>
> - Applied code from https://reviews.llvm.org/D38573 as requested.
>
>
> https://reviews.llvm.org/D38407
>
> Files:
>   ELF/Config.h
>   ELF/Driver.cpp
>   test/ELF/aarch64-gnu-ifunc-plt.s
>   test/ELF/aarch64-got-relocations.s
>   test/ELF/aarch64-tls-gdie.s
>   test/ELF/aarch64-tls-ie.s
>   test/ELF/aarch64-tls-static.s
>   test/ELF/aarch64-tlsdesc.s
>   test/ELF/abs-hidden.s
>   test/ELF/amdgpu-relocs.s
>   test/ELF/arm-copy.s
>   test/ELF/arm-exidx-shared.s
>   test/ELF/arm-gnu-ifunc-plt.s
>   test/ELF/arm-got-relative.s
>   test/ELF/arm-pie-relative.s
>   test/ELF/arm-plt-reloc.s
>   test/ELF/arm-thumb-plt-reloc.s
>   test/ELF/arm-tls-gd-nonpreemptible.s
>   test/ELF/arm-tls-gd32.s
>   test/ELF/arm-tls-ie32.s
>   test/ELF/arm-tls-ldm32.s
>   test/ELF/arm-tls-norelax-gd-ie.s
>   test/ELF/arm-tls-norelax-gd-le.s
>   test/ELF/arm-tls-norelax-ie-le.s
>   test/ELF/arm-tls-norelax-ld-le.s
>   test/ELF/basic-ppc.s
>   test/ELF/copy-rel-pie.s
>   test/ELF/dynamic-got.s
>   test/ELF/dynamic-list-preempt.s
>   test/ELF/dynamic-list.s
>   test/ELF/dynamic-reloc.s
>   test/ELF/eh-align-cie.s
>   test/ELF/eh-frame-hdr-augmentation.s
>   test/ELF/eh-frame-merge.s
>   test/ELF/eh-frame-padding-no-rosegment.s
>   test/ELF/emit-relocs-shared.s
>   test/ELF/global-offset-table-position-aarch64.s
>   test/ELF/global-offset-table-position-arm.s
>   test/ELF/global-offset-table-position-i386.s
>   test/ELF/global-offset-table-position.s
>   test/ELF/global_offset_table_shared.s
>   test/ELF/gnu-ifunc-gotpcrel.s
>   test/ELF/gnu-ifunc-plt-i386.s
>   test/ELF/gnu-ifunc-plt.s
>   test/ELF/gnu-ifunc-shared.s
>   test/ELF/got-aarch64.s
>   test/ELF/got.s
>   test/ELF/gotpc-relax-nopic.s
>   test/ELF/gotpc-relax-und-dso.s
>   test/ELF/gotpcrelx.s
>   test/ELF/i386-got-and-copy.s
>   test/ELF/i386-gotoff-shared.s
>   test/ELF/i386-gotpc-dynamic.s
>   test/ELF/i386-gotpc.s
>   test/ELF/i386-tls-ie-shared.s
>   test/ELF/icf-symbol-type.s
>   test/ELF/linkerscript/data-segment-relro.s
>   test/ELF/linkerscript/emit-reloc.s
>   test/ELF/linkerscript/extend-pt-load.s
>   test/ELF/linkerscript/header-addr.s
>   test/ELF/linkerscript/implicit-program-header.s
>   test/ELF/linkerscript/no-space.s
>   test/ELF/linkerscript/non-alloc.s
>   test/ELF/linkerscript/orphan-report.s
>   test/ELF/linkerscript/out-of-order.s
>   test/ELF/linkerscript/repsection-symbol.s
>   test/ELF/linkerscript/sections-sort.s
>   test/ELF/linkerscript/segment-start.s
>   test/ELF/linkerscript/sort-non-script.s
>   test/ELF/local-got-pie.s
>   test/ELF/local-got-shared.s
>   test/ELF/local-got.s
>   test/ELF/noplt-pie.s
>   test/ELF/pie-weak.s
>   test/ELF/pr34660.s
>   test/ELF/relocation-copy-alias.s
>   test/ELF/relocation-copy-align-common.s
>   test/ELF/relocation-copy-flags.s
>   test/ELF/relocation-copy-relro.s
>   test/ELF/relocation-i686.s
>   test/ELF/relocation.s
>   test/ELF/relro-omagic.s
>   test/ELF/resolution-end.s
>   test/ELF/retain-symbols-file.s
>   test/ELF/shared.s
>   test/ELF/sort-norosegment.s
>   test/ELF/startstop.s
>   test/ELF/synthetic-got.s
>   test/ELF/tls-dynamic-i686.s
>   test/ELF/tls-dynamic.s
>   test/ELF/tls-got.s
>   test/ELF/tls-i686.s
>   test/ELF/tls-initial-exec-local.s
>   test/ELF/tls-opt-gdie.s
>   test/ELF/tls-opt-gdiele-i686.s
>   test/ELF/tls-opt-iele-i686-nopic.s
>   test/ELF/tls-two-relocs.s
>   test/ELF/verdef-defaultver.s
>   test/ELF/verdef.s
>   test/ELF/verneed.s
>   test/ELF/version-script-extern.s
>   test/ELF/version-script.s
>   test/ELF/x86-64-relax-got-abs.s
>   test/ELF/x86-64-tls-gd-local.s
>
> Index: test/ELF/x86-64-tls-gd-local.s
> ===================================================================
> --- test/ELF/x86-64-tls-gd-local.s
> +++ test/ELF/x86-64-tls-gd-local.s
> @@ -1,6 +1,6 @@
>  // 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: ld.lld --hash-style=sysv %t.o -o %t.so -shared
>  // RUN: llvm-readobj -r -s -section-data %t.so | FileCheck %s
>  
>          .byte   0x66
> Index: test/ELF/x86-64-relax-got-abs.s
> ===================================================================
> --- test/ELF/x86-64-relax-got-abs.s
> +++ test/ELF/x86-64-relax-got-abs.s
> @@ -1,7 +1,7 @@
>  // REQUIRES: x86
>  // RUN: llvm-mc -filetype=obj -relax-relocations -triple=x86_64-pc-linux %s \
>  // RUN:   -o %t.o
> -// RUN: ld.lld %t.o -o %t.so -shared
> +// RUN: ld.lld --hash-style=sysv %t.o -o %t.so -shared
>  // RUN: llvm-objdump -d %t.so | FileCheck %s
>  
>  // We used to fail trying to relax this into a pc relocation to an absolute
> Index: test/ELF/version-script.s
> ===================================================================
> --- test/ELF/version-script.s
> +++ test/ELF/version-script.s
> @@ -142,12 +142,12 @@
>  # 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: ld.lld --hash-style=sysv -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: ld.lld --hash-style=sysv --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 [
> Index: test/ELF/version-script-extern.s
> ===================================================================
> --- test/ELF/version-script-extern.s
> +++ test/ELF/version-script-extern.s
> @@ -7,7 +7,7 @@
>  # RUN: echo "LIBSAMPLE_2.0 { global:" >> %t.script
>  # RUN: echo '  extern "C" { _Z3bari; };' >> %t.script
>  # RUN: echo "};" >> %t.script
> -# RUN: ld.lld --version-script %t.script -shared %t.o -o %t.so
> +# RUN: ld.lld --hash-style=sysv --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 [
> Index: test/ELF/verneed.s
> ===================================================================
> --- test/ELF/verneed.s
> +++ test/ELF/verneed.s
> @@ -1,6 +1,6 @@
>  # 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: ld.lld --hash-style=sysv %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 {
> Index: test/ELF/verdef.s
> ===================================================================
> --- test/ELF/verdef.s
> +++ test/ELF/verdef.s
> @@ -3,7 +3,7 @@
>  # RUN: echo "LIBSAMPLE_1.0 { global: a; local: *; };" > %t.script
>  # RUN: echo "LIBSAMPLE_2.0 { global: b; local: *; };" >> %t.script
>  # RUN: echo "LIBSAMPLE_3.0 { global: c; local: *; };" >> %t.script
> -# RUN: ld.lld --version-script %t.script -shared -soname shared %t.o -o %t.so
> +# RUN: ld.lld --hash-style=sysv --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 {
> @@ -65,7 +65,7 @@
>  
>  ## 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: ld.lld --hash-style=sysv %tmain.o %t.so -o %tout
>  # RUN: llvm-readobj -V %tout | FileCheck --check-prefix=MAIN %s
>  
>  # MAIN:      Version symbols {
> @@ -100,7 +100,7 @@
>  # RUN: echo "LIBSAMPLE_2.0 { global: b; local: *; };" >> %t.script
>  # RUN: echo "LIBSAMPLE_3.0 { global: c; local: *; };" >> %t.script
>  # RUN: echo "}" >> %t.script
> -# RUN: ld.lld --script %t.script -shared -soname shared %t.o -o %t2.so
> +# RUN: ld.lld --hash-style=sysv --script %t.script -shared -soname shared %t.o -o %t2.so
>  # RUN: llvm-readobj -V -dyn-symbols %t2.so | FileCheck --check-prefix=DSO %s
>  
>  .globl a
> Index: test/ELF/verdef-defaultver.s
> ===================================================================
> --- test/ELF/verdef-defaultver.s
> +++ test/ELF/verdef-defaultver.s
> @@ -3,7 +3,7 @@
>  # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/verdef-defaultver.s -o %t1
>  # RUN: echo "V1 { global: a; local: *; };" > %t.script
>  # RUN: echo "V2 { global: b; c; } V1;" >> %t.script
> -# RUN: ld.lld -shared -soname shared %t1 --version-script %t.script -o %t.so
> +# RUN: ld.lld --hash-style=sysv -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 [
> @@ -107,7 +107,7 @@
>  
>  ## 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: ld.lld --hash-style=sysv %t2 %t.so -o %t3
>  # RUN: llvm-readobj -V -dyn-symbols %t3 | FileCheck --check-prefix=EXE %s
>  
>  # EXE:      DynamicSymbols [
> Index: test/ELF/tls-two-relocs.s
> ===================================================================
> --- test/ELF/tls-two-relocs.s
> +++ test/ELF/tls-two-relocs.s
> @@ -1,6 +1,6 @@
>  // REQUIRES: x86
>  // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
> -// RUN: ld.lld %t -o %tout -shared
> +// RUN: ld.lld --hash-style=sysv %t -o %tout -shared
>  // RUN: llvm-readobj -r %tout | FileCheck %s
>  
>   data16
> Index: test/ELF/tls-opt-iele-i686-nopic.s
> ===================================================================
> --- test/ELF/tls-opt-iele-i686-nopic.s
> +++ test/ELF/tls-opt-iele-i686-nopic.s
> @@ -1,7 +1,7 @@
>  // 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 %t.o %tso -o %t1
> +// RUN: ld.lld --hash-style=sysv %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
>  
> Index: test/ELF/tls-opt-gdiele-i686.s
> ===================================================================
> --- test/ELF/tls-opt-gdiele-i686.s
> +++ test/ELF/tls-opt-gdiele-i686.s
> @@ -1,7 +1,7 @@
>  // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %p/Inputs/tls-opt-gdiele-i686.s -o %tso.o
>  // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o
>  // RUN: ld.lld -shared %tso.o -o %tso
> -// RUN: ld.lld %t.o %tso -o %tout
> +// RUN: ld.lld --hash-style=sysv %t.o %tso -o %tout
>  // RUN: llvm-readobj -r %tout | FileCheck --check-prefix=NORELOC %s
>  // RUN: llvm-objdump -d %tout | FileCheck --check-prefix=DISASM %s
>  
> Index: test/ELF/tls-opt-gdie.s
> ===================================================================
> --- test/ELF/tls-opt-gdie.s
> +++ test/ELF/tls-opt-gdie.s
> @@ -1,7 +1,7 @@
>  // 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-opt-gdie.s -o %tso.o
>  // RUN: ld.lld -shared %tso.o -o %t.so
> -// RUN: ld.lld %t.o %t.so -o %t1
> +// RUN: ld.lld --hash-style=sysv %t.o %t.so -o %t1
>  // RUN: llvm-readobj -s -r %t1 | FileCheck --check-prefix=RELOC %s
>  // RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASM %s
>  
> Index: test/ELF/tls-initial-exec-local.s
> ===================================================================
> --- test/ELF/tls-initial-exec-local.s
> +++ test/ELF/tls-initial-exec-local.s
> @@ -1,6 +1,6 @@
>  // 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: ld.lld --hash-style=sysv -shared %t.o -o %t
>  // RUN: llvm-readobj -r -s %t | FileCheck %s
>  // RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s
>  
> Index: test/ELF/tls-i686.s
> ===================================================================
> --- test/ELF/tls-i686.s
> +++ test/ELF/tls-i686.s
> @@ -1,7 +1,7 @@
>  // REQUIRES: x86
>  // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t
>  // RUN: ld.lld %t -o %tout
> -// RUN: ld.lld %t -shared -o %tsharedout
> +// RUN: ld.lld --hash-style=sysv %t -shared -o %tsharedout
>  // RUN: llvm-objdump -d %tout | FileCheck %s --check-prefix=DIS
>  // RUN: llvm-readobj -r %tout | FileCheck %s --check-prefix=RELOC
>  // RUN: llvm-objdump -d %tsharedout | FileCheck %s --check-prefix=DISSHARED
> Index: test/ELF/tls-got.s
> ===================================================================
> --- test/ELF/tls-got.s
> +++ test/ELF/tls-got.s
> @@ -1,7 +1,7 @@
>  // 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/tls-got.s -o %t2.o
>  // RUN: ld.lld -shared %t2.o -o %t2.so
> -// RUN: ld.lld -e main %t1.o %t2.so -o %t3
> +// RUN: ld.lld --hash-style=sysv -e main %t1.o %t2.so -o %t3
>  // RUN: llvm-readobj -s -r %t3 | FileCheck %s
>  // RUN: llvm-objdump -d %t3 | FileCheck --check-prefix=DISASM %s
>  
> Index: test/ELF/tls-dynamic.s
> ===================================================================
> --- test/ELF/tls-dynamic.s
> +++ test/ELF/tls-dynamic.s
> @@ -1,6 +1,6 @@
>  // REQUIRES: x86
>  // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
> -// RUN: ld.lld -shared %t -o %tout
> +// RUN: ld.lld --hash-style=sysv -shared %t -o %tout
>  // RUN: llvm-readobj -sections -relocations %tout | FileCheck %s
>  // RUN: llvm-objdump -d %tout | FileCheck %s --check-prefix=DIS
>  
> Index: test/ELF/tls-dynamic-i686.s
> ===================================================================
> --- test/ELF/tls-dynamic-i686.s
> +++ test/ELF/tls-dynamic-i686.s
> @@ -1,6 +1,6 @@
>  // REQUIRES: x86
>  // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t
> -// RUN: ld.lld -shared %t -o %tout
> +// RUN: ld.lld --hash-style=sysv -shared %t -o %tout
>  // RUN: llvm-readobj -sections -relocations %tout | FileCheck %s
>  // RUN: llvm-objdump -d %tout | FileCheck %s --check-prefix=DIS
>  
> Index: test/ELF/synthetic-got.s
> ===================================================================
> --- test/ELF/synthetic-got.s
> +++ test/ELF/synthetic-got.s
> @@ -1,7 +1,7 @@
>  # REQUIRES: x86
>  # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
>  # RUN: echo "SECTIONS { }" > %t0.script
> -# RUN: ld.lld -shared %t.o -o %t0.out --script %t0.script
> +# RUN: ld.lld --hash-style=sysv -shared %t.o -o %t0.out --script %t0.script
>  # RUN: llvm-objdump -section-headers %t0.out | FileCheck %s --check-prefix=GOT
>  # RUN: llvm-objdump -s -section=.got -section=.got.plt %t0.out \
>  # RUN:   | FileCheck %s --check-prefix=GOTDATA
> @@ -16,7 +16,7 @@
>  # GOTDATA-NEXT:  01d0 00000000 00000000
>  
>  # RUN: echo "SECTIONS { .mygot : { *(.got) *(.got.plt) } }" > %t1.script
> -# RUN: ld.lld -shared %t.o -o %t1.out --script %t1.script
> +# RUN: ld.lld --hash-style=sysv -shared %t.o -o %t1.out --script %t1.script
>  # RUN: llvm-objdump -section-headers %t1.out | FileCheck %s --check-prefix=MYGOT
>  # RUN: llvm-objdump -s -section=.mygot %t1.out | FileCheck %s --check-prefix=MYGOTDATA
>  
> Index: test/ELF/startstop.s
> ===================================================================
> --- test/ELF/startstop.s
> +++ test/ELF/startstop.s
> @@ -1,6 +1,6 @@
>  // REQUIRES: x86
>  // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
> -// RUN: ld.lld %t -o %tout -shared
> +// RUN: ld.lld --hash-style=sysv %t -o %tout -shared
>  // RUN: llvm-objdump -d %tout | FileCheck -check-prefix=DISASM %s
>  // RUN: llvm-readobj -symbols -r %tout | FileCheck -check-prefix=SYMBOL %s
>  
> Index: test/ELF/sort-norosegment.s
> ===================================================================
> --- test/ELF/sort-norosegment.s
> +++ test/ELF/sort-norosegment.s
> @@ -1,7 +1,7 @@
>  # REQUIRES: x86
>  # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
>  
> -# RUN: ld.lld -no-rosegment -o %t1  %t -shared
> +# RUN: ld.lld --hash-style=sysv -no-rosegment -o %t1  %t -shared
>  # RUN: llvm-readobj -elf-output-style=GNU -s %t1 | FileCheck %s
>  
>  # CHECK:      .text    {{.*}}   AX
> Index: test/ELF/shared.s
> ===================================================================
> --- test/ELF/shared.s
> +++ test/ELF/shared.s
> @@ -1,10 +1,10 @@
>  // RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %s -o %t.o
>  // 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 --hash-style=sysv -shared %t2.o -o %t2.so
>  // RUN: llvm-readobj -s %t2.so | FileCheck --check-prefix=SO %s
> -// RUN: ld.lld -dynamic-linker /lib64/ld-linux-x86-64.so.2 -rpath foo -rpath bar --export-dynamic %t.o %t2.so -o %t
> +// RUN: ld.lld --hash-style=sysv -dynamic-linker /lib64/ld-linux-x86-64.so.2 -rpath foo -rpath bar --export-dynamic %t.o %t2.so -o %t
>  // RUN: llvm-readobj --program-headers --dynamic-table -t -s -dyn-symbols -section-data -hash-table %t | FileCheck %s
> -// RUN: ld.lld %t.o %t2.so %t2.so -o %t2
> +// RUN: ld.lld --hash-style=sysv %t.o %t2.so %t2.so -o %t2
>  // RUN: llvm-readobj -dyn-symbols %t2 | FileCheck --check-prefix=DONT_EXPORT %s
>  // REQUIRES: x86
>  
> Index: test/ELF/retain-symbols-file.s
> ===================================================================
> --- test/ELF/retain-symbols-file.s
> +++ test/ELF/retain-symbols-file.s
> @@ -2,11 +2,11 @@
>  # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
>  # RUN: echo "bar" > %t_retain.txt
>  # RUN: echo "foo" >> %t_retain.txt
> -# RUN: ld.lld -shared --retain-symbols-file=%t_retain.txt %t -o %t2
> +# RUN: ld.lld --hash-style=sysv -shared --retain-symbols-file=%t_retain.txt %t -o %t2
>  # RUN: llvm-readobj --dyn-symbols %t2 | FileCheck %s
>  
>  ## Check separate form.
> -# RUN: ld.lld -shared --retain-symbols-file %t_retain.txt %t -o %t2
> +# RUN: ld.lld --hash-style=sysv -shared --retain-symbols-file %t_retain.txt %t -o %t2
>  # RUN: llvm-readobj --dyn-symbols %t2 | FileCheck %s
>  
>  # CHECK:      DynamicSymbols [
> Index: test/ELF/resolution-end.s
> ===================================================================
> --- test/ELF/resolution-end.s
> +++ test/ELF/resolution-end.s
> @@ -1,7 +1,7 @@
>  # 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/resolution-end.s -o %t2.o
>  # RUN: ld.lld -shared -o %t2.so %t2.o
> -# RUN: ld.lld %t1.o %t2.so -o %t
> +# RUN: ld.lld --hash-style=sysv %t1.o %t2.so -o %t
>  # RUN: llvm-readobj -t -s -section-data  %t | FileCheck %s
>  # REQUIRES: x86
>  
> Index: test/ELF/relro-omagic.s
> ===================================================================
> --- test/ELF/relro-omagic.s
> +++ test/ELF/relro-omagic.s
> @@ -1,7 +1,7 @@
>  # 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: ld.lld -shared %t2.o -o %t2.so -soname relro-omagic.s.tmp2.so
> -# RUN: ld.lld -N %t.o %t2.so -o %t
> +# RUN: ld.lld --hash-style=sysv -N %t.o %t2.so -o %t
>  # RUN: llvm-objdump -section-headers %t | FileCheck --check-prefix=NORELRO %s
>  # RUN: llvm-readobj --program-headers %t | FileCheck --check-prefix=NOPHDRS %s
>  
> Index: test/ELF/relocation.s
> ===================================================================
> --- test/ELF/relocation.s
> +++ test/ELF/relocation.s
> @@ -1,7 +1,7 @@
>  // 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/shared.s -o %t2
>  // RUN: ld.lld %t2 -o %t2.so -shared
> -// RUN: ld.lld %t %t2.so -o %t3
> +// RUN: ld.lld --hash-style=sysv %t %t2.so -o %t3
>  // RUN: llvm-readobj -s  %t3 | FileCheck --check-prefix=SEC %s
>  // RUN: llvm-objdump -s -d %t3 | FileCheck %s
>  // REQUIRES: x86
> Index: test/ELF/relocation-i686.s
> ===================================================================
> --- test/ELF/relocation-i686.s
> +++ test/ELF/relocation-i686.s
> @@ -1,7 +1,7 @@
>  // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t
>  // 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 %t2.so -o %t2
> +// RUN: ld.lld --hash-style=sysv %t %t2.so -o %t2
>  // RUN: llvm-readobj -s %t2 | FileCheck --check-prefix=ADDR %s
>  // RUN: llvm-objdump -d %t2 | FileCheck %s
>  // REQUIRES: x86
> Index: test/ELF/relocation-copy-relro.s
> ===================================================================
> --- test/ELF/relocation-copy-relro.s
> +++ test/ELF/relocation-copy-relro.s
> @@ -2,7 +2,7 @@
>  // 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-relro.s -o %t2.o
>  // RUN: ld.lld -shared %t2.o -o %t.so
> -// RUN: ld.lld %t.o %t.so -o %t3
> +// RUN: ld.lld --hash-style=sysv %t.o %t.so -o %t3
>  // RUN: llvm-readobj -program-headers -s -r %t3 | FileCheck %s
>  
>  // CHECK:        Name: .bss.rel.ro (48)
> Index: test/ELF/relocation-copy-flags.s
> ===================================================================
> --- test/ELF/relocation-copy-flags.s
> +++ test/ELF/relocation-copy-flags.s
> @@ -3,7 +3,7 @@
>  // 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: ld.lld --hash-style=sysv %t.o %t2.so -o %t.exe
>  // RUN: llvm-readobj -s -section-data -r %t.exe | FileCheck %s
>  
>          .global _start
> Index: test/ELF/relocation-copy-align-common.s
> ===================================================================
> --- test/ELF/relocation-copy-align-common.s
> +++ test/ELF/relocation-copy-align-common.s
> @@ -3,7 +3,7 @@
>  # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux \
>  # RUN:   %p/Inputs/relocation-copy-align-common.s -o %t2.o
>  # RUN: ld.lld -shared %t2.o -o %t.so
> -# RUN: ld.lld %t.o %t.so -o %t3
> +# RUN: ld.lld --hash-style=sysv %t.o %t.so -o %t3
>  # RUN: llvm-readobj -s -r --expand-relocs %t3 | FileCheck %s
>  
>  # CHECK:      Section {
> Index: test/ELF/relocation-copy-alias.s
> ===================================================================
> --- test/ELF/relocation-copy-alias.s
> +++ test/ELF/relocation-copy-alias.s
> @@ -1,8 +1,8 @@
>  // 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: ld.lld --hash-style=sysv -shared %t2.o -o %t.so
> +// RUN: ld.lld --hash-style=sysv %t.o %t.so -o %t3
>  // RUN: llvm-readobj --dyn-symbols -r --expand-relocs %t3 | FileCheck %s
>  
>  .global _start
> Index: test/ELF/pr34660.s
> ===================================================================
> --- test/ELF/pr34660.s
> +++ test/ELF/pr34660.s
> @@ -1,7 +1,7 @@
>  # REQUIRES: aarch64
>  
>  # RUN: llvm-mc -filetype=obj -triple=aarch64-linux-none %s -o %t.o
> -# RUN: ld.lld -shared %t.o -o %t
> +# RUN: ld.lld --hash-style=sysv -shared %t.o -o %t
>  # RUN: llvm-objdump %t -d | FileCheck %s --check-prefix=DISASM
>  # RUN: llvm-readobj -elf-output-style=GNU %t -t | FileCheck %s --check-prefix=SYM
>  
> Index: test/ELF/pie-weak.s
> ===================================================================
> --- test/ELF/pie-weak.s
> +++ test/ELF/pie-weak.s
> @@ -1,6 +1,6 @@
>  # REQUIRES: x86
>  # 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: ld.lld --hash-style=sysv -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
>  
> Index: test/ELF/noplt-pie.s
> ===================================================================
> --- test/ELF/noplt-pie.s
> +++ test/ELF/noplt-pie.s
> @@ -2,7 +2,7 @@
>  # 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: ld.lld --hash-style=sysv %t1.o %t2.so -o %t.out
>  # RUN: llvm-readobj -s -r %t.out | FileCheck %s
>  
>  # CHECK: Section {
> Index: test/ELF/local-got.s
> ===================================================================
> --- test/ELF/local-got.s
> +++ test/ELF/local-got.s
> @@ -1,7 +1,7 @@
>  // 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: ld.lld -shared %t2.o -o %t2.so
> -// RUN: ld.lld %t.o %t2.so -o %t
> +// RUN: ld.lld --hash-style=sysv %t.o %t2.so -o %t
>  // RUN: llvm-readobj -s -r -section-data %t | FileCheck %s
>  // RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s
>  
> Index: test/ELF/local-got-shared.s
> ===================================================================
> --- test/ELF/local-got-shared.s
> +++ test/ELF/local-got-shared.s
> @@ -1,5 +1,5 @@
>  // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
> -// RUN: ld.lld %t.o -o %t -shared
> +// RUN: ld.lld --hash-style=sysv %t.o -o %t -shared
>  // RUN: llvm-readobj -s -r -d %t | FileCheck %s
>  // RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s
>  
> Index: test/ELF/local-got-pie.s
> ===================================================================
> --- test/ELF/local-got-pie.s
> +++ test/ELF/local-got-pie.s
> @@ -1,5 +1,5 @@
>  // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
> -// RUN: ld.lld %t.o -o %t -pie
> +// RUN: ld.lld --hash-style=sysv %t.o -o %t -pie
>  // RUN: llvm-readobj -s -r -d %t | FileCheck %s
>  // RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s
>  
> Index: test/ELF/linkerscript/sort-non-script.s
> ===================================================================
> --- test/ELF/linkerscript/sort-non-script.s
> +++ test/ELF/linkerscript/sort-non-script.s
> @@ -2,7 +2,7 @@
>  # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
>  
>  # RUN: echo "SECTIONS { foo : {*(foo)} }" > %t.script
> -# RUN: ld.lld -o %t1 --script %t.script %t -shared
> +# RUN: ld.lld --hash-style=sysv -o %t1 --script %t.script %t -shared
>  # RUN: llvm-readobj -elf-output-style=GNU -s %t1 | FileCheck %s
>  
>  # CHECK:      .text    {{.*}}   AX
> Index: test/ELF/linkerscript/segment-start.s
> ===================================================================
> --- test/ELF/linkerscript/segment-start.s
> +++ test/ELF/linkerscript/segment-start.s
> @@ -1,6 +1,6 @@
>  // REQUIRES: x86
>  // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
> -// RUN: ld.lld %t.o %S/Inputs/segment-start.script -shared -o %t.so
> +// RUN: ld.lld --hash-style=sysv %t.o %S/Inputs/segment-start.script -shared -o %t.so
>  // RUN: llvm-readobj --dyn-symbols %t.so | FileCheck %s
>  
>  // CHECK:      Name: foobar1
> Index: test/ELF/linkerscript/sections-sort.s
> ===================================================================
> --- test/ELF/linkerscript/sections-sort.s
> +++ test/ELF/linkerscript/sections-sort.s
> @@ -2,7 +2,7 @@
>  # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
>  
>  # RUN: echo "SECTIONS { .text : {*(.text)} foo : {*(foo)}}" > %t.script
> -# RUN: ld.lld -o %t --script %t.script %t.o -shared
> +# RUN: ld.lld --hash-style=sysv -o %t --script %t.script %t.o -shared
>  # RUN: llvm-objdump --section-headers %t | FileCheck  %s
>  
>  # Test the section order. This is a case where at least with libstdc++'s
> Index: test/ELF/linkerscript/repsection-symbol.s
> ===================================================================
> --- test/ELF/linkerscript/repsection-symbol.s
> +++ test/ELF/linkerscript/repsection-symbol.s
> @@ -6,7 +6,7 @@
>  # RUN:   .text : { *(.text) } \
>  # RUN:   .foo : {foo1 = .;  *(.foo.*) foo2 = .;  *(.bar) foo3 = .;} \
>  # RUN: }" > %t.script
> -# RUN: ld.lld -o %t1 --script %t.script %t -shared
> +# RUN: ld.lld --hash-style=sysv -o %t1 --script %t.script %t -shared
>  # RUN: llvm-readobj -t %t1 | FileCheck %s
>  
>  # CHECK:      Name: foo1
> Index: test/ELF/linkerscript/out-of-order.s
> ===================================================================
> --- test/ELF/linkerscript/out-of-order.s
> +++ test/ELF/linkerscript/out-of-order.s
> @@ -1,7 +1,7 @@
>  # REQUIRES: x86
>  # RUN: llvm-mc -filetype=obj -triple=x86_64-linux %s -o %t.o
>  # RUN: echo "SECTIONS { .data 0x4000 : { *(.data) } .text 0x2000 : { *(.text) } }" > %t.script
> -# RUN: ld.lld -o %t.so --script %t.script %t.o -shared
> +# RUN: ld.lld --hash-style=sysv -o %t.so --script %t.script %t.o -shared
>  # RUN: llvm-objdump -section-headers %t.so | FileCheck %s
>  
>  # CHECK:      Sections:
> Index: test/ELF/linkerscript/orphan-report.s
> ===================================================================
> --- test/ELF/linkerscript/orphan-report.s
> +++ test/ELF/linkerscript/orphan-report.s
> @@ -1,7 +1,7 @@
>  # REQUIRES: x86
>  # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
>  # RUN: echo "SECTIONS { .text : { *(.text.1) } }" > %t.script
> -# RUN: ld.lld -shared -o %t.out --script %t.script %t.o --verbose | FileCheck %s
> +# RUN: ld.lld --hash-style=sysv -shared -o %t.out --script %t.script %t.o --verbose | FileCheck %s
>  
>  # CHECK:      {{.*}}.o:(.text) is being placed in '.text'
>  # CHECK-NEXT: {{.*}}.o:(.text.2) is being placed in '.text'
> Index: test/ELF/linkerscript/non-alloc.s
> ===================================================================
> --- test/ELF/linkerscript/non-alloc.s
> +++ test/ELF/linkerscript/non-alloc.s
> @@ -2,7 +2,7 @@
>  # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
>  
>  # RUN: echo "SECTIONS { .foo 0 : {*(foo)} }" > %t.script
> -# RUN: ld.lld -o %t1 --script %t.script %t -shared
> +# RUN: ld.lld --hash-style=sysv -o %t1 --script %t.script %t -shared
>  # RUN: llvm-readobj -elf-output-style=GNU -s -l %t1 | FileCheck %s
>  
>  # Test that we create all necessary PT_LOAD. We use to stop at the first
> Index: test/ELF/linkerscript/no-space.s
> ===================================================================
> --- test/ELF/linkerscript/no-space.s
> +++ test/ELF/linkerscript/no-space.s
> @@ -2,11 +2,11 @@
>  # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
>  
>  # RUN: echo "SECTIONS {foo 0 : {*(foo*)} }" > %t.script
> -# RUN: ld.lld -o %t --script %t.script %t.o -shared
> +# RUN: ld.lld --hash-style=sysv -o %t --script %t.script %t.o -shared
>  # RUN: llvm-readobj -elf-output-style=GNU -l %t | FileCheck %s
>  
>  # RUN: echo "SECTIONS {foo : {*(foo*)} }" > %t.script
> -# RUN: ld.lld -o %t --script %t.script %t.o -shared
> +# RUN: ld.lld --hash-style=sysv -o %t --script %t.script %t.o -shared
>  # RUN: llvm-readobj -elf-output-style=GNU -l %t | FileCheck %s
>  
>  # There is not enough address space available for the header, so just start the PT_LOAD
> Index: test/ELF/linkerscript/implicit-program-header.s
> ===================================================================
> --- test/ELF/linkerscript/implicit-program-header.s
> +++ test/ELF/linkerscript/implicit-program-header.s
> @@ -1,6 +1,6 @@
>  # REQUIRES: x86
>  # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
> -# RUN: ld.lld -o %t1 --script %S/Inputs/implicit-program-header.script  \
> +# RUN: ld.lld --hash-style=sysv -o %t1 --script %S/Inputs/implicit-program-header.script  \
>  # RUN:   %t.o -shared
>  # RUN: llvm-readobj -elf-output-style=GNU -l %t1 | FileCheck %s
>  
> Index: test/ELF/linkerscript/header-addr.s
> ===================================================================
> --- test/ELF/linkerscript/header-addr.s
> +++ test/ELF/linkerscript/header-addr.s
> @@ -5,7 +5,7 @@
>  # RUN:       . = 0x2000 + SIZEOF_HEADERS; \
>  # RUN:       .text : {*(.text)} :all \
>  # RUN:     }" > %t.script
> -# RUN: ld.lld -o %t.so --script %t.script %t.o -shared
> +# RUN: ld.lld --hash-style=sysv -o %t.so --script %t.script %t.o -shared
>  # RUN: llvm-readobj -program-headers %t.so | FileCheck %s
>  
>  # CHECK:      ProgramHeaders [
> @@ -25,7 +25,7 @@
>  # CHECK-NEXT:   }
>  # CHECK-NEXT: ]
>  
> -# RUN: ld.lld -o %t2.so --script %t.script %t.o -shared -z max-page-size=0x2000
> +# RUN: ld.lld --hash-style=sysv -o %t2.so --script %t.script %t.o -shared -z max-page-size=0x2000
>  # RUN: llvm-readobj -program-headers %t2.so \
>  # RUN:   | FileCheck --check-prefix=MAXPAGE %s
>  
> Index: test/ELF/linkerscript/extend-pt-load.s
> ===================================================================
> --- test/ELF/linkerscript/extend-pt-load.s
> +++ test/ELF/linkerscript/extend-pt-load.s
> @@ -15,7 +15,7 @@
>  # RUN:  . = ALIGN(0x1000); \
>  # RUN:  .data.rel.ro : { *(.data.rel.ro) } \
>  # RUN: }" > %t.script
> -# RUN: ld.lld -o %t1 --script %t.script %t.o -shared
> +# RUN: ld.lld --hash-style=sysv -o %t1 --script %t.script %t.o -shared
>  # RUN: llvm-readobj --elf-output-style=GNU -l -s %t1 | FileCheck --check-prefix=CHECK1 %s
>  
>  # CHECK1:      .text        PROGBITS 00000000000001bc 0001bc 000001 00 AX
> @@ -37,7 +37,7 @@
>  # RUN:  bar : { HIDDEN(bar_sym = .); } \
>  # RUN:  .data.rel.ro : { *(.data.rel.ro) } \
>  # RUN: }" > %t.script
> -# RUN: ld.lld -o %t2 --script %t.script %t.o -shared
> +# RUN: ld.lld --hash-style=sysv -o %t2 --script %t.script %t.o -shared
>  # RUN: llvm-readobj --elf-output-style=GNU -l -s %t2 | FileCheck --check-prefix=CHECK2 %s
>  
>  # CHECK2:      .text        PROGBITS 00000000000001bc 0001bc 000001 00 AX
> @@ -60,7 +60,7 @@
>  # RUN:  HIDDEN(bar_sym = .); \
>  # RUN:  .data.rel.ro : { *(.data.rel.ro) } \
>  # RUN: }" > %t.script
> -# RUN: ld.lld -o %t3 --script %t.script %t.o -shared
> +# RUN: ld.lld --hash-style=sysv -o %t3 --script %t.script %t.o -shared
>  # RUN: llvm-readobj --elf-output-style=GNU -l -s %t3 | FileCheck --check-prefix=CHECK1 %s
>  
>  nop
> Index: test/ELF/linkerscript/emit-reloc.s
> ===================================================================
> --- test/ELF/linkerscript/emit-reloc.s
> +++ test/ELF/linkerscript/emit-reloc.s
> @@ -1,7 +1,7 @@
>  # REQUIRES: x86
>  # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
>  # RUN: echo "SECTIONS { .rela.dyn : { *(.rela.data) } }" > %t.script
> -# RUN: ld.lld -T %t.script --emit-relocs %t.o -o %t.so -shared
> +# RUN: ld.lld --hash-style=sysv -T %t.script --emit-relocs %t.o -o %t.so -shared
>  # RUN: llvm-readobj -r %t.so | FileCheck %s
>  
>  .data
> Index: test/ELF/linkerscript/data-segment-relro.s
> ===================================================================
> --- test/ELF/linkerscript/data-segment-relro.s
> +++ test/ELF/linkerscript/data-segment-relro.s
> @@ -19,9 +19,9 @@
>  
>  ## With relro or without DATA_SEGMENT_RELRO_END just aligns to
>  ## page boundary.
> -# RUN: ld.lld -z norelro %t1.o %t2.so --script %t.script -o %t
> +# RUN: ld.lld --hash-style=sysv -z norelro %t1.o %t2.so --script %t.script -o %t
>  # RUN: llvm-readobj -s %t | FileCheck %s
> -# RUN: ld.lld -z relro %t1.o %t2.so --script %t.script -o %t2
> +# RUN: ld.lld --hash-style=sysv -z relro %t1.o %t2.so --script %t.script -o %t2
>  # RUN: llvm-readobj -s %t2 | FileCheck %s
>  
>  # CHECK:       Section {
> Index: test/ELF/icf-symbol-type.s
> ===================================================================
> --- test/ELF/icf-symbol-type.s
> +++ test/ELF/icf-symbol-type.s
> @@ -1,7 +1,7 @@
>  # REQUIRES: x86
>  
>  # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
> -# RUN: ld.lld %t.o -o %t --icf=all -shared
> +# RUN: ld.lld --hash-style=sysv %t.o -o %t --icf=all -shared
>  # RUN: llvm-readelf --dyn-symbols %t | FileCheck %s
>  
>  # We used to mark bar as absolute.
> Index: test/ELF/i386-tls-ie-shared.s
> ===================================================================
> --- test/ELF/i386-tls-ie-shared.s
> +++ test/ELF/i386-tls-ie-shared.s
> @@ -1,7 +1,7 @@
>  // 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: ld.lld --hash-style=sysv -shared %t.o %tso -o %t1
>  // RUN: llvm-readobj -s -r -d %t1 | FileCheck --check-prefix=GOTRELSHARED %s
>  // RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASMSHARED %s
>  
> Index: test/ELF/i386-gotpc.s
> ===================================================================
> --- test/ELF/i386-gotpc.s
> +++ test/ELF/i386-gotpc.s
> @@ -1,6 +1,6 @@
>  // 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: ld.lld --hash-style=sysv %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
>  
> Index: test/ELF/i386-gotpc-dynamic.s
> ===================================================================
> --- test/ELF/i386-gotpc-dynamic.s
> +++ test/ELF/i386-gotpc-dynamic.s
> @@ -1,6 +1,6 @@
>  # 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: ld.lld --hash-style=sysv %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
>  
> Index: test/ELF/i386-gotoff-shared.s
> ===================================================================
> --- test/ELF/i386-gotoff-shared.s
> +++ test/ELF/i386-gotoff-shared.s
> @@ -1,6 +1,6 @@
>  // 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: ld.lld --hash-style=sysv %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
>  
> Index: test/ELF/i386-got-and-copy.s
> ===================================================================
> --- test/ELF/i386-got-and-copy.s
> +++ test/ELF/i386-got-and-copy.s
> @@ -9,7 +9,7 @@
>  # 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: ld.lld --hash-style=sysv %t.o %t.so -o %t.exe
>  # RUN: llvm-readobj -r %t.exe | FileCheck %s
>  
>  # CHECK:      Relocations [
> Index: test/ELF/gotpcrelx.s
> ===================================================================
> --- test/ELF/gotpcrelx.s
> +++ test/ELF/gotpcrelx.s
> @@ -1,7 +1,7 @@
>  // 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: ld.lld --hash-style=sysv %t.o -o %t.so -shared
>  // RUN: llvm-readobj -s -r %t.so | FileCheck %s
>  
>  movq foo at GOTPCREL(%rip), %rax
> Index: test/ELF/gotpc-relax-und-dso.s
> ===================================================================
> --- test/ELF/gotpc-relax-und-dso.s
> +++ test/ELF/gotpc-relax-und-dso.s
> @@ -2,7 +2,7 @@
>  # 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: ld.lld --hash-style=sysv -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
>  
> Index: test/ELF/gotpc-relax-nopic.s
> ===================================================================
> --- test/ELF/gotpc-relax-nopic.s
> +++ test/ELF/gotpc-relax-nopic.s
> @@ -1,6 +1,6 @@
>  # 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: ld.lld --hash-style=sysv %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
>  
> @@ -25,7 +25,7 @@
>  # DISASM-NEXT:   201031: {{.*}} xorq  $2105344, %r8
>  # DISASM-NEXT:   201038: {{.*}} testq $2105344, %r15
>  
> -# RUN: ld.lld -shared %t.o -o %t2
> +# RUN: ld.lld --hash-style=sysv -shared %t.o -o %t2
>  # RUN: llvm-readobj -s -r -d %t2 | FileCheck --check-prefix=SEC-PIC    %s
>  # RUN: llvm-objdump -d %t2 | FileCheck --check-prefix=DISASM-PIC %s
>  # SEC-PIC:      Section {
> Index: test/ELF/got.s
> ===================================================================
> --- test/ELF/got.s
> +++ test/ELF/got.s
> @@ -1,7 +1,7 @@
>  // 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: ld.lld -shared %t2.o -o %t2.so
> -// RUN: ld.lld %t.o %t2.so -o %t
> +// RUN: ld.lld --hash-style=sysv %t.o %t2.so -o %t
>  // RUN: llvm-readobj -s -r %t | FileCheck %s
>  // RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s
>  // REQUIRES: x86
> Index: test/ELF/got-aarch64.s
> ===================================================================
> --- test/ELF/got-aarch64.s
> +++ test/ELF/got-aarch64.s
> @@ -1,5 +1,5 @@
>  // RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %s -o %t.o
> -// RUN: ld.lld -shared %t.o -o %t.so
> +// RUN: ld.lld --hash-style=sysv -shared %t.o -o %t.so
>  // RUN: llvm-readobj -s -r %t.so | FileCheck %s
>  // RUN: llvm-objdump -d %t.so | FileCheck --check-prefix=DISASM %s
>  // REQUIRES: aarch64
> Index: test/ELF/gnu-ifunc-shared.s
> ===================================================================
> --- test/ELF/gnu-ifunc-shared.s
> +++ test/ELF/gnu-ifunc-shared.s
> @@ -1,6 +1,6 @@
>  // REQUIRES: x86
>  // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
> -// RUN: ld.lld --shared -o %t.so %t.o
> +// RUN: ld.lld --hash-style=sysv --shared -o %t.so %t.o
>  // RUN: llvm-objdump -d %t.so | FileCheck %s --check-prefix=DISASM
>  // RUN: llvm-readobj -r %t.so | FileCheck %s
>  
> Index: test/ELF/gnu-ifunc-plt.s
> ===================================================================
> --- test/ELF/gnu-ifunc-plt.s
> +++ test/ELF/gnu-ifunc-plt.s
> @@ -1,7 +1,7 @@
>  // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/shared2-x86-64.s -o %t1.o
>  // RUN: ld.lld %t1.o --shared -o %t.so
>  // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
> -// RUN: ld.lld %t.so %t.o -o %tout
> +// RUN: ld.lld --hash-style=sysv %t.so %t.o -o %tout
>  // RUN: llvm-objdump -d %tout | FileCheck %s --check-prefix=DISASM
>  // RUN: llvm-objdump -s %tout | FileCheck %s --check-prefix=GOTPLT
>  // RUN: llvm-readobj -r -dynamic-table %tout | FileCheck %s
> Index: test/ELF/gnu-ifunc-plt-i386.s
> ===================================================================
> --- test/ELF/gnu-ifunc-plt-i386.s
> +++ test/ELF/gnu-ifunc-plt-i386.s
> @@ -1,7 +1,7 @@
>  // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %S/Inputs/shared2-x86-64.s -o %t1.o
>  // RUN: ld.lld %t1.o --shared -o %t.so
>  // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o
> -// RUN: ld.lld %t.so %t.o -o %tout
> +// RUN: ld.lld --hash-style=sysv %t.so %t.o -o %tout
>  // RUN: llvm-objdump -d %tout | FileCheck %s --check-prefix=DISASM
>  // RUN: llvm-objdump -s %tout | FileCheck %s --check-prefix=GOTPLT
>  // RUN: llvm-readobj -r -dynamic-table %tout | FileCheck %s
> Index: test/ELF/gnu-ifunc-gotpcrel.s
> ===================================================================
> --- test/ELF/gnu-ifunc-gotpcrel.s
> +++ test/ELF/gnu-ifunc-gotpcrel.s
> @@ -2,7 +2,7 @@
>  # 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: ld.lld --hash-style=sysv %t.o %t2.so -o %t
>  # RUN: llvm-readobj -dyn-relocations %t | FileCheck %s
>  
>  # CHECK:      Dynamic Relocations {
> Index: test/ELF/global_offset_table_shared.s
> ===================================================================
> --- test/ELF/global_offset_table_shared.s
> +++ test/ELF/global_offset_table_shared.s
> @@ -1,5 +1,5 @@
>  // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
> -// RUN: ld.lld -shared %t -o %t2
> +// RUN: ld.lld --hash-style=sysv -shared %t -o %t2
>  // RUN: llvm-readobj -t %t2 | FileCheck %s
>  .long _GLOBAL_OFFSET_TABLE_ - .
>  
> Index: test/ELF/global-offset-table-position.s
> ===================================================================
> --- test/ELF/global-offset-table-position.s
> +++ test/ELF/global-offset-table-position.s
> @@ -1,5 +1,5 @@
>  // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
> -// RUN: ld.lld -shared %t -o %t2
> +// RUN: ld.lld --hash-style=sysv -shared %t -o %t2
>  // RUN: llvm-readobj -t %t2 | FileCheck %s
>  // REQUIRES: x86
>  
> Index: test/ELF/global-offset-table-position-i386.s
> ===================================================================
> --- test/ELF/global-offset-table-position-i386.s
> +++ test/ELF/global-offset-table-position-i386.s
> @@ -1,5 +1,5 @@
>  // RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %s -o %t
> -// RUN: ld.lld -shared %t -o %t2
> +// RUN: ld.lld --hash-style=sysv -shared %t -o %t2
>  // RUN: llvm-readobj -t %t2 | FileCheck %s
>  // REQUIRES: x86
>  
> Index: test/ELF/global-offset-table-position-arm.s
> ===================================================================
> --- test/ELF/global-offset-table-position-arm.s
> +++ test/ELF/global-offset-table-position-arm.s
> @@ -1,5 +1,5 @@
>  // RUN: llvm-mc -filetype=obj -triple=armv7a-linux-gnueabihf %s -o %t
> -// RUN: ld.lld -shared %t -o %t2
> +// RUN: ld.lld --hash-style=sysv -shared %t -o %t2
>  // RUN: llvm-readobj -t %t2 | FileCheck %s
>  // REQUIRES: arm
>  
> Index: test/ELF/global-offset-table-position-aarch64.s
> ===================================================================
> --- test/ELF/global-offset-table-position-aarch64.s
> +++ test/ELF/global-offset-table-position-aarch64.s
> @@ -1,5 +1,5 @@
>  // RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu %s -o %t
> -// RUN: ld.lld -shared %t -o %t2
> +// RUN: ld.lld --hash-style=sysv -shared %t -o %t2
>  // RUN: llvm-readobj -t %t2 | FileCheck %s
>  // REQUIRES: aarch64
>  .globl  a
> Index: test/ELF/emit-relocs-shared.s
> ===================================================================
> --- test/ELF/emit-relocs-shared.s
> +++ test/ELF/emit-relocs-shared.s
> @@ -1,6 +1,6 @@
>  # REQUIRES: x86
>  # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
> -# RUN: ld.lld --emit-relocs %t.o -o %t.so -shared
> +# RUN: ld.lld --hash-style=sysv --emit-relocs %t.o -o %t.so -shared
>  # RUN: llvm-readobj -r %t.so | FileCheck %s
>  
>  .data
> Index: test/ELF/eh-frame-padding-no-rosegment.s
> ===================================================================
> --- test/ELF/eh-frame-padding-no-rosegment.s
> +++ test/ELF/eh-frame-padding-no-rosegment.s
> @@ -31,7 +31,7 @@
>  // OBJ-NEXT:   0020: 20000000 00000000 00000000 00000000
>  // OBJ-NEXT: )
>  
> -// RUN: ld.lld %t.o -no-rosegment -o %t -shared
> +// RUN: ld.lld --hash-style=sysv %t.o -no-rosegment -o %t -shared
>  
>  // Check that .eh_frame is in the same segment as .text
>  // RUN: llvm-readobj -l --elf-output-style=GNU %t | FileCheck --check-prefix=PHDR %s
> Index: test/ELF/eh-frame-merge.s
> ===================================================================
> --- test/ELF/eh-frame-merge.s
> +++ test/ELF/eh-frame-merge.s
> @@ -1,6 +1,6 @@
>  // REQUIRES: x86
>  // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
> -// RUN: ld.lld %t.o %t.o -o %t -shared
> +// RUN: ld.lld --hash-style=sysv %t.o %t.o -o %t -shared
>  // RUN: llvm-readobj -s -section-data %t | FileCheck %s
>  
>          .section	foo,"ax", at progbits
> Index: test/ELF/eh-frame-hdr-augmentation.s
> ===================================================================
> --- test/ELF/eh-frame-hdr-augmentation.s
> +++ test/ELF/eh-frame-hdr-augmentation.s
> @@ -1,6 +1,6 @@
>  // 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: ld.lld --hash-style=sysv --eh-frame-hdr %t.o -o %t -shared
>  // RUN: llvm-objdump --dwarf=frames %t | FileCheck %s
>  
>  // CHECK: .eh_frame contents:
> Index: test/ELF/eh-align-cie.s
> ===================================================================
> --- test/ELF/eh-align-cie.s
> +++ test/ELF/eh-align-cie.s
> @@ -31,7 +31,7 @@
>  // OBJ-NEXT:    )
>  
>  
> -// RUN: ld.lld %t.o -o %t -shared
> +// RUN: ld.lld --hash-style=sysv %t.o -o %t -shared
>  // RUN: llvm-readobj -s -section-data %t | FileCheck %s
>  
>  // Check that the size of the CIE was changed to (0x1C + 4) and the FDE one was
> Index: test/ELF/dynamic-reloc.s
> ===================================================================
> --- test/ELF/dynamic-reloc.s
> +++ test/ELF/dynamic-reloc.s
> @@ -2,7 +2,7 @@
>  // 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.s -o %t3.o
>  // RUN: ld.lld -shared %t2.o -o %t2.so
> -// RUN: ld.lld %t.o %t3.o %t2.so -o %t
> +// RUN: ld.lld --hash-style=sysv %t.o %t3.o %t2.so -o %t
>  // RUN: llvm-readobj -dynamic-table -r --expand-relocs -s %t | FileCheck %s
>  // REQUIRES: x86
>  
> Index: test/ELF/dynamic-list.s
> ===================================================================
> --- test/ELF/dynamic-list.s
> +++ test/ELF/dynamic-list.s
> @@ -1,24 +1,24 @@
>  # 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: ld.lld --hash-style=sysv -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: ld.lld --hash-style=sysv --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: ld.lld --hash-style=sysv --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: ld.lld --hash-style=sysv --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: ld.lld --hash-style=sysv --export-dynamic-symbol=foo1 %t %t2.so -o %t.exe
>  # RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck %s
>  
>  # CHECK:      DynamicSymbols [
> @@ -45,11 +45,11 @@
>  
>  ## 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: ld.lld --hash-style=sysv --dynamic-list %t.list %t %t2.so -o %t.exe
>  # RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck -check-prefix=CHECK2 %s
>  # RUN: echo "{ foo1; foo2; };" > %t1.list
>  # RUN: echo "{ foo31; };" > %t2.list
> -# RUN: ld.lld --dynamic-list %t1.list --dynamic-list %t2.list %t %t2.so -o %t.exe
> +# RUN: ld.lld --hash-style=sysv --dynamic-list %t1.list --dynamic-list %t2.list %t %t2.so -o %t.exe
>  # RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck -check-prefix=CHECK2 %s
>  
>  # CHECK2:      DynamicSymbols [
> @@ -95,11 +95,11 @@
>  ## --export-dynamic overrides --dynamic-list, i.e. --export-dynamic with an
>  ## incomplete dynamic-list still exports everything.
>  # RUN: echo "{ foo2; };" > %t.list
> -# RUN: ld.lld --dynamic-list %t.list --export-dynamic %t %t2.so -o %t.exe
> +# RUN: ld.lld --hash-style=sysv --dynamic-list %t.list --export-dynamic %t %t2.so -o %t.exe
>  # RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck -check-prefix=CHECK3 %s
>  
>  ## The same with --export-dynamic-symbol.
> -# RUN: ld.lld --export-dynamic-symbol=foo2 --export-dynamic %t %t2.so -o %t.exe
> +# RUN: ld.lld --hash-style=sysv --export-dynamic-symbol=foo2 --export-dynamic %t %t2.so -o %t.exe
>  # RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck -check-prefix=CHECK3 %s
>  
>  # CHECK3:      DynamicSymbols [
> Index: test/ELF/dynamic-list-preempt.s
> ===================================================================
> --- test/ELF/dynamic-list-preempt.s
> +++ test/ELF/dynamic-list-preempt.s
> @@ -3,7 +3,7 @@
>  # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
>  # RUN: echo "{ foo; zed; };" > %t.list
>  # RUN: echo "{ global: foo; bar; local: *; };" > %t.vers
> -# RUN: ld.lld -fatal-warnings -dynamic-list %t.list -version-script %t.vers -shared %t.o -o %t.so
> +# RUN: ld.lld --hash-style=sysv -fatal-warnings -dynamic-list %t.list -version-script %t.vers -shared %t.o -o %t.so
>  # RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=RELOCS %s
>  # RUN: llvm-readobj -dyn-symbols  %t.so | FileCheck --check-prefix=DYNSYMS %s
>  
> Index: test/ELF/dynamic-got.s
> ===================================================================
> --- test/ELF/dynamic-got.s
> +++ test/ELF/dynamic-got.s
> @@ -1,6 +1,6 @@
>  // REQUIRES: x86
>  // RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %s -o %t.o
> -// RUN: ld.lld %t.o -o %t.so -shared
> +// RUN: ld.lld --hash-style=sysv %t.o -o %t.so -shared
>  // RUN: llvm-readobj -s -l -section-data -r %t.so | FileCheck %s
>  
>  // CHECK:      Name: .got
> Index: test/ELF/copy-rel-pie.s
> ===================================================================
> --- test/ELF/copy-rel-pie.s
> +++ test/ELF/copy-rel-pie.s
> @@ -1,7 +1,7 @@
>  // 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: ld.lld --hash-style=sysv %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
>  
> Index: test/ELF/basic-ppc.s
> ===================================================================
> --- test/ELF/basic-ppc.s
> +++ test/ELF/basic-ppc.s
> @@ -1,5 +1,5 @@
>  # RUN: llvm-mc -filetype=obj -triple=powerpc-unknown-freebsd %s -o %t
> -# RUN: ld.lld -discard-all -shared %t -o %t2
> +# RUN: ld.lld --hash-style=sysv -discard-all -shared %t -o %t2
>  # RUN: llvm-readobj -file-headers -sections -section-data -program-headers %t2 | FileCheck %s
>  # REQUIRES: ppc
>  
> Index: test/ELF/arm-tls-norelax-ld-le.s
> ===================================================================
> --- test/ELF/arm-tls-norelax-ld-le.s
> +++ test/ELF/arm-tls-norelax-ld-le.s
> @@ -1,7 +1,7 @@
>  // RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %p/Inputs/arm-tls-get-addr.s -o %t1
>  // RUN: ld.lld %t1 --shared -o %t1.so
>  // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=armv7a-linux-gnueabi
> -// RUN: ld.lld %t1.so %t.o -o %t
> +// RUN: ld.lld --hash-style=sysv %t1.so %t.o -o %t
>  // RUN: llvm-objdump -s %t | FileCheck %s
>  // REQUIRES: arm
>  
> Index: test/ELF/arm-tls-norelax-ie-le.s
> ===================================================================
> --- test/ELF/arm-tls-norelax-ie-le.s
> +++ test/ELF/arm-tls-norelax-ie-le.s
> @@ -1,7 +1,7 @@
>  // RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %p/Inputs/arm-tls-get-addr.s -o %t1
>  // RUN: ld.lld %t1 --shared -o %t1.so
>  // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=armv7a-linux-gnueabi
> -// RUN: ld.lld %t1.so %t.o -o %t
> +// RUN: ld.lld --hash-style=sysv %t1.so %t.o -o %t
>  // RUN: llvm-objdump -s -triple=armv7a-linux-gnueabi %t | FileCheck %s
>  // REQUIRES: arm
>  
> Index: test/ELF/arm-tls-norelax-gd-le.s
> ===================================================================
> --- test/ELF/arm-tls-norelax-gd-le.s
> +++ test/ELF/arm-tls-norelax-gd-le.s
> @@ -1,7 +1,7 @@
>  // RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %p/Inputs/arm-tls-get-addr.s -o %t1
>  // RUN: ld.lld %t1 --shared -o %t1.so
>  // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=armv7a-linux-gnueabi
> -// RUN: ld.lld %t1.so %t.o -o %t
> +// RUN: ld.lld --hash-style=sysv %t1.so %t.o -o %t
>  // RUN: llvm-objdump -s %t | FileCheck %s
>  // REQUIRES: arm
>  
> Index: test/ELF/arm-tls-norelax-gd-ie.s
> ===================================================================
> --- test/ELF/arm-tls-norelax-gd-ie.s
> +++ test/ELF/arm-tls-norelax-gd-ie.s
> @@ -1,7 +1,7 @@
>  // RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %p/Inputs/arm-tls-get-addr.s -o %t1
>  // RUN: ld.lld %t1 --shared -o %t1.so
>  // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=armv7a-linux-gnueabi
> -// RUN: ld.lld %t1.so %t.o -o %t
> +// RUN: ld.lld --hash-style=sysv %t1.so %t.o -o %t
>  // RUN: llvm-readobj -s -dyn-relocations %t | FileCheck %s
>  // REQUIRES: arm
>  
> Index: test/ELF/arm-tls-ldm32.s
> ===================================================================
> --- test/ELF/arm-tls-ldm32.s
> +++ test/ELF/arm-tls-ldm32.s
> @@ -1,5 +1,5 @@
>  // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=armv7a-linux-gnueabi
> -// RUN: ld.lld %t.o -o %t.so -shared
> +// RUN: ld.lld --hash-style=sysv %t.o -o %t.so -shared
>  // RUN: llvm-readobj -s -dyn-relocations %t.so | FileCheck --check-prefix=SEC %s
>  // RUN: llvm-objdump -d -triple=armv7a-linux-gnueabi %t.so | FileCheck %s
>  // REQUIRES: arm
> Index: test/ELF/arm-tls-ie32.s
> ===================================================================
> --- test/ELF/arm-tls-ie32.s
> +++ test/ELF/arm-tls-ie32.s
> @@ -1,5 +1,5 @@
>  // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=armv7a-linux-gnueabi
> -// RUN: ld.lld %t.o -o %t.so -shared
> +// RUN: ld.lld --hash-style=sysv %t.o -o %t.so -shared
>  // RUN: llvm-readobj -s -dyn-relocations %t.so | FileCheck --check-prefix=SEC %s
>  // RUN: llvm-objdump -d -triple=armv7a-linux-gnueabi %t.so | FileCheck %s
>  // REQUIRES: arm
> Index: test/ELF/arm-tls-gd32.s
> ===================================================================
> --- test/ELF/arm-tls-gd32.s
> +++ test/ELF/arm-tls-gd32.s
> @@ -1,5 +1,5 @@
>  // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=armv7a-linux-gnueabi
> -// RUN: ld.lld %t.o -o %t.so -shared
> +// RUN: ld.lld --hash-style=sysv %t.o -o %t.so -shared
>  // RUN: llvm-readobj -s -dyn-relocations %t.so | FileCheck --check-prefix=SEC %s
>  // RUN: llvm-objdump -d -triple=armv7a-linux-gnueabi %t.so | FileCheck %s
>  // REQUIRES: arm
> Index: test/ELF/arm-tls-gd-nonpreemptible.s
> ===================================================================
> --- test/ELF/arm-tls-gd-nonpreemptible.s
> +++ test/ELF/arm-tls-gd-nonpreemptible.s
> @@ -2,7 +2,7 @@
>  // RUN: ld.lld %t -o %t2
>  // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=armv7a-linux-gnueabi
>  // RUN: llvm-objdump -s %t2 | FileCheck %s
> -// RUN: ld.lld %t --shared -o %t3.so
> +// RUN: ld.lld --hash-style=sysv %t --shared -o %t3.so
>  // RUN: llvm-objdump -s %t3.so | FileCheck -check-prefix=CHECK-SHARED %s
>  // REQUIRES: arm
>  
> Index: test/ELF/arm-thumb-plt-reloc.s
> ===================================================================
> --- test/ELF/arm-thumb-plt-reloc.s
> +++ test/ELF/arm-thumb-plt-reloc.s
> @@ -2,7 +2,7 @@
>  // 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: ld.lld --hash-style=sysv -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
> Index: test/ELF/arm-plt-reloc.s
> ===================================================================
> --- test/ELF/arm-plt-reloc.s
> +++ test/ELF/arm-plt-reloc.s
> @@ -2,7 +2,7 @@
>  // 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: ld.lld --hash-style=sysv -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
> Index: test/ELF/arm-pie-relative.s
> ===================================================================
> --- test/ELF/arm-pie-relative.s
> +++ test/ELF/arm-pie-relative.s
> @@ -1,5 +1,5 @@
>  // RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t
> -// RUN: ld.lld %t --pie -o %t2
> +// RUN: ld.lld --hash-style=sysv %t --pie -o %t2
>  // RUN: llvm-readobj -r %t2 | FileCheck %s
>  // RUN: llvm-objdump -s %t2 | FileCheck %s --check-prefix=GOT
>  // REQUIRES: arm
> Index: test/ELF/arm-got-relative.s
> ===================================================================
> --- test/ELF/arm-got-relative.s
> +++ test/ELF/arm-got-relative.s
> @@ -1,6 +1,6 @@
>  // 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: ld.lld --hash-style=sysv %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
> Index: test/ELF/arm-gnu-ifunc-plt.s
> ===================================================================
> --- test/ELF/arm-gnu-ifunc-plt.s
> +++ test/ELF/arm-gnu-ifunc-plt.s
> @@ -1,7 +1,7 @@
>  // RUN: llvm-mc -filetype=obj -triple=armv7a-linux-gnueabihf %S/Inputs/arm-shared.s -o %t1.o
>  // RUN: ld.lld %t1.o --shared -o %t.so
>  // RUN: llvm-mc -filetype=obj -triple=armv7a-linux-gnueabihf %s -o %t.o
> -// RUN: ld.lld %t.so %t.o -o %tout
> +// RUN: ld.lld --hash-style=sysv %t.so %t.o -o %tout
>  // RUN: llvm-objdump -triple=armv7a-linux-gnueabihf -d %tout | FileCheck %s --check-prefix=DISASM
>  // RUN: llvm-objdump -s %tout | FileCheck %s --check-prefix=GOTPLT
>  // RUN: llvm-readobj -r -dynamic-table %tout | FileCheck %s
> Index: test/ELF/arm-exidx-shared.s
> ===================================================================
> --- test/ELF/arm-exidx-shared.s
> +++ test/ELF/arm-exidx-shared.s
> @@ -1,5 +1,5 @@
>  // RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t
> -// RUN: ld.lld %t --shared -o %t2 2>&1
> +// RUN: ld.lld --hash-style=sysv %t --shared -o %t2 2>&1
>  // RUN: llvm-readobj --relocations %t2 | FileCheck %s
>  // RUN: llvm-objdump -s -triple=armv7a-none-linux-gnueabi %t2 | FileCheck -check-prefix=CHECK-EXTAB %s
>  // REQUIRES: arm
> Index: test/ELF/arm-copy.s
> ===================================================================
> --- test/ELF/arm-copy.s
> +++ test/ELF/arm-copy.s
> @@ -2,7 +2,7 @@
>  // 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: ld.lld --hash-style=sysv %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
> Index: test/ELF/amdgpu-relocs.s
> ===================================================================
> --- test/ELF/amdgpu-relocs.s
> +++ test/ELF/amdgpu-relocs.s
> @@ -1,5 +1,5 @@
>  # RUN: llvm-mc -filetype=obj -triple=amdgcn--amdhsa -mcpu=fiji %s -o %t.o
> -# RUN: ld.lld -shared %t.o -o %t.so
> +# RUN: ld.lld --hash-style=sysv -shared %t.o -o %t.so
>  # RUN: llvm-readobj -r %t.so | FileCheck %s
>  # RUN: llvm-objdump -s %t.so | FileCheck %s --check-prefix=OBJDUMP
>  
> Index: test/ELF/abs-hidden.s
> ===================================================================
> --- test/ELF/abs-hidden.s
> +++ test/ELF/abs-hidden.s
> @@ -1,7 +1,7 @@
>  // 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: ld.lld --hash-style=sysv %t.o %t2.o -o %t.so -shared
>  // RUN: llvm-readobj -r -s -section-data %t.so | FileCheck %s
>  
>          .quad foo
> Index: test/ELF/aarch64-tlsdesc.s
> ===================================================================
> --- test/ELF/aarch64-tlsdesc.s
> +++ test/ELF/aarch64-tlsdesc.s
> @@ -1,6 +1,6 @@
>  // 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: ld.lld --hash-style=sysv -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
>  
> Index: test/ELF/aarch64-tls-static.s
> ===================================================================
> --- test/ELF/aarch64-tls-static.s
> +++ test/ELF/aarch64-tls-static.s
> @@ -1,6 +1,6 @@
>  // 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: ld.lld --hash-style=sysv %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
>  
> Index: test/ELF/aarch64-tls-ie.s
> ===================================================================
> --- test/ELF/aarch64-tls-ie.s
> +++ test/ELF/aarch64-tls-ie.s
> @@ -2,7 +2,7 @@
>  # 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
> -# RUN: ld.lld %tmain.o %tdso.so -o %tout
> +# RUN: ld.lld --hash-style=sysv %tmain.o %tdso.so -o %tout
>  # RUN: llvm-objdump -d %tout | FileCheck %s
>  # RUN: llvm-readobj -s -r %tout | FileCheck -check-prefix=RELOC %s
>  # REQUIRES: aarch64
> Index: test/ELF/aarch64-tls-gdie.s
> ===================================================================
> --- test/ELF/aarch64-tls-gdie.s
> +++ test/ELF/aarch64-tls-gdie.s
> @@ -2,7 +2,7 @@
>  // 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: ld.lld --hash-style=sysv %t.o %t2.so -o %t
>  // RUN: llvm-readobj -s %t | FileCheck --check-prefix=SEC %s
>  // RUN: llvm-objdump -d %t | FileCheck %s
>  
> Index: test/ELF/aarch64-got-relocations.s
> ===================================================================
> --- test/ELF/aarch64-got-relocations.s
> +++ test/ELF/aarch64-got-relocations.s
> @@ -1,6 +1,6 @@
>  # REQUIRES: aarch64
>  # RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-cloudabi %s -o %t.o
> -# RUN: ld.lld -pie %t.o -o %t
> +# RUN: ld.lld --hash-style=sysv -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
> Index: test/ELF/aarch64-gnu-ifunc-plt.s
> ===================================================================
> --- test/ELF/aarch64-gnu-ifunc-plt.s
> +++ test/ELF/aarch64-gnu-ifunc-plt.s
> @@ -1,7 +1,7 @@
>  // RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux-gnu %S/Inputs/shared2.s -o %t1.o
>  // RUN: ld.lld %t1.o --shared -o %t.so
>  // RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux-gnu %s -o %t.o
> -// RUN: ld.lld %t.so %t.o -o %tout
> +// RUN: ld.lld --hash-style=sysv %t.so %t.o -o %tout
>  // RUN: llvm-objdump -d %tout | FileCheck %s --check-prefix=DISASM
>  // RUN: llvm-objdump -s %tout | FileCheck %s --check-prefix=GOTPLT
>  // RUN: llvm-readobj -r -dynamic-table %tout | FileCheck %s
> Index: ELF/Driver.cpp
> ===================================================================
> --- ELF/Driver.cpp
> +++ ELF/Driver.cpp
> @@ -560,17 +560,6 @@
>    return SortSectionPolicy::Default;
>  }
>  
> -static std::pair<bool, bool> getHashStyle(opt::InputArgList &Args) {
> -  StringRef S = Args.getLastArgValue(OPT_hash_style, "sysv");
> -  if (S == "sysv")
> -    return {true, false};
> -  if (S == "gnu")
> -    return {false, true};
> -  if (S != "both")
> -    error("unknown -hash-style: " + S);
> -  return {true, true};
> -}
> -
>  // Parse --build-id or --build-id=<style>. We handle "tree" as a
>  // synonym for "sha1" because all our hash functions including
>  // -build-id=sha1 are actually tree hashes for performance reasons.
> @@ -749,6 +738,19 @@
>      Config->Emulation = S;
>    }
>  
> +  // Parse -hash-style={sysv,gnu,both}.
> +  if (auto *Arg = Args.getLastArg(OPT_hash_style)) {
> +    StringRef S = Arg->getValue();
> +    if (S == "sysv")
> +      Config->SysvHash = true;
> +    else if (S == "gnu")
> +      Config->GnuHash = true;
> +    else if (S == "both")
> +      Config->SysvHash = Config->GnuHash = true;
> +    else
> +      error("unknown -hash-style: " + S);
> +  }
> +
>    if (Args.hasArg(OPT_print_map))
>      Config->MapFile = "-";
>  
> @@ -759,7 +761,6 @@
>    if (Config->Omagic)
>      Config->ZRelro = false;
>  
> -  std::tie(Config->SysvHash, Config->GnuHash) = getHashStyle(Args);
>    std::tie(Config->BuildId, Config->BuildIdVector) = getBuildId(Args);
>  
>    if (auto *Arg = Args.getLastArg(OPT_symbol_ordering_file))
> @@ -993,6 +994,15 @@
>    Config->MaxPageSize = getMaxPageSize(Args);
>    Config->ImageBase = getImageBase(Args);
>  
> +  // If a -hash-style option was not given, set to a default value,
> +  // which varies depending on the target.
> +  if (!Args.hasArg(OPT_hash_style)) {
> +    if (Config->EMachine == EM_MIPS)
> +      Config->SysvHash = true;
> +    else
> +      Config->SysvHash = Config->GnuHash = true;
> +  }
> +
>    // Default output filename is "a.out" by the Unix tradition.
>    if (Config->OutputFile.empty())
>      Config->OutputFile = "a.out";
> Index: ELF/Config.h
> ===================================================================
> --- ELF/Config.h
> +++ ELF/Config.h
> @@ -125,7 +125,7 @@
>    bool FatalWarnings;
>    bool GcSections;
>    bool GdbIndex;
> -  bool GnuHash;
> +  bool GnuHash = false;
>    bool HasDynamicList = false;
>    bool HasDynSymTab;
>    bool ICF;
> @@ -144,7 +144,7 @@
>    bool SingleRoRx;
>    bool Shared;
>    bool Static = false;
> -  bool SysvHash;
> +  bool SysvHash = false;
>    bool Target1Rel;
>    bool Threads;
>    bool Trace;


More information about the llvm-commits mailing list