| ... | ... | @@ -24,6 +24,7 @@ pub fn build(b: *Build) void { |
| 24 | 24 | // Exercise linker in -r mode |
| 25 | 25 | elf_step.dependOn(testEmitRelocatable(b, .{ .use_llvm = false, .target = musl_target })); |
| 26 | 26 | elf_step.dependOn(testEmitRelocatable(b, .{ .target = musl_target })); |
| 27 | elf_step.dependOn(testRelocatableEhFrame(b, .{ .target = musl_target })); |
| 27 | 28 | |
| 28 | 29 | // Exercise linker in ar mode |
| 29 | 30 | elf_step.dependOn(testEmitStaticLib(b, .{ .target = musl_target })); |
| ... | ... | @@ -2139,6 +2140,48 @@ fn testPreinitArray(b: *Build, opts: Options) *Step { |
| 2139 | 2140 | return test_step; |
| 2140 | 2141 | } |
| 2141 | 2142 | |
| 2143 | fn testRelocatableEhFrame(b: *Build, opts: Options) *Step { |
| 2144 | const test_step = addTestStep(b, "relocatable-eh-frame", opts); |
| 2145 | |
| 2146 | const obj = addObject(b, "obj", opts); |
| 2147 | addCppSourceBytes(obj, |
| 2148 | \\#include <stdexcept> |
| 2149 | \\int try_me() { |
| 2150 | \\ throw std::runtime_error("Oh no!"); |
| 2151 | \\} |
| 2152 | , &.{}); |
| 2153 | addCppSourceBytes(obj, |
| 2154 | \\extern int try_me(); |
| 2155 | \\int try_again() { |
| 2156 | \\ return try_me(); |
| 2157 | \\} |
| 2158 | , &.{}); |
| 2159 | obj.linkLibCpp(); |
| 2160 | |
| 2161 | const exe = addExecutable(b, "test", opts); |
| 2162 | addCppSourceBytes(exe, |
| 2163 | \\#include <iostream> |
| 2164 | \\#include <stdexcept> |
| 2165 | \\extern int try_again(); |
| 2166 | \\int main() { |
| 2167 | \\ try { |
| 2168 | \\ try_again(); |
| 2169 | \\ } catch (const std::exception &e) { |
| 2170 | \\ std::cout << "exception=" << e.what() << std::endl; |
| 2171 | \\ } |
| 2172 | \\ return 0; |
| 2173 | \\} |
| 2174 | , &.{}); |
| 2175 | exe.addObject(obj); |
| 2176 | exe.linkLibCpp(); |
| 2177 | |
| 2178 | const run = addRunArtifact(exe); |
| 2179 | run.expectStdOutEqual("exception=Oh no!"); |
| 2180 | test_step.dependOn(&run.step); |
| 2181 | |
| 2182 | return test_step; |
| 2183 | } |
| 2184 | |
| 2142 | 2185 | fn testSharedAbsSymbol(b: *Build, opts: Options) *Step { |
| 2143 | 2186 | const test_step = addTestStep(b, "shared-abs-symbol", opts); |
| 2144 | 2187 | |