Questions tagged [coff]

COFF (Common Object File Format) is a file format for files containing machine code.

COFF is a file format originally used by early Unix systems for program objects and shared libraries. COFF has been largely superseded by ELF on modern unix-like systems.

COFF is in use in the Windows family of operating systems, in the form of the Windows™ Portable Executable format. It is also used in some embedded development environments.

101 questions
5
votes
1 answer

Disassemble Microsoft Visual Studio 2003 compiler output

I'm seeing what I think is strange behaviour from object files output by the Microsoft Visual Studio 2003 tools. The file utility tells me: asmfile.obj: 80386 COFF executable not stripped - version 30821 For objects created by the assembler, but…
Carl Norum
  • 219,201
  • 40
  • 422
  • 469
5
votes
5 answers

PE Header Requirements

What are the requirements of a PE file (PE/COFF)? What fields should be set, which value, at a bare minimum for enabling it to "run" on Windows (i.e. executing "ret" instruction and then close, without error). The library I am building first is the…
Pindatjuh
  • 10,550
  • 1
  • 41
  • 68
4
votes
3 answers

Names of PE directories

I'm working on a PE dissector and came across something rather unusual. The names and order of directories in the PE format seem to differ depending on where you look: From PEReader (perdr): #define IMAGE_DIRECTORY_ENTRY_EXPORT 0 //…
Polynomial
  • 27,674
  • 12
  • 80
  • 107
4
votes
1 answer

C++20 [[no_unique_address]] not working with clang's win32-coff target

While working with clang-13 in C++20, I noticed that the x86_64-pc-win32-coff cross-compile target seems to outright reject the [[no_unique_address]] attribute. This attribute is otherwise supported for other targets that I tested with. Consider…
Human-Compiler
  • 11,022
  • 1
  • 32
  • 59
4
votes
0 answers

How to change object file format for Clang/llvm

I'm currently working on adding Windows CE as a Target Operating system in LLVM/Clang. I've compiled LLVM/Clang on Windows and when I use it to compile code for my own native windows target or when I cross-compile to my new Windows CE target it…
marler8997
  • 119
  • 10
4
votes
1 answer

Dumpbin output ,meaning?

If I do something like this: dumpbin myexe.exe I got output similar to: Dump of file myexe.exe File Type: EXECUTABLE IMAGE Summary 21000 .data 1000 .gfids 3C9000 .rdata 4F000 .reloc B4000 .rsrc 325000 .text …
Klik Kliković
  • 364
  • 1
  • 5
  • 13
4
votes
1 answer

Writing a COFF object file... how to reference external symbols

I'm going to write my first compiler (ok... most of the work was done by using ANTLR, but it still required effort)... I have already done the following things: Implemented a working interpreter for very, very simple calculations (+, -, *, /, ^ -…
frankencode
  • 109
  • 1
  • 7
4
votes
2 answers

OMF format to COFF format

is there any tool like Borland "coff2omf.exe"for converting Borland OMF LIB format to MS VC++ COFF LIB format ? actually i want to create .obj file in delphi and use that in MSVC++ .
Behrooz
  • 684
  • 1
  • 9
  • 19
4
votes
1 answer

.NET library to access PE header

In order to automate some tasks I'm looking for a library which can let me read and manipulate (add/rename/remove sections,...) a PE header from a .NET application. If possible, I'd rather use something that can be redistributed without source code…
em70
  • 6,088
  • 6
  • 48
  • 80
3
votes
0 answers

Windows object file COFF relocations explanation

I'm trying to create an x86-64 Windows COFF object file, but I don't entirely understand the different types of relocations described at https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#x64-processors. Specifically, I'm not sure what…
abel1502
  • 955
  • 4
  • 14
3
votes
1 answer

How can I check the LIB file version?

After reinstalling Visual Studio 2010, I recompiled the code and encountered the following error: Error 'LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt' A solution mentioned that the lib file is incompatible…
camino
  • 10,085
  • 20
  • 64
  • 115
3
votes
1 answer

How to determine the major compiler version from .obj files compiled with /GL?

I'm trying to determine Visual Studio version (2002/2003, 2005, 2008, 2010, 2012, 2013, 2015) from the .obj file generated with the link time code generation option. The file I have, generated with MSVC2012, has following COFF header contents: …
Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
3
votes
1 answer

PE/COFF symbol type field

Microsoft's documentation for PE/COFF says of the type field in the symbol table: "The most significant byte specifies whether the symbol is a pointer to, function returning, or array of the base type that is specified in the LSB. Microsoft tools…
rwallace
  • 31,405
  • 40
  • 123
  • 242
3
votes
4 answers

PE File Format - What is between the section table and the first section?

When looking at PE files in a hex editor, I often encountered some bytes between the section table and the first section, which doesn't really make sense to me. As far as I am concerned, there should be a 00-byte padding in order to fit the…
user1658887
  • 449
  • 4
  • 15
3
votes
1 answer

make a near, relative call with NASM

I want to make a near, relative call to a function from another object file: ; a.asm global _func _func: ; [..] ; b.asm extern _func ; [..] call _func Unfortunately, the code above doesn't work. I need to load _func into a register: mov eax,…
0xbadf00d
  • 17,405
  • 15
  • 67
  • 107