Skip to content

Commit f8ee74f

Browse files
committed
[ELF] Require two-dash form for --pack-dyn-relocs
LLD specific options can be more rigid. Also add a test.
1 parent 489561d commit f8ee74f

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lld/ELF/Driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ static std::pair<bool, bool> getPackDynRelocs(opt::InputArgList &args) {
810810
return {true, true};
811811

812812
if (s != "none")
813-
error("unknown -pack-dyn-relocs format: " + s);
813+
error("unknown --pack-dyn-relocs format: " + s);
814814
return {false, false};
815815
}
816816

lld/ELF/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ defm orphan_handling:
314314
Eq<"orphan-handling", "Control how orphan sections are handled when linker script used">;
315315

316316
defm pack_dyn_relocs:
317-
Eq<"pack-dyn-relocs", "Pack dynamic relocations in the given format">,
317+
EEq<"pack-dyn-relocs", "Pack dynamic relocations in the given format">,
318318
MetaVarName<"[none,android,relr,android+relr]">;
319319

320320
defm use_android_relr_tags: BB<"use-android-relr-tags",

lld/test/ELF/pack-dyn-relocs.s

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
// RUN: ld.lld -pie --pack-dyn-relocs=none %t.a32.o %t.a32.so -o %t2.a32
77
// RUN: llvm-readobj -r %t2.a32 | FileCheck --check-prefix=UNPACKED32 %s
88

9+
// RUN: not ld.lld --pack-dyn-relocs=invalid %t.a32.o %t.a32.so -o /dev/null 2>&1 | FileCheck %s --check-prefix=UNKNOWN
10+
11+
// UNKNOWN: unknown --pack-dyn-relocs format: invalid
12+
913
/// Unpacked should have the relative relocations in their natural order.
1014
/// UNPACKED32: Section ({{.+}}) .rel.dyn {
1115
// UNPACKED32-NEXT: 0x30324 R_ARM_RELATIVE -

0 commit comments

Comments
 (0)