#220 closed defect (fixed)
emxomf: long names in libraries gets the wrong dict entry and barfs
Reported by: | dmik | Owned by: | bird |
---|---|---|---|
Priority: | normal | Milestone: | libc-0.6.6 |
Component: | libc | Version: | 0.6.5 |
Severity: | normal | Keywords: | |
Cc: | dryeo |
Description (last modified by )
~Recently I run into a situation when GCC 4.4.2 generated an N_EXP stub for a local symbol (having a name like _T.3032 to be precise) which is an emitted inline function (static member of a class defined as declspec(dllexport)) in the object file.~
~Given the resulting .obj file, emxomf created an OMF export record for this symbol but the linker (WLINK here) failed with the 'unresolved export' message when creating a DLL out of this .obj which is not a surprise because _T.3032 isn't public at all (lacks .globl in the assembler file). I understand that creating OMF export records for such local symbols will never succeed so I changed it to not do that which solved the problem (the patch is attached).~
emxomf-03-fix-symbol-too-long.diff: Make sure the stripped down symbol name is used not only when performing an AOUT to OMF conversion for a single object file but also when converting the whole object library. Prior to this fix, an unstripped version of the symbol would go to the OMF library's dictionary which caused the 'Symbol too long' error and program termination.
Attachments (7)
Change History (22)
by , 15 years ago
Attachment: | emxomf-no-export-locals.diff added |
---|
comment:1 by , 15 years ago
comment:2 by , 15 years ago
I attached the patched emxomf.exe here for those who bumps into the same problem since it's rather small. Tested it with GCC 3.3.5 CSD3 as well as GCC 4.4.2 built by Paul Smedley.
comment:3 by , 15 years ago
For some reason, GCC 4.4.2 prepends an asterisk ('*') to the symbols with the _System attribute when generating N_EXP stubs for them. This apparently confuses emxomf.exe and eventually breaks exporting of such symbols with declspec(dllexport). I'm attaching a new patch that fixes this, as well as the new binary (that contains all patches).
by , 15 years ago
Attachment: | emxomf-remove-asterisk.diff added |
---|
comment:4 by , 15 years ago
Note that I also disabled informational warnings in emxomf regarding unknown stubs (related to the HLL debug info as I understand).
comment:5 by , 15 years ago
Cc: | added |
---|
This patched emxomf also fixed a build break in Mozilla where some symbols now have an at sign ('@') prefix.
comment:6 by , 14 years ago
A couple of new emxomf fixes and a fresh binary. Not related to the subject of this topic but jut to keep it in one place.
- emxomf-03-fix-symbol-too-long.diff: Make sure the stripped down symbol name is used not only when performing an AOUT to OMF conversion for a single object file but also when converting the whole object library. Prior to this fix, an unstripped version of the symbol would go to the OMF library's dictionary which caused the 'Symbol too long' error and program termination.
- emxomf-04-no-hll-warnings.diff: Suppress three remaining HLL debug info related warnings which make no sense for the end user and only annoy him.
by , 14 years ago
Attachment: | emxomf-03-fix-symbol-too-long.diff added |
---|
by , 14 years ago
Attachment: | emxomf-04-no-hll-warnings.diff added |
---|
comment:7 by , 14 years ago
Milestone: | → libc-0.6.4 |
---|
comment:8 by , 14 years ago
Status: | new → assigned |
---|
This is a bug in the gcc port you're using really, but I'll see what I can do about the patches.
comment:9 by , 14 years ago
Summary: | emxomf tries to export local (non-public) symbols → emxomf: long names in libraries gets the wrong dict entry and barfs |
---|
The asterisk problem is a bug in the gcc port and should be fixed there and not in emxomf (emxomf-remove-asterisk.diff). A leading asterisk is used to indicate that the symbol should not have a leading underscore.
The _T.3032 export fix should be done in GCC, not emxomf. The behavior of emxomf+wlink is correct, i.e. the should fail when given bad input.
Disabling the stabs stuff isn't useful as it indicates that emxomf isn't producing the right HLL output. If anyone is annoyed by this, address the frustration into fixing the issue instead of hiding it.
The library w/ long names issue is valid. Will apply fix.
comment:10 by , 14 years ago
Description: | modified (diff) |
---|
comment:11 by , 14 years ago
comment:12 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:13 by , 10 years ago
Component: | emx → libc |
---|---|
Milestone: | libc-0.6.4 → libc-0.6.6 |
Version: | 0.6 → 0.6.5 |
JFYI, I created a GCC issue for the asterisk problem (emxomf-remove-asterisk.diff) here: https://github.com/psmedley/gcc/issues/9.
comment:14 by , 10 years ago
(Note: I didn't change the fields version, component and milestone above: my Safari changed it for me for unknown reason and I don't really know how to change it back, it reverts them to what you see above before I have an opportunity to press submit).
I must say that although emxomf seems to behave incorrectly, it's not the first one to spank in the line. I also really wonder:
P.S. JFYI, _T.3032 has n_type = N_TEXT in the object file, while other (working) dllexport symbols have N_EXT | N_TEXT.