Questions tagged [gnu-assembler]

The GNU Assembler (GAS). Use for GAS macros, machine dependent syntax, linkage and file format issues. Do use for generic assembler questions about how the machine works; the CPU tags are meant for this.

'gas' or the GNU assembler is used by GCC to process assembler files. It is included in the binutils suite of tools.

Relevant topics include gas macros, machine dependent GAS syntax, linkage and output formats (usually ELF sections). There isn't any need to tag generic assembler question just because 'gas' is being used. Use the CPU tag such as , , , etc. instead.

(For x86, is the syntax used by default by GAS, GCC, and other GNU tools. Its operands are in reverse order from Intel's documentation.)

A manual is hosted online at sourceware.org as well as a possible locally installed version matching the GAS in use.


This tag was formerly called [gas], renamed because lots of Google Apps Script questions were getting mistagged as gas.

1024 questions
0
votes
2 answers

Calling method using inline assembler in gcc

so as I said, I'm trying to call a method using inline asm using gcc. So, I searched how x86 works, and what are the calling convention, then I tried some easy call witch worked perfectly. Then I tried to embed v8, which was my original goal, but it…
SRLKilling
  • 42
  • 7
0
votes
1 answer

GCC generated assembly - Segfault at C function call

I have been practising x86 assembly lately with the GCC in windows. I am mixing assembly and C code for testing purposes at the moment. I have come across something odd which I can't explain with my current knowledge and so I turn to SO for…
Lefteris
  • 3,196
  • 5
  • 31
  • 52
0
votes
3 answers

Reading integers from keyboard in Assembly (Linux IA-32 x86 gcc gas)

I'd like to know how to read integers from keyboard in assembly. I'm using Linux/x86 IA-32 architecture and GCC/GAS (GNU Assembler). The examples I found so far are for NASM or some other Windows/DOS related compiler. I heard that it has something…
Flayshon
  • 363
  • 1
  • 5
  • 12
0
votes
1 answer

How to movl $0x41,%ecx

I've managed 'Hello World' with Gnu as! So, next thing is print 1 to 10 right? (Maybe in ruby) At the moment, I'll be happy to print A closely followed by B. Here's what I have. .section .text .globl _start _start: # Print A movl $4,%eax …
bluekeys
  • 2,217
  • 1
  • 22
  • 30
0
votes
1 answer

GNU Assembler (Mac OS X 64-bit): Illegal instruction: 4

I am new to GNU Assembler and I'm trying to execute this piece of code: .globl _main _main: movl $1, %eax movl $0, %ebx int $0x80 This programm should exit by the system call exit (1). Compiled it (no warnings): gcc test.s But running…
qwertz
  • 14,614
  • 10
  • 34
  • 46
-1
votes
1 answer

Cannot open disk file using assembler syscalls on aarch64 device

I am a Hobby programmer here now trying to get into assembler for an android phone. I cannot open a disk file. I would dearly like to get past this hurdle if anybody with a knowledge of gnu assemblers for aarch64 could help me out. I am using the…
-1
votes
1 answer

arm32 cross compiling giving compiling error in right assembly code

So, I need to run a certain arm32 code that I've done. The code is alright and running on my Windows machine using Keil, however when I try to run on the Ubuntu cross compiler (using arm-linux-gnueabihf-as prgm1.s -o asm32.o &&…
sasinhe
  • 29
  • 5
-1
votes
1 answer

Define Bytes in AT&T syntax

I am new to AT&T syntax (I used to code for NASM) and can't seem to find the equivalent of Intel's DB (Define Byte) I am trying to OSDev and need to define: db 0x55 db 0xAA
-1
votes
1 answer

Reverse engineering and interpreting assembly code

I am having difficulty with reverse engineering this assembly code to deduce the values of the array's dimensions. I am given struct vec3 { long z; int x; unsigned short y; }; struct vec3 array1[2][A]; struct vec3 array2[8][B]; int…
Megan Darcy
  • 530
  • 5
  • 15
-1
votes
1 answer

How to convert .s to .asm?

So I was having fun with MikeOS but I suck at Assembly. So I wrote a program in C, and convert it to Assembly with GCC(IN Ubuntu). But when I convert it, it ends up as a .s file. So how do I convert this to .asm? The command I used to make the .s…
-1
votes
1 answer

Handling Register Integer Value Wrap Around In x86 Assembly GNU on MacOSX

I am working with a simple example in x86 GNU GAS on MacOSX whereby an integer value of 300 is moved into the eax register. As expected, only 300 mod 256 (the value 44), is actually stored in %eax, as echo$? reveals from Mac terminal: .globl…
Ajax1234
  • 69,937
  • 8
  • 61
  • 102
-1
votes
1 answer

32 Bit Unsigned Integer to Hexadecimal String - Incorrect Output

I'm struggling to convert a given integer into hex. I'm not getting correct output and it's likely due to incorrect shifting of bits. The algorithm I tried was to start at the 3rd position The code: .globl hex_str hex_str: movl $48,…
-1
votes
2 answers

".int" vs ".byte" for creating an array on GNU assembler

I am at odds to understand why after initializing an integer array using .int doesn't work with movl however doing it with .byte works flawlessly. P.S. I'm using AT&T syntax just so that it is clear from the beginning Here's the code: .data …
AjB
  • 890
  • 13
  • 34
-1
votes
1 answer

GAS Assembly IDE SASM installation on Ubuntu

I would be very thankful if someone could help me with the installation of SASM on Ubuntu. SASM is the Assembly IDE and it is available for Fedora and Linux Mint. I was wondering whether it could be installed on Ubuntu or my only solution is to…
Joanna
  • 154
  • 2
  • 13
-1
votes
1 answer

x86 assembly GAS, padding

Is it possible to pad a certain amount of times depending on the current location counter? In NASM you can do something like this times value - ($ $$) db 0 Is there a coresponding way of doing this using the gas syntax? (The ammount of bytes i wish…
mat
  • 77
  • 1
  • 1
  • 6