[clang] [clang][driver] Support option '-r' for target AVR (PR #68484)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 10 16:04:26 PDT 2023


================
@@ -57,3 +57,30 @@
 // RUN: %clang -### --target=avr -mmcu=atmega328 -fuse-ld=lld -flto --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKS %s
 // LINKS: {{".*ld.*"}} {{.*}} "--defsym=__DATA_REGION_ORIGIN__=0x800100" "-plugin-opt=mcpu=atmega328"
 // LINKS-NOT: "-plugin-opt=thinlto"
+
+// RUN: %clang -### -r --target=avr -mmcu=atmega328 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck --check-prefix=LINKU %s
+// LINKU: {{".*ld.*"}} {{.*}} "-r" {{.*}} "-mavr5"
+// LINKU-NOT: "--gc-sections"
+// LINKU-NOT: {{"--defsym.*"}}
+// LINKU-NOT: {{"-l.*"}}
+
+// RUN: %clang -### -r --target=avr -mmcu=atmega328 -fuse-ld=lld --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck --check-prefix=LINKV %s
+// LINKV: {{".*ld.*"}} {{.*}} "-r"
+// LINKV-NOT: "--gc-sections"
+// LINKV-NOT: {{"--defsym.*"}}
+// LINKV-NOT: {{"-l.*"}}
+// LINKV-NOT: {{"-m.*"}}
+
+// RUN: %clang -### -r --target=avr -mmcu=atmega328 -lm --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck --check-prefix=LINKW %s
+// LINKW: {{".*ld.*"}} {{.*}} "-r" "-lm" {{.*}} "-mavr5"
+// LINKW-NOT: "--gc-sections"
+// LINKW-NOT: {{"--defsym.*"}}
----------------
MaskRay wrote:

`// LINKW-NOT: "--defsym`

https://github.com/llvm/llvm-project/pull/68484


More information about the cfe-commits mailing list