[sr #111245] MSVC removes MAGIC_EXE when -Gw or -GL is specified
anonymous <[email protected]> Fri, 23 May 2025 04:47:23 -0400 (EDT)
| Newsgroups | gmane.comp.gnu.libtool.general |
|---|---|
| Message-ID | <[email protected]> |
--8323329-1072702603-1747990043=:4014927
Content-Type: TEXT/plain; CHARSET=utf-8
Content-Transfer-Encoding: QUOTED-PRINTABLE
Content-Disposition: inline
URL:=0A <https://savannah.gnu.org/support/?111245>=0A=0A S=
ummary: MSVC removes MAGIC_EXE when -Gw or -GL is specified=0A =
Group: GNU Libtool=0A Submitter: None=0A =
Submitted: Fri 23 May 2025 08:47:19 AM UTC=0A Category: None=
=0A Priority: 5 - Normal=0A Severity: 3 - Nor=
mal=0A Status: None=0A Privacy: Public=0A =
Assigned to: None=0A Originator Email:=0A Op=
en/Closed: Open=0A Discussion Lock: Any=0A Operating System:=
Microsoft Windows=0A=0A=0A ____________________________________________=
___________=0A=0AFollow-up Comments:=0A=0A=0A------------------------------=
-------------------------=0ADate: Fri 23 May 2025 08:47:19 AM UTC By: Anony=
mous=0AIn lt-main.in, MAGIC_EXE hold a magic string to distinguish it wheth=
er it is a=0Awrapper executable or not. It's ok on GCC because=0A__attribut=
e__((externally_visible)) was applied. However, in MSVC, it doesn't=0Ahave =
the similar attributes, then it would be eliminated by -Gw option (an=0Aopt=
ion like -fdata-sections).=0A=0AThere are two possible solutions came to my=
mind.=0A=0A1. Use __pragma(comment(linker, "/INCLUDE:MAGIC_EXE"))=0A It=
places /INCLUDE:symbol_name option to linker, but please noticed that=0Ath=
e symbol name is _MAGIC_EXE instead of MAGIC_EXE in x86 (32-bit).=0A=0A2. U=
se (void) MAGIC_EXE in any function=0A It mark MAGIC_EXE as used (even i=
n a strange way) prevent the effect of=0A-Gw. Yeah, I don't think it is a g=
ood way that MSVC doesn't change this=0Abehavior in future.=0A=0A3. Use ano=
ther strings to do so=0A e.g. "libtool-wrapper" or "libtool wrapper (GNU=
$PACKAGE) $VERSION". I=0Adon't think user will uses these strings in their=
programs.=0A=0A=0A=0A=0A=0A=0A=0A _____________________________________=
__________________=0A=0AReply to this item at:=0A=0A <https://savannah.gnu=
.org/support/?111245>=0A=0A_______________________________________________=
=0AMessage sent via Savannah=0Ahttps://savannah.gnu.org/=0A
--8323329-1072702603-1747990043=:4014927
Content-Type: APPLICATION/pgp-signature; name=signature.asc
-----BEGIN PGP SIGNATURE-----
iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCaDA2GwAKCRCqLAuaBUf3
TmMxAQC6sHhJ/MxM77C04ChKOhL9xhy41sBpIXFtwlNR1OGGpwEAoasLB8msB2Au
/J3KICgywE6wZAwFSjhdXr2TkgJ5rgk=
=3+cB
-----END PGP SIGNATURE-----
--8323329-1072702603-1747990043=:4014927--