Files
TheRock/debug-tools/rocgdb/source/ld/testsuite/ld-loongarch-elf/pic.exp
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

210 lines
5.0 KiB
Plaintext

# Expect script for LoongArch ELF linker tests
# Copyright (C) 2022-2024 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
#
if ![istarget loongarch*-*-*] {
return
}
global verbose
set old_verbose verbose
# set verbose 3
# Check to see if the C compiler works
if { ![check_compiler_available] } {
return
}
set testname "nopic link test pre build"
set pre_builds [list \
[list \
"$testname" \
"-shared $NOSANITIZE_CFLAGS" \
"-fPIC $NOSANITIZE_CFLAGS" \
{libnopic-global.s} \
{} \
"libnopic-global.so" \
] \
]
# 0:name
# 1:ld or ar options
# 2:compile options
# 3:filenames of source files
# 4:action and options.
# 5:name of output file
# 6:language (optional)
run_cc_link_tests $pre_builds
set testname "nopic link test"
set link_tests [list \
[list \
"$testname readelf -s/-x nopic-local" \
"-T pic.ld" "" \
"" \
{ nopic-local.s } \
[list \
[list readelf -s nopic-local.sd] \
[list readelf "-x .data" nopic-local.xd] \
] \
"nopic-local" \
] \
[list \
"$testname readelf -s/-x nopic-weak-local" \
"-T pic.ld" "" \
"" \
{nopic-weak-local.s} \
[list \
[list readelf -s nopic-weak-local.sd] \
[list readelf "-x .data" nopic-weak-local.xd] \
] \
"nopic-weak-local" \
] \
[list \
"$testname readelf -s/-x nopic-global" \
"-T pic.ld" "" \
"" \
{nopic-global.s libnopic-global.s} \
[list \
[list readelf -s nopic-global.sd] \
[list readelf "-x .data" nopic-global.xd] \
] \
"nopic-global" \
] \
[list \
"$testname readelf -s/-x nopic-weak-global" \
"-T pic.ld" "" \
"" \
{nopic-weak-global.s libnopic-global.s} \
[list \
[list readelf -s nopic-weak-global.sd] \
[list readelf "-x .data" nopic-weak-global.xd] \
] \
"nopic-weak-global" \
] \
]
# Since the c library path may be different in different
# Distributions, the test program can link to the c library
# using the gcc instead of ld to avoid system impact.
run_ld_link_tests $link_tests
set link_tests_libc [list \
[list \
"$testname readelf -s/-r nopic-global-so" \
"-L./tmpdir -lnopic-global -L/usr/lib -lc" "" \
{nopic-global.s} \
{{readelf {-s} nopic-global-so.sd} \
{readelf {-r} nopic-global-so.rd}} \
"nopic-global-so" \
] \
[list \
"$testname readelf -s/-x nopic-weak-global-so" \
"-L./tmpdir -lnopic-global -L/usr/lib -lc" "" \
{nopic-weak-global.s} \
{{readelf {-s} nopic-weak-global-so.sd} \
{readelf {-r} nopic-weak-global-so.rd}} \
"nopic-weak-global-so" \
] \
]
# 0:name
# 1:ld/ar leading options, placed before object files
# 2:ld/ar trailing options, placed after object files
# 3:assembler options
# 4:filenames of assembler files
# 5:list of actions, options and expected outputs.
# 6:name of output file
# 7:compiler flags (optional)
run_cc_link_tests $link_tests_libc
set testname "nopic link exec test"
set link_exec_tests [list \
[list \
"$testname" \
"" "" \
{ nopic-local.s } \
"nopic-local" \
"nopic-local.out" \
] \
[list \
"$testname" \
"" "" \
{ nopic-weak-local.s } \
"nopic-weak-local" \
"nopic-weak-local.out" \
] \
[list \
"$testname" \
"" "" \
{ nopic-global.s libnopic-global.s } \
"nopic-global" \
"nopic-global.out" \
] \
[list \
"$testname" \
"-L./tmpdir -lnopic-global -lc -Wl,-rpath=./tmpdir -no-pie" "" \
{ nopic-global.s } \
"nopic-global-so" \
"nopic-global.out" \
] \
[list \
"$testname" \
"" "" \
{ nopic-weak-global.s libnopic-global.s } \
"nopic-weak-global" \
"nopic-weak-global.out" \
] \
[list \
"$testname" \
"-L./tmpdir -lnopic-global -lc -Wl,-rpath=./tmpdir -no-pie" "" \
{ nopic-weak-global.s } \
"nopic-weak-global-so" \
"nopic-weak-global.out" \
] \
]
# ldtests contains test-items with 3 items followed by 1 lists, 2 items
# and 3 optional items:
# 0:name
# 1:ld leading options, placed before object files
# 2:assembler options
# 3:filenames of source files
# 4:name of output file
# 5:expected output
# 6:compiler flags (optional)
# 7:language (optional)
# 8:linker warning (optional)
# 9:ld trailing options, placed after object files (optional)
run_ld_link_exec_tests $link_exec_tests
#set verbose old_verbose