authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-10-19 19:46:23+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-10-19 19:46:23+02:00
logb8ff989fa0863984604591bfe1c54ddbf4e59806
tree55add740eb02e366636eaa9d2a33a04915eb21ed
parent3768c9537111b85c2ee99470fbb1615bc5233516

elf: force pie in tests affected by QEMU bug


1 files changed, 76 insertions(+), 0 deletions(-)

test/link/elf.zig+76
......@@ -185,6 +185,8 @@ fn testAsNeeded(b: *Build, opts: Options) *Step {
185185 exe.addLibraryPath(libbaz.getEmittedBinDirectory());
186186 exe.addRPath(libbaz.getEmittedBinDirectory());
187187 exe.linkLibC();
188 // https://github.com/ziglang/zig/issues/17619
189 exe.pie = true;
188190
189191 const run = addRunArtifact(exe);
190192 run.expectStdOutEqual("42\n");
......@@ -211,6 +213,8 @@ fn testAsNeeded(b: *Build, opts: Options) *Step {
211213 exe.addLibraryPath(libbaz.getEmittedBinDirectory());
212214 exe.addRPath(libbaz.getEmittedBinDirectory());
213215 exe.linkLibC();
216 // https://github.com/ziglang/zig/issues/17619
217 exe.pie = true;
214218
215219 const run = addRunArtifact(exe);
216220 run.expectStdOutEqual("42\n");
......@@ -396,6 +400,8 @@ fn testCopyrel(b: *Build, opts: Options) *Step {
396400 , &.{});
397401 exe.linkLibrary(dso);
398402 exe.linkLibC();
403 // https://github.com/ziglang/zig/issues/17619
404 exe.pie = true;
399405
400406 const run = addRunArtifact(exe);
401407 run.expectStdOutEqual("3 5\n");
......@@ -556,6 +562,8 @@ fn testDsoPlt(b: *Build, opts: Options) *Step {
556562 , &.{});
557563 exe.linkLibrary(dso);
558564 exe.linkLibC();
565 // https://github.com/ziglang/zig/issues/17619
566 exe.pie = true;
559567
560568 const run = addRunArtifact(exe);
561569 run.expectStdOutEqual("Hello WORLD\n");
......@@ -591,6 +599,8 @@ fn testDsoUndef(b: *Build, opts: Options) *Step {
591599 \\}
592600 , &.{});
593601 exe.linkLibC();
602 // https://github.com/ziglang/zig/issues/17619
603 exe.pie = true;
594604
595605 const run = addRunArtifact(exe);
596606 run.expectExitCode(0);
......@@ -896,6 +906,8 @@ fn testIFuncAlias(b: *Build, opts: Options) *Step {
896906 , &.{});
897907 exe.force_pic = true;
898908 exe.linkLibC();
909 // https://github.com/ziglang/zig/issues/17619
910 exe.pie = true;
899911
900912 const run = addRunArtifact(exe);
901913 run.expectExitCode(0);
......@@ -1006,6 +1018,8 @@ fn testIFuncDynamic(b: *Build, opts: Options) *Step {
10061018 addCSourceBytes(exe, main_c, &.{});
10071019 exe.linkLibC();
10081020 exe.link_z_lazy = true;
1021 // https://github.com/ziglang/zig/issues/17619
1022 exe.pie = true;
10091023
10101024 const run = addRunArtifact(exe);
10111025 run.expectStdOutEqual("Hello world\n");
......@@ -1015,6 +1029,8 @@ fn testIFuncDynamic(b: *Build, opts: Options) *Step {
10151029 const exe = addExecutable(b, "other", opts);
10161030 addCSourceBytes(exe, main_c, &.{});
10171031 exe.linkLibC();
1032 // https://github.com/ziglang/zig/issues/17619
1033 exe.pie = true;
10181034
10191035 const run = addRunArtifact(exe);
10201036 run.expectStdOutEqual("Hello world\n");
......@@ -1078,6 +1094,8 @@ fn testIFuncFuncPtr(b: *Build, opts: Options) *Step {
10781094 , &.{});
10791095 exe.force_pic = true;
10801096 exe.linkLibC();
1097 // https://github.com/ziglang/zig/issues/17619
1098 exe.pie = true;
10811099
10821100 const run = addRunArtifact(exe);
10831101 run.expectStdOutEqual("3\n");
......@@ -1107,6 +1125,8 @@ fn testIFuncNoPlt(b: *Build, opts: Options) *Step {
11071125 , &.{"-fno-plt"});
11081126 exe.force_pic = true;
11091127 exe.linkLibC();
1128 // https://github.com/ziglang/zig/issues/17619
1129 exe.pie = true;
11101130
11111131 const run = addRunArtifact(exe);
11121132 run.expectStdOutEqual("Hello world\n");
......@@ -1413,6 +1433,8 @@ fn testLargeAlignmentDso(b: *Build, opts: Options) *Step {
14131433 , &.{});
14141434 exe.linkLibrary(dso);
14151435 exe.linkLibC();
1436 // https://github.com/ziglang/zig/issues/17619
1437 exe.pie = true;
14161438
14171439 const run = addRunArtifact(exe);
14181440 run.expectStdOutEqual("Hello world");
......@@ -1447,6 +1469,8 @@ fn testLargeAlignmentExe(b: *Build, opts: Options) *Step {
14471469 , &.{});
14481470 exe.link_function_sections = true;
14491471 exe.linkLibC();
1472 // https://github.com/ziglang/zig/issues/17619
1473 exe.pie = true;
14501474
14511475 const check = exe.checkObject();
14521476 check.checkInSymtab();
......@@ -1475,6 +1499,8 @@ fn testLargeBss(b: *Build, opts: Options) *Step {
14751499 \\}
14761500 , &.{});
14771501 exe.linkLibC();
1502 // https://github.com/ziglang/zig/issues/17619
1503 exe.pie = true;
14781504
14791505 const run = addRunArtifact(exe);
14801506 run.expectExitCode(0);
......@@ -1698,6 +1724,8 @@ fn testPltGot(b: *Build, opts: Options) *Step {
16981724 exe.linkLibrary(dso);
16991725 exe.force_pic = true;
17001726 exe.linkLibC();
1727 // https://github.com/ziglang/zig/issues/17619
1728 exe.pie = true;
17011729
17021730 const run = addRunArtifact(exe);
17031731 run.expectStdOutEqual("Hello world\n");
......@@ -1912,6 +1940,8 @@ fn testTlsDso(b: *Build, opts: Options) *Step {
19121940 , &.{});
19131941 exe.linkLibrary(dso);
19141942 exe.linkLibC();
1943 // https://github.com/ziglang/zig/issues/17619
1944 exe.pie = true;
19151945
19161946 const run = addRunArtifact(exe);
19171947 run.expectStdOutEqual("5 3 5 3 5 3\n");
......@@ -2061,6 +2091,8 @@ fn testTlsGdNoPlt(b: *Build, opts: Options) *Step {
20612091 exe.linkLibrary(a_so);
20622092 exe.linkLibrary(b_so);
20632093 exe.linkLibC();
2094 // https://github.com/ziglang/zig/issues/17619
2095 exe.pie = true;
20642096
20652097 const run = addRunArtifact(exe);
20662098 run.expectStdOutEqual("1 2 3 4 5 6\n");
......@@ -2074,6 +2106,8 @@ fn testTlsGdNoPlt(b: *Build, opts: Options) *Step {
20742106 exe.linkLibrary(b_so);
20752107 exe.linkLibC();
20762108 // exe.link_relax = false; // TODO
2109 // https://github.com/ziglang/zig/issues/17619
2110 exe.pie = true;
20772111
20782112 const run = addRunArtifact(exe);
20792113 run.expectStdOutEqual("1 2 3 4 5 6\n");
......@@ -2117,6 +2151,8 @@ fn testTlsGdToIe(b: *Build, opts: Options) *Step {
21172151 exe.addObject(b_o);
21182152 exe.linkLibrary(dso);
21192153 exe.linkLibC();
2154 // https://github.com/ziglang/zig/issues/17619
2155 exe.pie = true;
21202156
21212157 const run = addRunArtifact(exe);
21222158 run.expectStdOutEqual("1 2 3\n");
......@@ -2132,6 +2168,8 @@ fn testTlsGdToIe(b: *Build, opts: Options) *Step {
21322168 exe.addObject(b_o);
21332169 exe.linkLibrary(dso);
21342170 exe.linkLibC();
2171 // https://github.com/ziglang/zig/issues/17619
2172 exe.pie = true;
21352173
21362174 const run = addRunArtifact(exe);
21372175 run.expectStdOutEqual("1 2 3\n");
......@@ -2211,6 +2249,8 @@ fn testTlsIe(b: *Build, opts: Options) *Step {
22112249 exe.addObject(main_o);
22122250 exe.linkLibrary(dso);
22132251 exe.linkLibC();
2252 // https://github.com/ziglang/zig/issues/17619
2253 exe.pie = true;
22142254
22152255 const run = addRunArtifact(exe);
22162256 run.expectStdOutEqual(exp_stdout);
......@@ -2223,6 +2263,8 @@ fn testTlsIe(b: *Build, opts: Options) *Step {
22232263 exe.linkLibrary(dso);
22242264 exe.linkLibC();
22252265 // exe.link_relax = false; // TODO
2266 // https://github.com/ziglang/zig/issues/17619
2267 exe.pie = true;
22262268
22272269 const run = addRunArtifact(exe);
22282270 run.expectStdOutEqual(exp_stdout);
......@@ -2270,6 +2312,8 @@ fn testTlsLargeAlignment(b: *Build, opts: Options) *Step {
22702312 exe.addObject(c_o);
22712313 exe.linkLibrary(dso);
22722314 exe.linkLibC();
2315 // https://github.com/ziglang/zig/issues/17619
2316 exe.pie = true;
22732317
22742318 const run = addRunArtifact(exe);
22752319 run.expectStdOutEqual("42 1 2 3\n");
......@@ -2282,6 +2326,8 @@ fn testTlsLargeAlignment(b: *Build, opts: Options) *Step {
22822326 exe.addObject(b_o);
22832327 exe.addObject(c_o);
22842328 exe.linkLibC();
2329 // https://github.com/ziglang/zig/issues/17619
2330 exe.pie = true;
22852331
22862332 const run = addRunArtifact(exe);
22872333 run.expectStdOutEqual("42 1 2 3\n");
......@@ -2315,6 +2361,8 @@ fn testTlsLargeTbss(b: *Build, opts: Options) *Step {
23152361 \\}
23162362 , &.{});
23172363 exe.linkLibC();
2364 // https://github.com/ziglang/zig/issues/17619
2365 exe.pie = true;
23182366
23192367 const run = addRunArtifact(exe);
23202368 run.expectStdOutEqual("3 0 5 0 0 0\n");
......@@ -2337,6 +2385,8 @@ fn testTlsLargeStaticImage(b: *Build, opts: Options) *Step {
23372385 , &.{});
23382386 exe.force_pic = true;
23392387 exe.linkLibC();
2388 // https://github.com/ziglang/zig/issues/17619
2389 exe.pie = true;
23402390
23412391 const run = addRunArtifact(exe);
23422392 run.expectStdOutEqual("1 2 3 0 5\n");
......@@ -2375,6 +2425,8 @@ fn testTlsLd(b: *Build, opts: Options) *Step {
23752425 exe.addObject(main_o);
23762426 exe.addObject(a_o);
23772427 exe.linkLibC();
2428 // https://github.com/ziglang/zig/issues/17619
2429 exe.pie = true;
23782430
23792431 const run = addRunArtifact(exe);
23802432 run.expectStdOutEqual(exp_stdout);
......@@ -2387,6 +2439,8 @@ fn testTlsLd(b: *Build, opts: Options) *Step {
23872439 exe.addObject(a_o);
23882440 exe.linkLibC();
23892441 // exe.link_relax = false; // TODO
2442 // https://github.com/ziglang/zig/issues/17619
2443 exe.pie = true;
23902444
23912445 const run = addRunArtifact(exe);
23922446 run.expectStdOutEqual(exp_stdout);
......@@ -2420,6 +2474,8 @@ fn testTlsLdDso(b: *Build, opts: Options) *Step {
24202474 , &.{});
24212475 exe.linkLibrary(dso);
24222476 exe.linkLibC();
2477 // https://github.com/ziglang/zig/issues/17619
2478 exe.pie = true;
24232479
24242480 const run = addRunArtifact(exe);
24252481 run.expectStdOutEqual("1 2\n");
......@@ -2457,6 +2513,8 @@ fn testTlsLdNoPlt(b: *Build, opts: Options) *Step {
24572513 exe.addObject(a_o);
24582514 exe.addObject(b_o);
24592515 exe.linkLibC();
2516 // https://github.com/ziglang/zig/issues/17619
2517 exe.pie = true;
24602518
24612519 const run = addRunArtifact(exe);
24622520 run.expectStdOutEqual("3 5 3 5\n");
......@@ -2469,6 +2527,8 @@ fn testTlsLdNoPlt(b: *Build, opts: Options) *Step {
24692527 exe.addObject(b_o);
24702528 exe.linkLibC();
24712529 // exe.link_relax = false; // TODO
2530 // https://github.com/ziglang/zig/issues/17619
2531 exe.pie = true;
24722532
24732533 const run = addRunArtifact(exe);
24742534 run.expectStdOutEqual("3 5 3 5\n");
......@@ -2554,6 +2614,8 @@ fn testTlsOffsetAlignment(b: *Build, opts: Options) *Step {
25542614 exe.addRPath(dso.getEmittedBinDirectory());
25552615 exe.linkLibC();
25562616 exe.force_pic = true;
2617 // https://github.com/ziglang/zig/issues/17619
2618 exe.pie = true;
25572619
25582620 const run = addRunArtifact(exe);
25592621 run.expectExitCode(0);
......@@ -2588,6 +2650,8 @@ fn testTlsPic(b: *Build, opts: Options) *Step {
25882650 , &.{});
25892651 exe.addObject(obj);
25902652 exe.linkLibC();
2653 // https://github.com/ziglang/zig/issues/17619
2654 exe.pie = true;
25912655
25922656 const run = addRunArtifact(exe);
25932657 run.expectStdOutEqual("3 5 3 5\n");
......@@ -2627,6 +2691,8 @@ fn testTlsSmallAlignment(b: *Build, opts: Options) *Step {
26272691 exe.addObject(b_o);
26282692 exe.addObject(c_o);
26292693 exe.linkLibC();
2694 // https://github.com/ziglang/zig/issues/17619
2695 exe.pie = true;
26302696
26312697 const run = addRunArtifact(exe);
26322698 run.expectStdOutEqual("42\n");
......@@ -2642,6 +2708,8 @@ fn testTlsSmallAlignment(b: *Build, opts: Options) *Step {
26422708 exe.addObject(c_o);
26432709 exe.linkLibrary(dso);
26442710 exe.linkLibC();
2711 // https://github.com/ziglang/zig/issues/17619
2712 exe.pie = true;
26452713
26462714 const run = addRunArtifact(exe);
26472715 run.expectStdOutEqual("42\n");
......@@ -2711,6 +2779,8 @@ fn testWeakExports(b: *Build, opts: Options) *Step {
27112779 const exe = addExecutable(b, "main", opts);
27122780 exe.addObject(obj);
27132781 exe.linkLibC();
2782 // https://github.com/ziglang/zig/issues/17619
2783 exe.pie = true;
27142784
27152785 const check = exe.checkObject();
27162786 check.checkInDynamicSymtab();
......@@ -2743,6 +2813,8 @@ fn testWeakUndefsDso(b: *Build, opts: Options) *Step {
27432813 , &.{});
27442814 exe.linkLibrary(dso);
27452815 exe.linkLibC();
2816 // https://github.com/ziglang/zig/issues/17619
2817 exe.pie = true;
27462818
27472819 const run = addRunArtifact(exe);
27482820 run.expectStdOutEqual("bar=-1\n");
......@@ -2759,6 +2831,8 @@ fn testWeakUndefsDso(b: *Build, opts: Options) *Step {
27592831 , &.{});
27602832 exe.linkLibrary(dso);
27612833 exe.linkLibC();
2834 // https://github.com/ziglang/zig/issues/17619
2835 exe.pie = true;
27622836
27632837 const run = addRunArtifact(exe);
27642838 run.expectStdOutEqual("bar=5\n");
......@@ -2866,6 +2940,8 @@ fn testZText(b: *Build, opts: Options) *Step {
28662940 , &.{});
28672941 exe.linkLibrary(dso);
28682942 exe.linkLibC();
2943 // https://github.com/ziglang/zig/issues/17619
2944 exe.pie = true;
28692945
28702946 const run = addRunArtifact(exe);
28712947 run.expectStdOutEqual("3\n");