This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

x3 multiplier of address of section specified by symbol in section


Hi all,

I'm having some strange behaviour with a symbol-defined starting address of a
.text section

```
$ cat mytest.s
.text
.org 5
.global ORG
ORG:
```

```
$ cat test.ld
SECTIONS
{
	. = ORG;
	.text : { *(.text) }
}
```

But for some reason, .text is found at `3 * ORG`, while ORG is separated from
.text by ORG amount

```
$ ld -o mytest mytest.o -T test.ld -M

Memory Configuration

Name             Origin             Length             Attributes
*default*        0x0000000000000000 0xffffffffffffffff

Linker script and memory map

LOAD mytest.o
                0x0000000000000014                . = ORG

.text           0x000000000000000f        0x5
 *(.text)
 .text          0x000000000000000f        0x5 mytest.o
                0x0000000000000014                ORG
...
```

Any idea what's going on? I suspect ORG is being evaluated multiple(3) times,
each time being offset more because .text is being offset more.

Thanks for your help,

-- Marco Sirabella
.text
.org 5
.global ORG
ORG:

Attachment: test.ld
Description: Text document

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]