Commit cf7c69e
committed
fix: propagate implicit --target to fallback_clang_args
Fixes #3352
When bindgen infers the target triple from the Rust target (i.e., no
explicit --target in clang_args), it inserts --target= into clang_args
at Bindings::generate() time. However, fallback_clang_args was already
populated from clang_args earlier in Builder::generate(), before this
insertion. This meant the fallback translation unit used for
clang_macro_fallback would use the host architecture instead of the
target architecture.
For cross-compilation, this caused sizeof-dependent macros (e.g., ioctl
constants using _IOR/_IOW) to evaluate with the host's struct layouts
instead of the target's, producing silently wrong values.
Fix: when inserting the inferred target into clang_args, also insert it
into fallback_clang_args.1 parent d95d75a commit cf7c69e
2 files changed
+50
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
824 | 824 | | |
825 | 825 | | |
826 | 826 | | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
827 | 873 | | |
828 | 874 | | |
829 | 875 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
787 | 787 | | |
788 | 788 | | |
789 | 789 | | |
790 | | - | |
791 | | - | |
792 | | - | |
793 | | - | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
794 | 794 | | |
795 | 795 | | |
796 | 796 | | |
| |||
0 commit comments