What is __asm ​​__ ("previous"); I mean?

When trying to compile my project, which uses some third-party headers, with mingw 4.4, I encountered the following error:

Assembler messages:
Error: garbage at the end of the line, the first unrecognized character is "" "
Error: unknown pseudo-op: '.previous'

I found this code at the end of one of the included headers:

__asm__(".section \".plc\"");
__asm__(".previous");

Since I have no experience with assembly instructions, I searched for an explanation for it, but could not find the answer to my two main questions. What does __asm__(".previous");and why does anyone put this at the end of the header file.

These are just __asm__instructions throughout the project. Can I safely remove them? Or is there a way to define .previous to make it a famous pseudo-operator?

Enlighten me, please!

+5
source share
1 answer

.previousis a directive that allows you to switch between two sections of an elf. This is a shortcut that allows you to create denser assembly files and allows, for example, to declare initialized data in a code stream or vice versa.

For example, you have an assembler file with data and a section of code.

If you want - in the middle of a function - to declare a constant in a data segment, you can use the .previous expression as follows:

  nop            // some code

.previous        // swaps current section (code) with previous section (data)

MyConstant:
  .word 0x0001   // some data

.previous        // swaps curent section (data) with previous section (code)

  nop            // more code

:

http://sourceware.org/binutils/docs-2.19/as/Previous.html#Previous

+4

All Articles