gcc

Linking g++ compiled code against libraries created by clang++

In my Homebrew installation my libraries are compiled with clang, whereas I would like to, for performance reasons, compile my scientific code with gcc. In order to understand this problem better, I have created a minimal test: // FILE print.cxx #include <string> #include <iostream> void print_message(const std::string& message) { std::cout << message << std::endl; } // FILE test.cxx #include <string>…
Read more

strtold parsing lower number than given number

I’ll cut right to the chase: I am trying to parse a string with strtold to get a long double, but it is giving me the wrong value. Specifically, I am parsing the number 97777777777777777777777777777777777777.0, but strtold parses it as 97777777777777777779155292002375958528.000000. I check errno, HUGE_VALL, and end_ptr, but errno does not report an error, my number is no where near…
Read more

how to build gcc cross complier with –disable-multilib

Anyone can help how to build the gcc cross compiler with multilib support for x86_64 architecture? That is to build it from source code for m32 and m64 lib support. There is a good article showing how to build a gcc cross compiler: http://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/ , but it only demonstrates the case with –disable-multilib. I am trying to build x86_64 gcc…
Read more

What does this g++ error mean : undefined reference to ‘__cxa_throw_bad_array_new_length’?

*** Hello, my code compiles with gcc 4.9.2 and runs on my ubuntu 12.04. But, on another machine with the same setting, I get this error message during the linking step: undefined reference to ‘__cxa_throw_bad_array_new_length’ I would like to try to solve the problem but I have no idea of what it means. Has someone already seen this message? Thank…
Read more

Partially Compile C++ Source

Goal I want to be able to extract some information out of a collection of C++ source files by partially compiling them. I say partially compile, because I don’t have access to all the shared libraries it is supposed to link against. The exact situation will be explained further below. In pseudo-code, I have (roughly) the following structure: class AParent…
Read more

Executable exporting symbols BUT not getting exported as they are unreferenced by the executable itself

I have a particular use case where executable needs to export certain symbols, which are imported and used by the dynamically loaded DLLs the executable loads on runtime. The executable links with some static libraries, which actually have symbols that are exported while the DLLs use these static libraries headers to import those symbols. If these symbols are not used…
Read more

Unable to Initialize 2D Array

I have declared a 2D global array variable like so: int grid_2d_array[ROWS][COLUMNS]; then in main I’ve to initialize it with hard-coded values: grid_2d_array[ROWS][COLUMNS] = {{5, 7, 2, 8, 3, 6, 1, 4}, …. {1, 6, 3, 2, 4, 8, 9, 5} }; Example: #include <stdio.h> #define ROWS 9 #define COLUMNS 9 /* Global variable. */ int grid_2d_array[ROWS][COLUMNS]; int main() {…
Read more

GCC internals – Instruction Patterns

I am new to gcc compiler backend. I am currently studying how to the .md file to have a understanding. The thing that I don’t understand is: I understand the standard pattern like movsi and etc, but I can see some pattern like movsi_internal, movsi_internal_v850e and etc, my question is where in the spec can I find them ? and…
Read more