aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2025-07-09 08:54:24 +0930
committerAlan Modra <amodra@gmail.com>2025-07-09 09:35:06 +0930
commitb6ef2d0c2f70d3b50a51f3691d06948e4fa90074 (patch)
tree7a4107ffd35bd152aa40935cbcc6e99236c486db
parent4ff3ce6fcd811545c45211b794d67fa2c00e40ff (diff)
downloadbinutils-b6ef2d0c2f70d3b50a51f3691d06948e4fa90074.zip
binutils-b6ef2d0c2f70d3b50a51f3691d06948e4fa90074.tar.gz
binutils-b6ef2d0c2f70d3b50a51f3691d06948e4fa90074.tar.bz2
gas pointer to int and vice versa
Use "intptr_t" or "uintptr_t" for these conversions, not "long" which is wrong on LLP64 systems, or "size_t" which is better but still not the correct type. * config/tc-alpha.c (emit_ldXu, emit_ldX, emit_uldXu, emit_uldX), (emit_stX, emit_ustX, emit_sextX): Use correct type when converting vlgsize pointer to in. Use "int" rather than "long" for result. * config/tc-ia64.c (generate_unwind_image): Use intptr_t cast when passing personality_routine to frag_var. * config/tc-ppc.c (ppc_frob_symbol <coff>): Use uintptr_t cast when converting symbol pointer to valueT. * config/tc-v850.c (md_assemble): Use intptr_t cast when loading integer opindex.
-rw-r--r--gas/config/tc-alpha.c16
-rw-r--r--gas/config/tc-ia64.c2
-rw-r--r--gas/config/tc-ppc.c2
-rw-r--r--gas/config/tc-v850.c22
4 files changed, 21 insertions, 21 deletions
diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c
index f9ca351..07f457e 100644
--- a/gas/config/tc-alpha.c
+++ b/gas/config/tc-alpha.c
@@ -2262,7 +2262,7 @@ emit_ldXu (const expressionS *tok,
const void * vlgsize)
{
if (alpha_target & AXP_OPCODE_BWX)
- emit_ir_load (tok, ntok, ldXu_op[(long) vlgsize]);
+ emit_ir_load (tok, ntok, ldXu_op[(intptr_t) vlgsize]);
else
{
expressionS newtok[3];
@@ -2302,7 +2302,7 @@ emit_ldXu (const expressionS *tok,
/* Emit "extXl targ, $at, targ". */
set_tok_reg (newtok[1], basereg);
newtok[2] = newtok[0];
- assemble_tokens_to_insn (extXl_op[(long) vlgsize], newtok, 3, &insn);
+ assemble_tokens_to_insn (extXl_op[(intptr_t) vlgsize], newtok, 3, &insn);
if (lituse)
{
@@ -2325,7 +2325,7 @@ emit_ldX (const expressionS *tok,
const void * vlgsize)
{
emit_ldXu (tok, ntok, vlgsize);
- assemble_tokens (sextX_op[(long) vlgsize], tok, 1, 1);
+ assemble_tokens (sextX_op[(intptr_t) vlgsize], tok, 1, 1);
}
/* Load an integral value from an unaligned address as an unsigned
@@ -2336,7 +2336,7 @@ emit_uldXu (const expressionS *tok,
int ntok,
const void * vlgsize)
{
- long lgsize = (long) vlgsize;
+ int lgsize = (intptr_t) vlgsize;
expressionS newtok[3];
if (alpha_noat_on)
@@ -2386,7 +2386,7 @@ emit_uldX (const expressionS *tok,
const void * vlgsize)
{
emit_uldXu (tok, ntok, vlgsize);
- assemble_tokens (sextX_op[(long) vlgsize], tok, 1, 1);
+ assemble_tokens (sextX_op[(intptr_t) vlgsize], tok, 1, 1);
}
/* Implement the ldil macro. */
@@ -2411,7 +2411,7 @@ emit_stX (const expressionS *tok,
int ntok,
const void * vlgsize)
{
- int lgsize = (int) (long) vlgsize;
+ int lgsize = (intptr_t) vlgsize;
if (alpha_target & AXP_OPCODE_BWX)
emit_loadstore (tok, ntok, stX_op[lgsize]);
@@ -2513,7 +2513,7 @@ emit_ustX (const expressionS *tok,
int ntok,
const void * vlgsize)
{
- int lgsize = (int) (long) vlgsize;
+ int lgsize = (intptr_t) vlgsize;
expressionS newtok[3];
/* Emit "lda $at, exp". */
@@ -2584,7 +2584,7 @@ emit_sextX (const expressionS *tok,
int ntok,
const void * vlgsize)
{
- long lgsize = (long) vlgsize;
+ int lgsize = (intptr_t) vlgsize;
if (alpha_target & AXP_OPCODE_BWX)
assemble_tokens (sextX_op[lgsize], tok, ntok, 0);
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index 192c093..2fb6b11 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -3657,7 +3657,7 @@ generate_unwind_image (const segT text_seg)
unwind.info = expr_build_dot ();
frag_var (rs_machine_dependent, size, size, 0, 0,
- (offsetT) (long) unwind.personality_routine,
+ (intptr_t) unwind.personality_routine,
(char *) list);
/* Add the personality address to the image. */
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 714dfca..d8a7d21 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -6338,7 +6338,7 @@ ppc_frob_symbol (symbolS *sym)
asymbol *bsym = symbol_get_bfdsym (symbol_get_tc (sym)->within);
combined_entry_type *c = coffsymbol (bsym)->native;
- S_SET_VALUE (sym, (valueT) (size_t) c);
+ S_SET_VALUE (sym, (uintptr_t) c);
coffsymbol (symbol_get_bfdsym (sym))->native->fix_value = 1;
}
else if (S_GET_STORAGE_CLASS (sym) == C_STSYM)
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c
index b344005..0941176 100644
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -3070,7 +3070,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 6, 2, SUBYPTE_LOOP_16_22,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *)(intptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f+4, 0, 4);
}
@@ -3087,7 +3087,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 4, 2, SUBYPTE_UNCOND_9_22,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *)(intptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 2);
}
@@ -3096,7 +3096,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 6, 4, SUBYPTE_UNCOND_9_22_32,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *)(intptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 4);
}
@@ -3113,7 +3113,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 8, 6, SUBYPTE_SA_9_17_22,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *)(intptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 6);
}
@@ -3122,7 +3122,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 6, 4, SUBYPTE_COND_9_17_22,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *)(intptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 4);
}
@@ -3134,7 +3134,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 8, 6, SUBYPTE_SA_9_22,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *)(intptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 6);
}
@@ -3143,7 +3143,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 6, 4, SUBYPTE_COND_9_22,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *)(intptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 4);
}
@@ -3158,7 +3158,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 10, 8, SUBYPTE_SA_9_17_22_32,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *)(intptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 8);
}
@@ -3167,7 +3167,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 8, 6, SUBYPTE_COND_9_17_22_32,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *)(intptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 6);
}
@@ -3179,7 +3179,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 10, 8, SUBYPTE_SA_9_22_32,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *)(intptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 8);
}
@@ -3188,7 +3188,7 @@ md_assemble (char *str)
f = frag_var (rs_machine_dependent, 8, 6, SUBYPTE_COND_9_22_32,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
- (char *)(size_t) fixups[0].opindex);
+ (char *)(intptr_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 6);
}