<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/62329>62329</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang-cl/lld-link .def files ordinals don't work at all
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Jimbopython
      </td>
    </tr>
</table>

<pre>
    When using clang-cl/lld-link with a def file for a shared dll, the ordinals placed in the def file have no impact at all.

1. The exported functions in the resulting dll are always in the same order, ignoring the sequence specified in the def file
2. With MSVC, the numbers don't have to be ongoing. There can be spaces between the ordinals.

Visual Studio 2022
MSVC: 17.5.4
llvm 15.0.1/16.0.1

Example:
CMake:
```
cmake_minimum_required(VERSION 3.15)
project(foobar C)

set(CMAKE_C_STANDARD 11)

add_library(foobar SHARED lib.c lib.def)
```

lib.h:
```
__declspec(dllexport) void foo(void);
__declspec(dllexport) void bar(void);
```

lib.c:
```
#include "lib.h"
#include <stdio.h>

void foo(void) {
    printf("Foo!\n");
}
void bar(void) {
 printf("Bar!\n");
}
```

lib.def:
```
EXPORTS
foo @2
bar @4
```

The result from dumpbin with MSVC native is:
```
2    0 00001010 foo
4    1 00001020 bar
```

The result from dumpbin with clang-cl/lld-link is:
```
1    0 00001000 foo
2    1 00001010 bar
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyclV1v4ygXxz8NuTmqBdh5u_BFmhc9z646s2qqzt5FGI5jthg8gNvpt19hJ22604xWK0XEcF74nT_2QYSgjxaxJNNbMt1MRB8b58vfdFu57jU2zk4qp17Lbw1a6IO2R5BG2OONNITvjFE3RtsneNGxAQEKa6i1QaidBwGhER4VKGMIX0NsEJxX2goToDNCogJth-W3uEY8I1gHuu2EjCAiCGMyQjeErsaRZfDQIOCPzvmICureyqidDedcHkNvYgJVxoDwCMK8iNc3exDtwIE-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