The Wayback Machine - https://web.archive.org/web/20210909051515/https://github.com/radareorg/radare2/issues/17898
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARM32 build warnings #17898

Open
eagleoflqj opened this issue Nov 6, 2020 · 11 comments
Open

ARM32 build warnings #17898

eagleoflqj opened this issue Nov 6, 2020 · 11 comments

Comments

@eagleoflqj
Copy link
Collaborator

@eagleoflqj eagleoflqj commented Nov 6, 2020

On my rpi4 (Linux liumeo-rpi4 5.4.79-v7l+ #1373 SMP Mon Nov 23 13:27:40 GMT 2020 armv7l GNU/Linux), all test errors fixed now.

pi@liumeo-rpi4:~/github/radare2/test $ r2 -v
radare2 4.6.0-git 25454 @ linux-arm-32 git.
commit: 8c742b28f089385cd76fd6b7a35cb658eb911237 build: 2020-12-20__14:25:02
pi@liumeo-rpi4:~/github/radare2/test $ r2r -L
Skipping db/archos/linux-x64 because it does not match the current platform.
Skipping db/archos/darwin-x64 because it does not match the current platform.
Skipping db/archos/windows-x64 because it does not match the current platform.
Skipping db/extras because it requires additional dependencies.
Loaded 14214 tests.
...
[**]                               db/cmd/cmd_zignature    13274 OK       927 BR        0 XX       13 FX

Finished in 14 minutes and 5 seconds.
@eagleoflqj
Copy link
Collaborator Author

@eagleoflqj eagleoflqj commented Nov 10, 2020

Build warnings. Most of them are just 32-bit pointer to 64-bit integer cast.

/home/pi/github/radare2/libr/..//libr/bin/p/bin_dex.c: In function ‘dex_fields’:
/home/pi/github/radare2/libr/..//libr/bin/p/bin_dex.c:2100:86: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  r_list_append (ret, r_bin_field_new (addr, addr, siz, nam, sdb_fmt ("0x%08"PFMT64x, (ut64)val), fmt, false)); \
                                                                                      ^
/home/pi/github/radare2/libr/..//libr/bin/p/bin_dex.c:2109:2: note: in expansion of macro ‘ROW’
  ROW ("dex_signature", 8, signature, "[20]c");
  ^~~
/home/pi/github/radare2/libr/..//libr/bin/p/../format/le/le.c: In function ‘r_bin_le_get_relocs’:
/home/pi/github/radare2/libr/..//libr/bin/p/../format/le/le.c:546:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    rel->addend = (ut64)r_list_get_n (entries, ordinal - 1);
                  ^
block.c: In function ‘automerge_predecessor_successor_cb’:
block.c:841:52: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  RAnalBlock *pred = ht_up_find (ctx->predecessors, (ut64)block, &found);
                                                    ^
block.c:845:37: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    ht_up_update (ctx->predecessors, (ut64) block, NULL);
                                     ^
block.c:849:36: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   ht_up_insert (ctx->predecessors, (ut64) block, ctx->cur_pred);
                                    ^
block.c: In function ‘automerge_get_predecessors_cb’:
block.c:856:29: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  const RAnalFunction *fcn = (const RAnalFunction *)k;
                             ^
block.c:861:36: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   ht_up_find (ctx->visited_blocks, (ut64)block, &already_visited);
                                    ^
block.c:868:38: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   ht_up_insert (ctx->visited_blocks, (ut64)block, (void *)ctx->cur_succ_count);
                                      ^
block.c: In function ‘r_anal_block_automerge’:
block.c:896:33: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    ht_up_insert (relevant_fcns, (ut64)fcn, NULL);
                                 ^
block.c:907:59: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   RAnalBlock *predecessor = ht_up_find (ctx.predecessors, (ut64)block, NULL);
                                                           ^
block.c:911:69: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   size_t pred_succs_count = (size_t)ht_up_find (ctx.visited_blocks, (ut64)predecessor, NULL);
                                                                     ^
block.c:923:59: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    RAnalBlock *fixup_pred = ht_up_find (ctx.predecessors, (ut64)clock, NULL);
                                                           ^
block.c:934:38: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    ht_up_update (ctx.visited_blocks, (ut64)predecessor, (void *)ctx.cur_succ_count);
                                      ^
block.c:937:37: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     ht_up_update (ctx.predecessors, (ut64)clock, predecessor);
                                     ^
In file included from p/debug_native.c:74:
p/native/linux/linux_coredump.h:60: warning: "R_DEBUG_REG_T" redefined
 #define R_DEBUG_REG_T struct user_regs_struct
 
In file included from p/debug_native.c:65:
p/native/linux/linux_debug.h:68: note: this is the location of the previous definition
 #define R_DEBUG_REG_T struct user_regs
 
p/debug_native.c: In function ‘r_debug_native_map_protect’:
p/debug_native.c:1513:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   "}\n", num, (void*)addr, size, io_perms_to_prot (perms));
               ^
p/native/linux/linux_debug.c: In function ‘linux_handle_signals’:
p/native/linux/linux_debug.c:95:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   dbg->stopaddr = (ut64)siginfo.si_addr;
                   ^
p/native/linux/linux_debug.c: In function ‘print_fpu’:
p/native/linux/linux_debug.c:1058:2: warning: #warning print_fpu not implemented for this platform [-Wcpp]
 #warning print_fpu not implemented for this platform
  ^~~~~~~
p/native/linux/linux_debug.c: In function ‘linux_reg_read’:
p/native/linux/linux_debug.c:1162:3: warning: #warning getfpregs not implemented for this platform [-Wcpp]
  #warning getfpregs not implemented for this platform
   ^~~~~~~
p/native/linux/linux_debug.c:1063:7: warning: variable ‘showfpu’ set but not used [-Wunused-but-set-variable]
  bool showfpu = false;
       ^~~~~~~
At top level:
p/native/linux/linux_debug.c:970:13: warning: ‘print_fpu’ defined but not used -Wunused-function]
 static void print_fpu(void *f){
             ^~~~~~~~~
panels.c: In function ‘__fix_layout_w’:
panels.c:1204:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   r_list_append (list, (void *)(t));
                        ^
panels.c:1218:8: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    if ((int64_t)num - 1 == tx) {
        ^
panels.c:1222:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    int sub = (int64_t)num - tx;
              ^
panels.c:1225:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     target_num = (int64_t)num;
                  ^
panels.c: In function ‘__fix_layout_h’:
panels.c:1245:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   r_list_append (list, (void *)(t));
                        ^
panels.c:1260:8: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    if ((int64_t)num - 1 == ty) {
        ^
panels.c:1264:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    int sub = (int64_t)num - ty;
              ^
panels.c:1267:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     target_num = (int64_t)num;
                  ^
@XVilka
Copy link
Contributor

@XVilka XVilka commented Nov 20, 2020

Can you please update these? I believe some should be fixed already.

@eagleoflqj
Copy link
Collaborator Author

@eagleoflqj eagleoflqj commented Nov 20, 2020

Edit: unit tests are all OK.

@eagleoflqj
Copy link
Collaborator Author

@eagleoflqj eagleoflqj commented Dec 18, 2020

This test is slow.

pi@liumeo-rpi4:~/github/radare2/test $ time ~/bin/prefix/radare2/bin/r2 -Qc 'aa
om~?
s   
pi 1
q!
' bins/pe/65535sects.exe
[x] Analyze all flags starting with sym. and entry0 (aa)
65536
0x291120
mov edi, 0x7027aff9

real	1m50.779s
user	1m50.360s
sys	0m0.371s
@trufae
Copy link
Contributor

@trufae trufae commented Dec 18, 2020

Thanks for identifying it. I found other slow tests too. We can do different things here:

  • disable it
  • Rewrite it to be fast (using a smaller binary or reproducer)
  • only run it in asan builds which are already slow
  • Optimize r2 to make this test fast

Ci time is precious. We must take care of it.

i cactually wanted to have a benchmark ci. Like the V people do

@eagleoflqj eagleoflqj mentioned this issue Dec 19, 2020
4 tasks
@eagleoflqj eagleoflqj changed the title ARM32 test errors ARM32 build warnings Dec 20, 2020
@trufae
Copy link
Contributor

@trufae trufae commented Dec 22, 2020

Is this issue fixed now?

@eagleoflqj
Copy link
Collaborator Author

@eagleoflqj eagleoflqj commented Dec 22, 2020

Is this issue fixed now?

Yes, tests are all passed now. Only warnings remain. Feel free to close it.

@trufae
Copy link
Contributor

@trufae trufae commented Dec 22, 2020

Can you paste the updated list of warnings in here?

@eagleoflqj
Copy link
Collaborator Author

@eagleoflqj eagleoflqj commented Dec 22, 2020

Can you paste the updated list of warnings in here?

Updated above #17898 (comment) when 5.0.0 released.

@trufae
Copy link
Contributor

@trufae trufae commented Dec 22, 2020

Some of them can be solved with an intermediate size_t cast, just if the destination is ut64. For the other cases in afraid its bad code that must be fixed. I can take care of the one in panels unless you started already

@eagleoflqj
Copy link
Collaborator Author

@eagleoflqj eagleoflqj commented Dec 23, 2020

Some of them can be solved with an intermediate size_t cast, just if the destination is ut64. For the other cases in afraid its bad code that must be fixed. I can take care of the one in panels unless you started already

I'm still dealing with pj of lazula's branch. I'll take care of the intermediate casts and you may fix other stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment