Arm Community
Site
Search
User
Site
Search
User
Support forums
Arm Development Studio forum
fPIC with alignment
Jump...
Cancel
Locked
Locked
Replies
4 replies
Subscribers
119 subscribers
Views
3383 views
Users
0 members are here
Options
Share
More actions
Cancel
Related
How was your experience today?
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion
fPIC with alignment
Elf Elf
over 12 years ago
Note: This was originally posted on 18th July 2012 at
http://forums.arm.com
Hi
I am trying to create a PIC elf image with --apcs=/fpic compiler option and --fpic linker option. It creates a PIC image alright with different load regions for code and data, but I would like to have them 4K aligned so that I can map those with appropriate RX and RW permissions. Any idea how can force the alignment?
Thanks in advance.
Elf Elf
over 12 years ago
Note: This was originally posted on 19th July 2012 at
http://forums.arm.com
The problem is that --fpicis ignored when --scatter is used, so it does not generate PIC image. To generate the pic image --sysv --sharedhad to be added which the ignores the --scatter option. it then generates the PIC image correctly, but does not create aligned load regions. so bottom line, --scatter loader file cannot be used for PIC images. One solution i found was specifying --ro-base and and --rw-base WITH -fPIC linker option. This is not efficient since RO and RW are going to grow and we need to make sure they dont overlap. so it sucks that there are no good options to create PIC image and make the load regions aligned.
Thanks.
Cancel
Vote up
0
Vote down
Cancel
Elf Elf
over 12 years ago
Cancel
Vote up
0
Vote down
Cancel
Peter Harris
over 12 years ago
Note: This was originally posted on 18th July 2012 at
http://forums.arm.com
With the ARM tools this is achieved using the scatter loader:
http://infocenter.arm.com/help/topic/com.arm.doc.dui0474g/CHDIEAJD.html
For GNU tools you'll need to create a linker script (similar concept the ARM scatter loading scripts, but different syntax)
http://www.delorie.com/gnu/docs/binutils/ld_6.html
HTH,
Iso
Cancel
Vote up
0
Vote down
Cancel
Peter Harris
over 12 years ago
Note: This was originally posted on 19th July 2012 at
http://forums.arm.com
[color=#222222][size=2]
The problem is that --fpicis ignored when --scatter is used
[/size][/color]
[color=#222222][size=2]
[/size][/color]
[size=2]For RVCT you just need to mark the section as position independent in the scatter file (add the "PI" attribute to the section). I'd be surprised if there was not a similar option for the GNU linker script.[/size]
[color=#222222][size=2]
[/size][/color]
[color=#222222][size=2]Iso[/size][/color]
[color=#222222][size=2]
[/size][/color]
Cancel
Vote up
0
Vote down
Cancel