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

Closed
opened 2026-10-14 02:49:48 +07:00 by bsakaguchi · 7 comments
Owner

Originally created by @rofl0r on GitHub (Apr 11, 2013).
Original GitHub issue: https://github.com/openwall/john/issues/250


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
Originally created by @rofl0r on GitHub (Apr 11, 2013). Original GitHub issue: https://github.com/openwall/john/issues/250 ``` 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 ```
bsakaguchi 2026-10-14 02:49:48 +07:00
Author
Owner

@rofl0r commented on GitHub (Apr 11, 2013):

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

<!-- gh-comment-id:16234076 --> @rofl0r commented on GitHub (Apr 11, 2013): seems the primary bug is that "-c" gets removed from the CFLAGS when the user passes his own set...
Author
Owner

@magnumripper commented on GitHub (Apr 11, 2013):

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

<!-- gh-comment-id:16250091 --> @magnumripper commented on GitHub (Apr 11, 2013): We have a JOHN_CFLAGS that you can use to add stuff without dropping our usual CFLAGS.
Author
Owner

@rofl0r commented on GitHub (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

<!-- gh-comment-id:16250422 --> @rofl0r commented on GitHub (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
Author
Owner

@magnumripper commented on GitHub (Apr 11, 2013):

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).

<!-- gh-comment-id:16252114 --> @magnumripper commented on GitHub (Apr 11, 2013): 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).
Author
Owner

@rofl0r commented on GitHub (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)
<!-- gh-comment-id:16253533 --> @rofl0r commented on GitHub (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) ```
Author
Owner

@magnumripper commented on GitHub (Apr 12, 2013):

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

<!-- gh-comment-id:16314573 --> @magnumripper commented on GitHub (Apr 12, 2013): Agreed. We should do that to the bleeding branch. But ideally Solar should do it in core first (or too).
Author
Owner

@magnumripper commented on GitHub (Oct 13, 2014):

This was fixed once we started using AC.

<!-- gh-comment-id:58943063 --> @magnumripper commented on GitHub (Oct 13, 2014): This was fixed once we started using AC.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#18
No description provided.