All Questions
306 questions
1
vote
1
answer
64
views
Why is libc++ not a dynamic executable like libstdc++?
I stumbled across this when building clang and gcc from source. libstdc++ seems to be dynamically linked while libc++ is not. Why is this the case? Does it mean libc++ has glibc and glib statically ...
0
votes
2
answers
60
views
Compiler Optimizations Are Not Applied [closed]
I try to see the effects of individual compiler optimizations on the execution time of programs. For this, I use a simple matrix addition program.
When I compile the program with some different ...
1
vote
0
answers
62
views
What are GCC and Clang options to generate Intel DL Boost bfloat16 instructions?
For this code:
#include <stdfloat>
std::bfloat16_t foo(std::float32_t f)
{
return f;
}
GCC generates this code:
foo(_Float32):
sub rsp, 8
call __truncsfbf2
...
0
votes
1
answer
51
views
What are the differences between the implementation-defined behavior of LLVM and GCC?
I've noticed that clang documentation doesn't specify how clang behaves in cases specified to be implementation-defined in the relevant standards.
So it's hard to organize the way LLVM's ...
0
votes
1
answer
77
views
Calling Conventions and Register Selection
I've been delving into compiler theory, and how do they really compile source code into machine code. Though, there is something that all papers about register selection seem to ignore, and I'm not ...
-1
votes
1
answer
158
views
"junk at end of line" when assembling .s file compiled from C++ file using Clang and LLVM, but works with C file
I am learning how to use the LLVM toolchain. I have a .cpp file, and I'm trying to compile it to an LLVM bitcode file, compile the LLVM bytecode file into an assembly file, and then assemble the ...
0
votes
0
answers
53
views
Re-exporting an import with gcc/llvm linker
I'm trying to re-create MSVC's behavior of the /export:myfunction=upstreamlib.myfunction linker flag in gcc/llvm (specifically Rust but I think this is a linker question rather than rust) which ...
0
votes
1
answer
184
views
using clang to generate .o files for .i files generated by gcc, errors occur
The code example is very simple.
#include <stdio.h>
int main() {
printf("hello, world");
}
Generate the .i file.
gcc -E test.cpp -o test.cpp.ii
generate .o files for .i files
...
1
vote
2
answers
102
views
Does C standard define the calling convention?
Does the C standard define the calling convention? I find the calling convention cdecl stands for C declaration, but i can’t find anything about it in the C stardard draft.
0
votes
1
answer
157
views
My programm is crashes when i compile std::cout using Clang on Windows 10
My app crashes when I compile std::cout using Clang on Windows 10. Clang compile this without warnings or errors. Same problem with mingw-64.
#include <iostream>
int main(int argc, char* argv[])...
1
vote
1
answer
151
views
GCC, GDC, and LLVM and LDC compilers’ prefetch builtins - exact meaning of the locality parameter
In the description of the x86 prefetch instructions, I found the following explanation for the instructions’ hint number
"Fetches the line of data from memory that contains the byte specified ...
1
vote
2
answers
84
views
GCC not standard / non-conforming optimization flags?
I'm looking for compiler optimization flags that disregard standards compliance to produce better performing/smaller binaries.
Thus far I found:
-ffast-math
-fno-math-errno
-funsafe-math-...
1
vote
0
answers
121
views
Why do modern C/C++ compilers put aditional unused data into the output binaries?
I'm a low-level developer and a reverse-engineer. While investigating malware and software compiled using different compilers such as LLVM GCC/G++ for windows I found out that modern compilers put ...
0
votes
0
answers
109
views
How to convert RISC-V Executable from rv64gc to rv32im
Executable codes can be converted to the assembly by using objdump. We can convert this objdump for another target by hand (by writing different assembly codes when needed lines, of course with the ...
4
votes
1
answer
140
views
Why does the correct implementation of std::addressof require compiler support?
From possible implementation of std::addressof on https://en.cppreference.com/w/cpp/memory/addressof, it states that "correct implementation of std::addressof require compiler support". Why ...