Files
TheRock/compiler/amd-llvm/lld/test/ELF/linkerscript/header-alloc.test
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

58 lines
2.1 KiB
Plaintext

# REQUIRES: x86
## Test ELF header and phdrs allocation. Also check that SIZEOF_HEADERS as a
## symbol value matches the post-layout address.
# RUN: rm -rf %t && split-file %s %t && cd %t
# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o
## Fits: . leaves enough room below the first alloc section, same page.
# RUN: ld.lld -T fit.t a.o -o fit
# RUN: llvm-readelf -ls fit | FileCheck %s --check-prefix=FIT
## After .text's alignment is applied, `min` is 4 bytes below headerSize => headers dropped.
# RUN: ld.lld -T nofit.t a.o -o nofit
# RUN: llvm-readelf -l nofit | FileCheck %s --check-prefix=NOFIT
## min is page-aligned, base = alignDown(min, page) = min, so min - base == 0
## and allocating would add a whole page => headers dropped.
# RUN: ld.lld -T page.t a.o -o page -z max-page-size=0x1000
# RUN: llvm-readelf -l page | FileCheck %s --check-prefix=NOFIT
## Explicit FILEHDR/PHDRS but headers cannot fit => error.
# RUN: not ld.lld -T explicit-nofit.t a.o 2>&1 | FileCheck %s --check-prefix=ERR
# ERR: error: could not allocate headers
# FIT: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
# FIT-NEXT: PHDR 0x000040 0x0000000000000040 0x0000000000000040 0x0000e0 0x0000e0 R 0x8
# FIT-NEXT: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x000120 0x000120 R 0x1000
# FIT-NEXT: LOAD 0x000120 0x0000000000000120 0x0000000000000120 0x000001 0x000001 R E 0x1000
# FIT: 0000000000000120 0 NOTYPE GLOBAL DEFAULT 1 _start
# FIT-NEXT: 0000000000000120 0 NOTYPE GLOBAL DEFAULT ABS _size
# NOFIT: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
# NOFIT-NEXT: LOAD
# NOFIT-NOT: PHDR
#--- a.s
.globl _start
_start:
ret
#--- fit.t
SECTIONS {
. = SIZEOF_HEADERS;
_size = SIZEOF_HEADERS;
.text : { *(.text) }
}
#--- nofit.t
SECTIONS { . = SIZEOF_HEADERS - 4; .text : { *(.text) } }
#--- page.t
SECTIONS { . = 0x1000; .text : { *(.text) } }
#--- explicit-nofit.t
PHDRS { foobar PT_LOAD FILEHDR PHDRS; }
SECTIONS { .text : { *(.text) } : foobar }