]> git.ipfire.org Git - thirdparty/gcc.git/commit
lto/122515: Fix archive offset types for i686
authorSiddhesh Poyarekar <siddhesh@gotplt.org>
Mon, 3 Nov 2025 23:02:00 +0000 (17:02 -0600)
committerSiddhesh Poyarekar <siddhesh@gotplt.org>
Tue, 4 Nov 2025 11:13:30 +0000 (05:13 -0600)
commit0013501e462bd362de50bbac71ea4c6c7528dc08
treeded561414a0c08ca6041e3e26cdd89b2f18980a0
parentf062a6b7985fcee82e02b626aada4e0824850bd0
lto/122515: Fix archive offset types for i686

On i686, offsets into object archives could be 64-bit, but they're
inconsistently treated across the lto, which may sometimes result in
truncation of those offsets for large archives.

Use int64_t/off_t consistently across all uses of archive offsets to
make sure that they're always read and mapped correctly.

gcc/lto/ChangeLog

PR lto/122515
* lto.h (lto_section_slot): Set type of START to off_t.
* lto-common.cc (lto_read_section_data): Adjust.
* lto-object.cc (lto_obj_file_open): Set type of OFFSET to
int64_t.

gcc/ChangeLog

PR lto/122515
* lto-wrapper.cc (debug_objcopy): Set type of INOFF to int64_t.
(run_gcc): Set type of FILE_OFFSET to int64_t.

gcc/testsuite/ChangeLog

PR lto/122515
* lib/lto.exp (lto-build-archive): New procedure.
(lto-execute-1): Use it.
(lto-link-and-maybe-run, lto-get-options-main): Handle ar-link.
* gcc.dg/lto/pr122515_0.c: New test case.
* gcc.dg/lto/pr122515_1.c: New file.
* gcc.dg/lto/pr122515_2.c: Likewise.
* gcc.dg/lto/pr122515_3.c: Likewise.
* gcc.dg/lto/pr122515_4.c: Likewise.
* gcc.dg/lto/pr122515_5.c: Likewise.
* gcc.dg/lto/pr122515_6.c: Likewise.
* gcc.dg/lto/pr122515_7.c: Likewise.
* gcc.dg/lto/pr122515_8.c: Likewise.
* gcc.dg/lto/pr122515_9.c: Likewise.

Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
15 files changed:
gcc/lto-wrapper.cc
gcc/lto/lto-common.cc
gcc/lto/lto-object.cc
gcc/lto/lto.h
gcc/testsuite/gcc.dg/lto/pr122515_0.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/pr122515_1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/pr122515_2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/pr122515_3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/pr122515_4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/pr122515_5.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/pr122515_6.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/pr122515_7.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/pr122515_8.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/pr122515_9.c [new file with mode: 0644]
gcc/testsuite/lib/lto.exp