w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
  Home » GCC » Page 1
Why u-boot can put global data's address into r9 register?
Well, there is -ffixed-reg. However, if all code is compiled with this variable declared as global, then it will never be used for any other purpose (see https://gcc.gnu.org/onlinedocs/gcc/Global-Reg-Vars.html#Global-Reg-Vars).

Categories : Gcc

Macro for coroutines
By now I found a solution static void * parser_state = &&l_parser_start; goto *parser_state; #define LABEL(N) label_ ## N #define XLABEL(N) LABEL(N) #define WAIT_FOR_NEXT_CHAR parser_state = &&XLABEL(__LINE__) ; return; XLABEL(__LINE__) : ; l_parser_start: ; The solution is basically a copy of the documentation for Argument Prescan. However I have no rea

Categories : Gcc

Xeon Phi Knights Corner intrinsics with GCC
You will have to use inline assembly rather than intrinsics to use the MIC vector instructions with GCC. The Intel non-commercial software program was recently rebooted. See https://software.intel.com/en-us/qualify-for-free-software for details.

Categories : Gcc

Cause link to fail if certain symbol is referenced
Okay, stepping out for a lunch helped me find this (pretty obvious) solution: /* stubs.c */ void ERROR_DO_NOT_REFERENCE_THIS_SYMBOL( void ); void Offending3rdPartyFunction( void ) { ERROR_DO_NOT_REFERENCE_THIS_SYMBOL(); } Here, the symbol ERROR_DO_NOT_REFERENCE_THIS_SYMBOL is never defined. An additional source file is added to the project, with stubs like the one shown above for each fun

Categories : Gcc

Clion with MinGW not compiling simple Hello World app
After so much time spent without any clue, I found that actually the crashing softwares were cc1.exe and cc1plus.exe. After using Dependency Waker tool which led mo to manually adding the zlib1.dll file near these two crashing exe, I found that the real reason was that package mingw32-libz was not installed. I have installed mingw32-libz package in MinGW and removed manually added dlls and I get

Categories : Gcc

Several questions dealing with functions in IA32 assembly language
The printUInt routine works like this: Take an integer (initially in %edi, but put in %eax) Repeatedly divide this by 10 and find the remainder (found in %edx after division). This remainder is the last digit of the number being divided, or the right-most digit. Add the ASCII code for "0" to this right-most digit to get the ASCII code for the digit. Store the resulting value in memory where %ec

Categories : Gcc

What's the purpose of copy relocation?
Is it possible to implement it through GOT, just like the external data reference in shared object? Yes. For this to work, you'll need to build code that is linked into the main executable with -fPIC. Since that is often less efficient (extra indirection), and usually not done, the linker has to do copy relocations instead. More info here.

Categories : Gcc

Linking problems with 64bit db2 db2api.lib truncated to fit errors
If you are using binutils version 2.24, I suspect the problem to be this: https://sourceware.org/bugzilla/show_bug.cgi?id=16598 Luckily, the Cygwin port of GNU ld is capable of linking directly against DLLs. Specifying the relevant DLL(s) rather than the import library db2api.lib to gcc should work.

Categories : Gcc

cmake, keeping link flags of internal libs
As of CMake 3.0, CMake is missing the INTERFACE_LINK_FLAGS target property which would make this possible. The problem here is really that using target_link_libraries to specify linker flags was not the smartest design decision in the first place. A separate command in the spirit of target_compile_options would have been desirable. I consider this an oversight in CMake. If you have a relevant us

Categories : Gcc

Controlling File Offset in linking
According to your objdump listing everything is suppose to be laid out as you expect. I.e. VMA and LMA of your .text section are pointing to address 0x100. The offset 0x1000 as you correctly guessed is offset of the .text section inside ELF file. But this section will be loaded to address 0x100. If you try to disassemble your ELF with $ objdump -S startup.MICROBLAZE.elf you will see the prope

Categories : Gcc

Expression in GCC ARM assembly macro
The sum example works becuase it gives this output: .long 0 .long (0+1) .long ((0+1)+1) .long (((0+1)+1)+1) .long ((((0+1)+1)+1)+1) .long (((((0+1)+1)+1)+1)+1) Thus after macro expansion the assembler sees expressions where it expects expressions, and evaluates them. The trick you need is to get it to evaluate expressions where it doesn't expect expressions, and to do so before the assembly pas

Categories : Gcc

gcc 4.9.2 build error on RHEL6
Just completed building 4.9.2 on a CentOS 6.4 VM using 4.4.7 gcc. Ran into an out of space issue, which caused the build to fail, but once resolved, everything else went smoothly. Looks like your build is failing in the Java side of town? Not sure if you need the Java support, so have you tried compiling just the c/c++ language support? ~/gcc-4.9.2/configure --enable-languages=c,c++ ... I als

Categories : Gcc

How to make gcc generate rotate instructions
From the dump you show in the comments, it appears that n is signed. This means that, if n<0, the right shift may not be the logical shift that you expect. To get a valid rotate pattern, you need to make n unsigned.

Categories : Gcc

How to read mips assembly generated by gcc '-dap -S'
Use the source, Luke! The relevant part in gcc source code is: if (insn_data[num].n_alternatives > 1) fprintf (asm_out_file, "/%d", which_alternative + 1); The instruction templates may provide multiple alternatives for various circumstances, and this number tells you which one has been used. Let's look at the definition for movsf_softfloat: (define_insn "*movsf_softfloat" [(set (ma

Categories : Gcc

glob without GLOB_NOCHECK slowdown
Isn't it because GLOB_NOCHECK causes the original pattern to be returned if no match? Making a result list with the original pattern will surely be slower than an empty result. I expect that if the file main.c exists on disk then the times with and without GLOB_NOCHECK will be similar.

Categories : Gcc

Creating Static library using GCC
No you only need to add the .o file, a static library archive is just a collection of .o files. The .d file is a makefile fragment for specifying the dependencies used to build the object file, and is only needed when you are compiling the .o file itself.

Categories : Gcc

Change of directory in Fortran in a non compiler-specific way
See also Is there any way to change directory using C language? . You can make your own interface to the chdir() POSIX call to be independent of the Intel's interface. On Windows it is similar. module chdir_mod implicit none interface integer function c_chdir(path) bind(C,name="chdir") use iso_c_binding character(kind=c_char) :: path(*) end function end interface cont

Categories : Gcc

Odd linker issue "relocation R_X86_64_32 against" - not a typical -fPIC issue
I got the same error when building with eclipse: Trying to compile executable build with "-shared" (gcc c linker->shared library settings->Shared), resulted with this error. When the shared option is removed it solved this issue. From some reason when changing from excutable to "Static library" build in eclipse the "-shared" still remains, that's why it failed in my case. The "-shared" option need

Categories : Gcc

Linking against a versioned .so without SONAME
Is it a bad practice? Not by itself, no. However, it's likely that the library authors are clueless, especially if you followed their installation procedure, and ended up with libfoo.so.1.2.3.4, but no symlink. Should I try to push the library authors to change the options? Possibly. Not setting SONAME and setting RPATH aren't bad by themselves, but not providing a symlink certainly is

Categories : Gcc

Configure mpich2 3.1.3
Q: I get a configure error saying "Incompatible Fortran and C Object File Types!" A: This is a problem with the default compilers available on Mac OS: it provides a 32-bit C compiler and a 64-bit Fortran compiler (or the other way around). These two are not compatible with each other. Consider installing the same architecture compilers. Alternatively, if you do not need to build Fortran programs,

Categories : Gcc

Can the gcc preprocessor know if a plugin has been loaded
Currently (GCC 4.9) you cannot do that, since there is no plugin hooks related to the preprocessor. I guess that the simplest way would be to pass a -DMYPLUGIN. Or define some builtin in your plugin. PS. If you are looking for some tutorial material about GCC plugins consider also MELT and some documentation there (e.g. slides on GCC plugins thru the MELT example; Linux Foundation, march 2014)

Categories : Gcc

Want to read string and output same string in assembly
The general method to solve such issues is "ask a compiler". You know, that what are you trying to do is: #include <stdio.h> char str[1024]; int main (void) { scanf("%s", str); printf ("%s ", str); return 0; } Now take any cross compiler. Not aware of your assembler syntax, it is strange, but question is tagged "gcc", so for this example lets take Linaro GCC: gcc-linaro-2014.01/b

Categories : Gcc

risk of compile warning
Implicit declaration. E.g. you have function: float foo(float a), which isn't declared when you call it. Implicit rules will create auto-declaration with following signature: int foo(double) (if passed argument is float). So value you pass will be converted to double, but foo expects float. The same with return - calling code expects int, but returned float. Values would be a complete mess. enum

Categories : Gcc

gcc,cygwin: Unable to find depending library when creating library
Here I found the solution to my problem: building and linking a shared library I needed a specific syntax to make it work, similar to: -l:libbeat.so.1.0.1

Categories : Gcc

How to call a C compiler through library instead of via system call?
You cannot do exactly that. You might fork the GCC compilation command. It is probably operating system specific, I'm supposing you are on Linux (or some other POSIX system). However, there are alternatives: using asmjit to generate x86 machine code in memory using tinycc and its libtcc library (which can compile a string containing C or asm code; beware, the compiled machine code is slow since

Categories : Gcc

bootstrap building gcc - stage 2 and 3 comparison fail
I didn't set up --build= or --target= because the architecture is x86_64 not i686, so it fails me when I was compiling my gcc-4.9.1 on a Mac Mini with option --build=i686-*** You can try --disable-checking but not so sure.

Categories : Gcc

Gcc plugin api from 4.8 to 4.9
Ha finally found the answer, that was pretty simple in fact : There are some simple examples included in gcc sources files but they are quite hidden =), they are in $(GCC_SRC)/gcc/testsuite/gcc.dg/plugin/ So I was pretty close from the solution, here is the simpliest code to install a pass #include <gcc-plugin.h> #include <context.h> //This is is the context g that is needed for the

Categories : Gcc

Hardfault on STM32F030 startup, __libc_init_array
That __libc_init_array is ARM code, not Thumb, hence the M0 will fall over trying to execute some nonsense it doesn't understand (actually, it never quite gets there since it faults on the attempt to switch to ARM state in the bx, but hey, same difference...) You'll need to make sure you use pure-Thumb versions of any libraries - a Cortex-M-specific toolchain might be a better bet than a generic

Categories : Gcc

what is the meaning of ".clone" in linux kernel dumpstack?
In the context of a compiler, function cloning is creating several copies of a function with some modifications. For example, if the compiler discovers that a function is called many different times with the same initial parameter, it may clone the function to produce a version which takes one less parameter, and then change all the callers to call the clone.

Categories : Gcc

Default GCC optimization options for a specific architecture
Here's what you need to know about compiler optimizations : they are architecture dependent. Also, they're mainly different from one version of the compiler to another (gcc-4.9 does more stuff by default than gcc-4.4). By architecture, I mean CPU micro architecture (Intel : Nehalem, Sandy bridge, Ivy Bridge, Haswell, KNC ... AMD : Bobcat, Bulldozzer, Jaguar, ...). Compilers usually convert input c

Categories : Gcc

Bin Utils are not compiling
Maybe this answer comes a bit late, but I had the same problem when I tried to build binutils 2.9 with gcc 4.9.2 and the solution for me was another version of binutils. binutils-2.24 worked fine with gcc 4.9.2

Categories : Gcc

Using precompiled headers in gcc
The above leads me to Think that to get the most Performance improvements, I would have to make a collection of common includes, put them into a single Header file, compile and include that Header file. Yes, this observation is correct: You put most (all?) includes in one single header file, which is then precompiled. Which, in turn, means that... any compilation without the aid of t

Categories : Gcc

Why does Rust fail to link on Windows?
Success! The problem, it turns out, is that I had also had ld installed, inside cygwin. So from what I can tell, it was using the version of gcc that ships as part of rustc, but that gcc was calling out to C:cygwin64inld.exe, instead of it's own internal ld. As soon as I removed ld, everything worked. Mind you, this reinforces the point I made in my comment: Apparently I can't do Rust developme

Categories : Gcc

GCC Static Linking And Separate Loader
Take a look at this, strace does the job (show you the secrets) but you will soon realize there are tons of options in it... You need to link a few stuff together (from GNU C lib) to get your executable, not only your object... You can add grep 'exec' in the end to make it cleaner. Uhhh, also you need to do this: as obj.s -o obj.o Use GNU assembler to convert your .s to .o then link with ld.

Categories : Gcc

undefined reference to `__aeabi_ddiv' and friends - building without stdlib but with -mfloat-abi=hard
Your core supports single-precision floating point instructions however your code works with double-precision floating point. You can notice all the missing __aeabi stuff has a 'd' (as in double) mentioned. If you have floating point literals in your code, by C standard they are considered double. You can force them into single-precision range by adding a f or F at the end of literal. 2.13.3

Categories : Gcc

How does one read from an peripheral IO register using C/gcc?
Reading interrupt status register through pointer cast to (volatile uint32_t*) tells compiler that reading this expression (variable at specified address) produces side effects, so it always needs to evaluate this expression. As your tmp variable is not volatile, compiler is free to optimize away storing the value of your register to variable. I think chapter 5.1.2.3 of C standard (see here) is

Categories : Gcc

Compiler crash with ARM NEON datatypes
That is a compiler bug, you should not get an internal compiler error. You should be able to work around it by performing the shift with the NEON intrinsics. This is also more portable to other compilers, as the NEON intrinsics definition does not include using C operators on the NEON types - it's a GCC extension. #include <arm_neon.h> void crash( const unsigned short * in, unsigned s

Categories : Gcc

OpenMp to Pthreads IR file
GCC does not directly convert OpenMP pragmas into Pthreads code. Rather it converts each OpenMP construct into a set of calls to the GNU OpenMP run-time library libgomp. You could get the intermediate representation by compiling with -fdump-tree-all. Look for a file (or files) with extension .ompexp. Example: #include <stdio.h> int main() { int i; #pragma omp parallel for for(

Categories : Gcc

ARMv8 NEON GCC intrinsics
The NEON intrinsics in C should be mostly the same - Linaro are converting hand-written assembly to intrinsics (which obviously incurs some amount of performance loss, since compilers aren't perfect in this regard) to port the NEON support in some libraries (e.g. libvpx) to 64 bit. There's some new stuff (like support for 64 bit floats), but as far as I know most (practically all?) of the existing

Categories : Gcc




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.