Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally hide symbols from export #5

Merged
merged 5 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ cmake_minimum_required(VERSION 3.5)

project(RandomX)

set(CMAKE_VERBOSE_MAKEFILE ON)

set(randomx_sources
src/aes_hash.cpp
src/argon2_ref.c
Expand Down Expand Up @@ -212,9 +214,14 @@ endif()
set(RANDOMX_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/src" CACHE STRING "RandomX Include path")

# Define variables for custom preprocessor definitions with default values
option(USE_HIDDEN_VISIBILITY "Include -fvisibility=hidden flag" OFF)
set(RANDOMX_ARGON_MEMORY "" CACHE STRING "Set the RANDOMX_ARGON_MEMORY value")
set(RANDOMX_DATASET_BASE_SIZE "" CACHE STRING "Set the RANDOMX_DATASET_BASE_SIZE value")

if(USE_HIDDEN_VISIBILITY)
add_compile_options("-fvisibility=hidden")
endif()

add_library(randomx ${randomx_sources})

# Apply the custom preprocessor definitions only if they are set
Expand Down
157 changes: 82 additions & 75 deletions doc/design.md

Large diffs are not rendered by default.

567 changes: 299 additions & 268 deletions doc/specs.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/aes_hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,4 @@ void hashAndFillAes1Rx4(void *scratchpad, size_t scratchpadSize, void *hash, voi
}

template void hashAndFillAes1Rx4<false>(void *scratchpad, size_t scratchpadSize, void *hash, void* fill_state);
template void hashAndFillAes1Rx4<true>(void *scratchpad, size_t scratchpadSize, void *hash, void* fill_state);
template void hashAndFillAes1Rx4<true>(void *scratchpad, size_t scratchpadSize, void *hash, void* fill_state);
1 change: 0 additions & 1 deletion src/asm/configuration.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
RANDOMX_ARGON_MEMORY EQU 262144t
RANDOMX_ARGON_ITERATIONS EQU 3t
RANDOMX_ARGON_LANES EQU 1t
RANDOMX_ARGON_SALT TEXTEQU <"RandomX\x03">
RANDOMX_CACHE_ACCESSES EQU 8t
RANDOMX_SUPERSCALAR_LATENCY EQU 170t
RANDOMX_DATASET_BASE_SIZE EQU 2147483648t
Expand Down
2 changes: 1 addition & 1 deletion src/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ Total sum of frequencies must be 256
#define RANDOMX_FREQ_NOP 0
/* ------
256
*/
*/
1 change: 0 additions & 1 deletion src/randomx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ extern "C" {
}

randomx_dataset *randomx_alloc_dataset(randomx_flags flags) {

//fail on 32-bit systems if DatasetSize is >= 4 GiB
if (randomx::DatasetSize > std::numeric_limits<size_t>::max()) {
return nullptr;
Expand Down
6 changes: 3 additions & 3 deletions src/tests/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ int main() {
decoder.executeInstruction(ibc, pc, nullptr, config);
assert(reg.r[registerDst] == 1);
});

runTest("IXOR_R (decode)", RANDOMX_FREQ_IXOR_R > 0, [&] {
randomx::Instruction instr;
instr.opcode = randomx::ceil_IXOR_R - 1;
Expand Down Expand Up @@ -1078,15 +1078,15 @@ int main() {
randomx_calculate_hash_last(vm, &hash3);

assert(equalsHex(hash1, "639183aae1bf4c9a35884cb46b09cad9175f04efd7684e7262a0ac1c2f0b4e3f"));
assert(equalsHex(hash2, "300a0adb47603dedb42228ccb2b211104f4da45af709cd7547cd049e9489c969"));
assert(equalsHex(hash2, "de506caf4c69cb93f70a6aab078ce450a2a942e8ca79ca4e0d49e899b2bcbe8e"));
assert(equalsHex(hash3, "c36d4ed4191e617309867ed66a443be4075014e2b061bcdaf9ce7b721d2b77a8"));
});

runTest("Preserve rounding mode", RANDOMX_FREQ_CFROUND > 0, []() {
rx_set_rounding_mode(RoundToNearest);
char hash[RANDOMX_HASH_SIZE];
calcStringHash("test key 000", "Lorem ipsum dolor sit amet", &hash);
assert(equalsHex(hash, "300a0adb47603dedb42228ccb2b211104f4da45af709cd7547cd049e9489c969"));
assert(equalsHex(hash, "de506caf4c69cb93f70a6aab078ce450a2a942e8ca79ca4e0d49e899b2bcbe8e"));
assert(rx_get_rounding_mode() == RoundToNearest);
});

Expand Down
4 changes: 2 additions & 2 deletions src/vm_interpreted.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ namespace randomx {

template<class Allocator, bool softAes>
void InterpretedVm<Allocator, softAes>::execute() {

NativeRegisterFile nreg;

for(unsigned i = 0; i < RegisterCountFlt; ++i)
Expand All @@ -71,7 +70,7 @@ namespace randomx {
spAddr0 &= ScratchpadL3Mask64;
spAddr1 ^= spMix >> 32;
spAddr1 &= ScratchpadL3Mask64;

for (unsigned i = 0; i < RegistersCount; ++i)
nreg.r[i] ^= load64(scratchpad + spAddr0 + 8 * i);

Expand All @@ -85,6 +84,7 @@ namespace randomx {

mem.mx ^= nreg.r[config.readReg2] ^ nreg.r[config.readReg3];
mem.mx &= CacheLineAlignMask;

datasetPrefetch(datasetOffset + mem.mx);
datasetRead(datasetOffset + mem.ma, nreg.r);
std::swap(mem.mx, mem.ma);
Expand Down
Loading