.rodata section breaks after moving an object out of the function scope
I'm building a simple payload to execute on an ARM64 system that will print a "Hello, world!" string over UART.hello-world-payload.c:#include <stdint.h>typedef uint32_t u32;int _start() { const...
View ArticleHow to not "return address of local variable" when modifying a copy of a struct?
I have the struct:struct mystruct { int a;};If I create a function with the struct as an argument,and try to directly return its address:struct mystruct *modifystruct1(struct mystruct s){ s.a = 5;...
View ArticleI want to know why this result is output
source code /*************************************************** * Copyright: 2023, 黄子涵. * File name: huangzihan_c_program_142 * Description: 改变指针的值 * Author: 黄子涵 * Version: V1.0.0 * Date: 2023-01-08 *...
View ArticleGCC option to avoid function calls to simple get/set functions? [duplicate]
There maybe a very simple solution to this problem but it has been bothering me for a while, so I have to ask.In our embedded projects, it seems common to have simple get/set functions to many...
View ArticleIs there a way to disable inline assembly in GCC?
I'm developing an online judge system for programming contests. As for most programming contests, it is not allowed to use inline assembly in C/C++, so I would like to add the same restriction to my...
View ArticleHow to fix cannot find libgcc.a: No such file or directory error
I'm trying to make a standalone compile of the kernel for my android phone, using Google Toolchain, and have already tried Uber and linarc. All of them give the same error, which I don't...
View ArticleWhat is the correct version of CUDA for my nvidia driver?
I am using ubuntu 14.04. I want to install CUDA. But I don't know which version is good for my laptop. I trace my driver that is:$cat /proc/driver/nvidia/versionNVRM version: NVIDIA UNIX x86_64 Kernel...
View ArticleHow to tell the MinGW linker not to export all symbols?
I'm building a Windows dynamic library using the MinGW toolchain.To build this library I'm statically linking to other 2 which offer an API and I have a .def file where I wrote the only symbol I want...
View ArticleIs there a safe way to refer to linker-only symbols that without taking the...
A file has a series of void declarations used as void* as follows:extern void __flash_rwdata_start;...initialize(&__flash_rwdata_start, ...which are provided solely by the linker script as symbols...
View Articleis it possible to use the subsystem command and define other types of commands?
I want to create a driver that can run during Boot but VStudio is too heavy, so I use Dev-C++ 6.3 a good programming programbut when using /SUBSYSTEM Dev-C++ the compiler says [Error]...
View ArticleWhy could GCC prefer to use stdio.h file from later in the include path?
While compiling a Ruby gem's native extension, I get this error according to logs:LD_LIBRARY_PATH=.:/home/linuxbrew/.linuxbrew/Cellar/ruby@3.1/3.1.3_1/lib "gcc-12 -M -o conftest...
View Articledead code removal doesn't work for assembly code?
Apparently gcc -Wl,--gc-sections doesn't remove unused functions written in assembly code, even if the .S file is compiled with -ffunction-sections. objdump -x doesn't show the code in its own ELF...
View ArticleInvaild initializer for scanf [closed]
GCC won't compile my code because of scanf is a "Invalid initializer," and i don't see why it wont compile.Heres the code:#include <stdio.h>#ifdef WIN32#include <io.h>#define F_OK 0#define...
View ArticleHow is GCC IR different from LLVM IR?
Why do people prefer LLVM IR, and how exactly is it different from the GCC IR? Is target dependency a factor here?I'm a complete newbie to compilers, and wasn't able to find anything relevant even...
View ArticleDon't allow nested switches in GCC
I'm using coroutines in C using several macros to simplify writing code. As it is known, these macros encapsulate the code inside a big switch statement, and use case __LINE__ to know where to return....
View Articlefacing linking issue for using mariadb connector/c
I am trying to interact with mariadb database using mariadb connector/c. I have installed mariadb connector using msi file from official site. But bin file of connector is empty. I am new to c coding,...
View ArticleGCC - two identical functions but the code generated differs. Why?
The code:#define OPPOSITE(c) (*((typeof(x) *)&(x)))int foo(volatile int x){ OPPOSITE(x) = OPPOSITE(x) + OPPOSITE(x); return x;}int bar(volatile int x){ OPPOSITE(x) = OPPOSITE(x) + OPPOSITE(x);...
View ArticleWhat does vectorization mean?
Is it a good idea to vectorize the code? What are good practices in terms of when to do it? What happens underneath?
View ArticleGLIBCXX_3.4.26' not found
```Traceback (most recent call last): File "/home/<my_user_name>/.conda/envs/sam/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File...
View ArticleHow do I extract only the specific string I want from the string?
I would like to extract only /home/user01\ruuidd:x:108:114::/run/uuuidd:/usr/sbin/nologin from the code string below. What should I do?#include <stdio.h>#include <stdlib.h>#include...
View Article