From: Fangrui Song Date: Mon, 25 Oct 2021 21:01:36 +0000 (-0700) Subject: [ELF] Update comments/diagnostics for -defsym and -image-base to use the canonical... X-Git-Tag: upstream/15.0.7~27694 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6506907a0a1a8a789ad7036ef911f7e31213c9a5;p=platform%2Fupstream%2Fllvm.git [ELF] Update comments/diagnostics for -defsym and -image-base to use the canonical two-dash form --- diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 8f0002f..51b3543 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -1489,9 +1489,9 @@ void LinkerDriver::createFiles(opt::InputArgList &args) { StringRef to; std::tie(from, to) = StringRef(arg->getValue()).split('='); if (from.empty() || to.empty()) - error("-defsym: syntax error: " + StringRef(arg->getValue())); + error("--defsym: syntax error: " + StringRef(arg->getValue())); else - readDefsym(from, MemoryBufferRef(to, "-defsym")); + readDefsym(from, MemoryBufferRef(to, "--defsym")); break; } case OPT_script: @@ -1636,11 +1636,11 @@ static Optional getImageBase(opt::InputArgList &args) { StringRef s = arg->getValue(); uint64_t v; if (!to_integer(s, v)) { - error("-image-base: number expected, but got " + s); + error("--image-base: number expected, but got " + s); return 0; } if ((v % config->maxPageSize) != 0) - warn("-image-base: address isn't multiple of page size: " + s); + warn("--image-base: address isn't multiple of page size: " + s); return v; } diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td index 2bd6356..d0a6ee2 100644 --- a/lld/ELF/Options.td +++ b/lld/ELF/Options.td @@ -256,7 +256,7 @@ def ignore_function_address_equality: F<"ignore-function-address-equality">, def ignore_data_address_equality: F<"ignore-data-address-equality">, HelpText<"lld can break the address equality of data">; -defm image_base: Eq<"image-base", "Set the base address">; +defm image_base: EEq<"image-base", "Set the base address">; defm init: Eq<"init", "Specify an initializer function">, MetaVarName<"">; diff --git a/lld/test/ELF/arm-thumb-interwork-thunk-range.s b/lld/test/ELF/arm-thumb-interwork-thunk-range.s index 3c01318..db50c3b 100644 --- a/lld/test/ELF/arm-thumb-interwork-thunk-range.s +++ b/lld/test/ELF/arm-thumb-interwork-thunk-range.s @@ -1,6 +1,6 @@ // REQUIRES: arm // RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o -// RUN: ld.lld %t.o -o /dev/null -image-base=0x80000000 +// RUN: ld.lld %t.o -o /dev/null --image-base=0x80000000 // Test that when the thunk is at a high address we don't get confused with it // being out of range. diff --git a/lld/test/ELF/defsym.s b/lld/test/ELF/defsym.s index bb5e783..0168ce8 100644 --- a/lld/test/ELF/defsym.s +++ b/lld/test/ELF/defsym.s @@ -13,7 +13,7 @@ ## when handling the second --defsym. # RUN: not ld.lld -o /dev/null %t.o --defsym ERR+ \ # --defsym foo2=foo1 2>&1 | FileCheck %s --check-prefix=ERR -# ERR: error: -defsym: syntax error: ERR+ +# ERR: error: --defsym: syntax error: ERR+ # CHECK-DAG: 0000000000000123 0 NOTYPE GLOBAL DEFAULT ABS foo1 # CHECK-DAG: 0000000000000123 0 NOTYPE GLOBAL DEFAULT ABS foo2 @@ -36,16 +36,16 @@ # EXPR-DAG: 0000000000000128 0 NOTYPE GLOBAL DEFAULT ABS foo2 # RUN: not ld.lld -o /dev/null %t.o --defsym=foo2=und 2>&1 | FileCheck %s -check-prefix=ERR1 -# ERR1: error: -defsym:1: symbol not found: und +# ERR1: error: --defsym:1: symbol not found: und # RUN: not ld.lld -o /dev/null %t.o --defsym=xxx=yyy,zzz 2>&1 | FileCheck %s -check-prefix=ERR2 -# ERR2: -defsym:1: EOF expected, but got , +# ERR2: error: --defsym:1: EOF expected, but got , # RUN: not ld.lld -o /dev/null %t.o --defsym=foo 2>&1 | FileCheck %s -check-prefix=ERR3 -# ERR3: error: -defsym: syntax error: foo +# ERR3: error: --defsym: syntax error: foo # RUN: not ld.lld -o /dev/null %t.o --defsym= 2>&1 | FileCheck %s -check-prefix=ERR4 -# ERR4: error: -defsym: syntax error: +# ERR4: error: --defsym: syntax error: .globl foo1 foo1 = 0x123 diff --git a/lld/test/ELF/image-base.s b/lld/test/ELF/image-base.s index 8396eaf..f6bb264 100644 --- a/lld/test/ELF/image-base.s +++ b/lld/test/ELF/image-base.s @@ -1,16 +1,16 @@ # 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: ld.lld --image-base=0x1000000 %t -o %t1 # RUN: llvm-readobj -l %t1 | FileCheck %s -# RUN: not ld.lld -image-base=ABC %t -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s -# ERR: error: -image-base: number expected, but got ABC +# RUN: not ld.lld --image-base=ABC %t -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s +# ERR: error: --image-base: number expected, but got ABC -# RUN: ld.lld -image-base=0x1000 -z max-page-size=0x2000 %t -o %t1 2>&1 | FileCheck --check-prefix=WARN %s -# WARN: warning: -image-base: address isn't multiple of page size: 0x1000 +# RUN: ld.lld --image-base=0x1000 -z max-page-size=0x2000 %t -o %t1 2>&1 | FileCheck --check-prefix=WARN %s +# WARN: warning: --image-base: address isn't multiple of page size: 0x1000 # Check alias. -# RUN: ld.lld -image-base 0x1000000 %t -o %t1 +# RUN: ld.lld --image-base 0x1000000 %t -o %t1 # RUN: llvm-readobj -l %t1 | FileCheck %s .global _start diff --git a/lld/test/ELF/x86-64-plt-high-addr.s b/lld/test/ELF/x86-64-plt-high-addr.s index 9eef3e1..64d6d929 100644 --- a/lld/test/ELF/x86-64-plt-high-addr.s +++ b/lld/test/ELF/x86-64-plt-high-addr.s @@ -4,7 +4,7 @@ // RUN: ld.lld -o %t.so -shared %t1.o -soname=so // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t2.o -// RUN: ld.lld -o %t1.exe %t2.o %t.so -image-base=0xcafe00000000 +// RUN: ld.lld -o %t1.exe %t2.o %t.so --image-base=0xcafe00000000 // RUN: llvm-objdump -s -j .got.plt %t1.exe | FileCheck %s // CHECK: Contents of section .got.plt: @@ -12,7 +12,7 @@ // CHECK-NEXT: cafe00003390 00000000 00000000 a6120000 feca0000 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t2.o -// RUN: ld.lld -o %t2.exe %t2.o %t.so -image-base=0xcafe00000000 -z retpolineplt +// RUN: ld.lld -o %t2.exe %t2.o %t.so --image-base=0xcafe00000000 -z retpolineplt // RUN: llvm-objdump -s -j .got.plt %t2.exe | FileCheck --check-prefix=RETPOLINE %s // RETPOLINE: Contents of section .got.plt: