Make variables in ec_base.h (file) static

ec_base.h has several variables, which were defined with
a global scope. Exactly those global variables caused issues
on linking a static compilation of libisal.a to a shared lib.
Adding -fPIC to CFLAGS somehow didn't help.
As all the variables in ec_base.h are only included
and used by a single C file, all of these can be
(file) static, which then will also helps the compiler to
make further optimizations. And which also solves the issue
to link the static libisal to a shared lib.

Also make the variables const, as these are constants and
must be modified.

Change-Id: I2b8141dabc1c7a528401f2778cdbdbed6c93c36b
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
This commit is contained in:
Bernd Schubert 2019-10-09 13:17:55 +02:00 committed by Greg Tucker
parent f3993f5c0b
commit d32d3f6902

View File

@ -32,7 +32,7 @@
// Global GF(256) tables
#ifndef GF_LARGE_TABLES
unsigned char gff_base[] = {
static const unsigned char gff_base[] = {
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1d, 0x3a,
0x74, 0xe8, 0xcd, 0x87, 0x13, 0x26, 0x4c, 0x98, 0x2d, 0x5a,
0xb4, 0x75, 0xea, 0xc9, 0x8f, 0x03, 0x06, 0x0c, 0x18, 0x30,
@ -61,7 +61,7 @@ unsigned char gff_base[] = {
0x6c, 0xd8, 0xad, 0x47, 0x8e, 0x01
};
unsigned char gflog_base[] = {
static const unsigned char gflog_base[] = {
0x00, 0xff, 0x01, 0x19, 0x02, 0x32, 0x1a, 0xc6, 0x03, 0xdf,
0x33, 0xee, 0x1b, 0x68, 0xc7, 0x4b, 0x04, 0x64, 0xe0, 0x0e,
0x34, 0x8d, 0xef, 0x81, 0x1c, 0xc1, 0x69, 0xf8, 0xc8, 0x08,
@ -90,7 +90,7 @@ unsigned char gflog_base[] = {
0xf4, 0xea, 0xa8, 0x50, 0x58, 0xaf
};
#else
unsigned char gf_mul_table_base[] = {
static const unsigned char gf_mul_table_base[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -6647,7 +6647,7 @@ unsigned char gf_mul_table_base[] = {
0xc6, 0x39, 0xfe, 0x01, 0x1d, 0xe2
};
unsigned char gf_inv_table_base[] = {
static const unsigned char gf_inv_table_base[] = {
0x00, 0x01, 0x8e, 0xf4, 0x47, 0xa7, 0x7a, 0xba, 0xad, 0x9d,
0xdd, 0x98, 0x3d, 0xaa, 0x5d, 0x96, 0xd8, 0x72, 0xc0, 0x58,
0xe0, 0x3e, 0x4c, 0x66, 0x90, 0xde, 0x55, 0x80, 0xa0, 0x83,