← Back to team overview

desktop-packages team mailing list archive

[Bug 1488254]

 

Hi Andrey,

(In reply to comment #45)
> Stefan [Bühler], do you plan to finish work on the patch? Do you need help
> with code review? (I just added Aaron Ballman, who is code owner for
> attributes).

I think the attributes part of the patch is quite good compared with
the mangling part... perhaps it should be split into a separate patch.

Regarding the mangling I'm not too happy with my patch. I don't understand 
what most of the mangling code did before to actually know where 
to insert the tagging code. This is C++ on a level I don't usually touch;
I'm not familiar with all the terms (<unscoped-template-name>,
<source-name>, ...) and just keep guessing what they do.

Also I don't like using recursion to determine the inherited abi tags;
I think using temporary strings instead of directly writing to the stream
would solve this.

All in all I hoped to get some feedbacks how things are done or should
look like; I don't mind if someone else wants to take over and rewrite
the mangling :)

I planned looking at the original gcc code some day, but didn't get around
doing that either; maybe others can help with the documentation too (how
the abi tag mangling actually should look like). More "examples" certainly
wouldn't hurt either.

-- 
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