What's New in C++Builder 10.2: Part 1 - The Linker

Posted by on in Blogs

RAD Studio 10.2 Tokyo will be out very soon, and I'd like to let you know some of what you can expect to see new on the C++Builder side.  While the majority of work is for Linux, which will be available for C++ in 10.2.1, we've worked on three key areas:

  1. Improved linking
  2. Improved code generation
  3. Improved debugging

Today I want to discuss what's new in the linker.

The Win32 and Win64 linker

The Win32 linker, which we also use for Win64, is one of the oldest technologies we still use, and until today in recent years it hasn't had much work done on it.  As time has passed the applications people are writing, and so the data that needs to be linked, has changed significantly.  Today's apps are larger, with more debug info and importantly larger quantities of certain types of debug info than they were when the linker was first written. This led to problems allocating space for and handling large linksets. Sometimes, the problem was not the size of a specific type of data, so much as that the size was more than had been predicted in relation to other types when the linker was written.

We have addressed this in 10.2 in two ways:

  • The linker is now large address aware and can address up to 4GB on a 64-bit system, twice the previous amount. (Some customers hacked the linker to be LAE in the past by toggling the bit in the PE header; since the code wasn't written to be LAE-aware this hack prevented incremental linking and sometimes other functionality from functioning correctly.)
  • The linker has been tuned to modern debug usage.  That is, the various pools and heaps it uses have been modified to follow typical behaviour for debug information today.

The second means that many linksets that experienced problems will now link correctly. The first means that linksets that stressed the heap allocations, even when manually tweaked via command-line flags, can now access much more memory and link correctly. We hope to see the vast majority of linker errors solved with these two changes.

The vast majority? What if that's not me?

Glad you asked! In the past, we recommended users use command-line flags to change the allocation size of various pools or heaps.

Those flags are still available, and we have expanded their support. The settings are now available in the IDE's project options (C++ Linker > Linker Heap Settings) with some options for Win32 linking, and more for Win64 linking:

If you encounter an error, the linker will emit a message stating what failed, and you can look up the appropriate option here to set a specific size. (Note if you're building in the IDE, you may need to set Verbosity to Diagnostic in Tools > Options > Environment Options.) However, the vast majority of users will not need to use these settings - they are there as a backup.

Future plans

We plan to continue working on the linker in future over the next few releases. If you have update subscription, you will get all changes as they are released. However, in 10.2, we've taken a large step in addressing issues customers have experienced. We hope that when you test out your projects with 10.2, you will find significantly improved behaviour.

 



About
Gold User, No rank,
C++ Product Manager, looking after C++Builder as well as the IDE.

Comments

  • Andrew Bond
    Andrew Bond Monday, 19 June 2017

    David
    You were asking for the bug report concerning dupliacte tags being added to project files. Here are some reports about this:

    RSP-9774 closed as fixed (duplicate) - but I can confirm it is NOT fixed in C++Builder 10.1 Berlin
    RSP-12577 still open

    This is an intermitent fault, hence difficult to report. However, it still persists and require hand-editing the cbproj file to remove the duplicate tag.

    You could easily track the problem down by checking for duplicate tags when the cbproj gets saved.
    I hope this helps

  • Reinaldo César G39499
    Reinaldo César G39499 Thursday, 1 June 2017

    Hi, David! I had seen the latest Roadmap(May 2017) but I could´n see when C++ Builder´s Clang-enhanced compiler will be upgraded to a newer Clang version. Could you tell us? Thank you very much!

  • David Millington
    David Millington Friday, 16 June 2017

    Sorry, don't have dates to announce yet. But it's coming!

  • Andrew Bond
    Andrew Bond Wednesday, 31 May 2017

    David, I am porting a large app from C++Builder 10.1 Berlin to 10.2 Tokyo. Under Berlin I used the linker flag -GHtds=0x0f400000 to overcome the out-of-memory problem.

    Can you confirm that the equivalent option under Tokyo is "TDS Hep Size" under "Linker heap Settings"? Also, what number should I enter there? Is it 0x0f400000 or something else?

    Any guidance would be much appreciated.

    Thanks
    Andrew Bond

  • David Millington
    David Millington Friday, 16 June 2017

    Hi Andrew - yes, looks like the one! If you want to check, verify against the linker command line shown in the Messages docked window, Build tab.

    The number: it will depend on your project, so "use whatever works for you", which isn't useful advice I know. Turn on diagnostic output in Tools > Options > Environment Options > Verbosity, and watch a failing link. It will write out a table (copy/paste this somewhere with a fixed width font to view as a table) showing the failing heap and the size it needed. Enter in settings larger than the amount it asked for. You might need to repeat this a few times, increasing each time.

  • Milen L
    Milen L Friday, 28 April 2017

    I have already migrated some of my small projects to 10.2.
    With previous versions (including 10.1) I encountered two issues:
    1. If IDE is opened by opening .cbproj linking faild. IDE should be opened first.
    2. Frequently after the sequence "Make->Successful Run->Some (even small) Change->Make->Run" occurs Run Time Exception. And after rebuild all goes fine.

    With 10.2 above issues are gone away.

    Really well done.
    Thank you David and your team for this great work.

  • David Millington
    David Millington Monday, 22 May 2017

    Thanks for the feedback! Bugs vanishing is good :)

  • Max K34801
    Max K34801 Friday, 24 March 2017
  • David Millington
    David Millington Friday, 24 March 2017

    Hopefully, or if not then soon - we have ongoing work in the linker planned to address any remaining issues or problems that specific customers still encounter.

  • Mark J691
    Mark J691 Thursday, 23 March 2017

    There are still problems - check out https://quality.embarcadero.com/browse/RSP-11737

  • David Millington
    David Millington Friday, 24 March 2017

    I see a comment in that thread that someone is still encountering problems - but unfortunately nothing to help us reproduce them. If you still have problems, please attach a repro project, or if it's commercially sensitive get in touch and we can arrange a private upload of the linkset only.

  • Ján K8372
    Ján K8372 Thursday, 11 May 2017

    Hello David,
    on my old computer LME288 error occured on every project I opened in C++ Builder, even on barebone VCL application. It seems that this error is (at least partially) related to operating system configuration. It was very malicious bug because it appeared very sudden after using C++ Builder XE4 for more than a year and it made the IDE totally unusable. Because of this error. I had to buy new computer. Fortunately I haven't seen this error last year and a half on new computer.

  • Niklas Sandberg
    Niklas Sandberg Sunday, 11 June 2017

    Have you checked that your environment variable PATH is below 2048 in size?

  • David Millington
    David Millington Monday, 22 May 2017

    We had a customer report recently that we tracked down to an antivirus. This seems to be quite common. Unfortunately, we can't help the behaviour of third party software that hurts ours.

  • David Millington
    David Millington Friday, 16 June 2017

    What is the duplicate in project file bug - can you point me at a QP please?

  • Max K34801
    Max K34801 Monday, 22 May 2017

    For your information, I don't use AV software and I recently got the famous duplicate in the project file... So that one isn't fixed.

  • Semih Ozmen
    Semih Ozmen Wednesday, 22 March 2017

    It is great to hear this improvement. I will keep you informed about our experiences with our large projects facing these problems.

  • Lena I2199
    Lena I2199 Saturday, 18 March 2017

    Good news!
    When servises for android in C++ Builder?
    Thanks.

  • David Millington
    David Millington Monday, 20 March 2017

    They're not in this release, but I hope soon! It's a common request.

  • Reinaldo Guedes
    Reinaldo Guedes Friday, 17 March 2017

    Awesome!
    Is that new linker based on LLD (LLVM linker)?
    Is there support for COFF libraries?

  • Please login first in order for you to submit comments

Check out more tips and tricks in this development video: