0003-Prevent-dead-code-on-x86-in-prepare_dynamic_rel.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From 34d84e06954fb712313a55f4b7c5c0904bcf2171 Mon Sep 17 00:00:00 2001
  2. From: Thomas Preud'homme <robotux@celest.fr>
  3. Date: Sat, 24 Feb 2018 15:50:14 +0000
  4. Subject: Prevent dead code on !x86 in prepare_dynamic_rel
  5. In prepare_dynamic_rel() on non x86 targets the count++ statements
  6. appear before any case label and are therefore dead code. This triggers
  7. build failure when building with -Werror. This patch adds an extra guard
  8. around all the x86 case labels and their associated action, leaving just
  9. the default case label for non x86 targets which builds fine.
  10. Origin: vendor
  11. Forwarded: http://repo.or.cz/tinycc.git/commit/776aa0c093cc6083cbb61d0db8e303209b21bbad
  12. Applied-Upstream: commit:776aa0c093cc6083cbb61d0db8e303209b21bbad
  13. Last-Updated: 2018-02-24
  14. ---
  15. tccelf.c | 2 ++
  16. 1 file changed, 2 insertions(+)
  17. diff --git a/tccelf.c b/tccelf.c
  18. index ff83eb45..ad97a5d1 100644
  19. --- a/tccelf.c
  20. +++ b/tccelf.c
  21. @@ -1036,6 +1036,7 @@ static int prepare_dynamic_rel(TCCState *s1, Section *sr)
  22. int sym_index = ELFW(R_SYM)(rel->r_info);
  23. int type = ELFW(R_TYPE)(rel->r_info);
  24. switch(type) {
  25. +#if defined(TCC_TARGET_I386) || defined(TCC_TARGET_X86_64)
  26. #if defined(TCC_TARGET_I386)
  27. case R_386_32:
  28. if (!get_sym_attr(s1, sym_index, 0)->dyn_index
  29. @@ -1069,6 +1070,7 @@ static int prepare_dynamic_rel(TCCState *s1, Section *sr)
  30. if (get_sym_attr(s1, sym_index, 0)->dyn_index)
  31. count++;
  32. break;
  33. +#endif
  34. default:
  35. break;
  36. }