summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2018-02-24 15:50:14 +0000
committerThomas Preud'homme <robotux@celest.fr>2020-08-14 23:05:16 +0100
commit34d84e06954fb712313a55f4b7c5c0904bcf2171 (patch)
tree6ba45c4f2ad84ce7ab2a4ffbe136905d70d74aa6
parent782f9a4a8e801b2077f1775a85cc5950bdd6acdf (diff)
Prevent dead code on !x86 in prepare_dynamic_rel
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. Origin: vendor Forwarded: http://repo.or.cz/tinycc.git/commit/776aa0c093cc6083cbb61d0db8e303209b21bbad Applied-Upstream: commit:776aa0c093cc6083cbb61d0db8e303209b21bbad Last-Updated: 2018-02-24
-rw-r--r--tccelf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tccelf.c b/tccelf.c
index ff83eb4..ad97a5d 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -1036,6 +1036,7 @@ static int prepare_dynamic_rel(TCCState *s1, Section *sr)
int sym_index = ELFW(R_SYM)(rel->r_info);
int type = ELFW(R_TYPE)(rel->r_info);
switch(type) {
+#if defined(TCC_TARGET_I386) || defined(TCC_TARGET_X86_64)
#if defined(TCC_TARGET_I386)
case R_386_32:
if (!get_sym_attr(s1, sym_index, 0)->dyn_index
@@ -1069,6 +1070,7 @@ static int prepare_dynamic_rel(TCCState *s1, Section *sr)
if (get_sym_attr(s1, sym_index, 0)->dyn_index)
count++;
break;
+#endif
default:
break;
}