From dd74008c15febfc5ca0705539be0e242bc1aa073 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Fri, 29 Feb 2008 03:11:32 -0300 Subject: [PATCH] Ensure symbols used by other modules are visible. The xf86-video-ati drivers are one of the cases where LoaderSymbol is widely used in some obscure ways. This patch fixes the problem, and allows compiling with -fvisibility=hidden. --- src/radeon_driver.c | 8 ++--- src/radeon_probe.c | 2 +- src/theatre.c | 28 ++++++++++---------- src/theatre.h | 70 ++++++++++++++++++++++--------------------------- src/theatre200.c | 28 ++++++++++---------- src/theatre_detect.c | 2 +- src/theatre_detect.h | 4 +- 7 files changed, 66 insertions(+), 76 deletions(-) diff --git a/src/radeon_driver.c b/src/radeon_driver.c index c38e39b..1a9ce7c 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -224,13 +224,11 @@ static const OptionInfoRec RADEONOptions[] = { const OptionInfoRec *RADEONOptionsWeak(void) { return RADEONOptions; } +extern _X_EXPORT int gRADEONEntityIndex; + static int getRADEONEntityIndex(void) { - int *radeon_entity_index = LoaderSymbol("gRADEONEntityIndex"); - if (!radeon_entity_index) - return -1; - else - return *radeon_entity_index; + return gRADEONEntityIndex; } struct RADEONInt10Save { diff --git a/src/radeon_probe.c b/src/radeon_probe.c index 4ec7485..5d2eb43 100644 --- a/src/radeon_probe.c +++ b/src/radeon_probe.c @@ -60,7 +60,7 @@ static Bool RADEONProbe(DriverPtr drv, int flags); #endif -int gRADEONEntityIndex = -1; +_X_EXPORT int gRADEONEntityIndex = -1; /* Return the options for supported chipset 'n'; NULL otherwise */ static const OptionInfoRec * diff --git a/src/theatre.c b/src/theatre.c index a5aadfb..72e7f15 100644 --- a/src/theatre.c +++ b/src/theatre.c @@ -793,7 +793,7 @@ static void RT_SetVINClock(TheatrePtr t, CARD16 wStandard) * Inputs: int hue - the hue value to be set. * * Outputs: NONE * ****************************************************************************/ -void RT_SetTint (TheatrePtr t, int hue) +_X_EXPORT void RT_SetTint (TheatrePtr t, int hue) { CARD32 nhue = 0; @@ -846,7 +846,7 @@ void RT_SetTint (TheatrePtr t, int hue) * Inputs: int Saturation - the saturation value to be set. * * Outputs: NONE * ****************************************************************************/ -void RT_SetSaturation (TheatrePtr t, int Saturation) +_X_EXPORT void RT_SetSaturation (TheatrePtr t, int Saturation) { CARD16 wSaturation_V, wSaturation_U; double dbSaturation = 0, dbCrGain = 0, dbCbGain = 0; @@ -893,7 +893,7 @@ void RT_SetSaturation (TheatrePtr t, int Saturation) * Inputs: int Brightness - the brightness value to be set. * * Outputs: NONE * ****************************************************************************/ -void RT_SetBrightness (TheatrePtr t, int Brightness) +_X_EXPORT void RT_SetBrightness (TheatrePtr t, int Brightness) { double dbSynctipRef0=0, dbContrast=1; @@ -967,7 +967,7 @@ void RT_SetBrightness (TheatrePtr t, int Brightness) * Inputs: CARD16 wSharpness - the sharpness value to be set. * * Outputs: NONE * ****************************************************************************/ -void RT_SetSharpness (TheatrePtr t, CARD16 wSharpness) ++_X_EXPORT void RT_SetSharpness (TheatrePtr t, CARD16 wSharpness) { switch (wSharpness) { @@ -993,7 +993,7 @@ void RT_SetSharpness (TheatrePtr t, CARD16 wSharpness) * Inputs: int Contrast - the contrast value to be set. * * Outputs: NONE * ****************************************************************************/ -void RT_SetContrast (TheatrePtr t, int Contrast) +_X_EXPORT void RT_SetContrast (TheatrePtr t, int Contrast) { double dbSynctipRef0=0, dbContrast=0; double dbYgain=0; @@ -1052,7 +1052,7 @@ void RT_SetContrast (TheatrePtr t, int Contrast) * Inputs: CARD8 bInterlace * * Outputs: NONE * ****************************************************************************/ -void RT_SetInterlace (TheatrePtr t, CARD8 bInterlace) +_X_EXPORT void RT_SetInterlace (TheatrePtr t, CARD8 bInterlace) { switch(bInterlace) @@ -1142,7 +1142,7 @@ static void GetStandardConstants (double *LPeriod, double *FPeriod, * Inputs: CARD16 wStandard - input standard (NTSC, PAL, SECAM) * * Outputs: NONE * ****************************************************************************/ -void RT_SetStandard (TheatrePtr t, CARD16 wStandard) +_X_EXPORT void RT_SetStandard (TheatrePtr t, CARD16 wStandard) { double dbFsamp=0, dbLPeriod=0, dbFPeriod=0; CARD16 wFrameTotal = 0; @@ -1427,7 +1427,7 @@ void RT_SetStandard (TheatrePtr t, CARD16 wStandard) * CARD16 wConnector - COMPOSITE, SVIDEO * * Outputs: NONE * ****************************************************************************/ -void RT_SetCombFilter (TheatrePtr t, CARD16 wStandard, CARD16 wConnector) +_X_EXPORT void RT_SetCombFilter (TheatrePtr t, CARD16 wStandard, CARD16 wConnector) { CARD32 dwComb_Cntl0=0; CARD32 dwComb_Cntl1=0; @@ -1567,7 +1567,7 @@ void RT_SetCombFilter (TheatrePtr t, CARD16 wStandard, CARD16 wConnector) * CARD8 fVBI_Cap_On - enable VBI capture * * Outputs: NONE * ****************************************************************************/ -void RT_SetOutputVideoSize (TheatrePtr t, CARD16 wHorzSize, CARD16 wVertSize, CARD8 fCC_On, CARD8 fVBICap_On) +_X_EXPORT void RT_SetOutputVideoSize (TheatrePtr t, CARD16 wHorzSize, CARD16 wVertSize, CARD8 fCC_On, CARD8 fVBICap_On) { CARD32 dwHwinStart=0; CARD32 dwHScaleRatio=0; @@ -1864,7 +1864,7 @@ void RT_SetConnector (TheatrePtr t, CARD16 wConnector, int tunerFlag) } /* RT_SetConnector ()...*/ -void InitTheatre(TheatrePtr t) +_X_EXPORT void InitTheatre(TheatrePtr t) { CARD32 data; @@ -1929,7 +1929,7 @@ void InitTheatre(TheatrePtr t) } -void ShutdownTheatre(TheatrePtr t) +_X_EXPORT void ShutdownTheatre(TheatrePtr t) { WriteRT_fld (fld_VIN_ASYNC_RST, RT_ASYNC_DISABLE); WriteRT_fld (fld_VINRST , RT_VINRST_RESET); @@ -1938,7 +1938,7 @@ void ShutdownTheatre(TheatrePtr t) t->mode=MODE_UNINITIALIZED; } -void DumpRageTheatreRegs(TheatrePtr t) +_X_EXPORT void DumpRageTheatreRegs(TheatrePtr t) { int i; CARD32 data; @@ -2159,7 +2159,7 @@ void DumpRageTheatreRegsByName(TheatrePtr t) } -void ResetTheatreRegsForNoTVout(TheatrePtr t) +_X_EXPORT void ResetTheatreRegsForNoTVout(TheatrePtr t) { RT_regw(VIP_CLKOUT_CNTL, 0x0); RT_regw(VIP_HCOUNT, 0x0); @@ -2173,7 +2173,7 @@ void ResetTheatreRegsForNoTVout(TheatrePtr t) } -void ResetTheatreRegsForTVout(TheatrePtr t) +_X_EXPORT void ResetTheatreRegsForTVout(TheatrePtr t) { /* RT_regw(VIP_HW_DEBUG, 0x200); */ /* RT_regw(VIP_INT_CNTL, 0x0); diff --git a/src/theatre.h b/src/theatre.h index 958b443..36d6e05 100644 --- a/src/theatre.h +++ b/src/theatre.h @@ -35,45 +35,37 @@ typedef struct { } TheatreRec, * TheatrePtr; -/* DO NOT FORGET to setup constants before calling InitTheatre */ -void InitTheatre(TheatrePtr t); - -void RT_SetTint (TheatrePtr t, int hue); -void RT_SetSaturation (TheatrePtr t, int Saturation); -void RT_SetBrightness (TheatrePtr t, int Brightness); -void RT_SetSharpness (TheatrePtr t, CARD16 wSharpness); -void RT_SetContrast (TheatrePtr t, int Contrast); -void RT_SetInterlace (TheatrePtr t, CARD8 bInterlace); -void RT_SetStandard (TheatrePtr t, CARD16 wStandard); -void RT_SetCombFilter (TheatrePtr t, CARD16 wStandard, CARD16 wConnector); -void RT_SetOutputVideoSize (TheatrePtr t, CARD16 wHorzSize, CARD16 wVertSize, CARD8 fCC_On, CARD8 fVBICap_On); -void CalculateCrCbGain (TheatrePtr t, double *CrGain, double *CbGain, CARD16 wStandard); -void RT_SetConnector (TheatrePtr t, CARD16 wConnector, int tunerFlag); - -void RageTheatreDebugGain(TheatrePtr t, Bool on, CARD32 gain); -void ShutdownTheatre(TheatrePtr t); -void DumpRageTheatreRegs(TheatrePtr t); -void ResetTheatreRegsForTVout(TheatrePtr t); -void ResetTheatreRegsForNoTVout(TheatrePtr t); - -#define xf86_InitTheatre ((void (*)(TheatrePtr t))LoaderSymbol("InitTheatre")) - -#define xf86_RT_SetTint ((void (*)(TheatrePtr, int))LoaderSymbol("RT_SetTint")) -#define xf86_RT_SetSaturation ((void (*)(TheatrePtr, int))LoaderSymbol("RT_SetSaturation")) -#define xf86_RT_SetBrightness ((void (*)(TheatrePtr, int))LoaderSymbol("RT_SetBrightness")) -#define xf86_RT_SetSharpness ((void (*)(TheatrePtr, CARD16))LoaderSymbol("RT_SetSharpness")) -#define xf86_RT_SetContrast ((void (*)(TheatrePtr, int))LoaderSymbol("RT_SetContrast")) -#define xf86_RT_SetInterlace ((void (*)(TheatrePtr, CARD8))LoaderSymbol("RT_SetInterlace")) -#define xf86_RT_SetStandard ((void (*)(TheatrePtr, CARD16))LoaderSymbol("RT_SetStandard")) -#define xf86_RT_SetOutputVideoSize ((void (*)(TheatrePtr, CARD16, CARD16, CARD8, CARD8))LoaderSymbol("RT_SetOutputVideoSize")) -#define xf86_RT_SetConnector ((void (*)(TheatrePtr, CARD16, int))LoaderSymbol("RT_SetConnector")) - -#define xf86_RageTheatreDebugGain ((void (*)(TheatrePtr, Bool, CARD32))LoaderSymbol("RageTheatreDebugGain")) -#define xf86_ShutdownTheatre ((void (*)(TheatrePtr))LoaderSymbol("ShutdownTheatre")) -#define xf86_DumpRageTheatreRegs ((void (*)(TheatrePtr))LoaderSymbol("DumpRageTheatreRegs")) -#define xf86_ResetTheatreRegsForTVout ((void (*)(TheatrePtr))LoaderSymbol("ResetTheatreRegsForTVout")) -#define xf86_ResetTheatreRegsForNoTVout ((void (*)(TheatrePtr))LoaderSymbol("ResetTheatreRegsForNoTVout")) -#define xf86_RT_GetSignalStatus ((void (*)(TheatrePtr))LoaderSymbol("xf86_RT_GetSignalStatus")) +/* DO NOT FORGET to setup constants before calling InitTheatre */ +#define xf86_InitTheatre InitTheatre +_X_EXPORT void InitTheatre(TheatrePtr t); +#define xf86_RT_SetTint RT_SetTint +_X_EXPORT void RT_SetTint (TheatrePtr t, int hue); +#define xf86_RT_SetSaturation RT_SetSaturation +_X_EXPORT void RT_SetSaturation (TheatrePtr t, int Saturation); +#define xf86_RT_SetBrightness RT_SetBrightness +_X_EXPORT void RT_SetBrightness (TheatrePtr t, int Brightness); +#define xf86_RT_SetSharpness RT_SetSharpness +_X_EXPORT void RT_SetSharpness (TheatrePtr t, CARD16 wSharpness); +#define xf86_RT_SetContrast RT_SetContrast +_X_EXPORT void RT_SetContrast (TheatrePtr t, int Contrast); +#define xf86_RT_SetInterlace RT_SetInterlace +_X_EXPORT void RT_SetInterlace (TheatrePtr t, CARD8 bInterlace); +#define xf86_RT_SetStandard RT_SetStandard +_X_EXPORT void RT_SetStandard (TheatrePtr t, CARD16 wStandard); +#define xf86_RT_SetOutputVideoSize RT_SetOutputVideoSize +_X_EXPORT void RT_SetOutputVideoSize (TheatrePtr t, CARD16 wHorzSize, CARD16 wVertSize, CARD8 fCC_On, CARD8 fVBICap_On); +#define xf86_RT_SetConnector RT_SetConnector +_X_EXPORT void RT_SetConnector (TheatrePtr t, CARD16 wConnector, int tunerFlag); +#define xf86_ResetTheatreRegsForNoTVout ResetTheatreRegsForNoTVout +_X_EXPORT void ResetTheatreRegsForNoTVout(TheatrePtr t); +#define xf86_ResetTheatreRegsForTVout ResetTheatreRegsForTVout +_X_EXPORT void ResetTheatreRegsForTVout(TheatrePtr t); +#define xf86_DumpRageTheatreRegs DumpRageTheatreRegs +_X_EXPORT void DumpRageTheatreRegs(TheatrePtr t); +#define xf86_DumpRageTheatreRegsByName DumpRageTheatreRegsByName +_X_EXPORT void DumpRageTheatreRegsByName(TheatrePtr t); +#define xf86_ShutdownTheatre ShutdownTheatre +_X_EXPORT void ShutdownTheatre(TheatrePtr t); #endif diff --git a/src/theatre200.c b/src/theatre200.c index 672f01e..0341c6e 100644 --- a/src/theatre200.c +++ b/src/theatre200.c @@ -1492,7 +1492,7 @@ static CARD32 ReadRT_fld1 (TheatrePtr t,CARD32 dwReg) * Inputs: int hue - the hue value to be set. * * Outputs: NONE * ****************************************************************************/ -void RT_SetTint (TheatrePtr t, int hue) +_X_EXPORT void RT_SetTint (TheatrePtr t, int hue) { /* Validate Hue level */ if (hue < -1000) @@ -1517,7 +1517,7 @@ void RT_SetTint (TheatrePtr t, int hue) * Inputs: int Saturation - the saturation value to be set. * * Outputs: NONE * ****************************************************************************/ -void RT_SetSaturation (TheatrePtr t, int Saturation) +_X_EXPORT void RT_SetSaturation (TheatrePtr t, int Saturation) { /* VALIDATE SATURATION LEVEL */ if (Saturation < -1000L) @@ -1543,7 +1543,7 @@ void RT_SetSaturation (TheatrePtr t, int Saturation) * Inputs: int Brightness - the brightness value to be set. * * Outputs: NONE * ****************************************************************************/ -void RT_SetBrightness (TheatrePtr t, int Brightness) +_X_EXPORT void RT_SetBrightness (TheatrePtr t, int Brightness) { /* VALIDATE BRIGHTNESS LEVEL */ if (Brightness < -1000) @@ -1572,7 +1572,7 @@ void RT_SetBrightness (TheatrePtr t, int Brightness) * Inputs: CARD16 wSharpness - the sharpness value to be set. * * Outputs: NONE * ****************************************************************************/ -void RT_SetSharpness (TheatrePtr t, CARD16 wSharpness) +_X_EXPORT void RT_SetSharpness (TheatrePtr t, CARD16 wSharpness) { switch (wSharpness) { @@ -1598,7 +1598,7 @@ void RT_SetSharpness (TheatrePtr t, CARD16 wSharpness) * Inputs: int Contrast - the contrast value to be set. * * Outputs: NONE * ****************************************************************************/ -void RT_SetContrast (TheatrePtr t, int Contrast) +_X_EXPORT void RT_SetContrast (TheatrePtr t, int Contrast) { /* VALIDATE CONTRAST LEVEL */ if (Contrast < -1000) @@ -1626,7 +1626,7 @@ void RT_SetContrast (TheatrePtr t, int Contrast) * Inputs: CARD8 bInterlace * * Outputs: NONE * ****************************************************************************/ -void RT_SetInterlace (TheatrePtr t, CARD8 bInterlace) +_X_EXPORT void RT_SetInterlace (TheatrePtr t, CARD8 bInterlace) { switch(bInterlace) { @@ -1653,7 +1653,7 @@ void RT_SetInterlace (TheatrePtr t, CARD8 bInterlace) * Inputs: CARD16 wStandard - input standard (NTSC, PAL, SECAM) * * Outputs: NONE * ****************************************************************************/ -void RT_SetStandard (TheatrePtr t, CARD16 wStandard) +_X_EXPORT void RT_SetStandard (TheatrePtr t, CARD16 wStandard) { xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"Rage Theatre setting standard 0x%04x\n", wStandard); @@ -1772,7 +1772,7 @@ void RT_SetStandard (TheatrePtr t, CARD16 wStandard) * CARD8 fVBI_Cap_On - enable VBI capture * * Outputs: NONE * ****************************************************************************/ -void RT_SetOutputVideoSize (TheatrePtr t, CARD16 wHorzSize, CARD16 wVertSize, CARD8 fCC_On, CARD8 fVBICap_On) +_X_EXPORT void RT_SetOutputVideoSize (TheatrePtr t, CARD16 wHorzSize, CARD16 wVertSize, CARD8 fCC_On, CARD8 fVBICap_On) { /* VBI is ignored now */ @@ -1792,7 +1792,7 @@ void RT_SetOutputVideoSize (TheatrePtr t, CARD16 wHorzSize, CARD16 wVertSize, CA * int tunerFlag * Outputs: NONE * ****************************************************************************/ -void RT_SetConnector (TheatrePtr t, CARD16 wConnector, int tunerFlag) +_X_EXPORT void RT_SetConnector (TheatrePtr t, CARD16 wConnector, int tunerFlag) { CARD32 data; @@ -1871,7 +1871,7 @@ void RT_SetConnector (TheatrePtr t, CARD16 wConnector, int tunerFlag) } /* RT_SetConnector ()...*/ -void InitTheatre(TheatrePtr t) +_X_EXPORT void InitTheatre(TheatrePtr t) { CARD32 data; CARD32 M, N, P; @@ -1992,7 +1992,7 @@ err_exit: } -void ShutdownTheatre(TheatrePtr t) +_X_EXPORT void ShutdownTheatre(TheatrePtr t) { #if 0 WriteRT_fld (fld_VIN_ASYNC_RST, RT_ASYNC_DISABLE); @@ -2003,7 +2003,7 @@ void ShutdownTheatre(TheatrePtr t) t->mode=MODE_UNINITIALIZED; } -void DumpRageTheatreRegs(TheatrePtr t) +_X_EXPORT void DumpRageTheatreRegs(TheatrePtr t) { int i; CARD32 data; @@ -2224,7 +2224,7 @@ void DumpRageTheatreRegsByName(TheatrePtr t) } -void ResetTheatreRegsForNoTVout(TheatrePtr t) +_X_EXPORT void ResetTheatreRegsForNoTVout(TheatrePtr t) { RT_regw(VIP_CLKOUT_CNTL, 0x0); RT_regw(VIP_HCOUNT, 0x0); @@ -2238,7 +2238,7 @@ void ResetTheatreRegsForNoTVout(TheatrePtr t) } -void ResetTheatreRegsForTVout(TheatrePtr t) +_X_EXPORT void ResetTheatreRegsForTVout(TheatrePtr t) { /* RT_regw(VIP_HW_DEBUG, 0x200); */ /* RT_regw(VIP_INT_CNTL, 0x0); diff --git a/src/theatre_detect.c b/src/theatre_detect.c index 8770911..d4c6ce8 100644 --- a/src/theatre_detect.c +++ b/src/theatre_detect.c @@ -64,7 +64,7 @@ static Bool theatre_write(TheatrePtr t,CARD32 reg, CARD32 data) #define VIP_TYPE "ATI VIP BUS" -TheatrePtr DetectTheatre(GENERIC_BUS_Ptr b) +_X_EXPORT TheatrePtr DetectTheatre(GENERIC_BUS_Ptr b) { TheatrePtr t; int i; diff --git a/src/theatre_detect.h b/src/theatre_detect.h index 5fed160..53d8d11 100644 --- a/src/theatre_detect.h +++ b/src/theatre_detect.h @@ -38,9 +38,9 @@ */ -TheatrePtr DetectTheatre(GENERIC_BUS_Ptr b); +#define xf86_DetectTheatre DetectTheatre +_X_EXPORT TheatrePtr DetectTheatre(GENERIC_BUS_Ptr b); -#define xf86_DetectTheatre ((TheatrePtr (*)(GENERIC_BUS_Ptr))LoaderSymbol("DetectTheatre")) #endif -- 1.5.3.2