flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > MS COFF I386 Relocations

Author
Thread Post new topic Reply to topic
flat cat



Joined: 04 May 2023
Posts: 8
flat cat 04 May 2023, 11:28
Question about MS COFF relocations:
In the description of the PE / COFF format on the website:
https://learn.microsoft.com/en-us/windows/win32/debug/pe-format

it is said that:

Quote:
IMAGE_REL_I386_ABSOLUTE 0x0000 This relocation is ignored.

does this kind of relocation use FASM?

Quote:
IMAGE_REL_I386_DIR32 - The target's 32-bit virtual address.

what kind of target is this, in what cases will FASM use this type of relocation?

Quote:
IMAGE_REL_I386_DIR32NB - The target's 32-bit relative virtual address.

in what cases, FASM will use this type of relocation?

Quote:
IMAGE_REL_I386_SECTION 0x000A The 16-bit-section index of the section containing the target. This is used to support debugging information.

in what cases, FASM will use this type of relocation? And does he use it?

Quote:
IMAGE_REL_I386_SECREL 0x000B The 32-bit offset of the target from the beginning of its section. This is used to support debugging information as well as static thread local storage.

in what cases, FASM will use this type of relocation? And does he use it?

Quote:
IMAGE_REL_I386_REL32 0x0014 The 32-bit relative displacement to the target. This supports the x86 relative branch and call instructions.

what is displacement? in what cases, FASM will use this type of relocation?
Post 04 May 2023, 11:28
View user's profile Send private message Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 785
Location: Russian Federation, Sochi
ProMiNick 04 May 2023, 12:12
fasm uses only one type of relocation (and that is enought), see Learning binary file formats (work in progress) 1.2 Adding relocations
in fasmg example emulated behaviour of fasm formatter - and there only 1 relocation type because only that one in fasm.
with fasmg thou could use any other relocation types.
Post 04 May 2023, 12:12
View user's profile Send private message Send e-mail Reply with quote
flat cat



Joined: 04 May 2023
Posts: 8
flat cat 04 May 2023, 12:27
Please don't comment on my threads again, ever.
Post 04 May 2023, 12:27
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8341
Location: Kraków, Poland
Tomasz Grysztar 05 May 2023, 12:08
ProMiNick wrote:
fasm uses only one type of relocation (and that is enought), see Learning binary file formats (work in progress) 1.2 Adding relocations
in fasmg example emulated behaviour of fasm formatter - and there only 1 relocation type because only that one in fasm.
with fasmg thou could use any other relocation types.
COFF is not the same as PE (although the latter has been based on the old executable variants of the former). The object files use different structures for relocations, and there's usually more of them. Because fasmg's formatter is fasm-compatible, you can look it up to see what types of relocations it is able to generate.
Post 05 May 2023, 12:08
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.