Im trying to understand relocation concepts but it is not to much
clearly described, maybe someone would like to clear it a bit
would number questions for clarity
when i got some assembly procedure it seem to me that often it
does not need a 'realocation fixups' (if i correctly understand what they
mean by this)
(1)- branching is usually relative so its reallocable, acces to local variables are
also relative so such kind of procedure do not need realocation fixup table
- am i right?
(2)I suspect (becouse im not sure as to this) that code
1) that uses calls 2) that references to global data - need fixups
as i suspect calls are not relative, also global data acces is not relative
- am i right here?
(3) when wathing some disasembly of .o .obj files etc and stuf i never see
relocation tables listed - Do most such of this object files has such fixup tables build-in or no? is there a way of listing them or something?
(4) if i understand correctly if some .obj module references 17 symbols
(I think thay may be both external or internal, (say 17 = for example 7 external function, 7 internal functions, 2 internal static data, 1 external static data ) it would be easiest to define 17 pointers and do not do a rewritting of each move that references do data and each call that calls the function but only fill up those pointers at link time and do indirectional (thru the pointer) addressings (?)
but loaders prefer to physically rewrite each immediate reference for efficiency reasons?
edit
specifically i am not sure if i understand right the shape of such fixup table, if i understand it right it should be like this
fixup table:
printf
+45
+235
+567
+597
+1120
min
+672
table
+527
+1230
I mean in the byte .code+45 (and 4 other places) are calls to the printf - so linker takes real adres of printf say it is 0x20004567 and puts that into code[45]=0x20004567, code[235]=0x20004567, ...
though some things are not clear and i would like to understood it in details, for example i do not understand if this revriting is done by static linker or it is done by loader
it seems to me that linker who van put many modules into one big ones could resolve all this adresses if he could known the base adresses of .code and .data - do the linker knows this? (If no it cannot resolve it till the load time when .code base adres and .data base adress would be provided
not sure how the things look like here, I heard that dlls do not know the base adress till the load time but what with exes? Are those fixed adresses? both of them? (make both fixed would help but where to place .data?)
Hope someone understand what i got on mind and could clarify a bit