|
167 | 167 | @test isfile(implibpath) |
168 | 168 | end |
169 | 169 | end |
| 170 | + |
| 171 | + # https://github.com/JuliaLang/JuliaC.jl/pull/69 |
| 172 | + @testset "`ld_flags` passes flags to compiler (Linux + MacOS)" begin |
| 173 | + if Sys.islinux() || Sys.isapple() |
| 174 | + outdir = mktempdir() |
| 175 | + libname = "libhasdebugtest" |
| 176 | + libout = joinpath(outdir, libname) |
| 177 | + rpath = "this/tests/ld/flags/" |
| 178 | + link = JuliaC.LinkRecipe( |
| 179 | + image_recipe=img_lib, |
| 180 | + outname=libout, |
| 181 | + ld_flags=["-Wl,-rpath,$(rpath)"] |
| 182 | + ) |
| 183 | + JuliaC.link_products(link) |
| 184 | + bun = JuliaC.BundleRecipe(link_recipe=link, output_dir=outdir) |
| 185 | + JuliaC.bundle_products(bun) |
| 186 | + |
| 187 | + libfile_name = libname * "." * Base.BinaryPlatforms.platform_dlext() |
| 188 | + libpath = joinpath(outdir, "lib", libfile_name) |
| 189 | + output = if Sys.islinux() |
| 190 | + readchomp(`$(Patchelf_jll.patchelf()) --print-rpath $(libpath)`) |
| 191 | + else |
| 192 | + output = readchomp(`otool -l $(libpath)`) |
| 193 | + end |
| 194 | + @test occursin(rpath, output) |
| 195 | + end |
| 196 | + end |
| 197 | + |
| 198 | + # https://github.com/JuliaLang/JuliaC.jl/pull/69 |
| 199 | + @testset "`ld_flags` passes flags to compiler (Windows)" begin |
| 200 | + if Sys.iswindows() |
| 201 | + outdir = mktempdir() |
| 202 | + libname = "libhasdebugtest" |
| 203 | + libout = joinpath(outdir, libname) |
| 204 | + link = JuliaC.LinkRecipe( |
| 205 | + image_recipe=img_lib, |
| 206 | + outname=libout, |
| 207 | + ld_flags=[ |
| 208 | + "-Wl,--major-image-version,32767", |
| 209 | + "-Wl,--minor-image-version,32767" |
| 210 | + ] |
| 211 | + ) |
| 212 | + JuliaC.link_products(link) |
| 213 | + bun = JuliaC.BundleRecipe(link_recipe=link, output_dir=outdir) |
| 214 | + JuliaC.bundle_products(bun) |
| 215 | + |
| 216 | + libfile_name = libname * "." * Base.BinaryPlatforms.platform_dlext() |
| 217 | + libpath = joinpath(outdir, "bin", libfile_name) |
| 218 | + output = read(`objdump -p $(libpath)`, String) |
| 219 | + @test occursin(r"MajorImageVersion\s+65535", output) |
| 220 | + @test occursin(r"MinorImageVersion\s+65535", output) |
| 221 | + end |
| 222 | + end |
170 | 223 | end |
171 | 224 |
|
172 | 225 | @testset "Programmatic binary (trim)" begin |
|
0 commit comments