Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
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".
  • Loading branch information
tjschuck committed Nov 15, 2018
commit 859d42027b4ac47ba84c29e2d7560815252246f7
5 changes: 5 additions & 0 deletions ext/mri/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
exit 0
else
require "mkmf"

# From Openwall's crypt_blowfish Makefile.
# This is `bcrypt_ext` (our extension) + CRYPT_OBJS from that Makefile.
$objs = %w(bcrypt_ext.o crypt_blowfish.o x86.o crypt_gensalt.o wrapper.o)

dir_config("bcrypt_ext")
create_makefile("bcrypt_ext")
end