Closed Bug 534916 Opened 15 years ago Closed 15 years ago

Rename functions or variables to avoid duplicate symbols in fully static builds

Categories

(NSS :: Libraries, defect)

defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wtc, Assigned: wtc)

Details

Attachments

(6 files, 2 obsolete files)

In bug 534471 I provided a patch for using NSS as static libraries.

Some of the required changes deal with same-named functions or
variables in different shared libraries (e.g., in libsoftokn3.so,
libfreebl3.so, and libnssdbm3.so) or in shared libraries and a
command-line tool (e.g., in libnss3.so and certutil).

In this bug I will break those changes into patches of digestible
size, so they can be easily reviewed.  Since we don't support static
libraries, please feel free to decline the review request.  But
I think these changes are generally useful.

In the first patch, crlutil contains SECITEM_Hash and SECITEM_HashCompare
copied from lib/util/secitem.c, but they are not being used.
Attachment #417727 - Flags: review?(emaldona)
Comment on attachment 417727 [details] [diff] [review]
Remove duplicate code SECITEM_Hash and SECITEM_HashCompare in crlutil (checked in)

Sorry, I was wrong.  crlutil is using SECITEM_Hash and
SECITEM_HashCompare.  So this patch removes duplicate
code as opposed to dead code.
Attachment #417727 - Attachment description: Remove dead code SECITEM_Hash and SECITEM_HashCompare in crlutil → Remove duplicate code SECITEM_Hash and SECITEM_HashCompare in crlutil
Comment on attachment 417727 [details] [diff] [review]
Remove duplicate code SECITEM_Hash and SECITEM_HashCompare in crlutil (checked in)

r+ 
This one is fine regardless of support for static libraries.
Attachment #417727 - Flags: review?(emaldona) → review+
This patch removes comments that should have been removed
when we started to build the libnss3.so shared library.
Attachment #417750 - Flags: review?(emaldona)
The global variable parentForkedAfterC_Initialize is
defined in libsoftokn3.so, libfreebl3.so, and libnssdbm3.so.
Conceptually these are three different variables.

This patch avoids the duplicate symbols in fully static
builds by adding the bl_ and lg_ prefixes to the
parentForkedAfterC_Initialize variables in lib/freebl and
lib/softoken/legacydb, respectively.
Attachment #417753 - Flags: review?(rrelyea)
Attachment #417753 - Attachment description: Address duplicate parentForkedAfterC_Initialize symbols → Address duplicate parentForkedAfterC_Initialize symbols (for SOFTOKEN_3_13_BRANCH only)
This patch is big but straigforward.

Several nsslowkey_xxx (mostly ASN.1 templates( and prepare_low_xxx
functions are defined in both libsoftokn3.so and libnssdbm3.so.  My
solution is to add the lg_ prefix to these symbols in
lib/softoken/legacydb.

The following ASN.1 templates/functions aren't being
used, so they're simply removed:
nsslowkey_DSAPrivateKeyExportTemplate
prepare_low_dsa_priv_key_export_for_asn1
nsslowkey_PrivateModulusLen
nsslowkey_PublicModulusLen
Attachment #417765 - Flags: review?(rrelyea)
The code in lib/softoken/legacydb doesn't use SOFTOKEN_LIB_NAME, so
the -DSOFTOKEN_LIB_NAME compiler flag can be removed from
lib/softoken/legacydb/manifest.mn.
Attachment #417766 - Flags: review?(rrelyea)
lib/util/config.mk has the same obsolete comments that
should also be removed.
Attachment #417750 - Attachment is obsolete: true
Attachment #417770 - Flags: review?(emaldona)
Attachment #417750 - Flags: review?(emaldona)
Comment on attachment 417727 [details] [diff] [review]
Remove duplicate code SECITEM_Hash and SECITEM_HashCompare in crlutil (checked in)

Checked in on the NSS trunk (NSS 3.12.6).

Checking in crlgen.c;
/cvsroot/mozilla/security/nss/cmd/crlutil/crlgen.c,v  <--  crlgen.c
new revision: 1.5; previous revision: 1.4
done
Attachment #417727 - Attachment description: Remove duplicate code SECITEM_Hash and SECITEM_HashCompare in crlutil → Remove duplicate code SECITEM_Hash and SECITEM_HashCompare in crlutil (checked in)
Attachment #417770 - Flags: review?(emaldona) → review+
It took me a while to understand how BLAPI_VerifySelf works.
I believe the old comment in lib/freebl/shvfy.c is wrong
or stale:

PRBool
BLAPI_VerifySelf(const char *name)
{
    /* to separate shlib to verify if name is NULL */
    if (name == NULL) {
 	return PR_TRUE;
    }
    return BLAPI_SHVerify(name, (PRFuncPtr) decodeInt);
}

So I updated the comments.  Bob, please verify if the new
comments are accurate.
Attachment #417788 - Flags: review?(rrelyea)
Comment on attachment 417770 [details] [diff] [review]
Remove obsolete comments in lib/util/config.mk and lib/nss/config.mk (checked in)

Checked in on the NSS trunk (NSS 3.12.6).

Checking in util/config.mk;
/cvsroot/mozilla/security/nss/lib/util/config.mk,v  <--  config.mk
new revision: 1.6; previous revision: 1.5
done
Checking in nss/config.mk;
/cvsroot/mozilla/security/nss/lib/nss/config.mk,v  <--  config.mk
new revision: 1.36; previous revision: 1.35
done
Attachment #417770 - Attachment description: Remove obsolete comments in lib/util/config.mk and lib/nss/config.mk → Remove obsolete comments in lib/util/config.mk and lib/nss/config.mk (checked in)
Comment on attachment 417753 [details] [diff] [review]
Address duplicate parentForkedAfterC_Initialize symbols (for SOFTOKEN_3_13_BRANCH only)

r+ for 3.13 branch (sigh)
Attachment #417753 - Flags: review?(rrelyea) → review+
Comment on attachment 417765 [details] [diff] [review]
Address duplicate nsslowkey_xxx and prepare_low_xxx symbols (for SOFTOKEN_3_13_BRANCH only; checked in)

r+ for 3.13 branch.

these should have been renamed when I split the lg_ stuff out anyway.
Attachment #417765 - Flags: review?(rrelyea) → review+
Comment on attachment 417788 [details] [diff] [review]
Update the comments for BLAPI_VerifySelf (for SOFTOKEN_3_13_BRANCH only; checked in)

r+ though I'm not sure this is the only case where VerifySelf could have a NULL name.

bob
Attachment #417788 - Flags: review?(rrelyea) → review+
Comment on attachment 417766 [details] [diff] [review]
Remove -DSOFTOKEN_LIB_NAME from legacydb/manifest.mn (for SOFTOKEN_3_13_BRANCH only; checked in)

r+ rrelyea
Attachment #417766 - Flags: review?(rrelyea) → review+
I updated this patch for the SOFTOKEN_3_13_BRANCH and checked it in
(NSS 3.13).  The original patch was generated on the NSS trunk and
didn't apply cleanly to the SOFTOKEN_3_13_BRANCH.

Checking in lib/freebl/blapii.h;
/cvsroot/mozilla/security/nss/lib/freebl/blapii.h,v  <--  blapii.h
new revision: 1.1.10.1; previous revision: 1.1
done
Checking in lib/freebl/rsa.c;
/cvsroot/mozilla/security/nss/lib/freebl/rsa.c,v  <--  rsa.c
new revision: 1.39.8.1; previous revision: 1.39
done
Checking in lib/softoken/legacydb/lgdb.h;
/cvsroot/mozilla/security/nss/lib/softoken/legacydb/lgdb.h,v  <--  lgdb.h
new revision: 1.5.8.2; previous revision: 1.5.8.1
done
Checking in lib/softoken/legacydb/lginit.c;
/cvsroot/mozilla/security/nss/lib/softoken/legacydb/lginit.c,v  <--  lginit.c
new revision: 1.14.8.1; previous revision: 1.14
done
Attachment #417753 - Attachment is obsolete: true
Comment on attachment 417765 [details] [diff] [review]
Address duplicate nsslowkey_xxx and prepare_low_xxx symbols (for SOFTOKEN_3_13_BRANCH only; checked in)

I checked in this patch on the SOFTOKEN_3_13_BRANCH (NSS 3.13).

Checking in keydb.c;
/cvsroot/mozilla/security/nss/lib/softoken/legacydb/keydb.c,v  <--  keydb.c
new revision: 1.11.8.1; previous revision: 1.11
done
Checking in lgattr.c;
/cvsroot/mozilla/security/nss/lib/softoken/legacydb/lgattr.c,v  <--  lgattr.c
new revision: 1.9.8.1; previous revision: 1.9
done
Checking in lgcreate.c;
/cvsroot/mozilla/security/nss/lib/softoken/legacydb/lgcreate.c,v  <--  lgcreate.c
new revision: 1.5.8.1; previous revision: 1.5
done
Checking in lgfind.c;
/cvsroot/mozilla/security/nss/lib/softoken/legacydb/lgfind.c,v  <--  lgfind.c
new revision: 1.4.48.1; previous revision: 1.4
done
Checking in lowcert.c;
/cvsroot/mozilla/security/nss/lib/softoken/legacydb/lowcert.c,v  <--  lowcert.c
new revision: 1.5.4.1; previous revision: 1.5
done
Checking in lowkey.c;
/cvsroot/mozilla/security/nss/lib/softoken/legacydb/lowkey.c,v  <--  lowkey.c
new revision: 1.4.44.1; previous revision: 1.4
done
Checking in lowkeyi.h;
/cvsroot/mozilla/security/nss/lib/softoken/legacydb/lowkeyi.h,v  <--  lowkeyi.h
new revision: 1.2.54.1; previous revision: 1.2
done
Checking in lowkeyti.h;
/cvsroot/mozilla/security/nss/lib/softoken/legacydb/lowkeyti.h,v  <--  lowkeyti.h
new revision: 1.3.54.1; previous revision: 1.3
done
Attachment #417765 - Attachment description: Address duplicate nsslowkey_xxx and prepare_low_xxx symbols (for SOFTOKEN_3_13_BRANCH only) → Address duplicate nsslowkey_xxx and prepare_low_xxx symbols (for SOFTOKEN_3_13_BRANCH only; checked in)
Comment on attachment 417766 [details] [diff] [review]
Remove -DSOFTOKEN_LIB_NAME from legacydb/manifest.mn (for SOFTOKEN_3_13_BRANCH only; checked in)

I checked in this patch on the SOFTOKEN_3_13_BRANCH (NSS 3.13).

Checking in manifest.mn;
/cvsroot/mozilla/security/nss/lib/softoken/legacydb/manifest.mn,v  <--  manifest.mn
new revision: 1.5.54.1; previous revision: 1.5
done
Attachment #417766 - Attachment description: Remove -DSOFTOKEN_LIB_NAME from legacydb/manifest.mn (for SOFTOKEN_3_13_BRANCH only) → Remove -DSOFTOKEN_LIB_NAME from legacydb/manifest.mn (for SOFTOKEN_3_13_BRANCH only; checked in)
Comment on attachment 417788 [details] [diff] [review]
Update the comments for BLAPI_VerifySelf (for SOFTOKEN_3_13_BRANCH only; checked in)

I checked in this patch on the SOFTOKEN_3_13_BRANCH (NSS 3.13).

Checking in loader.c;
/cvsroot/mozilla/security/nss/lib/freebl/loader.c,v  <--  loader.c
new revision: 1.44.8.1; previous revision: 1.44
done
Checking in shvfy.c;
/cvsroot/mozilla/security/nss/lib/freebl/shvfy.c,v  <--  shvfy.c
new revision: 1.11.8.1; previous revision: 1.11
done
Attachment #417788 - Attachment description: Update the comments for BLAPI_VerifySelf (for SOFTOKEN_3_13_BRANCH only) → Update the comments for BLAPI_VerifySelf (for SOFTOKEN_3_13_BRANCH only; checked in)
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.13
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: