[PATCH] D58724: [gnustep-objc] Make the GNUstep v2 ABI work for Windows DLLs.

Dustin L. Howett via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 28 11:07:15 PST 2019


DHowett-MSFT added inline comments.


================
Comment at: clang/lib/CodeGen/CGObjCGNU.cpp:188
 
+  StringRef SymbolPrefix() {
+    return CGM.getTriple().isOSBinFormatCOFF() ? "_" : "._";
----------------
theraven wrote:
> DHowett-MSFT wrote:
> > Should this be `SymbolPrefix()` or something more like `MangleSymbol(StringRef sym)`? I know that right now we only need to prepend `_` or `._`, but is it more future-proof to make it generic?
> I have refactored this, and then tried adding a $ instead of the . for mangling.  On further testing, the latest link.exe from VS 2017 no longer complains about symbols starting with a dot, so I'm inclined to revert that part of it entirely (lld-link.exe was always happy).  I'd prefer to minimise differences between COFF and ELF and this means that we have different section names, but aside from needing the extra global initialisation on COFF, everything else is the same.  
The issue I had with symbols starting with `.` was in `.DEF` files specifically.

Linking a shared object containing:
```
@.exp_with_dot = dllexport global i32 0, align 4
```

without a def file, yields:

```
    ordinal hint RVA      name

          1    0 00012900 .exp_with_dot
```

However, linking the same library with a definition file:

###test.def
```
EXPORTS
 .exp_with_dot
```

yields

###output
```
test.def : fatal error LNK1242: '.exp_with_dot' is an invalid export symbol name
```

This still reproduces with 15.9.8, sadly. LINK version 14.16.27027.1.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D58724





More information about the cfe-commits mailing list