| author | |
| committer | |
| log | 8b4e3b6aee61a26e7229ea30728e6c5e31c7cd0b |
| tree | c78414c59ad23d9dd24b8989cced5589203370a2 |
| parent | a306bfcd8eec166906ce2839bc7ff86ba6335376 |
10 files changed, 85 insertions(+), 12 deletions(-)
lib/std/Build/Step/Compile.zig+7| ... | @@ -123,6 +123,10 @@ link_emit_relocs: bool = false, | ... | @@ -123,6 +123,10 @@ link_emit_relocs: bool = false, |
| 123 | /// safely garbage-collected during the linking phase. | 123 | /// safely garbage-collected during the linking phase. |
| 124 | link_function_sections: bool = false, | 124 | link_function_sections: bool = false, |
| 125 | 125 | ||
| 126 | /// Place every data in its own section so that unused ones may be | ||
| 127 | /// safely garbage-collected during the linking phase. | ||
| 128 | link_data_sections: bool = false, | ||
| 129 | |||
| 126 | /// Remove functions and data that are unreachable by the entry point or | 130 | /// Remove functions and data that are unreachable by the entry point or |
| 127 | /// exported symbols. | 131 | /// exported symbols. |
| 128 | link_gc_sections: ?bool = null, | 132 | link_gc_sections: ?bool = null, |
| ... | @@ -1647,6 +1651,9 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { | ... | @@ -1647,6 +1651,9 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 1647 | if (self.link_function_sections) { | 1651 | if (self.link_function_sections) { |
| 1648 | try zig_args.append("-ffunction-sections"); | 1652 | try zig_args.append("-ffunction-sections"); |
| 1649 | } | 1653 | } |
| 1654 | if (self.link_data_sections) { | ||
| 1655 | try zig_args.append("-fdata-sections"); | ||
| 1656 | } | ||
| 1650 | if (self.link_gc_sections) |x| { | 1657 | if (self.link_gc_sections) |x| { |
| 1651 | try zig_args.append(if (x) "--gc-sections" else "--no-gc-sections"); | 1658 | try zig_args.append(if (x) "--gc-sections" else "--no-gc-sections"); |
| 1652 | } | 1659 | } |
src/Compilation.zig+8| ... | @@ -623,6 +623,7 @@ pub const InitOptions = struct { | ... | @@ -623,6 +623,7 @@ pub const InitOptions = struct { |
| 623 | formatted_panics: ?bool = null, | 623 | formatted_panics: ?bool = null, |
| 624 | rdynamic: bool = false, | 624 | rdynamic: bool = false, |
| 625 | function_sections: bool = false, | 625 | function_sections: bool = false, |
| 626 | data_sections: bool = false, | ||
| 626 | no_builtin: bool = false, | 627 | no_builtin: bool = false, |
| 627 | is_native_os: bool, | 628 | is_native_os: bool, |
| 628 | is_native_abi: bool, | 629 | is_native_abi: bool, |
| ... | @@ -1193,6 +1194,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { | ... | @@ -1193,6 +1194,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 1193 | cache.hash.add(omit_frame_pointer); | 1194 | cache.hash.add(omit_frame_pointer); |
| 1194 | cache.hash.add(link_mode); | 1195 | cache.hash.add(link_mode); |
| 1195 | cache.hash.add(options.function_sections); | 1196 | cache.hash.add(options.function_sections); |
| 1197 | cache.hash.add(options.data_sections); | ||
| 1196 | cache.hash.add(options.no_builtin); | 1198 | cache.hash.add(options.no_builtin); |
| 1197 | cache.hash.add(strip); | 1199 | cache.hash.add(strip); |
| 1198 | cache.hash.add(link_libc); | 1200 | cache.hash.add(link_libc); |
| ... | @@ -1572,6 +1574,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { | ... | @@ -1572,6 +1574,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 1572 | .is_native_os = options.is_native_os, | 1574 | .is_native_os = options.is_native_os, |
| 1573 | .is_native_abi = options.is_native_abi, | 1575 | .is_native_abi = options.is_native_abi, |
| 1574 | .function_sections = options.function_sections, | 1576 | .function_sections = options.function_sections, |
| 1577 | .data_sections = options.data_sections, | ||
| 1575 | .no_builtin = options.no_builtin, | 1578 | .no_builtin = options.no_builtin, |
| 1576 | .allow_shlib_undefined = options.linker_allow_shlib_undefined, | 1579 | .allow_shlib_undefined = options.linker_allow_shlib_undefined, |
| 1577 | .bind_global_refs_locally = options.linker_bind_global_refs_locally orelse false, | 1580 | .bind_global_refs_locally = options.linker_bind_global_refs_locally orelse false, |
| ... | @@ -4903,6 +4906,10 @@ pub fn addCCArgs( | ... | @@ -4903,6 +4906,10 @@ pub fn addCCArgs( |
| 4903 | try argv.append("-ffunction-sections"); | 4906 | try argv.append("-ffunction-sections"); |
| 4904 | } | 4907 | } |
| 4905 | 4908 | ||
| 4909 | if (comp.bin_file.options.data_sections) { | ||
| 4910 | try argv.append("-fdata-sections"); | ||
| 4911 | } | ||
| 4912 | |||
| 4906 | if (comp.bin_file.options.no_builtin) { | 4913 | if (comp.bin_file.options.no_builtin) { |
| 4907 | try argv.append("-fno-builtin"); | 4914 | try argv.append("-fno-builtin"); |
| 4908 | } | 4915 | } |
| ... | @@ -6405,6 +6412,7 @@ fn buildOutputFromZig( | ... | @@ -6405,6 +6412,7 @@ fn buildOutputFromZig( |
| 6405 | .optimize_mode = comp.compilerRtOptMode(), | 6412 | .optimize_mode = comp.compilerRtOptMode(), |
| 6406 | .link_mode = .Static, | 6413 | .link_mode = .Static, |
| 6407 | .function_sections = true, | 6414 | .function_sections = true, |
| 6415 | .data_sections = true, | ||
| 6408 | .no_builtin = true, | 6416 | .no_builtin = true, |
| 6409 | .want_sanitize_c = false, | 6417 | .want_sanitize_c = false, |
| 6410 | .want_stack_check = false, | 6418 | .want_stack_check = false, |
src/clang_options_data.zig+42-10| ... | @@ -2282,6 +2282,22 @@ flagpd1("fopenmp-is-device"), | ... | @@ -2282,6 +2282,22 @@ flagpd1("fopenmp-is-device"), |
| 2282 | .pd2 = false, | 2282 | .pd2 = false, |
| 2283 | .psl = true, | 2283 | .psl = true, |
| 2284 | }, | 2284 | }, |
| 2285 | .{ | ||
| 2286 | .name = "Qgather-", | ||
| 2287 | .syntax = .flag, | ||
| 2288 | .zig_equivalent = .other, | ||
| 2289 | .pd1 = true, | ||
| 2290 | .pd2 = false, | ||
| 2291 | .psl = true, | ||
| 2292 | }, | ||
| 2293 | .{ | ||
| 2294 | .name = "Qscatter-", | ||
| 2295 | .syntax = .flag, | ||
| 2296 | .zig_equivalent = .other, | ||
| 2297 | .pd1 = true, | ||
| 2298 | .pd2 = false, | ||
| 2299 | .psl = true, | ||
| 2300 | }, | ||
| 2285 | sepd1("Xmicrosoft-visualc-tools-root"), | 2301 | sepd1("Xmicrosoft-visualc-tools-root"), |
| 2286 | sepd1("Xmicrosoft-visualc-tools-version"), | 2302 | sepd1("Xmicrosoft-visualc-tools-version"), |
| 2287 | sepd1("Xmicrosoft-windows-sdk-root"), | 2303 | sepd1("Xmicrosoft-windows-sdk-root"), |
| ... | @@ -2727,7 +2743,14 @@ flagpd1("fcxx-modules"), | ... | @@ -2727,7 +2743,14 @@ flagpd1("fcxx-modules"), |
| 2727 | flagpd1("fc++-static-destructors"), | 2743 | flagpd1("fc++-static-destructors"), |
| 2728 | flagpd1("fd-lines-as-code"), | 2744 | flagpd1("fd-lines-as-code"), |
| 2729 | flagpd1("fd-lines-as-comments"), | 2745 | flagpd1("fd-lines-as-comments"), |
| 2730 | flagpd1("fdata-sections"), | 2746 | .{ |
| 2747 | .name = "fdata-sections", | ||
| 2748 | .syntax = .flag, | ||
| 2749 | .zig_equivalent = .data_sections, | ||
| 2750 | .pd1 = true, | ||
| 2751 | .pd2 = false, | ||
| 2752 | .psl = false, | ||
| 2753 | }, | ||
| 2731 | sepd1("fdebug-compilation-dir"), | 2754 | sepd1("fdebug-compilation-dir"), |
| 2732 | flagpd1("fdebug-dump-all"), | 2755 | flagpd1("fdebug-dump-all"), |
| 2733 | flagpd1("fdebug-dump-parse-tree"), | 2756 | flagpd1("fdebug-dump-parse-tree"), |
| ... | @@ -3130,7 +3153,14 @@ flagpd1("fno-cxx-modules"), | ... | @@ -3130,7 +3153,14 @@ flagpd1("fno-cxx-modules"), |
| 3130 | flagpd1("fno-c++-static-destructors"), | 3153 | flagpd1("fno-c++-static-destructors"), |
| 3131 | flagpd1("fno-d-lines-as-code"), | 3154 | flagpd1("fno-d-lines-as-code"), |
| 3132 | flagpd1("fno-d-lines-as-comments"), | 3155 | flagpd1("fno-d-lines-as-comments"), |
| 3133 | flagpd1("fno-data-sections"), | 3156 | .{ |
| 3157 | .name = "fno-data-sections", | ||
| 3158 | .syntax = .flag, | ||
| 3159 | .zig_equivalent = .no_data_sections, | ||
| 3160 | .pd1 = true, | ||
| 3161 | .pd2 = false, | ||
| 3162 | .psl = false, | ||
| 3163 | }, | ||
| 3134 | flagpd1("fno-debug-info-for-profiling"), | 3164 | flagpd1("fno-debug-info-for-profiling"), |
| 3135 | flagpd1("fno-debug-macro"), | 3165 | flagpd1("fno-debug-macro"), |
| 3136 | flagpd1("fno-debug-pass-manager"), | 3166 | flagpd1("fno-debug-pass-manager"), |
| ... | @@ -4080,7 +4110,7 @@ flagpd1("malign-double"), | ... | @@ -4080,7 +4110,7 @@ flagpd1("malign-double"), |
| 4080 | m("maltivec"), | 4110 | m("maltivec"), |
| 4081 | flagpd1("mamdgpu-ieee"), | 4111 | flagpd1("mamdgpu-ieee"), |
| 4082 | m("mamx-bf16"), | 4112 | m("mamx-bf16"), |
| 4083 | flagpd1("mamx-complex"), | 4113 | m("mamx-complex"), |
| 4084 | m("mamx-fp16"), | 4114 | m("mamx-fp16"), |
| 4085 | m("mamx-int8"), | 4115 | m("mamx-int8"), |
| 4086 | m("mamx-tile"), | 4116 | m("mamx-tile"), |
| ... | @@ -4109,7 +4139,7 @@ m("mavx512vpopcntdq"), | ... | @@ -4109,7 +4139,7 @@ m("mavx512vpopcntdq"), |
| 4109 | m("mavxifma"), | 4139 | m("mavxifma"), |
| 4110 | m("mavxneconvert"), | 4140 | m("mavxneconvert"), |
| 4111 | m("mavxvnni"), | 4141 | m("mavxvnni"), |
| 4112 | flagpd1("mavxvnniint16"), | 4142 | m("mavxvnniint16"), |
| 4113 | m("mavxvnniint8"), | 4143 | m("mavxvnniint8"), |
| 4114 | flagpd1("mbackchain"), | 4144 | flagpd1("mbackchain"), |
| 4115 | flagpd1("mbig-endian"), | 4145 | flagpd1("mbig-endian"), |
| ... | @@ -4264,7 +4294,7 @@ m("mno-aes"), | ... | @@ -4264,7 +4294,7 @@ m("mno-aes"), |
| 4264 | m("mno-altivec"), | 4294 | m("mno-altivec"), |
| 4265 | flagpd1("mno-amdgpu-ieee"), | 4295 | flagpd1("mno-amdgpu-ieee"), |
| 4266 | m("mno-amx-bf16"), | 4296 | m("mno-amx-bf16"), |
| 4267 | flagpd1("mno-amx-complex"), | 4297 | m("mno-amx-complex"), |
| 4268 | m("mno-amx-fp16"), | 4298 | m("mno-amx-fp16"), |
| 4269 | m("mno-amx-int8"), | 4299 | m("mno-amx-int8"), |
| 4270 | m("mno-amx-tile"), | 4300 | m("mno-amx-tile"), |
| ... | @@ -4290,7 +4320,7 @@ m("mno-avx512vpopcntdq"), | ... | @@ -4290,7 +4320,7 @@ m("mno-avx512vpopcntdq"), |
| 4290 | m("mno-avxifma"), | 4320 | m("mno-avxifma"), |
| 4291 | m("mno-avxneconvert"), | 4321 | m("mno-avxneconvert"), |
| 4292 | m("mno-avxvnni"), | 4322 | m("mno-avxvnni"), |
| 4293 | flagpd1("mno-avxvnniint16"), | 4323 | m("mno-avxvnniint16"), |
| 4294 | m("mno-avxvnniint8"), | 4324 | m("mno-avxvnniint8"), |
| 4295 | flagpd1("mno-backchain"), | 4325 | flagpd1("mno-backchain"), |
| 4296 | m("mno-bmi"), | 4326 | m("mno-bmi"), |
| ... | @@ -4336,6 +4366,7 @@ m("mno-fpu"), | ... | @@ -4336,6 +4366,7 @@ m("mno-fpu"), |
| 4336 | m("mno-fsgsbase"), | 4366 | m("mno-fsgsbase"), |
| 4337 | m("mno-fsmuld"), | 4367 | m("mno-fsmuld"), |
| 4338 | m("mno-fxsr"), | 4368 | m("mno-fxsr"), |
| 4369 | flagpd1("mno-gather"), | ||
| 4339 | m("mno-gfni"), | 4370 | m("mno-gfni"), |
| 4340 | m("mno-ginv"), | 4371 | m("mno-ginv"), |
| 4341 | flagpd1("mno-global-merge"), | 4372 | flagpd1("mno-global-merge"), |
| ... | @@ -4433,16 +4464,17 @@ flagpd1("mno-rtd"), | ... | @@ -4433,16 +4464,17 @@ flagpd1("mno-rtd"), |
| 4433 | m("mno-rtm"), | 4464 | m("mno-rtm"), |
| 4434 | m("mno-sahf"), | 4465 | m("mno-sahf"), |
| 4435 | m("mno-save-restore"), | 4466 | m("mno-save-restore"), |
| 4467 | flagpd1("mno-scatter"), | ||
| 4436 | m("mno-serialize"), | 4468 | m("mno-serialize"), |
| 4437 | m("mno-seses"), | 4469 | m("mno-seses"), |
| 4438 | m("mno-sgx"), | 4470 | m("mno-sgx"), |
| 4439 | m("mno-sha"), | 4471 | m("mno-sha"), |
| 4440 | flagpd1("mno-sha512"), | 4472 | m("mno-sha512"), |
| 4441 | m("mno-shstk"), | 4473 | m("mno-shstk"), |
| 4442 | m("mno-sign-ext"), | 4474 | m("mno-sign-ext"), |
| 4443 | m("mno-simd128"), | 4475 | m("mno-simd128"), |
| 4444 | flagpd1("mno-skip-rax-setup"), | 4476 | flagpd1("mno-skip-rax-setup"), |
| 4445 | flagpd1("mno-sm3"), | 4477 | m("mno-sm3"), |
| 4446 | m("mno-sm4"), | 4478 | m("mno-sm4"), |
| 4447 | m("mno-soft-float"), | 4479 | m("mno-soft-float"), |
| 4448 | m("mno-spe"), | 4480 | m("mno-spe"), |
| ... | @@ -4568,14 +4600,14 @@ m("msecure-plt"), | ... | @@ -4568,14 +4600,14 @@ m("msecure-plt"), |
| 4568 | m("mserialize"), | 4600 | m("mserialize"), |
| 4569 | m("msgx"), | 4601 | m("msgx"), |
| 4570 | m("msha"), | 4602 | m("msha"), |
| 4571 | flagpd1("msha512"), | 4603 | m("msha512"), |
| 4572 | m("mshstk"), | 4604 | m("mshstk"), |
| 4573 | m("msign-ext"), | 4605 | m("msign-ext"), |
| 4574 | flagpd1("msim"), | 4606 | flagpd1("msim"), |
| 4575 | m("msimd128"), | 4607 | m("msimd128"), |
| 4576 | m("msingle-float"), | 4608 | m("msingle-float"), |
| 4577 | flagpd1("mskip-rax-setup"), | 4609 | flagpd1("mskip-rax-setup"), |
| 4578 | flagpd1("msm3"), | 4610 | m("msm3"), |
| 4579 | m("msm4"), | 4611 | m("msm4"), |
| 4580 | sepd1("msmall-data-limit"), | 4612 | sepd1("msmall-data-limit"), |
| 4581 | m("msoft-float"), | 4613 | m("msoft-float"), |
src/codegen/llvm.zig+1| ... | @@ -955,6 +955,7 @@ pub const Object = struct { | ... | @@ -955,6 +955,7 @@ pub const Object = struct { |
| 955 | reloc_mode, | 955 | reloc_mode, |
| 956 | code_model, | 956 | code_model, |
| 957 | options.function_sections, | 957 | options.function_sections, |
| 958 | options.data_sections, | ||
| 958 | float_abi, | 959 | float_abi, |
| 959 | if (target_util.llvmMachineAbi(options.target)) |s| s.ptr else null, | 960 | if (target_util.llvmMachineAbi(options.target)) |s| s.ptr else null, |
| 960 | ); | 961 | ); |
src/codegen/llvm/bindings.zig+1| ... | @@ -919,6 +919,7 @@ pub const TargetMachine = opaque { | ... | @@ -919,6 +919,7 @@ pub const TargetMachine = opaque { |
| 919 | Reloc: RelocMode, | 919 | Reloc: RelocMode, |
| 920 | CodeModel: CodeModel, | 920 | CodeModel: CodeModel, |
| 921 | function_sections: bool, | 921 | function_sections: bool, |
| 922 | data_sections: bool, | ||
| 922 | float_abi: ABIType, | 923 | float_abi: ABIType, |
| 923 | abi_name: ?[*:0]const u8, | 924 | abi_name: ?[*:0]const u8, |
| 924 | ) *TargetMachine; | 925 | ) *TargetMachine; |
src/link.zig+1| ... | @@ -139,6 +139,7 @@ pub const Options = struct { | ... | @@ -139,6 +139,7 @@ pub const Options = struct { |
| 139 | link_libunwind: bool, | 139 | link_libunwind: bool, |
| 140 | darwin_sdk_layout: ?DarwinSdkLayout, | 140 | darwin_sdk_layout: ?DarwinSdkLayout, |
| 141 | function_sections: bool, | 141 | function_sections: bool, |
| 142 | data_sections: bool, | ||
| 142 | no_builtin: bool, | 143 | no_builtin: bool, |
| 143 | eh_frame_hdr: bool, | 144 | eh_frame_hdr: bool, |
| 144 | emit_relocs: bool, | 145 | emit_relocs: bool, |
src/main.zig+12| ... | @@ -453,6 +453,8 @@ const usage_build_generic = | ... | @@ -453,6 +453,8 @@ const usage_build_generic = |
| 453 | \\ -fno-builtin Disable implicit builtin knowledge of functions | 453 | \\ -fno-builtin Disable implicit builtin knowledge of functions |
| 454 | \\ -ffunction-sections Places each function in a separate section | 454 | \\ -ffunction-sections Places each function in a separate section |
| 455 | \\ -fno-function-sections All functions go into same section | 455 | \\ -fno-function-sections All functions go into same section |
| 456 | \\ -fdata-sections Places each data in a separate section | ||
| 457 | \\ -fno-data-sections All data go into same section | ||
| 456 | \\ -fstrip Omit debug symbols | 458 | \\ -fstrip Omit debug symbols |
| 457 | \\ -fno-strip Keep debug symbols | 459 | \\ -fno-strip Keep debug symbols |
| 458 | \\ -fformatted-panics Enable formatted safety panics | 460 | \\ -fformatted-panics Enable formatted safety panics |
| ... | @@ -793,6 +795,7 @@ fn buildOutputType( | ... | @@ -793,6 +795,7 @@ fn buildOutputType( |
| 793 | var strip: ?bool = null; | 795 | var strip: ?bool = null; |
| 794 | var formatted_panics: ?bool = null; | 796 | var formatted_panics: ?bool = null; |
| 795 | var function_sections = false; | 797 | var function_sections = false; |
| 798 | var data_sections = false; | ||
| 796 | var no_builtin = false; | 799 | var no_builtin = false; |
| 797 | var listen: Listen = .none; | 800 | var listen: Listen = .none; |
| 798 | var debug_compile_errors = false; | 801 | var debug_compile_errors = false; |
| ... | @@ -1459,6 +1462,10 @@ fn buildOutputType( | ... | @@ -1459,6 +1462,10 @@ fn buildOutputType( |
| 1459 | function_sections = true; | 1462 | function_sections = true; |
| 1460 | } else if (mem.eql(u8, arg, "-fno-function-sections")) { | 1463 | } else if (mem.eql(u8, arg, "-fno-function-sections")) { |
| 1461 | function_sections = false; | 1464 | function_sections = false; |
| 1465 | } else if (mem.eql(u8, arg, "-fdata-sections")) { | ||
| 1466 | data_sections = true; | ||
| 1467 | } else if (mem.eql(u8, arg, "-fno-data-sections")) { | ||
| 1468 | data_sections = false; | ||
| 1462 | } else if (mem.eql(u8, arg, "-fbuiltin")) { | 1469 | } else if (mem.eql(u8, arg, "-fbuiltin")) { |
| 1463 | no_builtin = false; | 1470 | no_builtin = false; |
| 1464 | } else if (mem.eql(u8, arg, "-fno-builtin")) { | 1471 | } else if (mem.eql(u8, arg, "-fno-builtin")) { |
| ... | @@ -1780,6 +1787,8 @@ fn buildOutputType( | ... | @@ -1780,6 +1787,8 @@ fn buildOutputType( |
| 1780 | .no_omit_frame_pointer => omit_frame_pointer = false, | 1787 | .no_omit_frame_pointer => omit_frame_pointer = false, |
| 1781 | .function_sections => function_sections = true, | 1788 | .function_sections => function_sections = true, |
| 1782 | .no_function_sections => function_sections = false, | 1789 | .no_function_sections => function_sections = false, |
| 1790 | .data_sections => data_sections = true, | ||
| 1791 | .no_data_sections => data_sections = false, | ||
| 1783 | .builtin => no_builtin = false, | 1792 | .builtin => no_builtin = false, |
| 1784 | .no_builtin => no_builtin = true, | 1793 | .no_builtin => no_builtin = true, |
| 1785 | .color_diagnostics => color = .on, | 1794 | .color_diagnostics => color = .on, |
| ... | @@ -3475,6 +3484,7 @@ fn buildOutputType( | ... | @@ -3475,6 +3484,7 @@ fn buildOutputType( |
| 3475 | .formatted_panics = formatted_panics, | 3484 | .formatted_panics = formatted_panics, |
| 3476 | .single_threaded = single_threaded, | 3485 | .single_threaded = single_threaded, |
| 3477 | .function_sections = function_sections, | 3486 | .function_sections = function_sections, |
| 3487 | .data_sections = data_sections, | ||
| 3478 | .no_builtin = no_builtin, | 3488 | .no_builtin = no_builtin, |
| 3479 | .self_exe_path = self_exe_path, | 3489 | .self_exe_path = self_exe_path, |
| 3480 | .thread_pool = &thread_pool, | 3490 | .thread_pool = &thread_pool, |
| ... | @@ -5589,6 +5599,8 @@ pub const ClangArgIterator = struct { | ... | @@ -5589,6 +5599,8 @@ pub const ClangArgIterator = struct { |
| 5589 | no_omit_frame_pointer, | 5599 | no_omit_frame_pointer, |
| 5590 | function_sections, | 5600 | function_sections, |
| 5591 | no_function_sections, | 5601 | no_function_sections, |
| 5602 | data_sections, | ||
| 5603 | no_data_sections, | ||
| 5592 | builtin, | 5604 | builtin, |
| 5593 | no_builtin, | 5605 | no_builtin, |
| 5594 | color_diagnostics, | 5606 | color_diagnostics, |
src/zig_llvm.cpp+3-1| ... | @@ -82,7 +82,8 @@ static const bool assertions_on = false; | ... | @@ -82,7 +82,8 @@ static const bool assertions_on = false; |
| 82 | 82 | ||
| 83 | LLVMTargetMachineRef ZigLLVMCreateTargetMachine(LLVMTargetRef T, const char *Triple, | 83 | LLVMTargetMachineRef ZigLLVMCreateTargetMachine(LLVMTargetRef T, const char *Triple, |
| 84 | const char *CPU, const char *Features, LLVMCodeGenOptLevel Level, LLVMRelocMode Reloc, | 84 | const char *CPU, const char *Features, LLVMCodeGenOptLevel Level, LLVMRelocMode Reloc, |
| 85 | LLVMCodeModel CodeModel, bool function_sections, ZigLLVMABIType float_abi, const char *abi_name) | 85 | LLVMCodeModel CodeModel, bool function_sections, bool data_sections, ZigLLVMABIType float_abi, |
| 86 | const char *abi_name) | ||
| 86 | { | 87 | { |
| 87 | std::optional<Reloc::Model> RM; | 88 | std::optional<Reloc::Model> RM; |
| 88 | switch (Reloc){ | 89 | switch (Reloc){ |
| ... | @@ -130,6 +131,7 @@ LLVMTargetMachineRef ZigLLVMCreateTargetMachine(LLVMTargetRef T, const char *Tri | ... | @@ -130,6 +131,7 @@ LLVMTargetMachineRef ZigLLVMCreateTargetMachine(LLVMTargetRef T, const char *Tri |
| 130 | TargetOptions opt; | 131 | TargetOptions opt; |
| 131 | 132 | ||
| 132 | opt.FunctionSections = function_sections; | 133 | opt.FunctionSections = function_sections; |
| 134 | opt.DataSections = data_sections; | ||
| 133 | switch (float_abi) { | 135 | switch (float_abi) { |
| 134 | case ZigLLVMABITypeDefault: | 136 | case ZigLLVMABITypeDefault: |
| 135 | opt.FloatABIType = FloatABI::Default; | 137 | opt.FloatABIType = FloatABI::Default; |
src/zig_llvm.h+2-1| ... | @@ -57,7 +57,8 @@ enum ZigLLVMABIType { | ... | @@ -57,7 +57,8 @@ enum ZigLLVMABIType { |
| 57 | 57 | ||
| 58 | ZIG_EXTERN_C LLVMTargetMachineRef ZigLLVMCreateTargetMachine(LLVMTargetRef T, const char *Triple, | 58 | ZIG_EXTERN_C LLVMTargetMachineRef ZigLLVMCreateTargetMachine(LLVMTargetRef T, const char *Triple, |
| 59 | const char *CPU, const char *Features, LLVMCodeGenOptLevel Level, LLVMRelocMode Reloc, | 59 | const char *CPU, const char *Features, LLVMCodeGenOptLevel Level, LLVMRelocMode Reloc, |
| 60 | LLVMCodeModel CodeModel, bool function_sections, enum ZigLLVMABIType float_abi, const char *abi_name); | 60 | LLVMCodeModel CodeModel, bool function_sections, bool data_sections, enum ZigLLVMABIType float_abi, |
| 61 | const char *abi_name); | ||
| 61 | 62 | ||
| 62 | ZIG_EXTERN_C void ZigLLVMSetOptBisectLimit(LLVMContextRef context_ref, int limit); | 63 | ZIG_EXTERN_C void ZigLLVMSetOptBisectLimit(LLVMContextRef context_ref, int limit); |
| 63 | 64 |
tools/update_clang_options.zig+8| ... | @@ -332,6 +332,14 @@ const known_options = [_]KnownOpt{ | ... | @@ -332,6 +332,14 @@ const known_options = [_]KnownOpt{ |
| 332 | .name = "fno-function-sections", | 332 | .name = "fno-function-sections", |
| 333 | .ident = "no_function_sections", | 333 | .ident = "no_function_sections", |
| 334 | }, | 334 | }, |
| 335 | .{ | ||
| 336 | .name = "fdata-sections", | ||
| 337 | .ident = "data_sections", | ||
| 338 | }, | ||
| 339 | .{ | ||
| 340 | .name = "fno-data-sections", | ||
| 341 | .ident = "no_data_sections", | ||
| 342 | }, | ||
| 335 | .{ | 343 | .{ |
| 336 | .name = "fbuiltin", | 344 | .name = "fbuiltin", |
| 337 | .ident = "builtin", | 345 | .ident = "builtin", |