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 | sym_index = ELFW(R_SYM)(rel->r_info); | 873 | sym_index = ELFW(R_SYM)(rel->r_info); |
| 874 | type = ELFW(R_TYPE)(rel->r_info); | 874 | type = ELFW(R_TYPE)(rel->r_info); |
| 875 | switch(type) { | 875 | switch(type) { |
| 876 | #if defined(TCC_TARGET_I386) || defined(TCC_TARGET_X86_64) | ||
| 876 | #if defined(TCC_TARGET_I386) | 877 | #if defined(TCC_TARGET_I386) |
| 877 | case R_386_32: | 878 | case R_386_32: |
| 878 | if (!get_sym_attr(s1, sym_index, 0)->dyn_index | 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 | if (get_sym_attr(s1, sym_index, 0)->dyn_index) | 897 | if (get_sym_attr(s1, sym_index, 0)->dyn_index) |
| 897 | count++; | 898 | count++; |
| 898 | break; | 899 | break; |
| 900 | #endif | ||
| 899 | default: | 901 | default: |
| 900 | break; | 902 | break; |
| 901 | } | 903 | } |