RNA secondary and tertiary structures are strongly stabilized by added salts, and a quantitative thermodynamic analysis of the relevant ion-RNA interactions is an important aspect of the RNA folding problem. Because of long-range electrostatic forces, an RNA perturbs the distribution of both cations and anions throughout a large volume. Binding formalisms that require a distinction between "bound" and "free" ions become problematic in such situations. A more fundamental thermodynamic framework is developed here, based on preferential interaction coefficients; linkage equations derived from this framework provide a model-free description of the "uptake" or "release" of cations and anions that accompany an RNA conformational transition. Formulas appropriate for analyzing the dependence of RNA stability on either mono- or divalent salt concentration are presented and their application to experimental data is illustrated. Two example datasets are analyzed with respect to the monovalent salt dependence of tertiary structure formation in different RNAs, and three different experimental methods for quantitating the "uptake" of Mg(2+) ions are applied to the folding of a riboswitch RNA. Advantages and limitations of each method are discussed.