1,088 questions
Advice
0
votes
8
replies
213
views
Why does `tcc` compile local variables onto the stack?
I have the following C code (an MWE):
#include<time.h>
void fun() {
asm("arg1:");
struct timespec const a = { .tv_sec = 10, .tv_nsec = 0 };
asm("call_nanosleep:");
...
2
votes
1
answer
101
views
Assembly code fail when I add a jump before rept
I have the following assembled but when ever I uncomment the jmp or je it fail with 11: Error: bad or irreducible absolute expression
_start:
mov $0x0e, %ah
mov $'a', %al
_loop:
int $...
1
vote
0
answers
126
views
How to compare a register and the effective address of a variable in GAS with intel_syntax
I am following an assembly tutorial where they use NASM. They manage to compare a register to a variable's address with cmp rcx, digitSpace, but how can I do the same with GAS?
As you know this ...
3
votes
1
answer
98
views
Can I somehow tell GAS to change direction of operands?
I have the binary image of a bootloader which was written with some ancient assembler.
I want to port the assembly code to GNU assembler (GAS). We speak about the X86/16-bit
(real mode) world.
This ...
-2
votes
1
answer
179
views
Local variable in .c file overwrites memory address previously aquired in ARM GNU assembly file [duplicate]
I have implemented a basic FIFO data structure with its related functions/subroutines in a FIFO.s file and want to use them in the main function inside a main.c file;
// FIFO.s
.syntax unified
.cpu ...
2
votes
2
answers
168
views
Trying to build golang package ending up with GCC compilation segfault on as --gdwarf-5
After some package upgrade on my Ubuntu 24.04 I stumbled upon inability to build/install/work with almost any of golang packages.
So, I'm trying to install staticcheck and get the following error:
$ ...
1
vote
0
answers
51
views
Is it possible to reuse label names in ARM GNU Assembly? [duplicate]
I want to use the same label name in different parts of my Assembly code instead of using a new, never-before-used label name; Is such a thing possible?
For example:
.
.
.
Factorial: // A subroutine ...
4
votes
1
answer
119
views
Is it possible to undo the effect of the .req directive in ARM GNU Assembly?
I want to rename (more like add an alias to) one or more registers for a specific part of my Assembly code using the .req directive and later on undo the renaming of said register(s) so that those ...
1
vote
0
answers
46
views
gnu assembler x64, how to push big unsigned value [duplicate]
I have
pushl $2147487744
this is 0x80001000 gnu as gives
mycc_cpp.s:27: Error: invalid instruction suffix for `push'
I have tried
pushq
pushing hex
no luck
1
vote
1
answer
79
views
GAS creates a PLT relocation entry for call to an extern symbol?
I assembled the following file with GAS, the GNU assembler:
.extern foo
.global bar
.section .text
bar:
call foo
ret
In the object file it produced there is a relocation entry of type ...
1
vote
0
answers
99
views
Debugging GDT in assembly/D lang
I've been dabbling with writing a small OS in D lang but I'm crashing on boot. I've been debugging my main file and think that the issue is with gdt_flush which is called in gdt.d and defined in gdt.s....
3
votes
0
answers
86
views
Can the GNU Assembler perform all macro expansions in a file and then output compilable code without macros?
Is there a way to have the GNU assembly process a source file that contains macros, expand them, and then output the expanded equivalent code in a form that could be assembled by as? Basically, I'm ...
4
votes
1
answer
113
views
GNU as recursive/loop macro expected output
In this assembly file below, the macro jump_table should automagically create ... a jump table to consecutively numbered labels like jump_0, jump_1, ... jump_<n>.
It seems there is no loop ...
1
vote
1
answer
127
views
What does this mean: .size _start, . - _start in assembler?
What do the symbols mean in this assembly language statement:
.size _start, . - _start
I've searched and found quite a few identical examples and several variations but none explain what the ...
3
votes
0
answers
86
views
Why is this .section directive terminated with ._start?
I'm trying to understand this assembly from a bare-metal project I've cloned from GitHub.
.section .text._start
_start:
// Infinitely wait for events (aka "park the core").
....