In prepare_dynamic_rel() on non x86 targets the count++ statements appear before any case label and are therefore dead code. This triggers build failure when building with -Werror. This patch adds an extra guard around all the x86 case labels and their associated action, leaving just the default case label for non x86 targets which builds fine.
Unified · Split
| @@ -873,6 +873,7 @@ static int prepare_dynamic_rel(TCCState *s1, Section *sr) · 872 unmodified lines | ||
| 873 | 873 | sym_index = ELFW(R_SYM)(rel->r_info); |
| 874 | 874 | type = ELFW(R_TYPE)(rel->r_info); |
| 875 | 875 | switch(type) { |
| 876 | +#if defined(TCC_TARGET_I386) || defined(TCC_TARGET_X86_64) | |
| 876 | 877 | #if defined(TCC_TARGET_I386) |
| 877 | 878 | case R_386_32: |
| 878 | 879 | if (!get_sym_attr(s1, sym_index, 0)->dyn_index |
| @@ -896,6 +897,7 @@ static int prepare_dynamic_rel(TCCState *s1, Section *sr) · 17 unmodified lines | ||
| 896 | 897 | if (get_sym_attr(s1, sym_index, 0)->dyn_index) |
| 897 | 898 | count++; |
| 898 | 899 | break; |
| 900 | +#endif | |
| 899 | 901 | default: |
| 900 | 902 | break; |
| 901 | 903 | } |