https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123888

--- Comment #23 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, I've tried to add a.C:
extern "C" int
_Z38NS_LoadPersistentPropertiesFromURISpecPP23nsIPersistentPropertiesRK12nsTSubstringIcE
();

int
foo ()
{
  return
_Z38NS_LoadPersistentPropertiesFromURISpecPP23nsIPersistentPropertiesRK12nsTSubstringIcE
();
}
g++ -o Unified_cpp_netwerk_base3.o -c -flto -flifetime-dse=1
-fstack-protector-strong -fstrict-flex-arrays=1 -fno-rtti -pthread
-fno-sized-deallocation -fno-aligned-new -ffunction-sections -fdata-sections
-fno-math-errno -fno-exceptions -fPIC -O2 -g1 -m64 -march=x86-64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
-fpermissive -O3 -fomit-frame-pointer -funwind-tables -fno-strict-aliasing
-ffp-contract=off -fprofile-use -fprofile-correction
Unified_cpp_netwerk_base3.ii -Wno-coverage-mismatch
g++ -o Unified_cpp_netwerk_base4.o -c -flto -flifetime-dse=1
-fstack-protector-strong -fstrict-flex-arrays=1 -fno-rtti -pthread
-fno-sized-deallocation -fno-aligned-new -ffunction-sections -fdata-sections
-fno-math-errno -fno-exceptions -fPIC -O2 -g1 -m64 -march=x86-64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
-fpermissive -O3 -fomit-frame-pointer -funwind-tables -fno-strict-aliasing
-ffp-contract=off -fprofile-use -fprofile-correction
Unified_cpp_netwerk_base4.ii -Wno-coverage-mismatch

../g++ -shared -flto -fno-whole-program -fPIC -O2 -o libxul.so a.C
Unified_cpp_netwerk_base{3,4}.o 
a.C:1:16: warning: type of
‘_Z38NS_LoadPersistentPropertiesFromURISpecPP23nsIPersistentPropertiesRK12nsTSubstringIcE’
does not match original declaration [-Wlto-type-mismatch]
    1 | extern "C" int
_Z38NS_LoadPersistentPropertiesFromURISpecPP23nsIPersistentPropertiesRK12nsTSubstringIcE
();
      |                ^
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/netwerk/base/nsNetUtil.cpp:2128:10:
note: return value type mismatch
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/ErrorList.h:56:12:
note: type ‘nsresult’ should match type ‘int’
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/netwerk/base/nsNetUtil.cpp:2128:10:
note: ‘NS_LoadPersistentPropertiesFromURISpec’ was previously declared here
lto-wrapper: warning: using serial compilation of 2 LTRANS jobs
lto-wrapper: note: see the ‘-flto’ option documentation for more information
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`nsCOMPtr<nsIPrefBranch>::assign_from_gs_contractid(nsGetServiceByContractID,
nsID const&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsCOMPtr.h:870:(.text+0x79):
undefined reference to `nsGetServiceByContractID::operator()(nsID const&,
void**) const'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function `NS_MutateURI&
NS_MutateURI::Apply<nsresult (nsIStandardURLMutator::*)(unsigned int, int,
nsTSubstring<char> const&, char const*, nsIURI*, nsIURIMutator**),
nsIStandardURL::{unnamed type#1}, int, nsTSubstring<char> const&, char const*&,
nsIURI*&, decltype(nullptr)>(nsresult (nsIStandardURLMutator::*)(unsigned int,
int, nsTSubstring<char> const&, char const*, nsIURI*, nsIURIMutator**),
nsIStandardURL::{unnamed type#1}&&, int&&, nsTSubstring<char> const&, char
const*&, nsIURI*&, decltype(nullptr)&&) [clone .constprop.0]':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsCOMPtr.h:189:(.text+0x26e):
undefined reference to `nsQueryInterfaceISupportsWithError::operator()(nsID
const&, void**) const'
/usr/bin/ld:
/tmp/cckKR9qr.ltrans0.ltrans.o:/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsCOMPtr.h:189:(.text+0x31a):
undefined reference to `nsQueryInterfaceISupportsWithError::operator()(nsID
const&, void**) const'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsSimpleURI::GetPathQueryRef(nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTDependentSubstring.h:67:(.text+0x438):
undefined reference to `nsTDependentSubstring<char>::Rebind(nsTSubstring<char>
const&, unsigned long, unsigned long)'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsSimpleURI::GetPathQueryRef(nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTSubstring.h:526:(.text+0x443):
undefined reference to `nsTSubstring<char>::Assign(nsTSubstring<char> const&)'
/usr/bin/ld:
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTSubstring.h:327:(.text+0x44b):
undefined reference to `nsTSubstring<char>::Finalize()'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsSimpleURI::SchemeIs(char const*, bool*)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTDependentSubstring.h:67:(.text+0x4db):
undefined reference to `nsTDependentSubstring<char>::Rebind(nsTSubstring<char>
const&, unsigned long, unsigned long)'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsSimpleURI::SchemeIs(char const*, bool*)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/netwerk/base/nsSimpleURI.cpp:556:(.text+0x4fa):
undefined reference to
`mozilla::detail::nsTStringRepr<char>::EqualsIgnoreCase(std::basic_string_view<char,
std::char_traits<char> > const&) const'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsSimpleURI::SchemeIs(char const*, bool*)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTSubstring.h:327:(.text+0x505):
undefined reference to `nsTSubstring<char>::Finalize()'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsSimpleURI::GetAsciiSpec(nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTSubstring.h:526:(.text+0x54f):
undefined reference to `nsTSubstring<char>::Assign(nsTSubstring<char> const&)'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsSimpleURI::GetScheme(nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTDependentSubstring.h:67:(.text+0x5ae):
undefined reference to `nsTDependentSubstring<char>::Rebind(nsTSubstring<char>
const&, unsigned long, unsigned long)'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsSimpleURI::GetScheme(nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTSubstring.h:530:(.text+0x5b9):
undefined reference to `nsTSubstring<char>::Assign(nsTSubstring<char>&&)'
/usr/bin/ld:
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTSubstring.h:327:(.text+0x5c1):
undefined reference to `nsTSubstring<char>::Finalize()'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsStandardURL::Resolve(nsTSubstring<char> const&,
nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTPromiseFlatString.h:104:(.text+0x8bb):
undefined reference to `nsTPromiseFlatString<char>::Init(nsTSubstring<char>
const&)'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsStandardURL::Resolve(nsTSubstring<char> const&,
nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/netwerk/base/nsURLHelper.cpp:465:(.text+0x8fd):
undefined reference to `nsTSubstring<char>::Truncate()'
/usr/bin/ld:
/tmp/cckKR9qr.ltrans0.ltrans.o:/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/netwerk/base/nsURLHelper.cpp:481:(.text+0x93e):
undefined reference to `mozilla::ASCIIMask::MaskCRLFTab()'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsStandardURL::Resolve(nsTSubstring<char> const&,
nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTSubstring.h:526:(.text+0x999):
undefined reference to `nsTSubstring<char>::Assign(nsTSubstring<char> const&)'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsStandardURL::Resolve(nsTSubstring<char> const&,
nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTDependentSubstring.h:67:(.text+0xa10):
undefined reference to `nsTDependentSubstring<char>::Rebind(nsTSubstring<char>
const&, unsigned long, unsigned long)'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsStandardURL::Resolve(nsTSubstring<char> const&,
nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTString.h:315:(.text+0xa50):
undefined reference to `nsTSubstring<char>::Assign(nsTSubstring<char>&&)'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsStandardURL::Resolve(nsTSubstring<char> const&,
nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTSubstring.h:327:(.text+0xa5d):
undefined reference to `nsTSubstring<char>::Finalize()'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsStandardURL::Resolve(nsTSubstring<char> const&,
nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTDependentSubstring.h:131:(.text+0xac1):
undefined reference to `nsTDependentSubstring<char>::nsTDependentSubstring(char
const*, char const*)'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsStandardURL::Resolve(nsTSubstring<char> const&,
nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/netwerk/base/nsURLHelper.cpp:399:(.text+0xada):
undefined reference to
`mozilla::TTokenizer<char>::TTokenizer(nsTSubstring<char> const&, char const*,
char const*)'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsStandardURL::Resolve(nsTSubstring<char> const&,
nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTSubstring.h:327:(.text+0xae7):
undefined reference to `nsTSubstring<char>::Finalize()'
/usr/bin/ld:
/tmp/cckKR9qr.ltrans0.ltrans.o:/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/netwerk/base/nsURLHelper.cpp:400:(.text+0xaf4):
undefined reference to
`mozilla::TTokenizer<char>::Record(mozilla::TTokenizer<char>::ClaimInclusion)'
/usr/bin/ld:
/tmp/cckKR9qr.ltrans0.ltrans.o:/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/netwerk/base/nsURLHelper.cpp:401:(.text+0xb03):
undefined reference to `mozilla::TTokenizer<char>::CheckChar(bool (*)(char))'
/usr/bin/ld:
/tmp/cckKR9qr.ltrans0.ltrans.o:/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/netwerk/base/nsURLHelper.cpp:406:(.text+0xb1b):
undefined reference to `mozilla::TTokenizer<char>::CheckChar(bool (*)(char))'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsStandardURL::Resolve(nsTSubstring<char> const&,
nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/mozilla/Tokenizer.h:308:(.text+0xb2c):
undefined reference to `mozilla::TokenizerBase<char>::Token::Whitespace()'
/usr/bin/ld:
/tmp/cckKR9qr.ltrans0.ltrans.o:/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/mozilla/Tokenizer.h:308:(.text+0xb3c):
undefined reference to
`mozilla::TTokenizer<char>::Check(mozilla::TokenizerBase<char>::Token const&)'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsStandardURL::Resolve(nsTSubstring<char> const&,
nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTSubstring.h:327:(.text+0xb4c):
undefined reference to `nsTSubstring<char>::Finalize()'
/usr/bin/ld:
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTSubstring.h:327:(.text+0xb59):
undefined reference to `nsTSubstring<char>::Finalize()'
/usr/bin/ld:
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTSubstring.h:327:(.text+0xb66):
undefined reference to `nsTSubstring<char>::Finalize()'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsStandardURL::Resolve(nsTSubstring<char> const&,
nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/mozilla/Tokenizer.h:314:(.text+0xb7d):
undefined reference to `mozilla::TokenizerBase<char>::Token::Char(char)'
/usr/bin/ld:
/tmp/cckKR9qr.ltrans0.ltrans.o:/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/mozilla/Tokenizer.h:314:(.text+0xb8d):
undefined reference to
`mozilla::TTokenizer<char>::Check(mozilla::TokenizerBase<char>::Token const&)'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsStandardURL::Resolve(nsTSubstring<char> const&,
nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTSubstring.h:327:(.text+0xb9d):
undefined reference to `nsTSubstring<char>::Finalize()'
/usr/bin/ld:
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTSubstring.h:327:(.text+0xbaa):
undefined reference to `nsTSubstring<char>::Finalize()'
/usr/bin/ld:
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTSubstring.h:327:(.text+0xbb7):
undefined reference to `nsTSubstring<char>::Finalize()'
/usr/bin/ld:
/tmp/cckKR9qr.ltrans0.ltrans.o:/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/netwerk/base/nsURLHelper.cpp:414:(.text+0xbd8):
undefined reference to `mozilla::TTokenizer<char>::Claim(nsTSubstring<char>&,
mozilla::TTokenizer<char>::ClaimInclusion)'
/usr/bin/ld:
/tmp/cckKR9qr.ltrans0.ltrans.o:/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/netwerk/base/nsURLHelper.cpp:415:(.text+0xbdd):
undefined reference to `mozilla::ASCIIMask::MaskCRLFTab()'
/usr/bin/ld:
/tmp/cckKR9qr.ltrans0.ltrans.o:/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/netwerk/base/nsURLHelper.cpp:415:(.text+0xbe8):
undefined reference to `nsTSubstring<char>::StripTaggedASCII(std::array<bool,
128ul> const&)'
/usr/bin/ld:
/tmp/cckKR9qr.ltrans0.ltrans.o:/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/netwerk/base/nsURLHelper.cpp:416:(.text+0xbf0):
undefined reference to `ToLowerCase(nsTSubstring<char>&)'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: in function
`mozilla::net::nsStandardURL::Resolve(nsTSubstring<char> const&,
nsTSubstring<char>&)':
/builddir/build/BUILD/firefox-147.0.1-build/firefox-147.0.1/objdir/dist/include/nsTArray.h:3101:(.text+0xc06):
undefined reference to `sEmptyTArrayHeader'
/usr/bin/ld: /tmp/cckKR9qr.ltrans0.ltrans.o: relocation R_X86_64_PC32 against
undefined hidden symbol `sEmptyTArrayHeader' can not be used when making a
shared object
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status

Though, if I add -fdump-ipa-all-details -fdump-tree-all to the -shared command
line, it already shows the problem in there, in
libxul.so.ltrans0.ltrans.114t.ccp2 I see that
  if (_1079 ==
_ZThn24_N7mozilla3net13nsStandardURL16TemplatedMutatorIS1_E4InitEjiRK12nsTSubstringIcEPKcP6nsIURIPP13nsIURIMutator)
    goto <bb 112>; [100.00%]
  else
    goto <bb 119>; [0.00%]

  <bb 112> [count: 46506]:
  _1769 = _1074 + 18446744073709551592;
  _1131 = MEM[(const struct RefPtr *)_1769 + 16B].mRawPtr;
  if (_1131 != 0B)
    goto <bb 113>; [0.00%]
  else
    goto <bb 114>; [100.00%]

  <bb 113> [count: 0]:
  MEM[(struct RefPtr *)_1769 + 16B].mRawPtr = 0B;
  rv_1138 = Init (_1131, 2, 80, aSpec_5(D), _35, _34);
  _1139 = (signed int) rv_1138;
  _1140 = _1139 != 0;
  _1141 = (long int) _1140;
  _1142 = _1141;
  if (_1142 != 0)
    goto <bb 117>; [0.00%]
  else
    goto <bb 115>; [100.00%]

  <bb 114> [count: 46506]:
  _1132 = MEM[(struct TemplatedMutator
*)_1769].D.5920.D.5700.D.5698.D.5695._vptr.nsISupports;
  _1133 = MEM[(int (*__vtbl_ptr_type) () *)_1132 + 200B];
  __builtin_unreachable ();
again.  This was with r16-7218.  So while we don't have anything close to a
testcase for the testsuite, I think you can reproduce this yourself.

Reply via email to