fix(relinker): accept an identical duplicate relocation in Windows executables #11299

Merged
p3n1cillin merged 1 commit from upstream-pr/11299 into main 2026-10-26 22:07:10 +00:00
p3n1cillin commented 2026-10-26 00:53:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-26T00:53:26Z.


What

The Windows relinker refused an executable whose RELA table lists the same relocation twice. Forever Launcher (PPSA99030) starts a second executable, game-child.bin, which repeats one R_X86_64_RELATIVE entry: target 0x2df70, addend 0x2e040, twice in DT_RELA and nowhere else. Converting it with --executable game-child.bin stopped with:

FAIL: Overlapping ELF relocation targets (offset 0x2df70)

A RELA entry writes its value rather than adding to the target, so applying an identical entry twice leaves the same result as applying it once. FreeBSD's rtld walks every entry and, for a relative one, assigns relocbase + addend. The Linux output already passes such a table through unchanged.

  • WindowsRelocationBuilder: skips an entry identical to one already applied at the same target (same r_info, same addend).
  • Code analysis (CodeInstructionCollector): accepts a second relative or defined-symbol pointer at a slot only when it resolves to the same value.
  • Still refused: distinct entries at one target, or a different value at one slot, as #6607 intended.
  • Unchanged: the guest-module writers (Overlapping guest relocations). No module with a duplicate entry is known.

duplicate_relocations is a new test built on #6607's fixtures:

  • An executable with its RELATIVE entry listed twice converts for Linux, Windows and macOS, and the Windows and macOS pointers are checked.
  • The same entry with a different addend is still refused on Windows.

Tested

Windows 11 Pro (26300), WinLibs GCC 15.2.0, Release, full build on main 1f68b1f776:

  • Relinker suite: all 178 tests registered by core/relinker pass, duplicate_relocations and overlapping_relocations among them.
  • Without the change: the new test fails on the Windows target with Overlapping ELF relocation targets (offset 0x308). With only the builder change it fails in code analysis with invalid relative relocation.
  • Forever Launcher: with --executable game-child.bin, it now converts both eboot.bin and game-child.bin.exe. Its run is still blocked elsewhere: its Wine needs 0x7ffe0000, which a Windows host already owns.
  • Checks: tools/check_conventions.py --base origin/main passes. tools/pr_overlap.py lists only #5021 and #6713, which it couldn't compare; they share only core/relinker/CMakeLists.txt.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: conversion of PPSA99030's game-child.bin (the title stays blocked by its fixed 0x7ffe0000 mapping)
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5010380173 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11299). Originally posted by [p3n1cillin](https://github.com/p3n1cillin) on 2026-10-26T00:53:26Z. --- ### What The Windows relinker refused an executable whose `RELA` table lists the same relocation twice. Forever Launcher (PPSA99030) starts a second executable, `game-child.bin`, which repeats one `R_X86_64_RELATIVE` entry: target `0x2df70`, addend `0x2e040`, twice in `DT_RELA` and nowhere else. Converting it with `--executable game-child.bin` stopped with: ```text FAIL: Overlapping ELF relocation targets (offset 0x2df70) ``` A RELA entry writes its value rather than adding to the target, so applying an identical entry twice leaves the same result as applying it once. FreeBSD's rtld [walks every entry](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/libexec/rtld-elf/amd64/reloc.c#L153) and, for a relative one, [assigns](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/libexec/rtld-elf/amd64/reloc.c#L299-L300) `relocbase + addend`. The Linux output already passes such a table through unchanged. - **`WindowsRelocationBuilder`:** skips an entry identical to one already applied at the same target (same `r_info`, same addend). - **Code analysis (`CodeInstructionCollector`):** accepts a second relative or defined-symbol pointer at a slot only when it resolves to the same value. - **Still refused:** distinct entries at one target, or a different value at one slot, as #6607 intended. - **Unchanged:** the guest-module writers (`Overlapping guest relocations`). No module with a duplicate entry is known. `duplicate_relocations` is a new test built on #6607's fixtures: - An executable with its `RELATIVE` entry listed twice converts for Linux, Windows and macOS, and the Windows and macOS pointers are checked. - The same entry with a different addend is still refused on Windows. ### Tested Windows 11 Pro (26300), WinLibs GCC 15.2.0, Release, full build on `main` 1f68b1f776: - **Relinker suite:** all 178 tests registered by `core/relinker` pass, `duplicate_relocations` and `overlapping_relocations` among them. - **Without the change:** the new test fails on the Windows target with `Overlapping ELF relocation targets (offset 0x308)`. With only the builder change it fails in code analysis with `invalid relative relocation`. - **Forever Launcher:** with `--executable game-child.bin`, it now converts both `eboot.bin` and `game-child.bin.exe`. Its run is still blocked elsewhere: its Wine needs `0x7ffe0000`, which a Windows host already owns. - **Checks:** `tools/check_conventions.py --base origin/main` passes. `tools/pr_overlap.py` lists only #5021 and #6713, which it couldn't compare; they share only `core/relinker/CMakeLists.txt`. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: conversion of PPSA99030's `game-child.bin` (the title stays blocked by its fixed `0x7ffe0000` mapping) - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-26 01:01:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T01:01:02Z.

Review: APPROVED


Reviewed exact head 191f1da02020b1f095cb76247a4105bd3492314a. The Windows builder suppresses only a repeated relocation at the same target with identical r_info and addend; distinct/overlapping entries still take the existing rejection path. The code-analysis change likewise accepts duplicate pointer entries only when their resolved target is equal. This matches the relocation write semantics and keeps conflicting-target protection intact.\n\nI built this exact head on Linux with the relinker-only Release configuration and ran duplicate_relocations plus overlapping_relocations: 2/2 passed. Hosted Linux, Windows, macOS arm64 and macOS x86_64 relinker jobs, ASan, conventions, intake, eligibility and labels all pass. Product and hardware-specific jobs were skipped by path policy. I found no blocking issue.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5646307709 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11299#pullrequestreview-5646307709). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-26T01:01:02Z. **Review:** APPROVED --- Reviewed exact head `191f1da02020b1f095cb76247a4105bd3492314a`. The Windows builder suppresses only a repeated relocation at the same target with identical `r_info` and addend; distinct/overlapping entries still take the existing rejection path. The code-analysis change likewise accepts duplicate pointer entries only when their resolved target is equal. This matches the relocation write semantics and keeps conflicting-target protection intact.\n\nI built this exact head on Linux with the relinker-only Release configuration and ran `duplicate_relocations` plus `overlapping_relocations`: 2/2 passed. Hosted Linux, Windows, macOS arm64 and macOS x86_64 relinker jobs, ASan, conventions, intake, eligibility and labels all pass. Product and hardware-specific jobs were skipped by path policy. I found no blocking issue.
thepoppfish commented 2026-10-26 01:27:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by thepoppfish on 2026-10-26T01:27:29Z.

Review: APPROVED


Reviewed exact head 191f1da02020b1f095cb76247a4105bd3492314a. The identical R_X86_64_RELATIVE case is fixed, and I approve.

I built fresh relinker-only Release binaries from this head, current-main pin 0f34ebb8539187e50e028e088093d25c85405d2a, and their clean local integration eb62eed58e8be9432fd6771dbcb811813e3de5dc (tree 8c98f334d7c21316447db71fcf16af54b2a147bd): 88 Ninja steps each, Windows 11 build 26200 / GCC 16.2.0-6 UCRT64 / CMake 4.3.1 / Ninja 1.13.2 / Python 3.14.7. The changed Windows builder, code collector and new test are byte-identical between head and integration.

  • Head: 5/5 focused CTests pass, 35.50s total, zero skips.
  • Integration: 5/5 pass, 34.41s total, zero skips.
  • Main: 4/4 matching existing tests pass, 20.33s total, zero skips. The new committed regression fails against this freshly built main at the Windows target with Overlapping ELF relocation targets (offset 0x308).

The selected tests are duplicate_relocations (positive trees), overlapping_relocations, guest_none_relocations, guest_own_tls_relocations and guest_symbol_names. Every individual test finishes below 30 seconds.

Additional independent matrix: 132 real CLI conversions and 24 native Windows executable runs. For each tree:

  • 30 positive conversions: standard/SCE dynamic tags, 1/2/4/8 identical relative entries or two disjoint pointer slots, across ELF/PE/Mach-O output. Head and integration pass all 30. Main accepts the 18 existing cases and rejects six duplicate cases each on Windows and macOS.
  • 10 Windows conflict cases: changed addend, partial overlap on either side, changed symbol index and changed type, with both dynamic-tag forms. All return 2 and leave no main output.
  • Four repeated-PLT-import cases remain rejected on all three trees. Import rebuilding gives the duplicate imports separate synthesized symbol indices, so the builder no longer sees identical r_info. This is an existing limitation; these results establish the RELATIVE change rather than general support for repeated imports.

For successful Windows cases, the probe changes the synthetic entry point to jump through the relocated relative pointer itself. All 10 head, 10 integration and four main programs return 42. It also checks pointer values, exactly one PE DIR64 base-relocation record per target, the unchanged single import-registry slot, preserved ELF relocation records, and unchanged source/provider bytes. These are synthetic homebrew executions, not the reported title.

Source review also confirms table-type validation precedes the duplicate skip, and different or partially overlapping writes retain the rejection path. The cited pinned FreeBSD relative-relocation implementation assigns base plus addend, consistent with collapsing identical relative entries.

Conventions against pinned origin/main and whitespace checks pass for head and integration; all three builds have no compiler warnings. No full product build, full relinker suite, actual title, Linux/macOS execution, console/GPU, performance or hosted-CI result is claimed. This checks integration with the pinned main, not every outstanding PR. AI-assisted: yes.

Additional matrix replay

Save the script below and run it with the head checkout, the three executable paths and a JSON output path:

python check_matrix.py <head-checkout> <head-relinker.exe> <merged-relinker.exe> <main-relinker.exe> matrix.json

It uses the committed fixture and format parsers. Run on Windows x86-64; it executes each successful generated Windows program.

import collections
import json
from pathlib import Path
import struct
import subprocess
import sys
import tempfile

sys.path.insert(0,str(Path(sys.argv[1]).resolve()/'core/relinker/relinker/tests'))
from test_overlapping_relocations import SCE_TAGS,TARGETS,check_output,fixture
from test_guest_none_relocations import module
from test_guest_intel_trampolines import pe_sections

def image_for(sce,relocations,imports=None):
    image,_,plt=fixture('disjoint',sce,False)
    image[0x200:0x206]=b'\xff\x25'+struct.pack('<i',0x308-0x206)
    imports=plt if imports is None else imports
    updates={7:0x800,8:len(relocations)*24,23:0xa00,2:len(imports)*24}
    updates={(SCE_TAGS.get(k,k) if sce else k):(v-0x500 if sce and k in (7,23) else v) for k,v in updates.items()}
    for offset in range(0x400,0x500,16):
        tag,_=struct.unpack_from('<qQ',image,offset)
        if tag in updates:
            struct.pack_into('<qQ',image,offset,tag,updates[tag])
    for address,entries in ((0x800,relocations),(0xa00,imports)):
        for i,entry in enumerate(entries):
            struct.pack_into('<QQq',image,address+i*24,*entry)
    return image,imports

def pe_relocations(data):
    header=struct.unpack_from('<I',data,0x3c)[0]
    address,size=struct.unpack_from('<II',data,header+24+112+5*8)
    sections=pe_sections(data)
    def offset(rva):
        for _,start,length,raw,_ in sections:
            if start<=rva<start+length:
                return raw+rva-start
        raise AssertionError(('unmapped relocation RVA',rva))
    result=[]
    end=address+size
    while address<end:
        pos=offset(address)
        page,length=struct.unpack_from('<II',data,pos)
        assert length>=8 and address+length<=end
        for p in range(pos+8,pos+length,2):
            entry=struct.unpack_from('<H',data,p)[0]
            if entry>>12==10:
                result.append(page+(entry&0xfff))
            else:
                assert entry==0
        address+=length
    return result,next(s[1] for s in sections if s[0]==b'.elf0')

local=(0x308,8,0x210)
positive=[('count-'+str(n),[local]*n) for n in (1,2,4,8)]
positive += [('disjoint',[local,(0x310,8,0x210)])]
negative=[
    ('changed-addend',[local,(0x308,8,0x218)]),
    ('partial-after',[local,(0x309,8,0x210)]),
    ('partial-before',[local,(0x307,8,0x210)]),
    ('changed-symbol',[local,(0x308,(1<<32)|8,0x210)]),
    ('changed-type',[local,(0x308,(1<<32)|6,0)])]
rows=[]
with tempfile.TemporaryDirectory(prefix='anyps5-reloc-review-matrix-') as directory:
    root=Path(directory)
    def convert(variant,binary,name,sce,target,options,relocations,imports=None,category='positive'):
        image,plt=image_for(sce,relocations,imports)
        case=root/f'{variant}-{category}-{name}-{sce}-{target}'
        (case/'sce_module').mkdir(parents=True)
        provider=module()
        (case/'sce_module/module.prx').write_bytes(provider)
        source,output=case/'input.elf',case/('output.exe' if target=='windows' else 'output.out')
        source.write_bytes(image)
        result=subprocess.run([str(Path(binary).resolve()),'--registry',*options,str(source),str(output)],
                              capture_output=True,text=True,timeout=15)
        assert source.read_bytes()==image
        assert (case/'sce_module/module.prx').read_bytes()==provider
        row=dict(variant=variant,case=name,sce=sce,target=target,category=category,
                 returncode=result.returncode,diagnostic=result.stderr.splitlines()[0] if result.stderr else '')
        if category in ('negative','import-limit'):
            assert result.returncode==2 and not output.exists(),(row,result.stdout,result.stderr)
        elif result.returncode==0:
            data=output.read_bytes()
            check_output(data,target,False,relocations,plt)
            if target=='windows':
                entries,section_rva=pe_relocations(data)
                for destination in {entry[0] for entry in relocations}:
                    assert entries.count(section_rva+destination)==1,(row,entries)
                registry=json.loads(output.with_suffix('.registry.json').read_text(encoding='utf-8'))
                assert len(registry)==1 and registry[0]['targetOffset']=='0x300',registry
                executed=subprocess.run([str(output)],capture_output=True,timeout=10)
                assert executed.returncode==42,(row,executed.returncode,executed.stderr)
                row['native_exit']=42
        else:
            assert variant=='main' and name.startswith('count-') and name!='count-1' and target!='linux',(row,result.stdout,result.stderr)
            assert result.returncode==2 and not output.exists(),row
        rows.append(row)
    for variant,binary in zip(('head','merged','main'),sys.argv[2:5]):
        for sce in (False,True):
            for name,relocations in positive:
                for target,options in TARGETS:
                    convert(variant,binary,name,sce,target,options,relocations)
            for name,relocations in negative:
                convert(variant,binary,name,sce,'windows',['--windows'],relocations,category='negative')
            for name,relocations in [('plt',[local]),('both',[local,local])]:
                imports=[(0x300,(1<<32)|7,0)]*2
                convert(variant,binary,name,sce,'windows',['--windows'],relocations,imports,category='import-limit')
Path(sys.argv[5]).write_text(json.dumps(rows,indent=2)+'\n',encoding='utf-8')
summary=dict(conversions=len(rows),native_executions=sum('native_exit' in row for row in rows),
             outcomes=dict(collections.Counter(f"{r['variant']}:{r['category']}:{r['returncode']}" for r in rows)))
print(json.dumps(summary))
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5646417707 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11299#pullrequestreview-5646417707). Originally posted by [thepoppfish](https://github.com/thepoppfish) on 2026-10-26T01:27:29Z. **Review:** APPROVED --- Reviewed exact head `191f1da02020b1f095cb76247a4105bd3492314a`. The identical `R_X86_64_RELATIVE` case is fixed, and I approve. I built fresh relinker-only Release binaries from this head, current-main pin `0f34ebb8539187e50e028e088093d25c85405d2a`, and their clean local integration `eb62eed58e8be9432fd6771dbcb811813e3de5dc` (tree `8c98f334d7c21316447db71fcf16af54b2a147bd`): 88 Ninja steps each, Windows 11 build 26200 / GCC 16.2.0-6 UCRT64 / CMake 4.3.1 / Ninja 1.13.2 / Python 3.14.7. The changed Windows builder, code collector and new test are byte-identical between head and integration. - **Head: 5/5 focused CTests pass**, 35.50s total, zero skips. - **Integration: 5/5 pass**, 34.41s total, zero skips. - **Main: 4/4 matching existing tests pass**, 20.33s total, zero skips. The new committed regression fails against this freshly built main at the Windows target with `Overlapping ELF relocation targets (offset 0x308)`. The selected tests are `duplicate_relocations` (positive trees), `overlapping_relocations`, `guest_none_relocations`, `guest_own_tls_relocations` and `guest_symbol_names`. Every individual test finishes below 30 seconds. Additional independent matrix: **132 real CLI conversions and 24 native Windows executable runs**. For each tree: - 30 positive conversions: standard/SCE dynamic tags, 1/2/4/8 identical relative entries or two disjoint pointer slots, across ELF/PE/Mach-O output. Head and integration pass all 30. Main accepts the 18 existing cases and rejects six duplicate cases each on Windows and macOS. - 10 Windows conflict cases: changed addend, partial overlap on either side, changed symbol index and changed type, with both dynamic-tag forms. All return 2 and leave no main output. - Four repeated-PLT-import cases remain rejected on **all three** trees. Import rebuilding gives the duplicate imports separate synthesized symbol indices, so the builder no longer sees identical `r_info`. This is an existing limitation; these results establish the RELATIVE change rather than general support for repeated imports. For successful Windows cases, the probe changes the synthetic entry point to jump through the relocated relative pointer itself. All 10 head, 10 integration and four main programs return **42**. It also checks pointer values, exactly one PE DIR64 base-relocation record per target, the unchanged single import-registry slot, preserved ELF relocation records, and unchanged source/provider bytes. These are synthetic homebrew executions, not the reported title. Source review also confirms table-type validation precedes the duplicate skip, and different or partially overlapping writes retain the rejection path. The cited [pinned FreeBSD relative-relocation implementation](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/libexec/rtld-elf/amd64/reloc.c#L299) assigns base plus addend, consistent with collapsing identical relative entries. Conventions against pinned `origin/main` and whitespace checks pass for head and integration; all three builds have no compiler warnings. No full product build, full relinker suite, actual title, Linux/macOS execution, console/GPU, performance or hosted-CI result is claimed. This checks integration with the pinned main, not every outstanding PR. AI-assisted: yes. <details><summary>Additional matrix replay</summary> Save the script below and run it with the head checkout, the three executable paths and a JSON output path: ```text python check_matrix.py <head-checkout> <head-relinker.exe> <merged-relinker.exe> <main-relinker.exe> matrix.json ``` It uses the committed fixture and format parsers. Run on Windows x86-64; it executes each successful generated Windows program. ```python import collections import json from pathlib import Path import struct import subprocess import sys import tempfile sys.path.insert(0,str(Path(sys.argv[1]).resolve()/'core/relinker/relinker/tests')) from test_overlapping_relocations import SCE_TAGS,TARGETS,check_output,fixture from test_guest_none_relocations import module from test_guest_intel_trampolines import pe_sections def image_for(sce,relocations,imports=None): image,_,plt=fixture('disjoint',sce,False) image[0x200:0x206]=b'\xff\x25'+struct.pack('<i',0x308-0x206) imports=plt if imports is None else imports updates={7:0x800,8:len(relocations)*24,23:0xa00,2:len(imports)*24} updates={(SCE_TAGS.get(k,k) if sce else k):(v-0x500 if sce and k in (7,23) else v) for k,v in updates.items()} for offset in range(0x400,0x500,16): tag,_=struct.unpack_from('<qQ',image,offset) if tag in updates: struct.pack_into('<qQ',image,offset,tag,updates[tag]) for address,entries in ((0x800,relocations),(0xa00,imports)): for i,entry in enumerate(entries): struct.pack_into('<QQq',image,address+i*24,*entry) return image,imports def pe_relocations(data): header=struct.unpack_from('<I',data,0x3c)[0] address,size=struct.unpack_from('<II',data,header+24+112+5*8) sections=pe_sections(data) def offset(rva): for _,start,length,raw,_ in sections: if start<=rva<start+length: return raw+rva-start raise AssertionError(('unmapped relocation RVA',rva)) result=[] end=address+size while address<end: pos=offset(address) page,length=struct.unpack_from('<II',data,pos) assert length>=8 and address+length<=end for p in range(pos+8,pos+length,2): entry=struct.unpack_from('<H',data,p)[0] if entry>>12==10: result.append(page+(entry&0xfff)) else: assert entry==0 address+=length return result,next(s[1] for s in sections if s[0]==b'.elf0') local=(0x308,8,0x210) positive=[('count-'+str(n),[local]*n) for n in (1,2,4,8)] positive += [('disjoint',[local,(0x310,8,0x210)])] negative=[ ('changed-addend',[local,(0x308,8,0x218)]), ('partial-after',[local,(0x309,8,0x210)]), ('partial-before',[local,(0x307,8,0x210)]), ('changed-symbol',[local,(0x308,(1<<32)|8,0x210)]), ('changed-type',[local,(0x308,(1<<32)|6,0)])] rows=[] with tempfile.TemporaryDirectory(prefix='anyps5-reloc-review-matrix-') as directory: root=Path(directory) def convert(variant,binary,name,sce,target,options,relocations,imports=None,category='positive'): image,plt=image_for(sce,relocations,imports) case=root/f'{variant}-{category}-{name}-{sce}-{target}' (case/'sce_module').mkdir(parents=True) provider=module() (case/'sce_module/module.prx').write_bytes(provider) source,output=case/'input.elf',case/('output.exe' if target=='windows' else 'output.out') source.write_bytes(image) result=subprocess.run([str(Path(binary).resolve()),'--registry',*options,str(source),str(output)], capture_output=True,text=True,timeout=15) assert source.read_bytes()==image assert (case/'sce_module/module.prx').read_bytes()==provider row=dict(variant=variant,case=name,sce=sce,target=target,category=category, returncode=result.returncode,diagnostic=result.stderr.splitlines()[0] if result.stderr else '') if category in ('negative','import-limit'): assert result.returncode==2 and not output.exists(),(row,result.stdout,result.stderr) elif result.returncode==0: data=output.read_bytes() check_output(data,target,False,relocations,plt) if target=='windows': entries,section_rva=pe_relocations(data) for destination in {entry[0] for entry in relocations}: assert entries.count(section_rva+destination)==1,(row,entries) registry=json.loads(output.with_suffix('.registry.json').read_text(encoding='utf-8')) assert len(registry)==1 and registry[0]['targetOffset']=='0x300',registry executed=subprocess.run([str(output)],capture_output=True,timeout=10) assert executed.returncode==42,(row,executed.returncode,executed.stderr) row['native_exit']=42 else: assert variant=='main' and name.startswith('count-') and name!='count-1' and target!='linux',(row,result.stdout,result.stderr) assert result.returncode==2 and not output.exists(),row rows.append(row) for variant,binary in zip(('head','merged','main'),sys.argv[2:5]): for sce in (False,True): for name,relocations in positive: for target,options in TARGETS: convert(variant,binary,name,sce,target,options,relocations) for name,relocations in negative: convert(variant,binary,name,sce,'windows',['--windows'],relocations,category='negative') for name,relocations in [('plt',[local]),('both',[local,local])]: imports=[(0x300,(1<<32)|7,0)]*2 convert(variant,binary,name,sce,'windows',['--windows'],relocations,imports,category='import-limit') Path(sys.argv[5]).write_text(json.dumps(rows,indent=2)+'\n',encoding='utf-8') summary=dict(conversions=len(rows),native_executions=sum('native_exit' in row for row in rows), outcomes=dict(collections.Counter(f"{r['variant']}:{r['category']}:{r['returncode']}" for r in rows))) print(json.dumps(summary)) ``` </details>
MarcZX10 commented 2026-10-26 05:48:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T05:48:50Z.

Review: CHANGES_REQUESTED


I rechecked the current integration state after the earlier exact-head approval. The implementation and focused regression are still unchanged, and the hosted relinker matrix plus the reported Linux/Windows focused tests passed on the tested revisions. However, tools/check_main_sync.py --base upstream/main --head 191f1da02020b1f095cb76247a4105bd3492314a now reports 1 commit ahead and 379 behind current main (14c99b52ac). The merge preview is clean, but core/relinker/CMakeLists.txt changed on both sides since the base. CONTRIBUTING.md requires keeping the branch up to date; please refresh and rerun duplicate_relocations and overlapping_relocations on the resulting exact head. The prior approval covered 191f1da before these main changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5647887607 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11299#pullrequestreview-5647887607). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-26T05:48:50Z. **Review:** CHANGES_REQUESTED --- I rechecked the current integration state after the earlier exact-head approval. The implementation and focused regression are still unchanged, and the hosted relinker matrix plus the reported Linux/Windows focused tests passed on the tested revisions. However, `tools/check_main_sync.py --base upstream/main --head 191f1da02020b1f095cb76247a4105bd3492314a` now reports 1 commit ahead and 379 behind current `main` (`14c99b52ac`). The merge preview is clean, but `core/relinker/CMakeLists.txt` changed on both sides since the base. `CONTRIBUTING.md` requires keeping the branch up to date; please refresh and rerun `duplicate_relocations` and `overlapping_relocations` on the resulting exact head. The prior approval covered `191f1da` before these main changes.
MarcZX10 commented 2026-10-26 08:09:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T08:09:53Z.

Review: CHANGES_REQUESTED


I refreshed the exact-head check against current upstream/main 204c6747d0a1cbaf932def3dea0778810cc3935e: 191f1da02020b1f095cb76247a4105bd3492314a is 1 ahead / 456 behind. The merge preview is clean, but current main has changed CodeInstructionCollector.cpp and core/relinker/CMakeLists.txt since the tested base 1f68b1f7; in particular, the prior external integration run pinned an older main and does not cover these intervening collector changes. Please rebase and rerun duplicate_relocations and overlapping_relocations on the exact new head. The extensive existing Windows/Linux evidence remains useful; this is a current-main integration request.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5649023854 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11299#pullrequestreview-5649023854). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-26T08:09:53Z. **Review:** CHANGES_REQUESTED --- I refreshed the exact-head check against current `upstream/main` `204c6747d0a1cbaf932def3dea0778810cc3935e`: `191f1da02020b1f095cb76247a4105bd3492314a` is 1 ahead / 456 behind. The merge preview is clean, but current `main` has changed `CodeInstructionCollector.cpp` and `core/relinker/CMakeLists.txt` since the tested base `1f68b1f7`; in particular, the prior external integration run pinned an older main and does not cover these intervening collector changes. Please rebase and rerun `duplicate_relocations` and `overlapping_relocations` on the exact new head. The extensive existing Windows/Linux evidence remains useful; this is a current-main integration request.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!11299
No description provided.