[PATCH] D149023: [LLD][COFF] Add /inferasanlibs to lld-link as ignored flag

Alvin Wong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 24 07:07:11 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG8fa0cfeb61a1: [LLD][COFF] Add /inferasanlibs to lld-link as ignored flag (authored by alvinhochun).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149023/new/

https://reviews.llvm.org/D149023

Files:
  lld/COFF/Driver.cpp
  lld/COFF/Options.td
  lld/test/COFF/inferasanlibs-drectve.s
  lld/test/COFF/inferasanlibs.test


Index: lld/test/COFF/inferasanlibs.test
===================================================================
--- /dev/null
+++ lld/test/COFF/inferasanlibs.test
@@ -0,0 +1,8 @@
+# RUN: yaml2obj %p/Inputs/ret42.yaml -o %t.obj
+
+# RUN: lld-link /out:%t.exe /entry:main %t.obj /inferasanlibs 2>&1 | FileCheck --check-prefix=POS %s
+# RUN: lld-link /out:%t.exe /entry:main %t.obj /inferasanlibs:no 2>&1 | FileCheck --allow-empty --check-prefix=NEG %s
+
+POS: ignoring '/inferasanlibs', this flag is not supported
+
+NEG-NOT: ignoring '/inferasanlibs', this flag is not supported
Index: lld/test/COFF/inferasanlibs-drectve.s
===================================================================
--- /dev/null
+++ lld/test/COFF/inferasanlibs-drectve.s
@@ -0,0 +1,16 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -triple=x86_64-windows %s -filetype=obj -o %t.obj
+
+# RUN: lld-link -dll -out:%t.dll -entry:entry %t.obj -subsystem:console 2>&1 | FileCheck --allow-empty --ignore-case %s
+
+# CHECK-NOT: ignoring unknown argument
+# CHECK-NOT: inferasanlibs
+# CHECK-NOT: is not allowed in .drectve
+
+  .global entry
+  .text
+entry:
+  ret
+  .section .drectve
+  .ascii " /INFERASANLIBS "
Index: lld/COFF/Options.td
===================================================================
--- lld/COFF/Options.td
+++ lld/COFF/Options.td
@@ -194,6 +194,9 @@
 defm incremental : B<"incremental",
                      "Keep original import library if contents are unchanged",
                      "Overwrite import library even if contents are unchanged">;
+defm inferasanlibs : B<"inferasanlibs",
+                       "Unused, generates a warning",
+                       "No effect (default)">;
 defm integritycheck : B<"integritycheck",
                         "Set FORCE_INTEGRITY bit in PE header",
                         "No effect (default)">;
Index: lld/COFF/Driver.cpp
===================================================================
--- lld/COFF/Driver.cpp
+++ lld/COFF/Driver.cpp
@@ -445,6 +445,8 @@
     case OPT_editandcontinue:
     case OPT_guardsym:
     case OPT_throwingnew:
+    case OPT_inferasanlibs:
+    case OPT_inferasanlibs_no:
       break;
     default:
       error(arg->getSpelling() + " is not allowed in .drectve (" +
@@ -1933,6 +1935,9 @@
       args.hasFlag(OPT_stdcall_fixup, OPT_stdcall_fixup_no, config->mingw);
   config->warnStdcallFixup = !args.hasArg(OPT_stdcall_fixup);
 
+  if (args.hasFlag(OPT_inferasanlibs, OPT_inferasanlibs_no, false))
+    warn("ignoring '/inferasanlibs', this flag is not supported");
+
   // Don't warn about long section names, such as .debug_info, for mingw or
   // when -debug:dwarf is requested.
   if (config->mingw || config->debugDwarf)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149023.516399.patch
Type: text/x-patch
Size: 2699 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230424/103d6f7a/attachment.bin>


More information about the llvm-commits mailing list