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

custom CFLAGS lead to missing -c [was: -flto -fwhole-program does not work] #250

Closed
rofl0r opened this issue Apr 11, 2013 · 7 comments
Closed
Labels
core branch Bug or issue coming from John the Ripper core enhancement

Comments

@rofl0r
Copy link
Contributor

rofl0r commented Apr 11, 2013


gcc -flto -fwhole-program -O3 -mxop -DHAVE_CRYPT -DHAVE_DL -funroll-loops DES_fmt.c
/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64/crt1.o: In function `_start':
/usr/src/packages/BUILD/glibc-2.11.3/csu/../sysdeps/x86_64/elf/start.S:109: undefined reference to `main'
/tmp/ccEc71Xa.o: In function `valid':
DES_fmt.c:(.text+0x1a): undefined reference to `atoi64'
DES_fmt.c:(.text+0x34): undefined reference to `atoi64'
DES_fmt.c:(.text+0x48): undefined reference to `atoi64'
DES_fmt.c:(.text+0x7f): undefined reference to `atoi64'
/tmp/ccEc71Xa.o: In function `get_key':
DES_fmt.c:(.text+0x117): undefined reference to `DES_bs_all'
/tmp/ccEc71Xa.o: In function `cmp_exact':
DES_fmt.c:(.text+0x204): undefined reference to `DES_bs_get_binary'
/tmp/ccEc71Xa.o: In function `salt':
DES_fmt.c:(.text+0x245): undefined reference to `DES_raw_get_salt'
/tmp/ccEc71Xa.o: In function `cmp_exact':
DES_fmt.c:(.text+0x214): undefined reference to `DES_bs_cmp_one'
/tmp/ccEc71Xa.o: In function `cmp_one':
DES_fmt.c:(.text+0x228): undefined reference to `DES_bs_cmp_one'
/tmp/ccEc71Xa.o: In function `set_salt':
DES_fmt.c:(.text+0x234): undefined reference to `DES_bs_set_salt'
/tmp/ccEc71Xa.o: In function `init':
DES_fmt.c:(.text+0x2e8): undefined reference to `DES_bs_init'
/tmp/ccEc71Xa.o:(.data+0x50): undefined reference to `fmt_default_prepare'
/tmp/ccEc71Xa.o:(.data+0x68): undefined reference to `DES_bs_get_binary'
/tmp/ccEc71Xa.o:(.data+0xc0): undefined reference to `DES_bs_set_key'
/tmp/ccEc71Xa.o:(.data+0xd0): undefined reference to `fmt_default_clear_keys'
/tmp/ccEc71Xa.o:(.data+0xd8): undefined reference to `DES_bs_crypt_25'
/tmp/ccEc71Xa.o:(.data+0xe0): undefined reference to `DES_bs_get_hash_0'
/tmp/ccEc71Xa.o:(.data+0xe8): undefined reference to `DES_bs_get_hash_1'
/tmp/ccEc71Xa.o:(.data+0xf0): undefined reference to `DES_bs_get_hash_2'
/tmp/ccEc71Xa.o:(.data+0xf8): undefined reference to `DES_bs_get_hash_3'
/tmp/ccEc71Xa.o:(.data+0x100): undefined reference to `DES_bs_get_hash_4'
/tmp/ccEc71Xa.o:(.data+0x108): undefined reference to `DES_bs_get_hash_5'
/tmp/ccEc71Xa.o:(.data+0x110): undefined reference to `DES_bs_get_hash_6'
/tmp/ccEc71Xa.o:(.data+0x118): undefined reference to `DES_bs_cmp_all'
collect2: ld returned 1 exit status
make[1]: *** [DES_fmt.o] Error 1
make[1]: Leaving directory `/media/3T/git-mirror/JohnTheRipper/src'
make: *** [linux-x86-64-xop] Error 2

invoked make as:

make clean && make CFLAGS="-flto -fwhole-program -O3" linux-x86-64-xop
@rofl0r
Copy link
Contributor Author

rofl0r commented Apr 11, 2013

seems the primary bug is that "-c" gets removed from the CFLAGS when the user passes his own set...

@magnumripper
Copy link
Member

We have a JOHN_CFLAGS that you can use to add stuff without dropping our usual CFLAGS.

@rofl0r
Copy link
Contributor Author

rofl0r commented Apr 11, 2013

yes, however this is unexpected behaviour.
the polite way would be to just accept the user-passed cflags without breaking
kinda like:

STANDARD_CFLAGS= -c -fomit-frame-pointer ...
ALL_CFLAGS = $(STANDARD_CFLAGS) $(CFLAGS) $(JOHN_CFLAGS)
...
target-xxx:
          $(CC) $(ALL_CFLAGS) $@

edit: reversed cflags order so that user supplied flags come last to override opt levels

@magnumripper
Copy link
Member

I'm fine with that but we need to discuss it on john-dev because I have no idea about the history of the current behaviour. Actually some comments in params.h (iirc) claim that you can use CFLAGS normally (add to it).

@rofl0r
Copy link
Contributor Author

rofl0r commented Apr 11, 2013

the most proper way to handle this specific case though is when $(CC) is always followed by -c in the makefile target.
i.e. not in the CFLAGS

target-xxx:
        $(CC) -c $@ $(CFLAGS)

@magnumripper
Copy link
Member

Agreed. We should do that to the bleeding branch. But ideally Solar should do it in core first (or too).

@magnumripper
Copy link
Member

This was fixed once we started using AC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core branch Bug or issue coming from John the Ripper core enhancement
Projects
None yet
Development

No branches or pull requests

2 participants