4 Commits

Author SHA1 Message Date
Martin Storsjö
8822eaae0f
[compiler-rt] Switch LLD specific tests to a more precise option (#69781)
Prefer the new flag -lld-allow-duplicate-weak (which was added recently
in a67ae8c0fd301a11e2a058e8035304cfc70a3e91), over the old -lldmingw.

The -lldmingw option enables a number of different behaviours, while
this test only is interested in one aspect of them.

This should allow making -lldmingw more strict with not enabling MSVC
specific behaviours like inferring lib directories automatically from
the environment, as being pursued in https://reviews.llvm.org/D144084.
2023-10-21 09:42:49 +03:00
Martin Storsjö
56320301a7 [compiler-rt] [test] [profile] Mark a Windows test as requiring an MSVC target
This test uses lots of lld-link specific linker options that don't
work as such in mingw command lines.

Differential Revision: https://reviews.llvm.org/D148168
2023-04-13 12:03:34 +03:00
Fangrui Song
87c43f3aa9 [InstrProfiling] Delete linkage/visibility toggling for Windows
The linkage/visibility of `__profn_*` variables are derived
from the profiled functions.

    extern_weak => linkonce
    available_externally => linkonce_odr
    internal => private
    extern => private
    _ => unchanged

The linkage/visibility of `__profc_*`/`__profd_*` variables are derived from
`__profn_*` with linkage/visibility wrestling for Windows.

The changes can be folded to the following without changing semantics.

```
if (TT.isOSBinFormatCOFF() && !NeedComdat) {
  Linkage = GlobalValue::InternalLinkage;
  Visibility = GlobalValue::DefaultVisibility;
}
```

That said, I think we can just delete the code block.

An extern/internal function will now use private `__profc_*`/`__profd_*`
variables, instead of internal ones. This saves some symbol table entries.

A non-comdat {linkonce,weak}_odr function will now use hidden external
`__profc_*`/`__profd_*` variables instead of internal ones.  There is potential
object file size increase because such symbols need `/INCLUDE:` directives.
However such non-comdat functions are rare (note that non-comdat weak
definitions don't prevent duplicate definition error).

The behavior changes match ELF.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D103355
2021-06-02 16:49:54 -07:00
Fangrui Song
effb87dfa8 [profile] Add -fprofile-instr-generate tests for weak definition and various linkages 2021-06-02 16:12:08 -07:00