desktop-packages team mailing list archive
-
desktop-packages team
-
Mailing list archive
-
Message #157678
[Bug 1488254]
(In reply to comment #33)
> I really see no option in this; if the return type is tagged, the tag must be
> present in the signature somehow, or you can never mix different ABIs in the
> same binary.
This was probably already discussed, but if you mangle the return type,
how can you mix this with previous mangling?
Say, you have:
int foo(int);
Old mangling would give you _Z3fooi. Then you add:
double foo(int);
With old mangling, you get an error. With new mangling (mixed with old
mangling), you end up with three names. Say we mangle it before the
function name:
_Z3fooi, _Z3ifooi, _Z3dfooi
Now, it's clear that _Z3fooi needs to be an alias to one of the other
two, the question I can't answer is which one?
If you don't mix ABIs, then you only have two symbols and there is no
problem.
And how different from this did GCC implement their mangling and why is
it worse?
--
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to llvm-toolchain-3.6 in Ubuntu.
https://bugs.launchpad.net/bugs/1488254
Title:
clang++ no longer ABI-compatible with g++
Status in LLVM:
Confirmed
Status in llvm-toolchain-3.6 package in Ubuntu:
Confirmed
Bug description:
$ cat foo.cc
#include <string>
std::string hello = "Hello, world!\n";
$ cat bar.cc
#include <string>
#include <iostream>
extern std::string hello;
int main() {
std::cout << hello;
return 0;
}
$ g++ -c foo.cc && g++ foo.o bar.cc && ./a.out
Hello, world!
$ clang++ -c foo.cc && clang++ foo.o bar.cc && ./a.out
Hello, world!
$ g++ -c foo.cc && clang++ foo.o bar.cc && ./a.out
/tmp/bar-34fb23.o: In function `main':
bar.cc:(.text+0x14): undefined reference to `hello'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
$ clang++ -c foo.cc && g++ foo.o bar.cc && ./a.out
/tmp/ccqU38Mh.o: In function `main':
bar.cc:(.text+0x5): undefined reference to `hello[abi:cxx11]'
collect2: error: ld returned 1 exit status
In practice, this means that many programs using C++ libraries other
than libstdc++ fail to compile with clang++. For example, mosh fails
with undefined references to
google::protobuf::internal::empty_string_,
google::protobuf::MessageLite::InitializationErrorString() const, and
google::protobuf::MessageLite::SerializeAsString() const.
To manage notifications about this bug go to:
https://bugs.launchpad.net/llvm/+bug/1488254/+subscriptions
References