This is the mail archive of the binutils@sourceware.cygnus.com 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]

Re: Behaviour change from ld 2.9.1 to ld 2.9.5



I am not an ld expert, except that I play one for Linux. You may
get answers from the binutils mailing list.


H.J.
--
On Sat, May 06, 2000 at 09:50:33AM +0200, Lorenzo Campedelli wrote:
> Hello,
>     I have a problem I assume related to ld, I hope you can help me.
> 
> I wrote a program which  simulates an embedded system, where some memory
> areas access permissions, or even their availability are variable at
> runtime, depending, for instance, on the running task (some tasks use a
> different LDT, by the simulated OS point of view).
> 
> The implementation depends on being able to place some global variables,
> let's say the COMMON section from some object files, at a specific
> memory
> address (e.g. 0x50000000).
> This is needed in order to have the variables allocated in a private
> shared memory segment and thus to able to change the access permissions
> at runtime, or even mapping the same memory twice in memory with
> different permissions.
> 
> While using ld 2.9.1 (rh5.2 up to rh6.1) I was able to obtain that setup
> by means of a modified ld script, defining new sections, placing them at
> the desired address, and declaring some object files inside them solved
> the problem.
> 
> When I switched to ld 2.9.5 (rh6.2) the trick stopped working. The
> program is still linked, but the produced executable SEEMS enormous
> (~ 1.5 Gb instead of 2 Mb) and its execution gives :
> 
> [campedel@betelgeuse ld]$ ./ld_prova
> Segmentation fault (core dumped)
> 
> if run from gdb :
> 
> (gdb) r
> Starting program: /home/campedel/misc/prova/ld/ld_prova
> warning: Cannot insert breakpoint -1:
> Cannot access memory at address 0x4000af20
> 
> This seems to be caused by the new section being placed at an offset
> 0x50000000 inside the executable file.
> 
> Attached you can find a very little program reproducing the described
> behaviour.
> Let me know whether you would like to have some more information.
> 
> Do you think this can depend on changed behaviour from 2.9.1 to 2.9.5 ?
> If yes, is there anything I can do in order to obtain the needed
> behaviour from the new version ?
> By the way, is there another way to place a variable at a desired memory
> address ?
> 
> Thanks in advance for any help you will provide.
> 
> Best Regards
>     Lorenzo Campedelli


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