Issue
I am trying to get Rasta Ring0 Debugger version 0.3 compiled in my x86-64 Linux, it's a Linux kernel module. I have replaced 32-bit inline assembly with 64-bit assembly as explained in my question How to convert Linux 32-bit gcc inline assembly to 64-bit code? , by using Vim regular expressions, and gcc gives no syntax errors. But I get several other errors.
My computer is a Lenovo W520 laptop with Intel Core i7-2760QM and I'm using Debian GNU/Linux Wheezy.
These are first lines of the output of $ make >make_output.txt 2>&1
make -C /lib/modules/`uname -r`/build/ SUBDIRS=`pwd` modules
make[1]: Entering directory `/usr/src/linux-3.5.4'
/usr/src/linux-3.5.4/arch/x86/Makefile:96: CONFIG_X86_X32 enabled but no binutils support
CC [M] /home/user/code/rr0d/0.3/module_nux.o
/bin/sh: 1: nobjdump: not found
CC [M] /home/user/code/rr0d/0.3/breakpoint.o
/home/user/code/rr0d/0.3/breakpoint.c: In function ‘insert_bp’:
/home/user/code/rr0d/0.3/breakpoint.c:66:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
First, CONFIG_X86_X32 enabled but no binutils support
. But in my custom kernel .config
it's clear that it's a 64-bit system:
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 3.5.4 Kernel Configuration
#
CONFIG_64BIT=y
# CONFIG_X86_32 is not set
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
Second, there is this row in $ make >make_output.txt 2>&1
output:
/bin/sh: 1: nobjdump: not found
Obviously there is no such program as nobjdump
, it should be objdump
. Where might this n
come from? This same error is present later also with ld
, in the form of nld
. Any ideas where this error might originate and it could be solved?
The Makefile
is the following:
# EXTRA_CFLAGS += -O2 -Wall -DLINUX_26
EXTRA_CFLAGS += -O2 -Wall -DLINUX_26 -m64
OBJ := module_nux.o breakpoint.o buffering.o command.o disasmbak.o idt.o
OBJ += keyboard.o page.o video.o utils.o import_symb.o core_rr0d.o pci.o
MODULE := rr0d.o
obj-m := $(MODULE)
rr0d-objs := $(OBJ)
default:
make -C /lib/modules/`uname -r`/build/ SUBDIRS=`pwd` modules
clean:
rm -f *.o .*.o.cmd .*.ko.cmd *.mod.c *~
rm -rf .tmp_versions
mrproper:
make clean
rm -f *.ko
In Makefile
I added -m64
to EXTRA_FLAGS
but it didn't change the make
output.
In the end of output (entire output below) there are three more errors of the same type as the one above:
/bin/sh: 1: nobjdump: not found
/bin/sh: 1: nobjdump: not found
/bin/sh: 1: nld: not found
Clearly there are 3 n
letters that shouldn't be there. Probably this is not related to Rasta Ring0 Debugger, because I got identical error also when trying to compile 'parrot' sample device driver for Linux 2.6 and 3.0.
So, any ideas how to solve these compiling errors? Googling around for days hasn't helped in this and I'm totally out of ideas.
This is the entire $ make >make_output.txt 2>&1
output (including the 8 lines already presented above):
make -C /lib/modules/`uname -r`/build/ SUBDIRS=`pwd` modules
make[1]: Entering directory `/usr/src/linux-3.5.4'
/usr/src/linux-3.5.4/arch/x86/Makefile:96: CONFIG_X86_X32 enabled but no binutils support
CC [M] /home/user/code/rr0d/0.3/module_nux.o
/bin/sh: 1: nobjdump: not found
CC [M] /home/user/code/rr0d/0.3/breakpoint.o
/home/user/code/rr0d/0.3/breakpoint.c: In function ‘insert_bp’:
/home/user/code/rr0d/0.3/breakpoint.c:66:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/breakpoint.c:74:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/breakpoint.c:80:33: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/breakpoint.c:81:46: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/breakpoint.c: In function ‘is_breakpoint’:
/home/user/code/rr0d/0.3/breakpoint.c:127:30: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/breakpoint.c: In function ‘parse_inst’:
/home/user/code/rr0d/0.3/breakpoint.c:310:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/breakpoint.c:312:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/breakpoint.c: In function ‘is_hw_breakpoint’:
/home/user/code/rr0d/0.3/breakpoint.c:600:40: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/bin/sh: 1: nobjdump: not found
CC [M] /home/user/code/rr0d/0.3/buffering.o
/bin/sh: 1: nobjdump: not found
CC [M] /home/user/code/rr0d/0.3/command.o
/bin/sh: 1: nobjdump: not found
CC [M] /home/user/code/rr0d/0.3/disasmbak.o
/bin/sh: 1: nobjdump: not found
CC [M] /home/user/code/rr0d/0.3/idt.o
/home/user/code/rr0d/0.3/idt.c: In function ‘translate_logic_to_linear’:
/home/user/code/rr0d/0.3/idt.c:92:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/idt.c: In function ‘visualise_idt’:
/home/user/code/rr0d/0.3/idt.c:157:1: warning: the frame size of 2064 bytes is larger than 2048 bytes [-Wframe-larger-than=]
/bin/sh: 1: nobjdump: not found
CC [M] /home/user/code/rr0d/0.3/keyboard.o
/home/user/code/rr0d/0.3/keyboard.c: In function ‘back_disasm’:
/home/user/code/rr0d/0.3/keyboard.c:500:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/keyboard.c:511:27: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/keyboard.c: In function ‘handle_scancode’:
/home/user/code/rr0d/0.3/keyboard.c:784:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/keyboard.c:839:55: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/keyboard.c:1230:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/keyboard.c:1245:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/keyboard.c:1250:43: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/bin/sh: 1: nobjdump: not found
CC [M] /home/user/code/rr0d/0.3/page.o
/home/user/code/rr0d/0.3/page.c: In function ‘basetp’:
/home/user/code/rr0d/0.3/page.c:68:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/page.c: In function ‘get_page_info’:
/home/user/code/rr0d/0.3/page.c:190:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/page.c:193:23: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/page.c: In function ‘write_save_dirty’:
/home/user/code/rr0d/0.3/page.c:355:33: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/page.c:359:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/page.c: In function ‘poked1’:
/home/user/code/rr0d/0.3/page.c:405:49: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/page.c:434:33: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/page.c:447:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/page.c:472:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/bin/sh: 1: nobjdump: not found
CC [M] /home/user/code/rr0d/0.3/video.o
/bin/sh: 1: nobjdump: not found
CC [M] /home/user/code/rr0d/0.3/utils.o
/bin/sh: 1: nobjdump: not found
CC [M] /home/user/code/rr0d/0.3/import_symb.o
/bin/sh: 1: nobjdump: not found
CC [M] /home/user/code/rr0d/0.3/core_rr0d.o
/home/user/code/rr0d/0.3/core_rr0d.c: In function ‘printf_disasm’:
/home/user/code/rr0d/0.3/core_rr0d.c:314:16: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:318:53: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:319:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:344:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:358:44: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:393:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:417:11: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c: In function ‘dump_data’:
/home/user/code/rr0d/0.3/core_rr0d.c:457:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:459:16: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:464:53: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:465:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/core_rr0d.c: In function ‘_kbdhandle’:
/home/user/code/rr0d/0.3/core_rr0d.c:817:41: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:824:45: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/core_rr0d.c: At top level:
/home/user/code/rr0d/0.3/core_rr0d.c:841:1: warning: ‘cdecl’ attribute ignored [-Wattributes]
/home/user/code/rr0d/0.3/core_rr0d.c: In function ‘kbdhandle’:
/home/user/code/rr0d/0.3/core_rr0d.c:845:3: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c: In function ‘step_by_step’:
/home/user/code/rr0d/0.3/core_rr0d.c:1041:44: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:1063:49: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/core_rr0d.c: At top level:
/home/user/code/rr0d/0.3/core_rr0d.c:1181:1: warning: ‘cdecl’ attribute ignored [-Wattributes]
/home/user/code/rr0d/0.3/core_rr0d.c: In function ‘int0_handle’:
/home/user/code/rr0d/0.3/core_rr0d.c:1185:3: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c: At top level:
/home/user/code/rr0d/0.3/core_rr0d.c:1366:1: warning: ‘cdecl’ attribute ignored [-Wattributes]
/home/user/code/rr0d/0.3/core_rr0d.c: In function ‘int1_handle’:
/home/user/code/rr0d/0.3/core_rr0d.c:1370:3: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c: In function ‘_int3_handle’:
/home/user/code/rr0d/0.3/core_rr0d.c:1430:30: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/core_rr0d.c: At top level:
/home/user/code/rr0d/0.3/core_rr0d.c:1495:1: warning: ‘cdecl’ attribute ignored [-Wattributes]
/home/user/code/rr0d/0.3/core_rr0d.c: In function ‘int3_handle’:
/home/user/code/rr0d/0.3/core_rr0d.c:1499:3: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c: At top level:
/home/user/code/rr0d/0.3/core_rr0d.c:1540:1: warning: ‘cdecl’ attribute ignored [-Wattributes]
/home/user/code/rr0d/0.3/core_rr0d.c: In function ‘int6_handle’:
/home/user/code/rr0d/0.3/core_rr0d.c:1544:3: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c: At top level:
/home/user/code/rr0d/0.3/core_rr0d.c:1586:1: warning: ‘cdecl’ attribute ignored [-Wattributes]
/home/user/code/rr0d/0.3/core_rr0d.c: In function ‘int13_handle’:
/home/user/code/rr0d/0.3/core_rr0d.c:1589:3: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c: In function ‘_int14_handle’:
/home/user/code/rr0d/0.3/core_rr0d.c:1605:32: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:1606:36: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/core_rr0d.c: At top level:
/home/user/code/rr0d/0.3/core_rr0d.c:1648:1: warning: ‘cdecl’ attribute ignored [-Wattributes]
/home/user/code/rr0d/0.3/core_rr0d.c: In function ‘int14_handle’:
/home/user/code/rr0d/0.3/core_rr0d.c:1651:3: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c: In function ‘_int128_handle’:
/home/user/code/rr0d/0.3/core_rr0d.c:1664:32: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:1665:36: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/core_rr0d.c: At top level:
/home/user/code/rr0d/0.3/core_rr0d.c:1687:1: warning: ‘cdecl’ attribute ignored [-Wattributes]
/home/user/code/rr0d/0.3/core_rr0d.c: In function ‘int128_handle’:
/home/user/code/rr0d/0.3/core_rr0d.c:1691:3: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c: In function ‘init_rr0d’:
/home/user/code/rr0d/0.3/core_rr0d.c:1791:13: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:1794:9: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:1846:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:1848:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:1849:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:1850:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:1851:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:1852:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:1853:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:1854:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/home/user/code/rr0d/0.3/core_rr0d.c:1869:49: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/user/code/rr0d/0.3/core_rr0d.c: In function ‘cleanup_rr0d’:
/home/user/code/rr0d/0.3/core_rr0d.c:1938:36: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/bin/sh: 1: nobjdump: not found
CC [M] /home/user/code/rr0d/0.3/pci.o
/bin/sh: 1: nobjdump: not found
LD [M] /home/user/code/rr0d/0.3/rr0d.o
/bin/sh: 1: nld: not found
make[2]: *** [/home/user/code/rr0d/0.3/rr0d.o] Error 127
make[1]: *** [_module_/home/user/code/rr0d/0.3] Error 2
make[1]: Leaving directory `/usr/src/linux-3.5.4'
make: *** [default] Error 2
Solution
Answering to myself after solving these two problems, the first as indicated by Banthar, and the second by myself.
The first issue is that CONFIG_X86_32
and CONFIG_X86_X32
are two different variables. CONFIG_X86_X32
(x32 ABI for 64-bit mode) must be set to N
to solve the problem related with binutils
support.
The other problem is with nobjdump
and nld
:
/bin/sh: 1: nobjdump: not found
/bin/sh: 1: nld: not found
This can be fixed easily with symlinks:
$ su
# cd /usr/bin
# ln -s objdump nobjdump
# ln -s ld nld
Answered By - nrz