Skip to content

emxomfld does not convert IMPORTS of .def to WLINK style #165

@komh

Description

@komh

Hi/2.

If an internal name is not given, it's not possible to execute the .exe

Here is the test codes.

https://github.com/komh/klibctest/blob/master/misc/wl-1-dll.c
https://github.com/komh/klibctest/blob/master/misc/wl-1.c
https://github.com/komh/klibctest/blob/master/misc/wl-1.def

And the patch.

0001-emxomfld-fix-conversion-of-IMPORT-modulename.entryna.patch

From 3e15264b2e60561f76a97e74ae2be79a4fc7df56 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <[email protected]>
Date: Wed, 31 Jul 2019 15:49:41 +0900
Subject: [PATCH] emxomfld: fix conversion of `IMPORT modulename.entryname' on
 WLINK mode

emxomfld does not convert `IMPORT modulename.entryname' of .def to
a style of wlink, because internalname is used unconditionally.

entryname should be used if internalname is not defined.
---
 src/emx/src/emxomf/emxomfld.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/emx/src/emxomf/emxomfld.c b/src/emx/src/emxomf/emxomfld.c
index bc9011f..c49c09c 100644
--- a/src/emx/src/emxomf/emxomfld.c
+++ b/src/emx/src/emxomf/emxomfld.c
@@ -1351,7 +1351,9 @@ static int def_2_watcom(struct _md *md, const _md_stmt *stmt, _md_token token, v
         break;
 
       case _MD_IMPORTS:
-        fprintf (response_file, "IMPORT '%s' '%s'", stmt->import.internalname,
+        fprintf (response_file, "IMPORT '%s' '%s'",
+                 stmt->import.internalname[0] ?
+                   stmt->import.internalname : stmt->import.entryname,
                  stmt->import.modulename);
         if (stmt->import.flags & _MDEP_ORDINAL)
           fprintf (response_file, ".%d", stmt->import.ordinal);
-- 
2.50.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions