[PATCH] D147931: [ARM] Fix null pointer dereferences in ARMMachObjectWriter::recordRelocation()

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 9 14:40:50 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9a564a61a281: [ARM] ARMMachObjectWriter::recordRelocation: reduce strength on a condition (authored by SweetVishnya, committed by MaskRay).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147931

Files:
  llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp


Index: llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
===================================================================
--- llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
+++ llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
@@ -427,8 +427,10 @@
   unsigned Type = 0;
   const MCSymbol *RelSymbol = nullptr;
 
-  if (Target.isAbsolute()) { // constant
-    // FIXME!
+  if (!A) { // constant
+    // FIXME! This is Target.isAbsolute() case as we check SymB above. We check
+    // !A to ensure that null pointer isn't dereferenced and suppress static
+    // analyzer warnings.
     report_fatal_error("FIXME: relocations to absolute targets "
                        "not yet implemented");
   } else {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147931.520822.patch
Type: text/x-patch
Size: 733 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230509/cf9d4bd6/attachment.bin>


More information about the llvm-commits mailing list