boringssl/crypto/bn
Adam Langley 30eda1d2b8 Include some build fixes for OS X.
Apart from the obvious little issues, this also works around a
(seeming) libtool/linker:

a.c defines a symbol:

int kFoo;

b.c uses it:

extern int kFoo;

int f() {
  return kFoo;
}

compile them:

$ gcc -c a.c
$ gcc -c b.c

and create a dummy main in order to run it, main.c:

int f();

int main() {
  return f();
}

this works as expected:

$ gcc main.c a.o b.o

but, if we make an archive:

$ ar q lib.a a.o b.o

and use that:

$ gcc main.c lib.a
Undefined symbols for architecture x86_64
  "_kFoo", referenced from:
    _f in lib.a(b.o)

(It doesn't matter what order the .o files are put into the .a)

Linux and Windows don't seem to have this problem.

nm on a.o shows that the symbol is of type "C", which is a "common symbol"[1].
Basically the linker will merge multiple common symbol definitions together.

If ones makes a.c read:

int kFoo = 0;

Then one gets a type "D" symbol - a "data section symbol" and everything works
just fine.

This might actually be a libtool bug instead of an ld bug: Looking at `xxd
lib.a | less`, the __.SYMDEF SORTED index at the beginning of the archive
doesn't contain an entry for kFoo unless initialised.

Change-Id: I4cdad9ba46e9919221c3cbd79637508959359427
2014-06-24 11:15:12 -07:00
..
asm Add needed volatile qualifications. 2014-06-20 13:17:33 -07:00
add.c Inital import. 2014-06-20 13:17:32 -07:00
bn_error.c Add function to recover RSA CRT params. 2014-06-20 13:17:35 -07:00
bn_test.c Include some build fixes for OS X. 2014-06-24 11:15:12 -07:00
bn.c Inital import. 2014-06-20 13:17:32 -07:00
bn.h Improvements in constant-time OAEP decoding. 2014-06-20 13:17:37 -07:00
CMakeLists.txt Inital import. 2014-06-20 13:17:32 -07:00
cmp.c Inital import. 2014-06-20 13:17:32 -07:00
convert.c Improvements in constant-time OAEP decoding. 2014-06-20 13:17:37 -07:00
ctx.c Inital import. 2014-06-20 13:17:32 -07:00
div.c Check for invalid divisors in BN_div. 2014-06-20 13:17:33 -07:00
exponentiation.c bignum: fix boundary condition in montgomery logic 2014-06-20 13:17:40 -07:00
gcd.c Inital import. 2014-06-20 13:17:32 -07:00
generic.c Inital import. 2014-06-20 13:17:32 -07:00
internal.h Include some build fixes for OS X. 2014-06-24 11:15:12 -07:00
kronecker.c Inital import. 2014-06-20 13:17:32 -07:00
montgomery.c bignum: allow concurrent BN_MONT_CTX_set_locked() 2014-06-20 13:17:40 -07:00
mul.c Inital import. 2014-06-20 13:17:32 -07:00
prime.c Small prime generation. 2014-06-20 13:17:34 -07:00
random.c Generate (EC)DSA nonces with truncate/test/reject. 2014-06-23 15:41:44 -07:00
rsaz_exp.c Inital import. 2014-06-20 13:17:32 -07:00
rsaz_exp.h Inital import. 2014-06-20 13:17:32 -07:00
shift.c Inital import. 2014-06-20 13:17:32 -07:00
sqrt.c Add function to recover RSA CRT params. 2014-06-20 13:17:35 -07:00