Skip to content

Commit 859d420

Browse files
committed
Explicitly enumerate $objs for the generated Makefile
Ruby's mkmf generates the $objs for the Makefile by [looping over the files with SRC_EXT extensions](https://github.com/ruby/ruby/blob/9b7d8947df9780c120db7a1407bbe06e2004c511/lib/mkmf.rb#L2224-L2232), which are only [c, m, cc, mm, cxx, and cpp](https://github.com/ruby/ruby/blob/9b7d8947df9780c120db7a1407bbe06e2004c511/lib/mkmf.rb#L75-L88), not the `.S` we need here. This instead explicitly uses the list of object files that Openwall's crypt_blowfish lists in its provided Makefile. See it's Makefile, lines 25-29: ```c BLOWFISH_OBJS = \ crypt_blowfish.o x86.o CRYPT_OBJS = \ $(BLOWFISH_OBJS) crypt_gensalt.o wrapper.o ``` Those are what's passed to Makefile > all on line 41: ```c all: $(CRYPT_OBJS) man ``` This just uses that list plus the name of our actual extension (the `bcrypt_ext.o` entry) to ensure that the x86.S extension gets built in. That extension is only needed for 32-bit x86 systems, but it's fine to include on x64 as well, per the crypt_blowfish README: "you can compile and link it even on a non-x86, it will produce no code in this case".
1 parent 4b97854 commit 859d420

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

ext/mri/extconf.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
exit 0
1212
else
1313
require "mkmf"
14+
15+
# From Openwall's crypt_blowfish Makefile.
16+
# This is `bcrypt_ext` (our extension) + CRYPT_OBJS from that Makefile.
17+
$objs = %w(bcrypt_ext.o crypt_blowfish.o x86.o crypt_gensalt.o wrapper.o)
18+
1419
dir_config("bcrypt_ext")
1520
create_makefile("bcrypt_ext")
1621
end

0 commit comments

Comments
 (0)