Subversion Repositories Kolibri OS

Rev

Hide changed files | Directory listing | RSS feed

Filtering Options

Rev Age Author Path Log message Diff Changes
9927 265 d 1 h boppan /programs/develop/clink/ [clink] Make it able to read and write more than 64k - 1 COFF relocation

These are changes from two commits from the upstream clink repo (https://github.com/mkostoevr/clink) and one commit from the upstream epep repo (https://github.com/mkostoevr/epep).

clink:

Commit e63ed12ead17e47d77e848da0e7b9f4dd3ad5127
Bugfix: Make it able to write more than 64k - 1 COFF relocations

If the relocation count is greater than 0xffff then it can't fit
in the NumberOfRelocations field of a section header. In order to
specify greater relocation count IMAGE_SCN_LNK_NRELOC_OVFL flag
should be added to Characteristics and the actual relocation count
should be written into VirtualAddress field of the first COFF
relocation.

Commit 328fc3112a30fcaa808f2cad34028a6507d602a3
Bugfix: Make it able to read more than 64k - 1 COFF relocations

New EPEP API allows to read more than 64k - 1 relocations. Use it
when reading relocation count for filling SectionInfo and when
reading relocations for wriring the output file.

epep:

Commit 3bed4e348a486c346d0a452c58c1d85e1805c09d
Feature: Higher-level COFF relocations API

Number of COFF relocations of a section is stored in the 16-bit
NumberOfRelocations field of a section header. If a COFF object has
more than 2^16 - 1 relocations, then the value does not fit in the
field.

To solve this problem, IMAGE_SCN_LNK_NRELOC_OVFL flag of a section
header has been introduced. If this flag is set for the section,
then the actual number of relocations is stored in the
VirtualAddress field of the first relocation.

If the flag is set, then NumberOfRelocations field of the section
header should be equal to 0xffff, othervice the linker should give
an error.

So this patch introduces few functions adressing this mechanism.

epep_section_contains_extended_relocations:

Checks whether the section has more than 2^16 - 1 relocations.
Retrns error if the IMAGE_SCN_LNK_NRELOC_OVFL flag is set, but
the NumberOfRelocations field is not equal to 0xffff.

epep_get_section_extended_number_of_relocations:

Reads the number of COFF relocations from the VirtualAddress
field of the first COFF relocation.

epep_get_section_number_of_relocations_x:

Gives the number of meaningful relocations of the section.

If the section has less than 2^16 relocations, then returns the
value of the NumberOfRelocations field of the section header,
othervice reads the number of relocations from the first COFF
relocation, but: since the first relocation in this case is not
meaningful, gives the actual number of relocations minus one.
This is used in the function documented below.

Returns 1 in the last argument if the section contains extended
number of relocations, 0 othervice.

epep_get_section_relocation_by_index_x:

If the section has less than 2^16 relocations, then just reads
a relocation by the given index. In case if the section has
extended number of relocations, the first relocation is not
meaningful, so it is skipped, and the relocation at index + 1
is read instead.
 
/programs/develop/clink/epep/epep.h
/programs/develop/clink/main.c
9220 923 d 6 h Boppan /programs/develop/clink/ [clink] Make it compile by GCC  
/programs/develop/clink/main.c
9218 923 d 18 h Boppan /programs/develop/clink/ [clink] Update README.txt  
/programs/develop/clink/README.md
/programs/develop/clink/README.txt
9088 1006 d 19 h Boppan /programs/develop/clink/ [clink] Improve program argument system  
/programs/develop/clink/main.c
9085 1006 d 20 h Boppan /programs/develop/clink/ [clink] Small fixes for GCC (rev. cbd306345347fae28f12fa7f79960403d19e216e)  
/programs/develop/clink/main.c
9084 1007 d 3 h Boppan /programs/develop/clink/ [clink] Emit log on -v, -verbose or --verbose  
/programs/develop/clink/main.c
9080 1008 d 7 h Boppan /programs/develop/clink/ [clink] Update to revision ed897ae9c5dd7e13444aad65506698a34802a69e

- Allow to set output file name
 
/programs/develop/clink/main.c
9075 1009 d 20 h Boppan /programs/develop/clink/ [clink] Update to revision b8d0c8154f15478f34027ab959277ddf2c706354
- Fixed bug with 8-char name symbols
- Fixed bug with label values
- Added warning for non-zero VirtualAddress
 
/programs/develop/clink/main.c
8959 1033 d 21 h Boppan /programs/develop/clink/ [clink] Show undefined symbols  
/programs/develop/clink/main.c
8948 1035 d 16 h Boppan /programs/develop/clink/ [clink] Verify input files  
/programs/develop/clink/epep/epep.h
/programs/develop/clink/main.c
8639 1148 d 0 h Boppan /programs/develop/clink/ clink: Remove unuseful binary file  
/programs/develop/clink/a.out.obj
8620 1152 d 22 h Boppan /programs/develop/clink/ [clink] Return zero (success)  
/programs/develop/clink/main.c
8618 1154 d 0 h Boppan /programs/develop/clink/ [clink] Fill BSS section by zeroes  
/programs/develop/clink/main.c
8602 1160 d 7 h Boppan /programs/develop/clink/epep/ Add missing file for testing  
/programs/develop/clink/epep/example.c
8601 1160 d 7 h Boppan /programs/develop/clink/cdict/ Add one more clink's dependency  
/programs/develop/clink/cdict/LICENSE
/programs/develop/clink/cdict/README.md
/programs/develop/clink/cdict/cdict.h
8600 1160 d 19 h Boppan /programs/develop/clink/ Add unexisted dependencies  
/programs/develop/clink/cvec/LICENSE
/programs/develop/clink/cvec/README.md
/programs/develop/clink/cvec/cvec.h
/programs/develop/clink/epep/LICENSE
/programs/develop/clink/epep/README.md
/programs/develop/clink/epep/epep.h
8579 1176 d 21 h Boppan /programs/develop/clink/ Add clink (COFF-to-COFF linker cpable of making DLLs for KolibriOS from several separated COFF objects)  
/programs/develop/clink
/programs/develop/clink/.gitmodules
/programs/develop/clink/README.md
/programs/develop/clink/README.txt
/programs/develop/clink/a.out.obj
/programs/develop/clink/cdict
/programs/develop/clink/cvec
/programs/develop/clink/epep
/programs/develop/clink/main.c
/programs/develop/clink/test
/programs/develop/clink/test.bat
/programs/develop/clink/test/a.c
/programs/develop/clink/test/a.obj
/programs/develop/clink/test/b.c
/programs/develop/clink/test/b.obj
/programs/develop/clink/test/rel.c
/programs/develop/clink/test/rel.obj