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

error build on centos 5 #12

Open
sin5678 opened this issue Mar 22, 2019 · 3 comments
Open

error build on centos 5 #12

sin5678 opened this issue Mar 22, 2019 · 3 comments

Comments

@sin5678
Copy link

sin5678 commented Mar 22, 2019

[root@promote ~]# unzip libelfmaster-master.zip
Archive: libelfmaster-master.zip
1879e92
creating: libelfmaster-master/
inflating: libelfmaster-master/.gitignore
inflating: libelfmaster-master/ELF_STRUCTURE_MODIFICATION.md
inflating: libelfmaster-master/Makefile.in
inflating: libelfmaster-master/PARSING_DETAILS.md
inflating: libelfmaster-master/README.md
inflating: libelfmaster-master/TODO
creating: libelfmaster-master/build/
inflating: libelfmaster-master/build/libelfmaster.build.in
extracting: libelfmaster-master/build/libelfmaster.build.x86_64
inflating: libelfmaster-master/build/libelfmaster.pc
inflating: libelfmaster-master/build/libelfmaster.pc.in
inflating: libelfmaster-master/configure
creating: libelfmaster-master/examples/
inflating: libelfmaster-master/examples/Makefile
inflating: libelfmaster-master/examples/checksec.c
inflating: libelfmaster-master/examples/eh_frame.c
inflating: libelfmaster-master/examples/elf_text.c
inflating: libelfmaster-master/examples/elfparse.c
inflating: libelfmaster-master/examples/ldd.c
inflating: libelfmaster-master/examples/merged.c
inflating: libelfmaster-master/examples/modify_dynsym.c
inflating: libelfmaster-master/examples/modify_section.c
inflating: libelfmaster-master/examples/modify_segment.c
inflating: libelfmaster-master/examples/modify_symbol.c
extracting: libelfmaster-master/examples/nostdlib.c
inflating: libelfmaster-master/examples/objdump_libelfmaster.c
inflating: libelfmaster-master/examples/plt_dump.c
inflating: libelfmaster-master/examples/plt_dump2.c
inflating: libelfmaster-master/examples/pltgot.c
inflating: libelfmaster-master/examples/pointers.c
inflating: libelfmaster-master/examples/pointers.s
inflating: libelfmaster-master/examples/read_mem.c
inflating: libelfmaster-master/examples/scount.c
inflating: libelfmaster-master/examples/sections.c
inflating: libelfmaster-master/examples/symbols.c
inflating: libelfmaster-master/examples/test.c
inflating: libelfmaster-master/examples/test2.c
creating: libelfmaster-master/include/
extracting: libelfmaster-master/include/configure.h
extracting: libelfmaster-master/include/configure.h.in
inflating: libelfmaster-master/include/dwarf.h
inflating: libelfmaster-master/include/internal.h
inflating: libelfmaster-master/include/libelfmaster.h
inflating: libelfmaster-master/include/misc.h
inflating: libelfmaster-master/libelfmaster_talk_hushcon.odp
inflating: libelfmaster-master/libelfmaster_talk_hushcon.pdf
creating: libelfmaster-master/regressions/
extracting: libelfmaster-master/regressions/*.c
inflating: libelfmaster-master/regressions/Makefile.in
creating: libelfmaster-master/src/
inflating: libelfmaster-master/src/Makefile.in
inflating: libelfmaster-master/src/internal.c
inflating: libelfmaster-master/src/libelfmaster.c
creating: libelfmaster-master/utils/
inflating: libelfmaster-master/utils/stripx.c
[root@promote ~]# cd libelfmaster-master
[root@promote libelfmaster-master]# ls
build include PARSING_DETAILS.md TODO
configure libelfmaster_talk_hushcon.odp README.md utils
ELF_STRUCTURE_MODIFICATION.md libelfmaster_talk_hushcon.pdf regressions
examples Makefile.in src
[root@promote libelfmaster-master]# ./configure \

Detecting operating system.......success [linux]
Detecting machine architecture...success [x86_64]
Finding dirname command..........success [/usr/bin/dirname]
Determining build directory......success [/root/libelfmaster-master]
Finding gzip tool................success [/bin/gzip]
Finding suitable C compiler......success [/usr/bin/cc]
Finding suitable C++ compiler....success [/usr/bin/g++]
Package ck was not found in the pkg-config search path.
Perhaps you should add the directory containing ck.pc' to the PKG_CONFIG_PATH environment variable No package 'ck' found Package libelfmaster was not found in the pkg-config search path. Perhaps you should add the directory containing libelfmaster.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libelfmaster' found
Checking header file usability...success [stdint.h]
Checking header file usability...success [stdlib.h]
Checking header file usability...success [string.h]
Checking header file usability...success [errno.h]
Checking header file usability...success [sys/types.h]
Checking dynamic libraries.......success [dl]
Checking dynamic libraries.......ignored [@LIBJEMALLOC@]
Checking dynamic libraries.......ignored [@LIBTCMALLOC@]
Generating build files...........success

       VERSION = 0.1.0
     BUILD_DIR = /root/libelfmaster-master
INSTALL_PREFIX = /opt/elfmaster
       SRC_DIR = /root/libelfmaster-master
        SYSTEM = linux
       PROFILE = x86_64
            CC = /usr/bin/cc
           CXX = /usr/bin/g++
      COMPILER = gcc
        CFLAGS = -D_DEFAULT_SOURCE -D_GNU_SOURCE -D_BSD_SOURCE -std=gnu99 -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -fstrict-aliasing -O2 -pipe -Wno-parentheses -g -rdynamic -fno-omit-frame-pointer -I/root/libelfmaster-master/include -I/root/libelfmaster-master/include -I/opt/elfmaster/include    -m64 -fPIC
      CXXFLAGS = -D_DEFAULT_SOURCE -D_GNU_SOURCE -D_BSD_SOURCE -std=gnu++98 -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wdisabled-optimization -fstrict-aliasing -O2 -pipe -Wno-parentheses -g -rdynamic -fno-omit-frame-pointer -I/root/libelfmaster-master/include -I/root/libelfmaster-master/include -I/opt/elfmaster/include  -m64
PTHREAD_CFLAGS = -pthread
            LD = /usr/bin/cc
       LDFLAGS = -Wl,-rpath,/opt/elfmaster/lib -Wl,-rpath-link,/opt/elfmaster/lib  -fPIC
          GZIP = /bin/gzip -c
          MAKE = make
      LDOBJECT =  /usr/lib64/libdl.so

Headers will be installed in /opt/elfmaster/include
Libraries will be installed in /opt/elfmaster/lib
Documentation will be installed in /opt/elfmaster/share/man
[root@promote libelfmaster-master]# mjake
bash: mjake: command not found
[root@promote libelfmaster-master]# make
make -C src all || exit
make[1]: Entering directory /root/libelfmaster-master/src' /usr/bin/cc -D_DEFAULT_SOURCE -D_GNU_SOURCE -D_BSD_SOURCE -std=gnu99 -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -fstrict-aliasing -O2 -pipe -Wno-parentheses -g -rdynamic -fno-omit-frame-pointer -I/root/libelfmaster-master/include -I/root/libelfmaster-master/include -I/opt/elfmaster/include -m64 -fPIC -I/root/libelfmaster-master/include -I/root/libelfmaster-master/include -m64 -D__x86_64__ -ggdb -O2 -I/root/libelfmaster-master/include -c -o /root/libelfmaster-master/src/libelfmaster.o /root/libelfmaster-master/src/libelfmaster.c /root/libelfmaster-master/src/libelfmaster.c: In function ‘elf_symtab_modify’: /root/libelfmaster-master/src/libelfmaster.c:207: warning: declaration of ‘index’ shadows a global declaration /usr/include/string.h:304: warning: shadowed declaration is here /root/libelfmaster-master/src/libelfmaster.c: In function ‘elf_dynsym_modify’: /root/libelfmaster-master/src/libelfmaster.c:251: warning: declaration of ‘index’ shadows a global declaration /usr/include/string.h:304: warning: shadowed declaration is here /root/libelfmaster-master/src/libelfmaster.c: In function ‘elf_segment_modify’: /root/libelfmaster-master/src/libelfmaster.c:294: warning: declaration of ‘index’ shadows a global declaration /usr/include/string.h:304: warning: shadowed declaration is here /root/libelfmaster-master/src/libelfmaster.c: In function ‘elf_dynamic_modify’: /root/libelfmaster-master/src/libelfmaster.c:344: warning: declaration of ‘index’ shadows a global declaration /usr/include/string.h:304: warning: shadowed declaration is here /root/libelfmaster-master/src/libelfmaster.c: In function ‘elf_section_modify’: /root/libelfmaster-master/src/libelfmaster.c:395: warning: declaration of ‘index’ shadows a global declaration /usr/include/string.h:304: warning: shadowed declaration is here /root/libelfmaster-master/src/libelfmaster.c: In function ‘elf_phdr_table_size’: /root/libelfmaster-master/src/libelfmaster.c:559: warning: unused variable ‘phdr_size’ /root/libelfmaster-master/src/libelfmaster.c: In function ‘elf_scop_text_filesz’: /root/libelfmaster-master/src/libelfmaster.c:602: warning: implicit declaration of function ‘__glibc_unlikely’ /root/libelfmaster-master/src/libelfmaster.c:602: warning: nested extern declaration of ‘__glibc_unlikely’ /root/libelfmaster-master/src/libelfmaster.c: In function ‘elf_reloc_type_string’: /root/libelfmaster-master/src/libelfmaster.c:771: error: ‘R_386_SIZE32’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:771: error: (Each undeclared identifier is reported only once /root/libelfmaster-master/src/libelfmaster.c:771: error: for each function it appears in.) /root/libelfmaster-master/src/libelfmaster.c:773: error: ‘R_386_TLS_GOTDESC’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:775: error: ‘R_386_TLS_DESC_CALL’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:777: error: ‘R_386_TLS_DESC’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:780: error: ‘R_386_IRELATIVE’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:837: error: ‘R_X86_64_PC64’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:839: error: ‘R_X86_64_GOTOFF64’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:841: error: ‘R_X86_64_GOTPC32’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:843: error: ‘R_X86_64_GOT64’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:845: error: ‘R_X86_64_GOTPCREL64’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:847: error: ‘R_X86_64_GOTPC64’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:849: error: ‘R_X86_64_GOTPLT64’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:851: error: ‘R_X86_64_PLTOFF64’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:853: error: ‘R_X86_64_SIZE32’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:855: error: ‘R_X86_64_SIZE64’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:857: error: ‘R_X86_64_GOTPC32_TLSDESC’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:859: error: ‘R_X86_64_TLSDESC_CALL’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:861: error: ‘R_X86_64_TLSDESC’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:863: error: ‘R_X86_64_IRELATIVE’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c:866: error: ‘R_X86_64_RELATIVE64’ undeclared (first use in this function) /root/libelfmaster-master/src/libelfmaster.c: In function ‘elf_segment_by_index’: /root/libelfmaster-master/src/libelfmaster.c:880: warning: declaration of ‘index’ shadows a global declaration /usr/include/string.h:304: warning: shadowed declaration is here /root/libelfmaster-master/src/libelfmaster.c: In function ‘elf_section_by_index’: /root/libelfmaster-master/src/libelfmaster.c:1129: warning: declaration of ‘index’ shadows a global declaration /usr/include/string.h:304: warning: shadowed declaration is here /root/libelfmaster-master/src/libelfmaster.c: In function ‘elf_section_name_by_index’: /root/libelfmaster-master/src/libelfmaster.c:1165: warning: declaration of ‘index’ shadows a global declaration /usr/include/string.h:304: warning: shadowed declaration is here /root/libelfmaster-master/src/libelfmaster.c: In function ‘elf_symbol_by_index’: /root/libelfmaster-master/src/libelfmaster.c:1215: warning: declaration of ‘index’ shadows a global declaration /usr/include/string.h:304: warning: shadowed declaration is here make[1]: *** [libelfmaster.o] Error 1 make[1]: Leaving directory /root/libelfmaster-master/src'
make: *** [all] Error 2
[root@promote libelfmaster-master]#

@elfmaster
Copy link
Owner

elfmaster commented Mar 25, 2019 via email

@sin5678
Copy link
Author

sin5678 commented Mar 26, 2019

after add a lot ELF macro defines, and remove the likely(), unlikely(), I did a successfully build.
image

@sin5678
Copy link
Author

sin5678 commented Mar 26, 2019

But I got "Segmentation fault" when try to inject the shared object file
[root@promote dt_infect-master]# gcc evil.c --shared -fPIC -o libevil.so
[root@promote dt_infect-master]# file libevil.so
libevil.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped
[root@promote dt_infect-master]# ./test
Don't infect me please
[root@promote dt_infect-master]# ./a.out libevil.so test
Segmentation fault

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants