From 1e2acab558523fbfda43e1983865cf868f701286 Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Sun, 14 Jul 2024 21:21:11 +0200 Subject: [PATCH 01/12] rust detector --- linux-glibc-detectors/Cargo.lock | 16 +++++ linux-glibc-detectors/Cargo.toml | 14 ++++ linux-glibc-detectors/src/main.rs | 19 ++++++ src/lib.rs | 12 ++-- src/linux-glibc-detectors/README.md | 24 ------- .../glibc-detector-aarch64 | Bin 6160 -> 0 bytes .../glibc-detector-armv7l | Bin 5572 -> 0 bytes src/linux-glibc-detectors/glibc-detector-i686 | Bin 13716 -> 0 bytes .../glibc-detector-ppc64le | Bin 67616 -> 0 bytes .../glibc-detector-s390x | Bin 6136 -> 0 bytes .../glibc-detector-x86_64 | Bin 14416 -> 0 bytes src/linux-glibc-detectors/glibc-detector.c | 16 ----- src/linux-glibc-detectors/rebuild.py | 62 ------------------ 13 files changed, 55 insertions(+), 108 deletions(-) create mode 100644 linux-glibc-detectors/Cargo.lock create mode 100644 linux-glibc-detectors/Cargo.toml create mode 100644 linux-glibc-detectors/src/main.rs delete mode 100644 src/linux-glibc-detectors/README.md delete mode 100644 src/linux-glibc-detectors/glibc-detector-aarch64 delete mode 100644 src/linux-glibc-detectors/glibc-detector-armv7l delete mode 100644 src/linux-glibc-detectors/glibc-detector-i686 delete mode 100644 src/linux-glibc-detectors/glibc-detector-ppc64le delete mode 100644 src/linux-glibc-detectors/glibc-detector-s390x delete mode 100644 src/linux-glibc-detectors/glibc-detector-x86_64 delete mode 100644 src/linux-glibc-detectors/glibc-detector.c delete mode 100644 src/linux-glibc-detectors/rebuild.py diff --git a/linux-glibc-detectors/Cargo.lock b/linux-glibc-detectors/Cargo.lock new file mode 100644 index 0000000..9358c35 --- /dev/null +++ b/linux-glibc-detectors/Cargo.lock @@ -0,0 +1,16 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "linux-glibc-detector" +version = "0.1.0" +dependencies = [ + "libc", +] diff --git a/linux-glibc-detectors/Cargo.toml b/linux-glibc-detectors/Cargo.toml new file mode 100644 index 0000000..eec4460 --- /dev/null +++ b/linux-glibc-detectors/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "linux-glibc-detector" +version = "0.1.0" +edition = "2021" + +[dependencies] +libc = "0.2.155" + +[profile.release] +strip = true +opt-level = "z" +lto = true +codegen-units = 1 +panic = "abort" \ No newline at end of file diff --git a/linux-glibc-detectors/src/main.rs b/linux-glibc-detectors/src/main.rs new file mode 100644 index 0000000..c76c967 --- /dev/null +++ b/linux-glibc-detectors/src/main.rs @@ -0,0 +1,19 @@ +#![no_std] +#![no_main] + +extern crate libc; + +#[no_mangle] +pub extern "C" fn main(_argc: isize, _argv: *const *const u8) -> isize { + // Since we are passing a C string the final null character is mandatory. + const HELLO: &'static str = "Hello, world!\n\0"; + unsafe { + libc::printf(HELLO.as_ptr() as *const _); + } + 0 +} + +#[panic_handler] +fn my_panic(_info: &core::panic::PanicInfo) -> ! { + loop {} +} \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 138f57d..24e2148 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,11 +21,11 @@ fn glibc_detectors() -> Vec<(&'static str, &'static [u8])> { { detectors.push(( "x86_64", - include_bytes!("./linux-glibc-detectors/glibc-detector-x86_64").as_slice(), + include_bytes!("../linux-glibc-detectors/glibc-detector-x86_64").as_slice(), )); detectors.push(( "i686", - include_bytes!("./linux-glibc-detectors/glibc-detector-i686").as_slice(), + include_bytes!("../linux-glibc-detectors/glibc-detector-i686").as_slice(), )); } @@ -33,11 +33,11 @@ fn glibc_detectors() -> Vec<(&'static str, &'static [u8])> { { detectors.push(( "aarch64", - include_bytes!("./linux-glibc-detectors/glibc-detector-aarch64").as_slice(), + include_bytes!("../linux-glibc-detectors/glibc-detector-aarch64").as_slice(), )); detectors.push(( "armv7l", - include_bytes!("./linux-glibc-detectors/glibc-detector-armv7l").as_slice(), + include_bytes!("../linux-glibc-detectors/glibc-detector-armv7l").as_slice(), )); } @@ -45,7 +45,7 @@ fn glibc_detectors() -> Vec<(&'static str, &'static [u8])> { { detectors.push(( "ppc64le", - include_bytes!("./linux-glibc-detectors/glibc-detector-ppc64le").as_slice(), + include_bytes!("../linux-glibc-detectors/glibc-detector-ppc64le").as_slice(), )); } @@ -53,7 +53,7 @@ fn glibc_detectors() -> Vec<(&'static str, &'static [u8])> { { detectors.push(( "s390x", - include_bytes!("./linux-glibc-detectors/glibc-detector-s390x").as_slice(), + include_bytes!("../linux-glibc-detectors/glibc-detector-s390x").as_slice(), )); } diff --git a/src/linux-glibc-detectors/README.md b/src/linux-glibc-detectors/README.md deleted file mode 100644 index af2eda2..0000000 --- a/src/linux-glibc-detectors/README.md +++ /dev/null @@ -1,24 +0,0 @@ -This file was taken from https://github.com/njsmith/posy/blob/61ff56c68a6aeff744b274170c32f59ac9ac20e1/src/platform_tags/linux-glibc-detectors/README.md -Licensed under MIT/APACHE-2.0 - -# The problem - -When running on Linux, `posy` needs to know whether glibc is -installed, and which version, for which architectures. This is -difficult because: - -- `posy` itself might be linked as a static musl binary, so it can't - use `dlopen` or call any glibc-specific functions. -- The system might support multiple architectures (e.g. x86-64 and - i386). - -# The solution - -We have a tiny little program `glibc-detector.c`, which links against -glibc, and does nothing except print out the output of `gnu_get_libc_version()` - -We built this program in a Docker container running an old distro, to -make sure it doesn't use any new glibc symbol versions, against a -variety of architectures. Then we save those executables here, so we -don't need access to an old distro at build time – and since by -definition, these executables are unlikely to change! diff --git a/src/linux-glibc-detectors/glibc-detector-aarch64 b/src/linux-glibc-detectors/glibc-detector-aarch64 deleted file mode 100644 index cf9192dfb9fbe743178cfb015d4865d0343c7e07..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6160 zcmeHLUu;xW8b5PyMH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2Jv1n+gtWrEH%o1Z{2a^JK_8u3mNkSA6y4VJl`_ z&ozl`&Uv!r_Gg`323$%3!*NR`cW1z08y&m-`5uH&L|?ch`~iZ_y31vg=qdL1XA2%z z=a-{A7qZ8=-|PJ^!V$P1DKADt_CER1{~h9VR1BYSMAeKM=6l)^@wdt&MEMWG@GYJN zj?er+WFBF@;B(3T{(y$80r|`y#Q8d5*|w4+$metXsOrgQJ|Z&zz|Akw_1g%oJnQ81 z`6kNuzZAw#KjK!{BzI6|{vgJMj3V*N*oWeW;Fg(`*l zkjVTge3?s>{~UA@m!^fw|D*6d!n_L?zeMl|L^LJ|E~ytQpYErB2h6q z|4HcO+k)>;zTf%(Ueup5@ojK#2=V#;pV9*a{ovvk%EW1CW$$o&zPI@Q>8##A?l1Cq zU)~2-T*yDD@Bf1m6iU*+{%|3mI0I9d&-23><#+r*^;_f-KacSFe_@LT$T-;zd6ZA1 xAv(sN)c;qKN{ssJa*%GmLQ8Zlmo-6yeCAJ@$qysPrjOt@9sgWdi8gsu{~yL!c-a5| diff --git a/src/linux-glibc-detectors/glibc-detector-armv7l b/src/linux-glibc-detectors/glibc-detector-armv7l deleted file mode 100644 index 9c5112067e6a257428996709eaed115e8f61c4b4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5572 zcmeHLYitx%6u#5lw%cWe6}F|cL|5z&RCZ{f!Aem3Shp>uh@==rl4Z6#w1fL{cZ#K; zp#H&xh{i73d1(3+5-oI*4~@4Xclrzmd{eo=*3y{Kb6^d~7IGQa$-H;KCMc@yjSaH`Jj5$ZK(1N5Oz;PKb!_|wp z7ja?=KEb%WhZOh{L9`Px_DI%@!u^{t-wUiqymqubC?W z^B-lL9YGvomZe*~%%ooqXoZ%;U?r}cg#W9sSNp7vNWq4#Q$81wq$$wb)B3)|Eg ziG|zbs+3u4V_Teed;iJb;xmj}$XQd!;GUch+f&dDm~Z+`1>IcG!Gc~4U5zzbLXE|5 zq^=ZV6?GN*fv!Q^ON|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ST!%g=zuOncb z$JoZ}pJpCi0^y%8God~oKo72iyb72kPoEMVMr-W%Q{-IK`b^|5*PYJ}pKW3oR~+cMR*Om!_& zUCUI@vTuEqp1w6Y*m`bQ!7cVtz>~bb9p>eZnW}+Nu5HCV?VYn&@AIR3zTG!E=ho3T z_59N0iYfA0t~F0DIrNRZL7Z;VbAz7O>G=aa%&czY<7c|^>;~wo4>Sea`9tOV=3Szf zBzb(@bz>xNlAI>_n@!i9C0TG?mo5bJBa(bT^!^V#^OUJBMgvWC0Z-RRw)ZL5I7x2o z$LFL-I)@}T{*Mr$r;c*G zQa*1iZbsvVtF1=YT`K@3%xHaUu3ayAd#;-@j!C>LW97dh<2JGXTgE!C)^X3|m=dxX z7i8b=S^m#>qKJHF-JPA^bPgO(^`#RTCmi~EsP%B$LEAAVlpn|!a)m^n38gcIRBqUW zGTA~Z6zw>5xRB_VQGaG6)HjkIOdd`rO^8PWiTr>GB`;_4mxrt@zry?;)KUgPziRjK!?r14m5pXFJ4_>R(ey_Zz#eX8}VpUUr0Jl}ab z)_YH-Lw0UlKkuE^&pK}3qlcMlyxzMi_1@L_HD1@xpCQM0(8Epd`LeWX!|@N&QyKp( z>9{WaT`G4(@m;d{o8uo)e~KP|e6Pf*{K?i2mKW)G@2%Glsq2r|-(i*ew_Lp*uhrkC zX~6Lhh_X?BP*qm?>saN_C0_YAOT5Zsl2?Vs>3F6h{=CGiys3^NE8}NLUr&!>(*GTE z>o!35OTx?hr~22)@OfXn{x6yTFXP{!Smvkm>+j=-j3H=S2?f29s@xyG9f&PHv+ z3jMI|Dt=`lX078g8Mt4bUnXpo_;5MUb~H}qJEZo{AC~yA zr!_|F)HE8W<0b0&=RYa&CndhpU&_~T^8xi(SGi7&Z!UYh}t*4nq6lQRFmwp3nE H<5c}0Om@>B diff --git a/src/linux-glibc-detectors/glibc-detector-s390x b/src/linux-glibc-detectors/glibc-detector-s390x deleted file mode 100644 index d2c2a24b99131638f433c8b19cdd97fe05778581..0000000000000000000000000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z=g$jM;b#bji&+7}NF{*2KT~@z#d2rX{)t@NneNv)=K4;G`9*#6?m+b<3GPho35I*F`Rl3s z7T2l!H+*SJr2e@;SiE%mNAPN(y=^CU+Og9n`dDH;De0$YevLY0av-Q;}5-tmk+4Hu3Ic2Pw<@E47L2?0@RBQmLJN zt%hE!@qzl)KdGBiJ2%{S$K9KP*O|t~c?S1)nhe0TeZh(e5QJjWzW>?v08pp>ssx8)=dBfs?67|18Z{-wy}eoOps8?diD+-|3=gI+<{v2S+ou3h)q zExQv#$#}-@a_)B8TRXStic(H~Jn!fH_>gjv8QK$kOgWjXpKxM5eXV|cOeETR>WpQn;wL8Q zOq-dLQ9ZpiV8s)5&4#OV;Pe)VUzeP(H7m z;cPmc$nZZIzJbE)oYxH2?@GUmKvP&>kbgjx%00#5-vQWg6qMyy*8Y%cmHf-n5#Xk> zr>=zg9i+ZWYa9KqlLZb0AJ;#wGlbni70v3dH4r{=*OW81eaD02%iKpiOoz;r?r_Qjb%Ga|%B0N5ENeMEl|K z^D<<9kNDyK2E_f4`Fsxy^M64)UQ@Uqmp9y=dAU+2`2#@~-;RpYNWG9_$U|@tZA@T;*YgDo5z~>S^@9}$`us>wr zo5ZcJ;N$zig8ZHde&iAq$iNGv<+X?Q@%e<`L(TEvs9=49hj~0nHg*9Yzwdazjaf>y zXegh-2VNvgC0|9wwO!-?;{PqgZxMcr@X=3+`nCMelY#q!{&xw#OZey~_>vBY>hDxz eow%3v;NyE44B%HH+J+C~palF^rIPC4LH!>$f+$n~ diff --git a/src/linux-glibc-detectors/glibc-detector.c b/src/linux-glibc-detectors/glibc-detector.c deleted file mode 100644 index 7060e6a..0000000 --- a/src/linux-glibc-detectors/glibc-detector.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Taken from https://github.com/njsmith/posy/blob/61ff56c68a6aeff744b274170c32f59ac9ac20e1/src/platform_tags/linux-glibc-detectors/glibc-detector.c - * Licensed under MIT/APACHE-2.0 - - * A tiny C program that tries to fetch the version of glibc that it's run - * against. - */ - -#include -#include - -int main(int argc, char** argv) -{ - puts(gnu_get_libc_version()); - return 0; -} diff --git a/src/linux-glibc-detectors/rebuild.py b/src/linux-glibc-detectors/rebuild.py deleted file mode 100644 index 27437d3..0000000 --- a/src/linux-glibc-detectors/rebuild.py +++ /dev/null @@ -1,62 +0,0 @@ -# Taken from https://github.com/njsmith/posy/blob/61ff56c68a6aeff744b274170c32f59ac9ac20e1/src/platform_tags/linux-glibc-detectors/rebuild.py -# Licensed under MIT/APACHE-2.0 - -# Note: on Ubuntu, `apt install qemu-user-static` makes it possible to run this script -# with all arches. -# -# To rebuild specific versions: -# python rebuild.py x86_64 i686 -# -# To rebuild all versions: -# python rebuild.py - -# This image uses glibc 2.28. But, it has lots of arches available, it runs well under -# qemu-user-static for me (as opposed to centos:7, where yum segfaults on arm), and -# based on 'readelf' output + experiments I believe that the particular symbols we're -# using are stable enough that 2.28 should still work fine. And if I'm wrong we can -# always fix it :-) -BASE_IMAGE = "debian:buster-slim" - -# docker platforms from the "OS/ARCH" column at -# https://hub.docker.com/_/debian?tab=tags&page=1&ordering=last_updated&name=buster -PY_ARCH_TO_DOCKER_PLATFORM = { - "x86_64": "linux/amd64", - "i686": "linux/386", - "aarch64": "linux/arm64/v8", - "armv7l": "linux/arm/v7", - "ppc64le": "linux/ppc64le", - "s390x": "linux/s390x", -} - -import sys -import os -import subprocess - -py_arches = sys.argv[1:] -if not py_arches: - py_arches = PY_ARCH_TO_DOCKER_PLATFORM.keys() - -for py_arch in py_arches: - print(f"-- Building for {py_arch} --") - docker_arch = PY_ARCH_TO_DOCKER_PLATFORM[py_arch] - exec_name = f"glibc-detector-{py_arch}" - - subprocess.run( - [ - "docker", "run", "--rm", "-it", - f"--platform={docker_arch}", - "-v", f"{os.getcwd()}:/host", - BASE_IMAGE, - "bash", "-c", - f""" - set -euxo pipefail - cd /host - #yum install -y gcc - apt update && apt install -y gcc - gcc -Os glibc-detector.c -o {exec_name} - strip {exec_name} - ./{exec_name} - """ - ], - check=True - ) From 359dae8c006e61c35969aecdd1df0f2cc19d751e Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Sun, 14 Jul 2024 22:30:36 +0200 Subject: [PATCH 02/12] workflow --- .github/workflows/glibc-detectors.yml | 55 +++++++++++++++++++++++++++ linux-glibc-detectors/.gitignore | 3 ++ linux-glibc-detectors/README.md | 20 ++++++++++ linux-glibc-detectors/src/main.rs | 10 +++-- rust-toolchain | 2 +- 5 files changed, 85 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/glibc-detectors.yml create mode 100644 linux-glibc-detectors/.gitignore create mode 100644 linux-glibc-detectors/README.md diff --git a/.github/workflows/glibc-detectors.yml b/.github/workflows/glibc-detectors.yml new file mode 100644 index 0000000..25e6947 --- /dev/null +++ b/.github/workflows/glibc-detectors.yml @@ -0,0 +1,55 @@ +on: + pull_request: + paths: + - .github/workflows/glibc-detectors.yml + - linux-glibc-detectors/** + +name: Glibc Detectors + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + RUST_LOG: info + RUST_BACKTRACE: 1 + RUSTFLAGS: "-D warnings" + CARGO_TERM_COLOR: always + +jobs: + build: + name: ${{ matrix.target }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - { name: x86_64, target: x86_64-unknown-linux-gnu } + - { name: i686, target: x86_64-unknown-linux-gnu } + - { name: aarch64, target: aarch64-unknown-linux-gnu } + - { name: armv7l, target: arm-unknown-linux-gnueabi } + - { name: ppc64, target: powerpc64-unknown-linux-gnu } + - { name: ppcle64, target: powerpc64le-unknown-linux-gnu } + - { name: s390x, target: s390x-unknown-linux-gnu } + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly-2024-07-14 + targets: ${{ matrix.target }} + + - uses: taiki-e/install-action@v2 + name: Install cargo-zigbuild + with: + tool: cargo-zigbuild@0.19.1 + + - name: Install Zig + uses: goto-bus-stop/setup-zig@v2 + with: + version: 0.12.0 + + - name: Run build + run: cargo +nightly zigbuild -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target ${{ matrix.target }} --release \ No newline at end of file diff --git a/linux-glibc-detectors/.gitignore b/linux-glibc-detectors/.gitignore new file mode 100644 index 0000000..91b8835 --- /dev/null +++ b/linux-glibc-detectors/.gitignore @@ -0,0 +1,3 @@ +/target +/Cargo.lock +.idea/ diff --git a/linux-glibc-detectors/README.md b/linux-glibc-detectors/README.md new file mode 100644 index 0000000..e8c7c79 --- /dev/null +++ b/linux-glibc-detectors/README.md @@ -0,0 +1,20 @@ +# GLibc detector + +This directory contains the source code for a very simple program to detect the glibc version using the `gnu_get_libc_version` function. + +## Building + +To build the program, we need to make sure that we link to an ancient version of glibc to ensure maximum compatiblity. +We can use [cargo zigbuild](https://github.com/rust-cross/cargo-zigbuild) to use `zig` as the linker to allow linking against a specific glibc version without having to muck about with docker images. + +To build to program, run the following commands: + +```sh +ARCH=x86_64-unknown-linux-gnu + +# Make sure you have the appropriate target to build for. +rustup target add $ARCH + +# Build the program using zigbuild +cargo +nightly zigbuild -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target $ARCH --release +``` \ No newline at end of file diff --git a/linux-glibc-detectors/src/main.rs b/linux-glibc-detectors/src/main.rs index c76c967..4fb05f2 100644 --- a/linux-glibc-detectors/src/main.rs +++ b/linux-glibc-detectors/src/main.rs @@ -1,14 +1,16 @@ #![no_std] #![no_main] +// Link with libc +#[link(name = "c")] +extern "C" {} + extern crate libc; #[no_mangle] pub extern "C" fn main(_argc: isize, _argv: *const *const u8) -> isize { - // Since we are passing a C string the final null character is mandatory. - const HELLO: &'static str = "Hello, world!\n\0"; unsafe { - libc::printf(HELLO.as_ptr() as *const _); + libc::puts(libc::gnu_get_libc_version()); } 0 } @@ -16,4 +18,4 @@ pub extern "C" fn main(_argc: isize, _argv: *const *const u8) -> isize { #[panic_handler] fn my_panic(_info: &core::panic::PanicInfo) -> ! { loop {} -} \ No newline at end of file +} diff --git a/rust-toolchain b/rust-toolchain index 25948c2..79fcd0a 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.75.0 +1.77.0 From cf7b422f32913df162ae819e75b2b61a410c6981 Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Sun, 14 Jul 2024 22:33:27 +0200 Subject: [PATCH 03/12] fix --- .github/workflows/glibc-detectors.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/glibc-detectors.yml b/.github/workflows/glibc-detectors.yml index 25e6947..fb00090 100644 --- a/.github/workflows/glibc-detectors.yml +++ b/.github/workflows/glibc-detectors.yml @@ -25,7 +25,7 @@ jobs: matrix: include: - { name: x86_64, target: x86_64-unknown-linux-gnu } - - { name: i686, target: x86_64-unknown-linux-gnu } + - { name: i686, target: i686-unknown-linux-gnu } - { name: aarch64, target: aarch64-unknown-linux-gnu } - { name: armv7l, target: arm-unknown-linux-gnueabi } - { name: ppc64, target: powerpc64-unknown-linux-gnu } @@ -52,4 +52,4 @@ jobs: version: 0.12.0 - name: Run build - run: cargo +nightly zigbuild -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target ${{ matrix.target }} --release \ No newline at end of file + run: cargo +nightly-2024-07-14 zigbuild --manifest-path linux-glibc-detectors/Cargo.toml -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target ${{ matrix.target }} --release \ No newline at end of file From f7dcb77343ce2dcedd852010550c783448efd057 Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Sun, 14 Jul 2024 22:35:20 +0200 Subject: [PATCH 04/12] components --- .github/workflows/glibc-detectors.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/glibc-detectors.yml b/.github/workflows/glibc-detectors.yml index fb00090..f9e203a 100644 --- a/.github/workflows/glibc-detectors.yml +++ b/.github/workflows/glibc-detectors.yml @@ -40,6 +40,7 @@ jobs: with: toolchain: nightly-2024-07-14 targets: ${{ matrix.target }} + components: rust-src - uses: taiki-e/install-action@v2 name: Install cargo-zigbuild From 2adc7882b272a364718cd65fe8203b43d2549ba1 Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Sun, 14 Jul 2024 22:45:21 +0200 Subject: [PATCH 05/12] add artifacts --- .github/workflows/glibc-detectors.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/glibc-detectors.yml b/.github/workflows/glibc-detectors.yml index f9e203a..c71b336 100644 --- a/.github/workflows/glibc-detectors.yml +++ b/.github/workflows/glibc-detectors.yml @@ -30,7 +30,7 @@ jobs: - { name: armv7l, target: arm-unknown-linux-gnueabi } - { name: ppc64, target: powerpc64-unknown-linux-gnu } - { name: ppcle64, target: powerpc64le-unknown-linux-gnu } - - { name: s390x, target: s390x-unknown-linux-gnu } +# - { name: s390x, target: s390x-unknown-linux-gnu } steps: - name: Checkout source code uses: actions/checkout@v4 @@ -53,4 +53,12 @@ jobs: version: 0.12.0 - name: Run build - run: cargo +nightly-2024-07-14 zigbuild --manifest-path linux-glibc-detectors/Cargo.toml -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target ${{ matrix.target }} --release \ No newline at end of file + run: cargo +nightly-2024-07-14 zigbuild --manifest-path linux-glibc-detectors/Cargo.toml -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target ${{ matrix.target }} --release + + - name: Move binary + run: mv linux-glibc-detectors/target/${{ matrix.target }}/release/linux-glibc-detectors linux-glibc-detector-${{ matrix.name }} + + - uses: actions/upload-artifact@v4 + with: + name: linux-glibc-detector-${{ matrix.name }} + path: linux-glibc-detector-${{ matrix.name }} \ No newline at end of file From 678fcbd8116d83a2fbe326e001506cfd260e72ad Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Sun, 14 Jul 2024 22:46:36 +0200 Subject: [PATCH 06/12] correct name --- .github/workflows/glibc-detectors.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/glibc-detectors.yml b/.github/workflows/glibc-detectors.yml index c71b336..15115ba 100644 --- a/.github/workflows/glibc-detectors.yml +++ b/.github/workflows/glibc-detectors.yml @@ -56,7 +56,7 @@ jobs: run: cargo +nightly-2024-07-14 zigbuild --manifest-path linux-glibc-detectors/Cargo.toml -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target ${{ matrix.target }} --release - name: Move binary - run: mv linux-glibc-detectors/target/${{ matrix.target }}/release/linux-glibc-detectors linux-glibc-detector-${{ matrix.name }} + run: mv linux-glibc-detectors/target/${{ matrix.target }}/release/linux-glibc-detector linux-glibc-detector-${{ matrix.name }} - uses: actions/upload-artifact@v4 with: From 6668355e305680c506ea914f6b3feb7fbeb48ebf Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Sun, 14 Jul 2024 22:53:34 +0200 Subject: [PATCH 07/12] detectors --- .github/workflows/glibc-detectors.yml | 3 +++ linux-glibc-detectors/bin/README.md | 1 + .../bin/linux-glibc-detector-aarch64 | Bin 0 -> 4056 bytes .../bin/linux-glibc-detector-armv7l | Bin 0 -> 2752 bytes .../bin/linux-glibc-detector-i686 | Bin 0 -> 2752 bytes .../bin/linux-glibc-detector-ppc64 | Bin 0 -> 5024 bytes .../bin/linux-glibc-detector-ppcle64 | Bin 0 -> 4528 bytes .../bin/linux-glibc-detector-x86_64 | Bin 0 -> 3424 bytes src/lib.rs | 20 ++++++------------ 9 files changed, 10 insertions(+), 14 deletions(-) create mode 100644 linux-glibc-detectors/bin/README.md create mode 100755 linux-glibc-detectors/bin/linux-glibc-detector-aarch64 create mode 100755 linux-glibc-detectors/bin/linux-glibc-detector-armv7l create mode 100755 linux-glibc-detectors/bin/linux-glibc-detector-i686 create mode 100755 linux-glibc-detectors/bin/linux-glibc-detector-ppc64 create mode 100755 linux-glibc-detectors/bin/linux-glibc-detector-ppcle64 create mode 100755 linux-glibc-detectors/bin/linux-glibc-detector-x86_64 diff --git a/.github/workflows/glibc-detectors.yml b/.github/workflows/glibc-detectors.yml index 15115ba..3d20ed7 100644 --- a/.github/workflows/glibc-detectors.yml +++ b/.github/workflows/glibc-detectors.yml @@ -1,4 +1,7 @@ on: + push: + branches: + - main pull_request: paths: - .github/workflows/glibc-detectors.yml diff --git a/linux-glibc-detectors/bin/README.md b/linux-glibc-detectors/bin/README.md new file mode 100644 index 0000000..1bf027f --- /dev/null +++ b/linux-glibc-detectors/bin/README.md @@ -0,0 +1 @@ +These files are generated on CI and copied here. Do not edit manually. \ No newline at end of file diff --git a/linux-glibc-detectors/bin/linux-glibc-detector-aarch64 b/linux-glibc-detectors/bin/linux-glibc-detector-aarch64 new file mode 100755 index 0000000000000000000000000000000000000000..deaf0db3fc7589f39e8b8668f7c4f7befe063b5f GIT binary patch literal 4056 zcmb_fO>9(E6h1SLmI@WC{3^n{zy^r(+L?}Rg&3zp6^Ik5sDT)Cc=JCx^JX&hY6>M` z7GO+d(FO!#qOfpb8%;DJ=)y!aEJ)lK5p<&|Bp4SiAoA0OwBtGVozuR&FtFh^_kQo3 z^L_W+d*8ixUJtz(f64FjffNnC1+osdIKC(c_AC+xKot655wwdaA>jY(8c3rd6YJLyM2ah=8;cj4%byK`JUVNH|FDPsHD(ciYIes6IREk1+ zsz-S_yr?S{fS}~-EEbZT#dNS(u!e?%rddtpdm=`yY=oTtI#5T6w!QL(>Vdmg&-ZIc z^Ta&}OPlzgM8AFy{)Q&}=bQKe{P^eN)(0`<(Hy9p96Nza>xZ~ws+Pt{>rMES^2|5n zmv=#XmDY^T332aL=GG>Wz*S8pYPMOm6D6}?ftf5}BZz_$2~*w#eY2=zJ{>upXJjbGpez8605_$S#v>hbSsbw>X&`+e9C z%}L64?DwPJJhe53WqRu_GHBkR`E!JxqOkB~T(^uES*xwqA1$6CF-3J|nn%}|0 zEzr>qaC`u39bgpV1JhA}GiWb6rzI}WJ{FjI5o6o2PHKUP*@gX6&>|EKvUZfd@XTN-RyiG0d)_HIMv%Oke=R{Y#Hv-Q|^ADjuaz>SqhPJMFW z{pi%BwtUkSZP~ju58n55nxpn;Z?il8YPS1>-|AO*TrG95deo#3t zHX0{qMt)Q=w_kj?JgQtr{wU7x@izyiJAPU>ruze`AJR}&v9~dH)rl!PiMD^e;wn3f z_BxmS4%#u7ZK0iXY}s=$&cBvX?&G_SMwwj5Q?BJ47m#aO=NBuweN5nM8ff28ndbgv z@8bHaQfIyFb+x}RBD~YQkC!oD^2&YjH47JWT=L1DKhGV>&-iZU-I{ggSK&Ah1CFxY z&b+;Rjvr;)X8StNC(8U;w&QF!=GTvv4+lm$|AP>!Lp3|4^KGYxjJ}Z36|@Suyj|R{ zZ^))hvnQL*CiQSvI1=pY4TicmLaJz5xp_^m(Pi}L8}hbYscr7;%oXhXP|`@1OPvP_ zIieB1V^?a3~V$&GvMs&5aN* zSnp=4oAr2nKo6-j07k*GGt~+hR@u%N{jnWE+suKH-fz|Rm%zYF+>pE5Z6vBrEN|BG zU^p#lZ1h(%MUy(1duJc8W4B#; zIp2cv9Vq!_{HjxI@V5l$?vVU)9|-m_QS_2u@MVlsO!RX92+IA#-KaH`XTsO8QeUE% z`&Dos#;8bs8NaOmTNopKj7V7OJTSpw$F21Ajp)_q(C6NN&Az9(8LweTemPzsvtA^8d@E5E*%TbKWEPMEON8_xE0Q$U2F@tN+lWm;2skz5EU} z(~o)d^Y^r)sEClU!(*R7n^MX9o&UefA=YVfSY+JITU(@{AobQY_O-Ax_i4~lbcCq9c_-2Ve2S-EZi literal 0 HcmV?d00001 diff --git a/linux-glibc-detectors/bin/linux-glibc-detector-armv7l b/linux-glibc-detectors/bin/linux-glibc-detector-armv7l new file mode 100755 index 0000000000000000000000000000000000000000..e5ee19dbe5550c2e3add3002d2fe352d964515e3 GIT binary patch literal 2752 zcmaJ@UuauZ82@gXZrSXhYBsw$=0*0bSz2-(e_rWeyBB)6jz z!9NHNakikMjA`%Qd=RN1=))!z#0Q@$__&88UF`n6bTCC!7Jt9oobE25AN=ljzVG{; zbG~!VcTV!gq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%utUqh#8SFpPYu z>@+-v$U8M7Z@B^OEvr(s%Z?bYxmCeLZe6d~KXhQ=1tX!yR;@S|s^jdV&~wmhP{6m) zYf;cVHH!O@8ij_og?DSbVkqFP0d$S!l z2BVjRwNcq8F_>52E7RBiNc2q0!1~s~_gdeNc;OZc$#668HO8?%^)KJ`eSgUZ;rFxKJ7&LG6^=%{mFN;D z8=ai}0qZUO0(&~rvGf~syzb3KM^`hBOfQbSdemEKQwg6kVGP8X%kwvVfBM#)`I*yU znpf|(xT%>hY3{sp)o=0qkoUdF=^J*O23?2^JN63Utwj7=dj-KS&(Io2k{b0jho zpM&@p+h7#{vAh7ff03tDV0ihu9P=~_bS~F1W{>jBp9Dzy%lFIhMK{5wU@b9^{^1>B z67Ly#e+E3U1@;o+_!CTOYE?I*HSUfU*Zbmntjn?U z1-E!Y>&#_Lvp1K`rL{yXk?e}4y5c=MMW$#v`TIF3J*M|+odwq&ukPyZ&f9LGmew=n zQuj$aPbzg+x?FavZp9qel9^PWX~xrOvoD!VXL}M!E1v3mt|yVnKAT7+;>ma_*V~gd zcZwm~dDE)w(uRiiYH_)Y5W4NSR%Kl1PT95e{(%Esu9+8l_JmVCQ4%^n3A*|cG!KkQ z5G$C~g3yB}b6of&j9Q>+Uz?b2D^Da48?BXc7w-0Ce%G(T-CP^ zHhUjo+2`za&ZpKTk9eu!Baiol;5|{occF{`+#B+EKMB5H^L(uJ7(m_tz{RzPN z$m4Hn9X!Q>OY*2M0E)-&-!<^K&q`E%pTR*M&z`aX-sgcSpNtV-0J1je72-n_`&GlH HB8T!1!0W(* literal 0 HcmV?d00001 diff --git a/linux-glibc-detectors/bin/linux-glibc-detector-ppc64 b/linux-glibc-detectors/bin/linux-glibc-detector-ppc64 new file mode 100755 index 0000000000000000000000000000000000000000..b660914940f4f3127866e8b3ff0d57f495fddb9c GIT binary patch literal 5024 zcmdT|U2I%O6+ZW_?QFaba%q9IsoEPFp^d1o?X|Htbr9>MX;amTOaUoEp!MA!@2+a^ z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lge+@3OsN zc)37TJaGJ5f)e|aMjA9Y&sgj1{!81jYli1L0VQ@*BMoUYxPK2ATg?~qd8qwjXBlDd z8XG%a*&S``^{X3$toU7S!q)Q>K8p7DZbzyAd%LmH^z)ASEq2D;^td}VQmvHA{?a)o zxtRC7sl~!#&Pk1>CP&7mN5&_PQhv#+mb#j0cg&q~l4akoH(wYXEmi#TO3uyKmPgN5 zO6R8Q`q)G&U-&{Ql^UNMpI)4rD0oL{ zu2Oxy*m%L2n|sk2S7C_UO4Tnm>f}~ye$kyh@ydwrmB=let2WOqlZ#gjSKchbMz*2* z%3iZfu70w{2j3_zc|3q=)t7v7i{M8JYNA?ti$S_>Pc!!kpvi z_fGJABVom#ZN4kyT#H_v6I=iW$zjJ(G3Qk=e3!`i7yX9z4eo~)>^Q2#~;#(+;@TgCU-z$kjB_hlzvEj##cjq65rgL!TmWO(sEPQk=tKEmGO*TeisDQ z??O1f&5-^C+9>_^6a+{Muvss^Lt%XhyyRoz4>;gZ1cUE7O?UHUdj&PB&u|Cy z83jaNH7FqQ*!y?M_kL4KX;DPcX{4nCs4s=dwo zzka_B4-nSBxrct;=nc}Gwu5I_{}x!uU;mBedq@7CK;#5U-3YJWPeI9dw$Ypa2auq( z4xg|_+QZ;~h8l@)zK2M#M+^5J`{#S;@30e&y}|CgyXJfJ>?8S@{N=qxP@O*`RUrOs z{1UY{|KK|@`2W;(rRqMy`rm*STgQ(ju4z}nuF$l^pUpp@N_@U2LM70@7b3YS{)~S{ T)p5C}rwko4=0*?Q)zg0g_d*Un literal 0 HcmV?d00001 diff --git a/linux-glibc-detectors/bin/linux-glibc-detector-ppcle64 b/linux-glibc-detectors/bin/linux-glibc-detector-ppcle64 new file mode 100755 index 0000000000000000000000000000000000000000..38848c860b16c96abc0a7c3a24ca6c0920bf6f48 GIT binary patch literal 4528 zcmbVPUu;ul6hH0$P{uGrL8lnFQ({VFcWqa<%0^s={EH14s0lG>cl&2;L)R|tohi_{ zGBA~^+{-jMx57MGPT~P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@fTpAUGNbjSQ*u zoK?=>;Ed`)J*o{BY|;gwvVb;cz$<3618WBN=N*C5z<~+3FrGnH<+bZWyKXV%g4C=apWr z*je4!mk8KaUg?>W<=V-T(&;MEaf38>%&KQASha%Ey*G1g(pR%{77w8GY{AS`ty0!3 zWJr&m((UYm&5?`r&JnortWq&egH}jKlPzV-)Tk9`MB7T;;x4px=X&P{cUimd3=Dwt zfj-wW*F5;`{^#J2`b7UOYH-bik8=QA5Jx^o92@5e=VvGBxJJQ89RqP*q@1tEf&W9q z=bA?!br00Y&Vu-@`R^s$S`#1V5Xg5l3*sYxPpi}cYVa9He4JZgP#nQWeBcvgXB+sq zCxEyoWSHys8~TT-!DE4sdkZ)#j);%^vHmk;Z?2zq-&Hb<8w+j56ZACmUy_LdPd7VL z8}Xs83m^9=zE|-b`w1Kcy?@CY$`@MrxF;{j#mn{CELeBwUZw`;kNCJ(FA5*`J^Wkw zuL&3Hi|=N9-?o1LV*Z%NS&0umzFRc;BhnC95PYc5QG@eGok2e){Ewj!WM3BGd(=j3 R*C4Ooh5uo*lG@-w{WlDFUNHaw literal 0 HcmV?d00001 diff --git a/src/lib.rs b/src/lib.rs index 24e2148..ec155d4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,11 +21,11 @@ fn glibc_detectors() -> Vec<(&'static str, &'static [u8])> { { detectors.push(( "x86_64", - include_bytes!("../linux-glibc-detectors/glibc-detector-x86_64").as_slice(), + include_bytes!("../linux-glibc-detectors/bin/linux-glibc-detector-x86_64").as_slice(), )); detectors.push(( "i686", - include_bytes!("../linux-glibc-detectors/glibc-detector-i686").as_slice(), + include_bytes!("../linux-glibc-detectors/bin/linux-glibc-detector-i686").as_slice(), )); } @@ -33,11 +33,11 @@ fn glibc_detectors() -> Vec<(&'static str, &'static [u8])> { { detectors.push(( "aarch64", - include_bytes!("../linux-glibc-detectors/glibc-detector-aarch64").as_slice(), + include_bytes!("../linux-glibc-detectors/bin/linux-glibc-detector-aarch64").as_slice(), )); detectors.push(( "armv7l", - include_bytes!("../linux-glibc-detectors/glibc-detector-armv7l").as_slice(), + include_bytes!("../linux-glibc-detectors/bin/linux-glibc-detector-armv7l").as_slice(), )); } @@ -45,18 +45,10 @@ fn glibc_detectors() -> Vec<(&'static str, &'static [u8])> { { detectors.push(( "ppc64le", - include_bytes!("../linux-glibc-detectors/glibc-detector-ppc64le").as_slice(), + include_bytes!("../linux-glibc-detectors/bin/linux-glibc-detector-ppc64le").as_slice(), )); } - - #[cfg(target_arch = "s390x")] - { - detectors.push(( - "s390x", - include_bytes!("../linux-glibc-detectors/glibc-detector-s390x").as_slice(), - )); - } - + detectors } From 3da85c0d093f42ecb2f1c033352905f41e200514 Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Sun, 14 Jul 2024 22:54:23 +0200 Subject: [PATCH 08/12] fmt --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index ec155d4..41ddad1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -48,7 +48,7 @@ fn glibc_detectors() -> Vec<(&'static str, &'static [u8])> { include_bytes!("../linux-glibc-detectors/bin/linux-glibc-detector-ppc64le").as_slice(), )); } - + detectors } From ef46dc1d78511e319bc06966c1ac36e935bf50d2 Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Sun, 14 Jul 2024 23:01:50 +0200 Subject: [PATCH 09/12] detector --- .github/workflows/glibc-detectors.yml | 2 +- ...etector-ppcle64 => linux-glibc-detector-ppc64le} | Bin src/lib.rs | 2 +- src/main.rs | 3 +++ 4 files changed, 5 insertions(+), 2 deletions(-) rename linux-glibc-detectors/bin/{linux-glibc-detector-ppcle64 => linux-glibc-detector-ppc64le} (100%) create mode 100644 src/main.rs diff --git a/.github/workflows/glibc-detectors.yml b/.github/workflows/glibc-detectors.yml index 3d20ed7..26fec6e 100644 --- a/.github/workflows/glibc-detectors.yml +++ b/.github/workflows/glibc-detectors.yml @@ -32,7 +32,7 @@ jobs: - { name: aarch64, target: aarch64-unknown-linux-gnu } - { name: armv7l, target: arm-unknown-linux-gnueabi } - { name: ppc64, target: powerpc64-unknown-linux-gnu } - - { name: ppcle64, target: powerpc64le-unknown-linux-gnu } + - { name: ppc64le, target: powerpc64le-unknown-linux-gnu } # - { name: s390x, target: s390x-unknown-linux-gnu } steps: - name: Checkout source code diff --git a/linux-glibc-detectors/bin/linux-glibc-detector-ppcle64 b/linux-glibc-detectors/bin/linux-glibc-detector-ppc64le similarity index 100% rename from linux-glibc-detectors/bin/linux-glibc-detector-ppcle64 rename to linux-glibc-detectors/bin/linux-glibc-detector-ppc64le diff --git a/src/lib.rs b/src/lib.rs index 41ddad1..fd7d1a8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -121,7 +121,7 @@ pub fn glibc_version() -> Option<(u32, u32)> { /// Detect the current version of `musl` `libc` by inspecting the `/lib/ld-musl-*.so.1` loaders. pub fn musl_libc_version() -> Option<(u32, u32)> { - for arch in ["x86_64", "aarch64", "i386", "armhf", "powerpc64le", "s390x"] { + for arch in ["x86_64", "aarch64", "i386", "armhf", "arm", "powerpc64le", "s390x"] { let loader = PathBuf::from(format!("/lib/ld-musl-{arch}.so.1")); if !loader.exists() { continue; diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..9e1dcb9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("{:?}", libc_detector::libc_version()); +} \ No newline at end of file From 783bb350b4733956f2c02ea0ef0cc8c25bc18d5c Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Sun, 14 Jul 2024 23:03:29 +0200 Subject: [PATCH 10/12] fixes --- src/lib.rs | 10 +++++++++- src/main.rs | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index fd7d1a8..a3fa7a2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -121,7 +121,15 @@ pub fn glibc_version() -> Option<(u32, u32)> { /// Detect the current version of `musl` `libc` by inspecting the `/lib/ld-musl-*.so.1` loaders. pub fn musl_libc_version() -> Option<(u32, u32)> { - for arch in ["x86_64", "aarch64", "i386", "armhf", "arm", "powerpc64le", "s390x"] { + for arch in [ + "x86_64", + "aarch64", + "i386", + "armhf", + "arm", + "powerpc64le", + "s390x", + ] { let loader = PathBuf::from(format!("/lib/ld-musl-{arch}.so.1")); if !loader.exists() { continue; diff --git a/src/main.rs b/src/main.rs index 9e1dcb9..8afbdf1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,3 @@ -fn main() { - println!("{:?}", libc_detector::libc_version()); -} \ No newline at end of file +fn main() { + println!("{:?}", libc_detector::libc_version()); +} From c2a8897bcfb57f0ef00e7d9187b7f024dca35178 Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Sun, 14 Jul 2024 23:07:05 +0200 Subject: [PATCH 11/12] endianess --- src/lib.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index a3fa7a2..1e72fb3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -41,7 +41,15 @@ fn glibc_detectors() -> Vec<(&'static str, &'static [u8])> { )); } - #[cfg(target_arch = "powerpc64")] + #[cfg(all(target_arch = "powerpc64", target_endian = "big"))] + { + detectors.push(( + "ppc64le", + include_bytes!("../linux-glibc-detectors/bin/linux-glibc-detector-ppc64").as_slice(), + )); + } + + #[cfg(all(target_arch = "powerpc64", target_endian = "little"))] { detectors.push(( "ppc64le", From 963316112709f8bde6c211ad0764738cd5273d9c Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Sun, 14 Jul 2024 23:11:04 +0200 Subject: [PATCH 12/12] tracing test --- Cargo.toml | 3 +++ src/lib.rs | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 6c7aa46..5a48ba1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,3 +8,6 @@ description = "Detects the runtime version of libc on Linux systems" [dependencies] tracing = "0.1.40" tempfile = "3.9.0" + +[dev-dependencies] +tracing-test = "0.2.5" diff --git a/src/lib.rs b/src/lib.rs index 1e72fb3..d2bf649 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -44,7 +44,7 @@ fn glibc_detectors() -> Vec<(&'static str, &'static [u8])> { #[cfg(all(target_arch = "powerpc64", target_endian = "big"))] { detectors.push(( - "ppc64le", + "ppc64", include_bytes!("../linux-glibc-detectors/bin/linux-glibc-detector-ppc64").as_slice(), )); } @@ -225,6 +225,7 @@ pub fn libc_version() -> Option { #[cfg(test)] mod test { use super::*; + use tracing_test::traced_test; #[test] fn test_glibc_version() { @@ -237,6 +238,7 @@ mod test { } #[test] + #[traced_test] fn test_libc_version() { let version = libc_version(); match version {