Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #7984

Re: question about exe (again)

From Robert Wessel <robertwessel2@yahoo.com>
Newsgroups comp.programming
Subject Re: question about exe (again)
Message-ID <dthnpcdk09skrjs2mftof18vavtgvpj0cs@4ax.com> (permalink)
References <ae5e1307-b87e-4a1b-a6bd-6123a54e411a@googlegroups.com> <PZ_lB.1069$xN2.298@fx44.iad>
Organization Forte - www.forteinc.com
Date 2017-08-22 01:00 -0500

Show all headers | View raw


On Sat, 19 Aug 2017 13:57:03 -0400, Richard Damon
<Richard@Damon-Family.org> wrote:

>On 8/19/17 7:36 AM, fir wrote:
>> some times ago it was discussed and i know thet here are probably not much many people knowing that things but maybe some
>> 
>> if you load exe program into memory it is typically loaded under adress 0040_0000 (which is 4 MB skiping from begining)
>> 
>> header is typically loaded under 0040_0000,
>> code is typically loaded under 0040_1000, and data is loaded after that (in small hello worlds it will be 0040_2000),
>> consts after that, static empty ram area is reserved after that, then imports and other sections also somewhere after that
>> 
>> still i am not sure as to one thing.. in exe
>> i think you dont necessary need relocations
>> (or am i wrong?) So this would mean that in
>> such exe adresses may be fixed (and they in fact would have some values like 004x_xxxx and so on (may be obviously bigger but in small exe this kind of values))
>> 
>> is this really the case? no relocations and this kind of fixed values there?
>> 
>> 
>> <yet maybe second a bit more hard of this question -> if realocations are present are
>> they only a list of adresses in ram where you need to add "base adress" of image (as i heard) or yet something other to that?>
>> 
>> tnx
>> 
>
>My understanding is that the exe file (like DLLs) is relocatable, but 
>specifies a preferred address. I believe that if loaded at the preferred 
>address, than one advantage is that the loader doesn't need to do most 
>of the relocation fixups. The system has the option to load the program 
>at a different address if it wants (and there are some security benefits 
>to randomizing the load address), unless the file is specifically marked 
>as non-relocatable.


The default for .exes used to be to strip the relocation information,
although that could be overridden with a linker option.  ALSR got
added a few generations of VS back, use of which (obviously) needed
relocation information to remain, although ALSR was not the default
compile option.  ALSR became the default compile option a while after
its introduction, and so leaving relocation in .exes is now the
default.

Back to comp.programming | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

question about exe (again) fir <profesor.fir@gmail.com> - 2017-08-19 04:36 -0700
  Re: question about exe (again) Richard Damon <Richard@Damon-Family.org> - 2017-08-19 13:57 -0400
    Re: question about exe (again) fir <profesor.fir@gmail.com> - 2017-08-19 11:06 -0700
    Re: question about exe (again) Robert Wessel <robertwessel2@yahoo.com> - 2017-08-22 01:00 -0500

csiph-web