How to set gcc or clang to use Intel syntax permanently for inline asm() statements?

Use -masm=intel and don’t use any .att_syntax directives in your inline asm. This works with GCC and I think ICC, and with any constraints you use. Other methods don’t. (See Can I use Intel syntax of x86 assembly with GCC? for a simple answer saying that; this answer explores exactly what goes wrong, including with … Read more

What’s the difference between -rpath and -L?

You must be reading some outdated copies of the manpages (emphasis added): -rpath=dir       Add a directory to the runtime library search path. This is used       when linking an ELF executable with shared objects. All -rpath       arguments are concatenated and passed to the runtime linker, which       uses them to locate shared objects at runtime. vs. -L … Read more

How can I mitigate the impact of the Intel jcc erratum on gcc?

By compiler: GCC: -Wa,-mbranches-within-32B-boundaries clang (10+): -mbranches-within-32B-boundaries compiler option directly, not -Wa. MSVC: /QIntel-jcc-erratum See Intel JCC Erratum – what is the effect of prefixes used for mitigation? ICC: TODO, look for docs. The GNU toolchain does mitigation in the assembler, with as -mbranches-within-32B-boundaries, which enables (GAS manual: x86 options): -malign-branch-boundary=32 (care about 32-byte boundaries). … Read more

-isystem on a system include directory causes errors

In addition to considering the directory to contain “system headers”, -isystem alters the header search list, putting the directory argument at the top of the system header directories. If the directory already exists in the search list, it is removed from its current location. As of (at least) GCC 6.1.1, some C++ headers such as … Read more