Re: Fwd: [PATCH v2] PE/COFF: Implement visibility attribute via .drectve
Jonathan Yong <[email protected]>
| Newsgroups | gmane.comp.gcc.patches |
|---|---|
| Message-ID | <[email protected]> |
On 8/10/26 10:31, LIU Hao wrote: > 在 2026-8-9 22:45, Oleg Tolmatcev 写道: >> ---------- Forwarded message --------- >> От: Oleg Tolmatcev <[email protected]> >> Date: вс, 9 авг. 2026 г. в 16:43 >> Subject: [PATCH v2] PE/COFF: Implement visibility attribute via .drectve >> To: <[email protected]> >> Cc: Oleg Tolmatcev <[email protected]> >> >> >> On PE/COFF targets (MinGW, Cygwin), the visibility attribute was >> previously ignored with a warning. This patch makes it functional >> by emitting -exclude-symbols directives into the .drectve section, >> matching Clang's behavior. The GNU linker already reads and >> respects these directives during auto-export, so hidden/internal >> symbols are now correctly excluded from DLL exports. >> >> gcc/ChangeLog: >> >> * config/mingw/winnt.cc (i386_pe_drectve_name): New. >> (i386_pe_assemble_visibility): Emit -exclude-symbols >> directives into .drectve for VISIBILITY_HIDDEN and >> VISIBILITY_INTERNAL instead of warning. Use the external >> symbol spelling for 32-bit PE names. >> >> gcc/testsuite/ChangeLog: >> >> * gcc.target/i386/visibility-hidden-mingw.c: New test. >> * gcc.target/i386/visibility-hidden-mingw-32.c: New test. >> >> Signed-off-by: Oleg Tolmatcev <[email protected]> > > I have tested this change on {x86_64,i686}-w64-mingw32 and both look > good to me. Thanks. > Thanks, I have pushed this to the master branch.