URL:
  <https://savannah.gnu.org/support/?111245>

                 Summary: MSVC removes MAGIC_EXE when -Gw or -GL is specified
                   Group: GNU Libtool
               Submitter: None
               Submitted: Fri 23 May 2025 08:47:19 AM UTC
                Category: None
                Priority: 5 - Normal
                Severity: 3 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: Microsoft Windows


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Fri 23 May 2025 08:47:19 AM UTC By: Anonymous
In lt-main.in, MAGIC_EXE hold a magic string to distinguish it whether it is a
wrapper executable or not. It's ok on GCC because
__attribute__((externally_visible)) was applied. However, in MSVC, it doesn't
have the similar attributes, then it would be eliminated by -Gw option (an
option like -fdata-sections).

There are two possible solutions came to my mind.

1. Use __pragma(comment(linker, "/INCLUDE:MAGIC_EXE"))
    It places /INCLUDE:symbol_name option to linker, but please noticed that
the symbol name is _MAGIC_EXE instead of MAGIC_EXE in x86 (32-bit).

2. Use (void) MAGIC_EXE in any function
    It mark MAGIC_EXE as used (even in a strange way) prevent the effect of
-Gw. Yeah, I don't think it is a good way that MSVC doesn't change this
behavior in future.

3. Use another strings to do so
    e.g. "libtool-wrapper" or "libtool wrapper (GNU $PACKAGE) $VERSION". I
don't think user will uses these strings in their programs.







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/support/?111245>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to