[LLVMdev] Implementing the ldr pseudo instruction in ARM integrated assembler

David Peixotto
Fri, 01 Nov 2013 19:15:31 -0000

> >>> I was thinking that without the .ltorg directive the constant
pool
> >>> would go at the end of the section.
> >>>
> >> So where does the assembler place the constant pool(s) if that
> >> directive isn't present? I was under the impression it was
always
> required.
> >
> > From my understanding it is not required. I see that GCC will place it
> > at the end of the section. I don't know if it will ever place it
> > anywhere besides the end of the section when there is no .ltorg
> directive.
> >
> > Here is the relevant section from the gcc docs
> > (https://sourceware.org/binutils/docs/as/ARM-Directives.html):
> >
> > """
> > .ltorg
> > This directive causes the current contents of the literal pool to be
> > dumped into the current section (which is assumed to be the .text
> > section) at the current location (aligned to a word boundary). GAS
> > maintains a separate literal pool for each section and each
> > sub-section. The .ltorg directive will only affect the literal pool of
> > the current section and sub-section. At the end of assembly all
> > remaining, un-empty literal pools will automatically be dumped.
> > """
> >
>
> What does ARM's documentation say?

The ARM documentation says that the assembler puts the current literal pool
at the end of every code section, where the sections are determined by the
AREA directive or the end of the assembly. If the default literal pool will
be out of range the programmer can use the LTORG directive to assemble the
current literal pool immediately.