summaryrefslogtreecommitdiff
path: root/devel/gdb/files/patch-bfd-elf64-alpha.c
blob: 8ea0fd776a138e39eb2b14cd1ee9f2e020d1cb67 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
--- bfd/elf64-alpha.c.orig	2013-03-11 10:52:58.000000000 +0100
+++ bfd/elf64-alpha.c	2013-03-11 11:50:24.000000000 +0100
@@ -3585,9 +3585,9 @@
 
   /* Some compilers warn about a Boolean-looking expression being 
      used in a switch.  The explicit cast silences them.  */
-  switch ((int) (!dynamic && !info->link_info->shared))
-    {
-    case 1:
+  {
+    int skip_default = 0;
+    if (!dynamic && !info->link_info->shared)
       {
 	bfd_vma tp_base;
 	bfd_signed_vma disp;
@@ -3605,7 +3605,7 @@
 	    irel[0].r_offset = pos[0] - info->contents;
 	    irel[0].r_info = ELF64_R_INFO (new_symndx, R_ALPHA_TPREL16);
 	    irel[1].r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
-	    break;
+	    skip_default = 1;
 	  }
 	else if (disp >= -(bfd_signed_vma) 0x80000000
 		 && disp < (bfd_signed_vma) 0x7fff8000
@@ -3620,24 +3620,23 @@
 	    irel[0].r_info = ELF64_R_INFO (new_symndx, R_ALPHA_TPRELHI);
 	    irel[1].r_offset = pos[1] - info->contents;
 	    irel[1].r_info = ELF64_R_INFO (new_symndx, R_ALPHA_TPRELLO);
-	    break;
+	    skip_default = 1;
 	  }
       }
-      /* FALLTHRU */
-
-    default:
-      use_gottprel = TRUE;
-
-      insn = (OP_LDQ << 26) | (tlsgd_reg << 21) | (29 << 16);
-      bfd_put_32 (info->abfd, (bfd_vma) insn, pos[0]);
-      bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, pos[1]);
-
-      irel[0].r_offset = pos[0] - info->contents;
-      irel[0].r_info = ELF64_R_INFO (new_symndx, R_ALPHA_GOTTPREL);
-      irel[1].r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
-      break;
-    }
+      /* FALLTHRU (default) */
+    if (skip_default != 1 )
+      {
+        use_gottprel = TRUE;
 
+        insn = (OP_LDQ << 26) | (tlsgd_reg << 21) | (29 << 16);
+        bfd_put_32 (info->abfd, (bfd_vma) insn, pos[0]);
+        bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, pos[1]);
+
+        irel[0].r_offset = pos[0] - info->contents;
+        irel[0].r_info = ELF64_R_INFO (new_symndx, R_ALPHA_GOTTPREL);
+        irel[1].r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
+      }
+  }
   bfd_put_32 (info->abfd, (bfd_vma) INSN_RDUNIQ, pos[2]);
 
   insn = INSN_ADDQ | (16 << 21) | (0 << 16) | (0 << 0);