Adds support for "/ENTRY" and "/SUBSYSTEM" linker options in .drectve sections. Some Mozilla binaries were using these directives and MSVC link.exe appears to allow them. No attempt is made to reconcile these with the options on the command line.
Details
Diff Detail
Event Timeline
Can you add a test?
COFF/Driver.cpp | ||
---|---|---|
11 | Are you really sure if you need mangle? IIRC, there are some command line options that behave differently in terms of name mangling when they are given via .drctve section, so I wonder if that is not the case for /entry. |
COFF/Driver.cpp | ||
---|---|---|
11 | Also wrt mangle, it is possible that it also is done differently between gcc or clang in gnu mode, and msvc and clang in msvc mode. But if this is something that only is emitted e.g. with msvc specific pragmas that aren't enabled by default in gnu mode, it might not matter. (It does differ e.g. for mangling of symbol names in dllexport, which is supported in both modes.) |
COFF/Driver.cpp | ||
---|---|---|
11 | Sorry for the slow response. I finally got around to testing an I386 build (which is the only arch where this matters, according to the body of mangle) and I get an undefined symbol if I remove the call to mangle. So it seems that it's necessary. | |
11 | As far as I can tell (based on the comment above PragmaCommentHandler::HandlePragma) this is an msvc specific thing, so I wouldn't expect it to be enabled in gnu mode. |
I think I can approve if you add a test.
COFF/Driver.cpp | ||
---|---|---|
11 | Cool! Thank you very much for investigating. |
While writing a test I found a problem: the code that infers /entry should not run if we've previously defined one in a drectve. (In Mozilla's build, it worked by accident because the drectve was redundantly specifying the same function that got inferred.) Updated the patch.
Are you really sure if you need mangle? IIRC, there are some command line options that behave differently in terms of name mangling when they are given via .drctve section, so I wonder if that is not the case for /entry.