Skip to content

Commit

Permalink
Invoke cpp as ' -E'
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed May 23, 2022
1 parent 3d6a774 commit 7685298
Show file tree
Hide file tree
Showing 18 changed files with 34 additions and 39 deletions.
4 changes: 2 additions & 2 deletions arm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ ARCHTYPE_RESULT=$(shell uname -m)

ifeq ($(OSTYPE_RESULT),Darwin)
ifeq ($(ARCHTYPE_RESULT),arm64)
PREPROCESS=sed -e 's/\/\/.*//' | cpp -
PREPROCESS=sed -e 's/\/\/.*//' | $(CXX) -E -I../include -
else
PREPROCESS=sed -e 's/\/\/.*//' | cpp -xassembler-with-cpp -
PREPROCESS=sed -e 's/\/\/.*//' | $(CXX) -E -I../include -xassembler-with-cpp -
endif
else
PREPROCESS=cpp -xassembler-with-cpp -
Expand Down
2 changes: 1 addition & 1 deletion arm/curve25519/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ OBJ = bignum_add_p25519.o \
bignum_sqr_p25519_alt.o \
bignum_sub_p25519.o

%.o : %.S ; cpp $< | $(GAS) -o $@ -
%.o : %.S ; $(CXX) -E -I../../include $< | $(GAS) -o $@ -

default: $(OBJ);

Expand Down
2 changes: 1 addition & 1 deletion arm/fastmul/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ OBJ = bignum_emontredc_8n.o \
bignum_sqr_8_16.o \
bignum_sqr_8_16_alt.o

%.o : %.S ; cpp $< | $(GAS) -o $@ -
%.o : %.S ; $(CXX) -E -I../../include $< | $(GAS) -o $@ -

default: $(OBJ);

Expand Down
2 changes: 1 addition & 1 deletion arm/generic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ OBJ = bignum_add.o \
word_negmodinv.o \
word_recip.o

%.o : %.S ; cpp $< | $(GAS) -o $@ -
%.o : %.S ; $(CXX) -E -I../../include $< | $(GAS) -o $@ -

default: $(OBJ);

Expand Down
2 changes: 1 addition & 1 deletion arm/p256/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ OBJ = bignum_add_p256.o \
bignum_tomont_p256.o \
bignum_triple_p256.o

%.o : %.S ; cpp $< | $(GAS) -o $@ -
%.o : %.S ; $(CXX) -E -I../../include $< | $(GAS) -o $@ -

default: $(OBJ);

Expand Down
2 changes: 1 addition & 1 deletion arm/p384/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ OBJ = bignum_add_p384.o \
bignum_tomont_p384.o \
bignum_triple_p384.o

%.o : %.S ; cpp $< | $(GAS) -o $@ -
%.o : %.S ; $(CXX) -E -I../../include $< | $(GAS) -o $@ -

default: $(OBJ);

Expand Down
2 changes: 1 addition & 1 deletion arm/p521/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ OBJ = bignum_add_p521.o \
bignum_tomont_p521.o \
bignum_triple_p521.o

%.o : %.S ; cpp $< | $(GAS) -o $@ -
%.o : %.S ; $(CXX) -E -I../../include $< | $(GAS) -o $@ -

default: $(OBJ);

Expand Down
2 changes: 1 addition & 1 deletion arm/secp256k1/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ OBJ = bignum_add_p256k1.o \
bignum_tomont_p256k1.o \
bignum_triple_p256k1.o

%.o : %.S ; cpp $< | $(GAS) -o $@ -
%.o : %.S ; $(CXX) -E -I../../include $< | $(GAS) -o $@ -

default: $(OBJ);

Expand Down
21 changes: 8 additions & 13 deletions include/_internal_s2n_bignum.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@

#ifdef __APPLE__
# define S2N_BN_SYM_VISIBILITY_DIRECTIVE(name) .globl _##name
# ifdef S2N_BN_HIDE_SYMBOLS
# define S2N_BN_SYM_PRIVACY_DIRECTIVE(name) .private_extern _##name
# else
# define S2N_BN_SYM_PRIVACY_DIRECTIVE(name) /* NO-OP: S2N_BN_SYM_PRIVACY_DIRECTIVE */
# endif
# define S2N_BN_SYMBOL(name) _##name
# define S2N_BN_SYMBOL(NAME) _##NAME
#else
# define S2N_BN_SYM_VISIBILITY_DIRECTIVE(name) .globl name
# ifdef S2N_BN_HIDE_SYMBOLS
# define S2N_BN_SYM_PRIVACY_DIRECTIVE(name) .hidden name
# else
# define S2N_BN_SYM_PRIVACY_DIRECTIVE(name) /* NO-OP: S2N_BN_SYM_PRIVACY_DIRECTIVE */
# endif
# define S2N_BN_SYMBOL(name) name
#endif

#define S2N_BN_SYM_VISIBILITY_DIRECTIVE(name) .globl S2N_BN_SYMBOL(name)
#ifdef S2N_BN_HIDE_SYMBOLS
# define S2N_BN_SYM_PRIVACY_DIRECTIVE(name) .private_extern S2N_BN_SYMBOL(name)
#else
# define S2N_BN_SYM_PRIVACY_DIRECTIVE(name) /* NO-OP: S2N_BN_SYM_PRIVACY_DIRECTIVE */
#endif
4 changes: 2 additions & 2 deletions x86/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ARCHTYPE_RESULT=$(shell uname -m)
# by single-quote characters in comments, so we eliminate // comments first.

ifeq ($(OSTYPE_RESULT),Darwin)
PREPROCESS=sed -e 's/\/\/.*//' | cpp -DWINDOWS_ABI=0 -xassembler-with-cpp -
PREPROCESS=sed -e 's/\/\/.*//' | $(CXX) -E -I../include -DWINDOWS_ABI=0 -xassembler-with-cpp -
else
ifeq ($(OSTYPE_RESULT),CYGWIN_NT-10.0)
PREPROCESS=cpp -DWINDOWS_ABI=1 -xassembler-with-cpp -
Expand Down Expand Up @@ -63,7 +63,7 @@ endif
# for proof-checking, not used for actual code execution.

ifeq ($(OSTYPE_RESULT),Darwin)
WINPREPROCESS=sed -e 's/\/\/.*//' | cpp -DWINDOWS_ABI=1 -xassembler-with-cpp -
WINPREPROCESS=sed -e 's/\/\/.*//' | $(CXX) -E -I../include -DWINDOWS_ABI=1 -xassembler-with-cpp -
else
WINPREPROCESS=cpp -DWINDOWS_ABI=1 -xassembler-with-cpp -
endif
Expand Down
2 changes: 1 addition & 1 deletion x86/curve25519/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ OBJ = bignum_add_p25519.o \
bignum_sqr_p25519_alt.o \
bignum_sub_p25519.o

%.o : %.S ; cpp $< | as -o $@ -
%.o : %.S ; $(CXX) -E -I../../include $< | as -o $@ -

default: $(OBJ);

Expand Down
2 changes: 1 addition & 1 deletion x86/fastmul/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ OBJ = bignum_emontredc_8n.o \
bignum_sqr_8_16.o \
bignum_sqr_8_16_alt.o

%.o : %.S ; cpp $< | as -o $@ -
%.o : %.S ; $(CXX) -E -I../../include $< | as -o $@ -

default: $(OBJ);

Expand Down
2 changes: 1 addition & 1 deletion x86/generic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ OBJ = bignum_add.o \
word_negmodinv.o \
word_recip.o

%.o : %.S ; cpp $< | as -o $@ -
%.o : %.S ; $(CXX) -E -I../../include $< | as -o $@ -

default: $(OBJ);

Expand Down
2 changes: 1 addition & 1 deletion x86/p256/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ OBJ = bignum_add_p256.o \
bignum_triple_p256.o \
bignum_triple_p256_alt.o

%.o : %.S ; cpp $< | as -o $@ -
%.o : %.S ; $(CXX) -E -I../../include $< | as -o $@ -

default: $(OBJ);

Expand Down
2 changes: 1 addition & 1 deletion x86/p384/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ OBJ = bignum_add_p384.o \
bignum_triple_p384.o \
bignum_triple_p384_alt.o

%.o : %.S ; cpp $< | as -o $@ -
%.o : %.S ; $(CXX) -E -I../../include $< | as -o $@ -

default: $(OBJ);

Expand Down
2 changes: 1 addition & 1 deletion x86/p521/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ OBJ = bignum_add_p521.o \
bignum_triple_p521.o \
bignum_triple_p521_alt.o

%.o : %.S ; cpp $< | as -o $@ -
%.o : %.S ; $(CXX) -E -I../../include $< | as -o $@ -

default: $(OBJ);

Expand Down
2 changes: 1 addition & 1 deletion x86/secp256k1/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ OBJ = bignum_add_p256k1.o \
bignum_triple_p256k1.o \
bignum_triple_p256k1_alt.o

%.o : %.S ; cpp $< | as -o $@ -
%.o : %.S ; $(CXX) -E -I../../include $< | as -o $@ -

default: $(OBJ);

Expand Down
16 changes: 8 additions & 8 deletions x86_att/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,15 @@ code: $(ATTSOURCES)

all: $(OBJ);

%.o : %.S ; (cpp $< | as -o $@ -); (cd ../x86; cpp $< | as -o /tmp/original_object.o); cmp -s $@ /tmp/original_object.o
%.o : %.S ; ($(CXX) -E -I../include $< | as -o $@ -); (cd ../x86; $(CXX) -E -I../include $< | as -o /tmp/original_object.o); cmp -s $@ /tmp/original_object.o

curve25519/%.S :: ../x86/curve25519/%.S ; (cat $< | sed -E -f ./attrofy.sed >$@) && (cpp -DWINDOWS_ABI=0 $@ | as -o /tmp/translated_object.o) ; (cpp -DWINDOWS_ABI=1 $@ | as -o /tmp/translated_object.obj) ; (cpp -DWINDOWS_ABI=0 $< | as -o /tmp/original_object.o) ; (cpp -DWINDOWS_ABI=1 $< | as -o /tmp/original_object.obj) ; (cmp -s /tmp/translated_object.o /tmp/original_object.o && cmp -s /tmp/translated_object.obj /tmp/original_object.obj)
fastmul/%.S :: ../x86/fastmul/%.S ; (cat $< | sed -E -f ./attrofy.sed >$@) && (cpp -DWINDOWS_ABI=0 $@ | as -o /tmp/translated_object.o) ; (cpp -DWINDOWS_ABI=1 $@ | as -o /tmp/translated_object.obj) ; (cpp -DWINDOWS_ABI=0 $< | as -o /tmp/original_object.o) ; (cpp -DWINDOWS_ABI=1 $< | as -o /tmp/original_object.obj) ; (cmp -s /tmp/translated_object.o /tmp/original_object.o && cmp -s /tmp/translated_object.obj /tmp/original_object.obj)
generic/%.S :: ../x86/generic/%.S ; (cat $< | sed -E -f ./attrofy.sed >$@) && (cpp -DWINDOWS_ABI=0 $@ | as -o /tmp/translated_object.o) ; (cpp -DWINDOWS_ABI=1 $@ | as -o /tmp/translated_object.obj) ; (cpp -DWINDOWS_ABI=0 $< | as -o /tmp/original_object.o) ; (cpp -DWINDOWS_ABI=1 $< | as -o /tmp/original_object.obj) ; (cmp -s /tmp/translated_object.o /tmp/original_object.o && cmp -s /tmp/translated_object.obj /tmp/original_object.obj)
p256/%.S :: ../x86/p256/%.S ; (cat $< | sed -E -f ./attrofy.sed >$@) && (cpp -DWINDOWS_ABI=0 $@ | as -o /tmp/translated_object.o) ; (cpp -DWINDOWS_ABI=1 $@ | as -o /tmp/translated_object.obj) ; (cpp -DWINDOWS_ABI=0 $< | as -o /tmp/original_object.o) ; (cpp -DWINDOWS_ABI=1 $< | as -o /tmp/original_object.obj) ; (cmp -s /tmp/translated_object.o /tmp/original_object.o && cmp -s /tmp/translated_object.obj /tmp/original_object.obj)
p384/%.S :: ../x86/p384/%.S ; (cat $< | sed -E -f ./attrofy.sed >$@) && (cpp -DWINDOWS_ABI=0 $@ | as -o /tmp/translated_object.o) ; (cpp -DWINDOWS_ABI=1 $@ | as -o /tmp/translated_object.obj) ; (cpp -DWINDOWS_ABI=0 $< | as -o /tmp/original_object.o) ; (cpp -DWINDOWS_ABI=1 $< | as -o /tmp/original_object.obj) ; (cmp -s /tmp/translated_object.o /tmp/original_object.o && cmp -s /tmp/translated_object.obj /tmp/original_object.obj)
p521/%.S :: ../x86/p521/%.S ; (cat $< | sed -E -f ./attrofy.sed >$@) && (cpp -DWINDOWS_ABI=0 $@ | as -o /tmp/translated_object.o) ; (cpp -DWINDOWS_ABI=1 $@ | as -o /tmp/translated_object.obj) ; (cpp -DWINDOWS_ABI=0 $< | as -o /tmp/original_object.o) ; (cpp -DWINDOWS_ABI=1 $< | as -o /tmp/original_object.obj) ; (cmp -s /tmp/translated_object.o /tmp/original_object.o && cmp -s /tmp/translated_object.obj /tmp/original_object.obj)
secp256k1/%.S :: ../x86/secp256k1/%.S ; (cat $< | sed -E -f ./attrofy.sed >$@) && (cpp -DWINDOWS_ABI=0 $@ | as -o /tmp/translated_object.o) ; (cpp -DWINDOWS_ABI=1 $@ | as -o /tmp/translated_object.obj) ; (cpp -DWINDOWS_ABI=0 $< | as -o /tmp/original_object.o) ; (cpp -DWINDOWS_ABI=1 $< | as -o /tmp/original_object.obj) ; (cmp -s /tmp/translated_object.o /tmp/original_object.o && cmp -s /tmp/translated_object.obj /tmp/original_object.obj)
curve25519/%.S :: ../x86/curve25519/%.S ; (cat $< | sed -E -f ./attrofy.sed >$@) && ($(CXX) -E -I../include -DWINDOWS_ABI=0 $@ | as -o /tmp/translated_object.o) ; ($(CXX) -E -I../include -DWINDOWS_ABI=1 $@ | as -o /tmp/translated_object.obj) ; ($(CXX) -E -I../include -DWINDOWS_ABI=0 $< | as -o /tmp/original_object.o) ; ($(CXX) -E -I../include -DWINDOWS_ABI=1 $< | as -o /tmp/original_object.obj) ; (cmp -s /tmp/translated_object.o /tmp/original_object.o && cmp -s /tmp/translated_object.obj /tmp/original_object.obj)
fastmul/%.S :: ../x86/fastmul/%.S ; (cat $< | sed -E -f ./attrofy.sed >$@) && ($(CXX) -E -I../include -DWINDOWS_ABI=0 $@ | as -o /tmp/translated_object.o) ; ($(CXX) -E -I../include -DWINDOWS_ABI=1 $@ | as -o /tmp/translated_object.obj) ; ($(CXX) -E -I../include -DWINDOWS_ABI=0 $< | as -o /tmp/original_object.o) ; ($(CXX) -E -I../include -DWINDOWS_ABI=1 $< | as -o /tmp/original_object.obj) ; (cmp -s /tmp/translated_object.o /tmp/original_object.o && cmp -s /tmp/translated_object.obj /tmp/original_object.obj)
generic/%.S :: ../x86/generic/%.S ; (cat $< | sed -E -f ./attrofy.sed >$@) && ($(CXX) -E -I../include -DWINDOWS_ABI=0 $@ | as -o /tmp/translated_object.o) ; ($(CXX) -E -I../include -DWINDOWS_ABI=1 $@ | as -o /tmp/translated_object.obj) ; ($(CXX) -E -I../include -DWINDOWS_ABI=0 $< | as -o /tmp/original_object.o) ; ($(CXX) -E -I../include -DWINDOWS_ABI=1 $< | as -o /tmp/original_object.obj) ; (cmp -s /tmp/translated_object.o /tmp/original_object.o && cmp -s /tmp/translated_object.obj /tmp/original_object.obj)
p256/%.S :: ../x86/p256/%.S ; (cat $< | sed -E -f ./attrofy.sed >$@) && ($(CXX) -E -I../include -DWINDOWS_ABI=0 $@ | as -o /tmp/translated_object.o) ; ($(CXX) -E -I../include -DWINDOWS_ABI=1 $@ | as -o /tmp/translated_object.obj) ; ($(CXX) -E -I../include -DWINDOWS_ABI=0 $< | as -o /tmp/original_object.o) ; ($(CXX) -E -I../include -DWINDOWS_ABI=1 $< | as -o /tmp/original_object.obj) ; (cmp -s /tmp/translated_object.o /tmp/original_object.o && cmp -s /tmp/translated_object.obj /tmp/original_object.obj)
p384/%.S :: ../x86/p384/%.S ; (cat $< | sed -E -f ./attrofy.sed >$@) && ($(CXX) -E -I../include -DWINDOWS_ABI=0 $@ | as -o /tmp/translated_object.o) ; ($(CXX) -E -I../include -DWINDOWS_ABI=1 $@ | as -o /tmp/translated_object.obj) ; ($(CXX) -E -I../include -DWINDOWS_ABI=0 $< | as -o /tmp/original_object.o) ; ($(CXX) -E -I../include -DWINDOWS_ABI=1 $< | as -o /tmp/original_object.obj) ; (cmp -s /tmp/translated_object.o /tmp/original_object.o && cmp -s /tmp/translated_object.obj /tmp/original_object.obj)
p521/%.S :: ../x86/p521/%.S ; (cat $< | sed -E -f ./attrofy.sed >$@) && ($(CXX) -E -I../include -DWINDOWS_ABI=0 $@ | as -o /tmp/translated_object.o) ; ($(CXX) -E -I../include -DWINDOWS_ABI=1 $@ | as -o /tmp/translated_object.obj) ; ($(CXX) -E -I../include -DWINDOWS_ABI=0 $< | as -o /tmp/original_object.o) ; ($(CXX) -E -I../include -DWINDOWS_ABI=1 $< | as -o /tmp/original_object.obj) ; (cmp -s /tmp/translated_object.o /tmp/original_object.o && cmp -s /tmp/translated_object.obj /tmp/original_object.obj)
secp256k1/%.S :: ../x86/secp256k1/%.S ; (cat $< | sed -E -f ./attrofy.sed >$@) && ($(CXX) -E -I../include -DWINDOWS_ABI=0 $@ | as -o /tmp/translated_object.o) ; ($(CXX) -E -I../include -DWINDOWS_ABI=1 $@ | as -o /tmp/translated_object.obj) ; ($(CXX) -E -I../include -DWINDOWS_ABI=0 $< | as -o /tmp/original_object.o) ; ($(CXX) -E -I../include -DWINDOWS_ABI=1 $< | as -o /tmp/original_object.obj) ; (cmp -s /tmp/translated_object.o /tmp/original_object.o && cmp -s /tmp/translated_object.obj /tmp/original_object.obj)

clean:; rm -f */*.o

Expand Down

0 comments on commit 7685298

Please sign in to comment.