Index: trunk/src/emx/src/emxomf/emxomf.c
===================================================================
--- trunk/src/emx/src/emxomf/emxomf.c	(revision 726)
+++ trunk/src/emx/src/emxomf/emxomf.c	(revision 727)
@@ -184,5 +184,5 @@
  * Link386              support HLL v3 (?)
  */
-int hll_version = 6;
+int hll_version = 4;
 
 /* Private variables. */
@@ -559,6 +559,9 @@
    NAME.  On success, a pointer to the symbol table entry (in the
    array pointed to by sym_ptr) is returned.  If the symbol is not
-   found, NULL is returned. */
-const struct nlist *find_symbol (const char *name)
+   found, NULL is returned.
+   NOT_ENTRY is an entry index which is not to be found.
+   FEXT is an indicator on whether or not we can find external symbols or
+   not.  */
+const struct nlist *find_symbol_ex (const char *name, int not_entry, int fext)
 {
   int i, j, n, len, t;
@@ -580,9 +583,9 @@
 	  n = sym_count;
 	  for (j = 0; j < n; ++j)
-	    if (sym_ptr[j].n_un.n_strx == sym_ofs)
+	    if (sym_ptr[j].n_un.n_strx == sym_ofs && j != not_entry)
 	      {
 		t = sym_ptr[j].n_type & ~N_EXT;
-		if (t == N_TEXT || t == N_DATA || t == N_BSS
-                    /* kso #465 2003-06-04: Find weak symbols too. */
+		if (   t == N_TEXT || t == N_DATA || t == N_BSS
+                    || (fext && sym_ptr[j].n_type == N_EXT)
                     || (sym_ptr[j].n_type >= N_WEAKA && sym_ptr[j].n_type <= N_WEAKB)
                     || (t == 0 && sym_ptr[j].n_value != 0))
@@ -593,4 +596,13 @@
     }
   return NULL;                  /* Symbol not found */
+}
+
+/* Find an a.out symbol.  The underscore character `_' is prepended to
+   NAME.  On success, a pointer to the symbol table entry (in the
+   array pointed to by sym_ptr) is returned.  If the symbol is not
+   found, NULL is returned. */
+const struct nlist *find_symbol (const char *name)
+{
+  return find_symbol_ex (name, -1, 0);
 }
 
@@ -1099,8 +1111,5 @@
   for (i = 0; i < sym_count; ++i)
     if (sym_ptr[i].n_type == (N_INDR|N_EXT))
-      {
-        if (!strstr(str_ptr + sym_ptr[i].n_un.n_strx, "$hll$"))
-          ++i;                    /* Skip immediately following entry */
-      }
+      ++i;                       /* Skip immediately following entry */
     else if (sym_ptr[i].n_type == N_EXT && sym_ptr[i].n_value == 0)
       {
@@ -4023,5 +4032,5 @@
       case 'h':
         hll_version = optarg ? atoi(optarg) : 4;
-        if (hll_version != 4 && hll_version != 3)
+        if (hll_version != 4 && hll_version != 3 && hll_version != 6)
           {
             printf ("syntax error: Invalid HLL version specified (%d)\n", hll_version);
Index: trunk/src/emx/src/emxomf/emxomf.h
===================================================================
--- trunk/src/emx/src/emxomf/emxomf.h	(revision 726)
+++ trunk/src/emx/src/emxomf/emxomf.h	(revision 727)
@@ -31,4 +31,5 @@
 char *xstrdup (const char *s);
 extern const struct nlist *find_symbol (const char *name);
+extern const struct nlist *find_symbol_ex (const char *name, int not_entry, int fext);
 
 /* These variables are defined in emxomf.c. */
Index: trunk/src/emx/src/emxomf/stabshll.c
===================================================================
--- trunk/src/emx/src/emxomf/stabshll.c	(revision 726)
+++ trunk/src/emx/src/emxomf/stabshll.c	(revision 727)
@@ -27,4 +27,5 @@
 #include <stdlib.h>
 #include <string.h>
+#include <stdarg.h>
 #include <time.h>
 #include <alloca.h>
@@ -373,5 +374,5 @@
 
 /* kso #456 2003-06-11: Reversed quiet workaround. */
-#define no_warning warning
+#define no_warning warning_parse
 
 
@@ -380,6 +381,27 @@
 *******************************************************************************/
 static void parse_typedef (int *index);
-
-
+static void warning_parse (const char *pszFormat, ...);
+
+
+/**
+ * Report an warning in which might be connecting to parsing.
+ *
+ * @param   pszFormat   Message string.
+ * @param   ...         More arguments
+ */
+static void warning_parse (const char *pszFormat, ...)
+{
+  va_list args;
+
+  va_start (args, pszFormat);
+  fprintf (stderr, "emxomf warning: ");
+  vfprintf (stderr, pszFormat, args);
+  va_end (args);
+  fputc ('\n', stderr);
+
+  if (parse_ptr && parse_start && parse_ptr >= parse_start)
+    fprintf (stderr, "emxomf info: Currently parsing '%c' at position %ld in\n%s\n",
+             *parse_ptr, parse_ptr - parse_start, parse_start);
+}
 
 
@@ -2332,5 +2354,4 @@
 
     case 'a':
-
       /* An array: ar<index_type>;<lower_bound>;<upper_bound>;<el_type> */
 
@@ -2441,5 +2462,5 @@
   if (tp->index == -2)
     {
-      no_warning ("Cycle detected by make_type");
+      warning_parse ("Cycle detected by make_type.");
       RETURN (0);
     }
@@ -2453,5 +2474,5 @@
       if (t1 == NULL)
         {
-          no_warning ("Undefined stabs type %d referenced", tp->d.stabs_ref);
+          warning_parse ("Undefined stabs type %d referenced", tp->d.stabs_ref);
           RETURN (0x82);        /* 32 bit signed */
         }
@@ -3236,4 +3257,5 @@
       printf ("%s %s\n", msg, str);
 #endif
+
       parse_start = parse_ptr = p + 1;
       switch (*parse_ptr)
@@ -3248,8 +3270,11 @@
             }
           if (symbol->n_value == -12357)
-            { /* Special hack for unresolved external variables.
+            { /* Special hack for external and communials variables.
                  We expect the previous two symbols to be an alias for the
                  undefined symbol. The first of them will then have the name
-                 of this record with an $hll$ suffix. */
+                 of this record with an $hll$.* suffix. */
+              ++parse_ptr;
+              ti = hll_type ();
+
               if (   *index >= 2
                   && symbol[-2].n_type == (N_INDR | N_EXT)
@@ -3257,17 +3282,22 @@
                   && strstr(str_ptr + symbol[-2].n_un.n_strx, "$hll$"))
                 {
-                  ++parse_ptr;
-                  ti = hll_type ();
+                  const struct nlist *sym2;
+                  int fext = !strstr(str_ptr + symbol[-2].n_un.n_strx, "$hll$comm$");
+
 #if defined (HLL_DEBUG)
                   printf ("  type=%#x\n", ti);
 #endif
-                  sst_static (name, 0, ti, *index - 1, 1);
+                  sym2 = find_symbol_ex (symbol[-1].n_un.n_strx + str_ptr, *index - 1, fext);
+                  if (sym2)
+                    {
+                      if (sym2->n_type == N_EXT)
+                        sst_static (name, 0, ti, sym2 - sym_ptr, 1);
+                      else
+                        sst_static (name, sym2->n_value, ti, sym2->n_type, 0);
+                      break;
+                    }
                 }
-              else
-                {
-                  warning ("Cannot find address of external variable %s", name);
-                  return;
-                }
-              break;
+              warning ("Cannot find address of external variable %s", name);
+              return;
             }
           /* fall thru */
