From 43ec230cb7c7a39e044f73518bf1b61b0d986eaf Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Sun, 2 Mar 2008 14:52:48 -0300 Subject: [PATCH] Avoid usage of LoaderSymbol. It can be dangerous. This patch is based on the previous one when r128 was in xf86-video-ati. The problem is that if gR128EntityIndex is not explicitly marked as a public symbol, and weird things may happen when compiling with hidden symbols. Since the symbol is in the same shared binary of its callers, just use it, instead of using LoaderSymbol. Could also just replace calls getR128EntityIndex() to direct access to gR128EntityIndex. --- src/r128_driver.c | 8 +++----- src/r128_probe.c | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/r128_driver.c b/src/r128_driver.c index 0e693e0..2eb9d26 100644 --- a/src/r128_driver.c +++ b/src/r128_driver.c @@ -192,13 +192,11 @@ R128RAMRec R128RAM[] = { /* Memory Specifications { 4, 4, 3, 3, 2, 3, 1, 16, 12, "64-bit DDR SGRAM" }, }; +extern _X_EXPORT int gR128EntityIndex; + int getR128EntityIndex(void) { - int *r128_entity_index = LoaderSymbol("gR128EntityIndex"); - if (!r128_entity_index) - return -1; - else - return *r128_entity_index; + return gR128EntityIndex; } R128EntPtr R128EntPriv(ScrnInfoPtr pScrn) diff --git a/src/r128_probe.c b/src/r128_probe.c index b1f427a..bfec1eb 100644 --- a/src/r128_probe.c +++ b/src/r128_probe.c @@ -208,7 +208,7 @@ static const struct pci_id_match r128_device_match[] = { #endif /* XSERVER_LIBPCIACCESS */ -int gR128EntityIndex = -1; +_X_EXPORT int gR128EntityIndex = -1; /* Return the options for supported chipset 'n'; NULL otherwise */ static const OptionInfoRec * -- 1.5.3.2