]> Shamusworld >> Repos - rmac/blobdiff - sect.c
Added new optimisation option "+op" which enforces PC relative mode (#123)
[rmac] / sect.c
diff --git a/sect.c b/sect.c
index 0ea53a843f1c4568dec445fcab7c7f3a179ed014..781a81bda516c5e5fdbf7f0f06351a8a3e63f69e 100644 (file)
--- a/sect.c
+++ b/sect.c
@@ -415,6 +415,15 @@ int ResolveFixups(int sno)
                        // evexpr presumably issues the errors/warnings here
                        if (evexpr(fup->expr, &eval, &eattr, &esym) != OK)
                                continue;
+
+                       if (optim_pc)
+                               if (eattr & REFERENCED)
+                                       if (eattr & DEFINED)
+                                               if (!(eattr & EQUATED))
+                                               {
+                                                       error("relocation not allowed");
+                                                       continue;
+                                               }
                }
                // Simple symbol
                else
@@ -422,6 +431,15 @@ int ResolveFixups(int sno)
                        SYM * sy = fup->symbol;
                        eattr = sy->sattr;
 
+                       if (optim_pc)
+                               if (eattr & REFERENCED)
+                                       if (eattr & DEFINED)
+                                               if (!(eattr & EQUATED))
+                                               {
+                                                       error("relocation not allowed");
+                                                       continue;
+                                               }
+
                        if (eattr & DEFINED)
                                eval = sy->svalue;
                        else