ehopt.c (77298) | ehopt.c (78828) |
---|---|
1/* ehopt.c--optimize gcc exception frame information. | 1/* ehopt.c--optimize gcc exception frame information. |
2 Copyright (C) 1998, 2000 Free Software Foundation, Inc. | 2 Copyright 1998, 2000, 2001 Free Software Foundation, Inc. |
3 Written by Ian Lance Taylor <ian@cygnus.com>. 4 5This file is part of GAS, the GNU Assembler. 6 7GAS is free software; you can redistribute it and/or modify 8it under the terms of the GNU General Public License as published by 9the Free Software Foundation; either version 2, or (at your option) 10any later version. --- 72 unchanged lines hidden (view full) --- 83 .set .LLFDE1,.LEFDE1-.LSFDE1 / FDE Length Symbol 84 85 The immediate issue we can address in the assembler is the 86 DW_CFA_advance_loc4 followed by a four byte value. The value is 87 the difference of two addresses in the function. Since gcc does 88 not know this value, it always uses four bytes. We will know the 89 value at the end of assembly, so we can do better. */ 90 | 3 Written by Ian Lance Taylor <ian@cygnus.com>. 4 5This file is part of GAS, the GNU Assembler. 6 7GAS is free software; you can redistribute it and/or modify 8it under the terms of the GNU General Public License as published by 9the Free Software Foundation; either version 2, or (at your option) 10any later version. --- 72 unchanged lines hidden (view full) --- 83 .set .LLFDE1,.LEFDE1-.LSFDE1 / FDE Length Symbol 84 85 The immediate issue we can address in the assembler is the 86 DW_CFA_advance_loc4 followed by a four byte value. The value is 87 the difference of two addresses in the function. Since gcc does 88 not know this value, it always uses four bytes. We will know the 89 value at the end of assembly, so we can do better. */ 90 |
91static int eh_frame_code_alignment PARAMS ((int)); | 91struct cie_info 92{ 93 unsigned code_alignment; 94 int z_augmentation; 95}; |
92 | 96 |
93/* Get the code alignment factor from the CIE. */ | 97static int get_cie_info PARAMS ((struct cie_info *)); |
94 | 98 |
99/* Extract information from the CIE. */ 100 |
|
95static int | 101static int |
96eh_frame_code_alignment (in_seg) 97 int in_seg; | 102get_cie_info (info) 103 struct cie_info *info; |
98{ | 104{ |
99 /* ??? Assume .eh_frame and .debug_frame have the same alignment. */ 100 static int code_alignment; 101 | |
102 fragS *f; 103 fixS *fix; 104 int offset; 105 char CIE_id; 106 char augmentation[10]; 107 int iaug; | 105 fragS *f; 106 fixS *fix; 107 int offset; 108 char CIE_id; 109 char augmentation[10]; 110 int iaug; |
111 int code_alignment = 0; |
|
108 | 112 |
109 if (code_alignment != 0) 110 return code_alignment; 111 112 /* Can't find the alignment if we've changed sections. */ 113 if (! in_seg) 114 return -1; 115 | |
116 /* We should find the CIE at the start of the section. */ 117 118#if defined (BFD_ASSEMBLER) || defined (MANY_SEGMENTS) 119 f = seg_info (now_seg)->frchainP->frch_root; 120#else 121 f = frchain_now->frch_root; 122#endif 123#ifdef BFD_ASSEMBLER --- 18 unchanged lines hidden (view full) --- 142 f = f->fr_next; 143 } 144 if (f == NULL 145 || f->fr_fix - offset < 4 146 || f->fr_literal[offset] != CIE_id 147 || f->fr_literal[offset + 1] != CIE_id 148 || f->fr_literal[offset + 2] != CIE_id 149 || f->fr_literal[offset + 3] != CIE_id) | 113 /* We should find the CIE at the start of the section. */ 114 115#if defined (BFD_ASSEMBLER) || defined (MANY_SEGMENTS) 116 f = seg_info (now_seg)->frchainP->frch_root; 117#else 118 f = frchain_now->frch_root; 119#endif 120#ifdef BFD_ASSEMBLER --- 18 unchanged lines hidden (view full) --- 139 f = f->fr_next; 140 } 141 if (f == NULL 142 || f->fr_fix - offset < 4 143 || f->fr_literal[offset] != CIE_id 144 || f->fr_literal[offset + 1] != CIE_id 145 || f->fr_literal[offset + 2] != CIE_id 146 || f->fr_literal[offset + 3] != CIE_id) |
150 { 151 code_alignment = -1; 152 return -1; 153 } | 147 return 0; |
154 155 /* Next make sure the CIE version number is 1. */ 156 157 offset += 4; 158 while (f != NULL && offset >= f->fr_fix) 159 { 160 offset -= f->fr_fix; 161 f = f->fr_next; 162 } 163 if (f == NULL 164 || f->fr_fix - offset < 1 165 || f->fr_literal[offset] != 1) | 148 149 /* Next make sure the CIE version number is 1. */ 150 151 offset += 4; 152 while (f != NULL && offset >= f->fr_fix) 153 { 154 offset -= f->fr_fix; 155 f = f->fr_next; 156 } 157 if (f == NULL 158 || f->fr_fix - offset < 1 159 || f->fr_literal[offset] != 1) |
166 { 167 code_alignment = -1; 168 return -1; 169 } | 160 return 0; |
170 171 /* Skip the augmentation (a null terminated string). */ 172 173 iaug = 0; 174 ++offset; 175 while (1) 176 { 177 while (f != NULL && offset >= f->fr_fix) 178 { 179 offset -= f->fr_fix; 180 f = f->fr_next; 181 } 182 if (f == NULL) | 161 162 /* Skip the augmentation (a null terminated string). */ 163 164 iaug = 0; 165 ++offset; 166 while (1) 167 { 168 while (f != NULL && offset >= f->fr_fix) 169 { 170 offset -= f->fr_fix; 171 f = f->fr_next; 172 } 173 if (f == NULL) |
183 { 184 code_alignment = -1; 185 return -1; 186 } | 174 return 0; 175 |
187 while (offset < f->fr_fix && f->fr_literal[offset] != '\0') 188 { 189 if ((size_t) iaug < (sizeof augmentation) - 1) 190 { 191 augmentation[iaug] = f->fr_literal[offset]; 192 ++iaug; 193 } 194 ++offset; 195 } 196 if (offset < f->fr_fix) 197 break; 198 } 199 ++offset; 200 while (f != NULL && offset >= f->fr_fix) 201 { 202 offset -= f->fr_fix; 203 f = f->fr_next; 204 } 205 if (f == NULL) | 176 while (offset < f->fr_fix && f->fr_literal[offset] != '\0') 177 { 178 if ((size_t) iaug < (sizeof augmentation) - 1) 179 { 180 augmentation[iaug] = f->fr_literal[offset]; 181 ++iaug; 182 } 183 ++offset; 184 } 185 if (offset < f->fr_fix) 186 break; 187 } 188 ++offset; 189 while (f != NULL && offset >= f->fr_fix) 190 { 191 offset -= f->fr_fix; 192 f = f->fr_next; 193 } 194 if (f == NULL) |
206 { 207 code_alignment = -1; 208 return -1; 209 } | 195 return 0; |
210 211 augmentation[iaug] = '\0'; 212 if (augmentation[0] == '\0') 213 { 214 /* No augmentation. */ 215 } 216 else if (strcmp (augmentation, "eh") == 0) 217 { --- 7 unchanged lines hidden (view full) --- 225 else 226 offset += fix->fx_size; 227 while (f != NULL && offset >= f->fr_fix) 228 { 229 offset -= f->fr_fix; 230 f = f->fr_next; 231 } 232 if (f == NULL) | 196 197 augmentation[iaug] = '\0'; 198 if (augmentation[0] == '\0') 199 { 200 /* No augmentation. */ 201 } 202 else if (strcmp (augmentation, "eh") == 0) 203 { --- 7 unchanged lines hidden (view full) --- 211 else 212 offset += fix->fx_size; 213 while (f != NULL && offset >= f->fr_fix) 214 { 215 offset -= f->fr_fix; 216 f = f->fr_next; 217 } 218 if (f == NULL) |
233 { 234 code_alignment = -1; 235 return -1; 236 } | 219 return 0; |
237 } | 220 } |
238 else 239 { 240 code_alignment = -1; 241 return -1; 242 } | 221 else if (augmentation[0] != 'z') 222 return 0; |
243 244 /* We're now at the code alignment factor, which is a ULEB128. If 245 it isn't a single byte, forget it. */ 246 247 code_alignment = f->fr_literal[offset] & 0xff; | 223 224 /* We're now at the code alignment factor, which is a ULEB128. If 225 it isn't a single byte, forget it. */ 226 227 code_alignment = f->fr_literal[offset] & 0xff; |
248 if ((code_alignment & 0x80) != 0 || code_alignment == 0) 249 { 250 code_alignment = -1; 251 return -1; 252 } | 228 if ((code_alignment & 0x80) != 0) 229 code_alignment = 0; |
253 | 230 |
254 return code_alignment; | 231 info->code_alignment = code_alignment; 232 info->z_augmentation = (augmentation[0] == 'z'); 233 234 return 1; |
255} 256 257/* This function is called from emit_expr. It looks for cases which 258 we can optimize. 259 260 Rather than try to parse all this information as we read it, we 261 look for a single byte DW_CFA_advance_loc4 followed by a 4 byte 262 difference. We turn that into a rs_cfa_advance frag, and handle --- 6 unchanged lines hidden (view full) --- 269 270int 271check_eh_frame (exp, pnbytes) 272 expressionS *exp; 273 unsigned int *pnbytes; 274{ 275 struct frame_data 276 { | 235} 236 237/* This function is called from emit_expr. It looks for cases which 238 we can optimize. 239 240 Rather than try to parse all this information as we read it, we 241 look for a single byte DW_CFA_advance_loc4 followed by a 4 byte 242 difference. We turn that into a rs_cfa_advance frag, and handle --- 6 unchanged lines hidden (view full) --- 249 250int 251check_eh_frame (exp, pnbytes) 252 expressionS *exp; 253 unsigned int *pnbytes; 254{ 255 struct frame_data 256 { |
257 enum frame_state 258 { 259 state_idle, 260 state_saw_size, 261 state_saw_cie_offset, 262 state_saw_pc_begin, 263 state_seeing_aug_size, 264 state_skipping_aug, 265 state_wait_loc4, 266 state_saw_loc4, 267 state_error, 268 } state; 269 270 int cie_info_ok; 271 struct cie_info cie_info; 272 |
|
277 symbolS *size_end_sym; 278 fragS *loc4_frag; | 273 symbolS *size_end_sym; 274 fragS *loc4_frag; |
279 int saw_size; 280 int saw_advance_loc4; | |
281 int loc4_fix; | 275 int loc4_fix; |
276 277 int aug_size; 278 int aug_shift; |
|
282 }; 283 284 static struct frame_data eh_frame_data; 285 static struct frame_data debug_frame_data; 286 struct frame_data *d; 287 288 /* Don't optimize. */ 289 if (flag_traditional_format) 290 return 0; 291 292 /* Select the proper section data. */ 293 if (strcmp (segment_name (now_seg), ".eh_frame") == 0) 294 d = &eh_frame_data; 295 else if (strcmp (segment_name (now_seg), ".debug_frame") == 0) 296 d = &debug_frame_data; 297 else 298 return 0; 299 | 279 }; 280 281 static struct frame_data eh_frame_data; 282 static struct frame_data debug_frame_data; 283 struct frame_data *d; 284 285 /* Don't optimize. */ 286 if (flag_traditional_format) 287 return 0; 288 289 /* Select the proper section data. */ 290 if (strcmp (segment_name (now_seg), ".eh_frame") == 0) 291 d = &eh_frame_data; 292 else if (strcmp (segment_name (now_seg), ".debug_frame") == 0) 293 d = &debug_frame_data; 294 else 295 return 0; 296 |
300 if (d->saw_size && S_IS_DEFINED (d->size_end_sym)) | 297 if (d->state >= state_saw_size && S_IS_DEFINED (d->size_end_sym)) |
301 { 302 /* We have come to the end of the CIE or FDE. See below where 303 we set saw_size. We must check this first because we may now 304 be looking at the next size. */ | 298 { 299 /* We have come to the end of the CIE or FDE. See below where 300 we set saw_size. We must check this first because we may now 301 be looking at the next size. */ |
305 d->saw_size = 0; 306 d->saw_advance_loc4 = 0; | 302 d->state = state_idle; |
307 } 308 | 303 } 304 |
309 if (! d->saw_size 310 && *pnbytes == 4) | 305 switch (d->state) |
311 { | 306 { |
312 /* This might be the size of the CIE or FDE. We want to know 313 the size so that we don't accidentally optimize across an FDE 314 boundary. We recognize the size in one of two forms: a 315 symbol which will later be defined as a difference, or a 316 subtraction of two symbols. Either way, we can tell when we 317 are at the end of the FDE because the symbol becomes defined 318 (in the case of a subtraction, the end symbol, from which the 319 start symbol is being subtracted). Other ways of describing 320 the size will not be optimized. */ 321 if ((exp->X_op == O_symbol || exp->X_op == O_subtract) 322 && ! S_IS_DEFINED (exp->X_add_symbol)) | 307 case state_idle: 308 if (*pnbytes == 4) |
323 { | 309 { |
324 d->saw_size = 1; 325 d->size_end_sym = exp->X_add_symbol; | 310 /* This might be the size of the CIE or FDE. We want to know 311 the size so that we don't accidentally optimize across an FDE 312 boundary. We recognize the size in one of two forms: a 313 symbol which will later be defined as a difference, or a 314 subtraction of two symbols. Either way, we can tell when we 315 are at the end of the FDE because the symbol becomes defined 316 (in the case of a subtraction, the end symbol, from which the 317 start symbol is being subtracted). Other ways of describing 318 the size will not be optimized. */ 319 if ((exp->X_op == O_symbol || exp->X_op == O_subtract) 320 && ! S_IS_DEFINED (exp->X_add_symbol)) 321 { 322 d->state = state_saw_size; 323 d->size_end_sym = exp->X_add_symbol; 324 } |
326 } | 325 } |
327 } 328 else if (d->saw_size 329 && *pnbytes == 1 330 && exp->X_op == O_constant 331 && exp->X_add_number == DW_CFA_advance_loc4) 332 { 333 /* This might be a DW_CFA_advance_loc4. Record the frag and the 334 position within the frag, so that we can change it later. */ 335 d->saw_advance_loc4 = 1; 336 frag_grow (1); 337 d->loc4_frag = frag_now; 338 d->loc4_fix = frag_now_fix (); 339 } 340 else if (d->saw_advance_loc4 341 && *pnbytes == 4 342 && exp->X_op == O_constant) 343 { 344 int ca; | 326 break; |
345 | 327 |
346 /* This is a case which we can optimize. The two symbols being 347 subtracted were in the same frag and the expression was 348 reduced to a constant. We can do the optimization entirely 349 in this function. */ | 328 case state_saw_size: 329 case state_saw_cie_offset: 330 /* Assume whatever form it appears in, it appears atomically. */ 331 d->state += 1; 332 break; |
350 | 333 |
351 d->saw_advance_loc4 = 0; | 334 case state_saw_pc_begin: 335 /* Decide whether we should see an augmentation. */ 336 if (! d->cie_info_ok 337 && ! (d->cie_info_ok = get_cie_info (&d->cie_info))) 338 d->state = state_error; 339 else if (d->cie_info.z_augmentation) 340 { 341 d->state = state_seeing_aug_size; 342 d->aug_size = 0; 343 d->aug_shift = 0; 344 } 345 else 346 d->state = state_wait_loc4; 347 break; |
352 | 348 |
353 ca = eh_frame_code_alignment (1); 354 if (ca < 0) | 349 case state_seeing_aug_size: 350 /* Bytes == -1 means this comes from an leb128 directive. */ 351 if ((int)*pnbytes == -1 && exp->X_op == O_constant) |
355 { | 352 { |
356 /* Don't optimize. */ | 353 d->aug_size = exp->X_add_number; 354 d->state = state_skipping_aug; |
357 } | 355 } |
358 else if (exp->X_add_number % ca == 0 359 && exp->X_add_number / ca < 0x40) | 356 else if (*pnbytes == 1 && exp->X_op == O_constant) |
360 { | 357 { |
361 d->loc4_frag->fr_literal[d->loc4_fix] 362 = DW_CFA_advance_loc | (exp->X_add_number / ca); 363 /* No more bytes needed. */ 364 return 1; | 358 unsigned char byte = exp->X_add_number; 359 d->aug_size |= (byte & 0x7f) << d->aug_shift; 360 d->aug_shift += 7; 361 if ((byte & 0x80) == 0) 362 d->state = state_skipping_aug; |
365 } | 363 } |
366 else if (exp->X_add_number < 0x100) | 364 else 365 d->state = state_error; 366 break; 367 368 case state_skipping_aug: 369 if ((int)*pnbytes < 0) 370 d->state = state_error; 371 else |
367 { | 372 { |
368 d->loc4_frag->fr_literal[d->loc4_fix] = DW_CFA_advance_loc1; 369 *pnbytes = 1; | 373 int left = (d->aug_size -= *pnbytes); 374 if (left == 0) 375 d->state = state_wait_loc4; 376 else if (left < 0) 377 d->state = state_error; |
370 } | 378 } |
371 else if (exp->X_add_number < 0x10000) | 379 break; 380 381 case state_wait_loc4: 382 if (*pnbytes == 1 383 && exp->X_op == O_constant 384 && exp->X_add_number == DW_CFA_advance_loc4) |
372 { | 385 { |
373 d->loc4_frag->fr_literal[d->loc4_fix] = DW_CFA_advance_loc2; 374 *pnbytes = 2; | 386 /* This might be a DW_CFA_advance_loc4. Record the frag and the 387 position within the frag, so that we can change it later. */ 388 frag_grow (1); 389 d->state = state_saw_loc4; 390 d->loc4_frag = frag_now; 391 d->loc4_fix = frag_now_fix (); |
375 } | 392 } |
376 } 377 else if (d->saw_advance_loc4 378 && *pnbytes == 4 379 && exp->X_op == O_subtract) 380 { 381 /* This is a case we can optimize. The expression was not 382 reduced, so we can not finish the optimization until the end 383 of the assembly. We set up a variant frag which we handle 384 later. */ | 393 break; |
385 | 394 |
386 d->saw_advance_loc4 = 0; | 395 case state_saw_loc4: 396 d->state = state_wait_loc4; 397 if (*pnbytes != 4) 398 break; 399 if (exp->X_op == O_constant) 400 { 401 /* This is a case which we can optimize. The two symbols being 402 subtracted were in the same frag and the expression was 403 reduced to a constant. We can do the optimization entirely 404 in this function. */ 405 if (d->cie_info.code_alignment > 0 406 && exp->X_add_number % d->cie_info.code_alignment == 0 407 && exp->X_add_number / d->cie_info.code_alignment < 0x40) 408 { 409 d->loc4_frag->fr_literal[d->loc4_fix] 410 = DW_CFA_advance_loc 411 | (exp->X_add_number / d->cie_info.code_alignment); 412 /* No more bytes needed. */ 413 return 1; 414 } 415 else if (exp->X_add_number < 0x100) 416 { 417 d->loc4_frag->fr_literal[d->loc4_fix] = DW_CFA_advance_loc1; 418 *pnbytes = 1; 419 } 420 else if (exp->X_add_number < 0x10000) 421 { 422 d->loc4_frag->fr_literal[d->loc4_fix] = DW_CFA_advance_loc2; 423 *pnbytes = 2; 424 } 425 } 426 else if (exp->X_op == O_subtract) 427 { 428 /* This is a case we can optimize. The expression was not 429 reduced, so we can not finish the optimization until the end 430 of the assembly. We set up a variant frag which we handle 431 later. */ 432 int fr_subtype; |
387 | 433 |
388 frag_var (rs_cfa, 4, 0, 0, make_expr_symbol (exp), 389 d->loc4_fix, (char *) d->loc4_frag); | 434 if (d->cie_info.code_alignment > 0) 435 fr_subtype = d->cie_info.code_alignment << 3; 436 else 437 fr_subtype = 0; |
390 | 438 |
391 return 1; | 439 frag_var (rs_cfa, 4, 0, fr_subtype, make_expr_symbol (exp), 440 d->loc4_fix, (char *) d->loc4_frag); 441 return 1; 442 } 443 break; 444 445 case state_error: 446 /* Just skipping everything. */ 447 break; |
392 } | 448 } |
393 else 394 d->saw_advance_loc4 = 0; | |
395 396 return 0; 397} 398 399/* The function estimates the size of a rs_cfa variant frag based on 400 the current values of the symbols. It is called before the | 449 450 return 0; 451} 452 453/* The function estimates the size of a rs_cfa variant frag based on 454 the current values of the symbols. It is called before the |
401 relaxation loop. We set fr_subtype to the expected length. */ | 455 relaxation loop. We set fr_subtype{0:2} to the expected length. */ |
402 403int 404eh_frame_estimate_size_before_relax (frag) 405 fragS *frag; 406{ | 456 457int 458eh_frame_estimate_size_before_relax (frag) 459 fragS *frag; 460{ |
407 int ca; | |
408 offsetT diff; | 461 offsetT diff; |
462 int ca = frag->fr_subtype >> 3; |
|
409 int ret; 410 | 463 int ret; 464 |
411 ca = eh_frame_code_alignment (0); | |
412 diff = resolve_symbol_value (frag->fr_symbol, 0); 413 | 465 diff = resolve_symbol_value (frag->fr_symbol, 0); 466 |
414 if (ca < 0) 415 ret = 4; 416 else if (diff % ca == 0 && diff / ca < 0x40) | 467 if (ca > 0 && diff % ca == 0 && diff / ca < 0x40) |
417 ret = 0; 418 else if (diff < 0x100) 419 ret = 1; 420 else if (diff < 0x10000) 421 ret = 2; 422 else 423 ret = 4; 424 | 468 ret = 0; 469 else if (diff < 0x100) 470 ret = 1; 471 else if (diff < 0x10000) 472 ret = 2; 473 else 474 ret = 4; 475 |
425 frag->fr_subtype = ret; | 476 frag->fr_subtype = (frag->fr_subtype & ~7) | ret; |
426 427 return ret; 428} 429 430/* This function relaxes a rs_cfa variant frag based on the current | 477 478 return ret; 479} 480 481/* This function relaxes a rs_cfa variant frag based on the current |
431 values of the symbols. fr_subtype is the current length of the 432 frag. This returns the change in frag length. */ | 482 values of the symbols. fr_subtype{0:2} is the current length of 483 the frag. This returns the change in frag length. */ |
433 434int 435eh_frame_relax_frag (frag) 436 fragS *frag; 437{ 438 int oldsize, newsize; 439 | 484 485int 486eh_frame_relax_frag (frag) 487 fragS *frag; 488{ 489 int oldsize, newsize; 490 |
440 oldsize = frag->fr_subtype; | 491 oldsize = frag->fr_subtype & 7; |
441 newsize = eh_frame_estimate_size_before_relax (frag); 442 return newsize - oldsize; 443} 444 445/* This function converts a rs_cfa variant frag into a normal fill 446 frag. This is called after all relaxation has been done. | 492 newsize = eh_frame_estimate_size_before_relax (frag); 493 return newsize - oldsize; 494} 495 496/* This function converts a rs_cfa variant frag into a normal fill 497 frag. This is called after all relaxation has been done. |
447 fr_subtype will be the desired length of the frag. */ | 498 fr_subtype{0:2} will be the desired length of the frag. */ |
448 449void 450eh_frame_convert_frag (frag) 451 fragS *frag; 452{ 453 offsetT diff; 454 fragS *loc4_frag; 455 int loc4_fix; 456 457 loc4_frag = (fragS *) frag->fr_opcode; 458 loc4_fix = (int) frag->fr_offset; 459 460 diff = resolve_symbol_value (frag->fr_symbol, 1); 461 | 499 500void 501eh_frame_convert_frag (frag) 502 fragS *frag; 503{ 504 offsetT diff; 505 fragS *loc4_frag; 506 int loc4_fix; 507 508 loc4_frag = (fragS *) frag->fr_opcode; 509 loc4_fix = (int) frag->fr_offset; 510 511 diff = resolve_symbol_value (frag->fr_symbol, 1); 512 |
462 if (frag->fr_subtype == 0) | 513 switch (frag->fr_subtype & 7) |
463 { | 514 { |
464 int ca; | 515 case 0: 516 { 517 int ca = frag->fr_subtype >> 3; 518 assert (ca > 0 && diff % ca == 0 && diff / ca < 0x40); 519 loc4_frag->fr_literal[loc4_fix] = DW_CFA_advance_loc | (diff / ca); 520 } 521 break; |
465 | 522 |
466 ca = eh_frame_code_alignment (0); 467 assert (ca > 0 && diff % ca == 0 && diff / ca < 0x40); 468 loc4_frag->fr_literal[loc4_fix] = DW_CFA_advance_loc | (diff / ca); 469 } 470 else if (frag->fr_subtype == 1) 471 { | 523 case 1: |
472 assert (diff < 0x100); 473 loc4_frag->fr_literal[loc4_fix] = DW_CFA_advance_loc1; 474 frag->fr_literal[frag->fr_fix] = diff; | 524 assert (diff < 0x100); 525 loc4_frag->fr_literal[loc4_fix] = DW_CFA_advance_loc1; 526 frag->fr_literal[frag->fr_fix] = diff; |
475 } 476 else if (frag->fr_subtype == 2) 477 { | 527 break; 528 529 case 2: |
478 assert (diff < 0x10000); 479 loc4_frag->fr_literal[loc4_fix] = DW_CFA_advance_loc2; 480 md_number_to_chars (frag->fr_literal + frag->fr_fix, diff, 2); | 530 assert (diff < 0x10000); 531 loc4_frag->fr_literal[loc4_fix] = DW_CFA_advance_loc2; 532 md_number_to_chars (frag->fr_literal + frag->fr_fix, diff, 2); |
533 break; 534 535 default: 536 md_number_to_chars (frag->fr_literal + frag->fr_fix, diff, 4); 537 break; |
|
481 } | 538 } |
482 else 483 md_number_to_chars (frag->fr_literal + frag->fr_fix, diff, 4); | |
484 | 539 |
485 frag->fr_fix += frag->fr_subtype; | 540 frag->fr_fix += frag->fr_subtype & 7; |
486 frag->fr_type = rs_fill; | 541 frag->fr_type = rs_fill; |
542 frag->fr_subtype = 0; |
|
487 frag->fr_offset = 0; 488} | 543 frag->fr_offset = 0; 544} |