Changes to symbol visibility between RVCT v3.1 for µVision and RVCT v4.0 for µVision

The following changes to symbol visibility have been made:

Show/hideChange to ELF visibility used to represent __declspec(dllexport)

When using the --hide_all compiler command-line option, which is the default, the ELF visibility used to represent __declspec(dllexport) in RVCT v3.1 for µVision and earlier was STV_DEFAULT. In RVCT v4.0 for µVision it is STV_PROTECTED. Symbols that are STV_PROTECTED can be referred to by other DLLs but cannot be preempted at load-time.

When using the --no_hide_all command-line option, the visibility of imported and exported symbols is still STV_DEFAULT as it was in RVCT v3.1for µVision.

Show/hide__attribute(visibility(...))

The GNU-style __attribute(visibility(...)) has been added and is available even without specifying the --gnu compiler command-line option. Using it overrides any implicit visibility. For example, the following results in STV_DEFAULT visibility instead of STV_HIDDEN:

    __declspec(visibilty("default")) int x = 42;

Show/hideRVCT v3.1 for µVision symbol visibility summary

The following tables summarize the visibility rules in RVCT v3.1 for µVision:

Table 1. RVCT v3.1 for µVision symbol visibility summary

Code--hide_all (default)--no_hide_all--dllexport_all

extern int x;

extern int g(void);

STV_HIDDENSTV_DEFAULTSTV_HIDDEN

extern int y = 42;

extern int f() { return g() + x; }

STV_HIDDENSTV_DEFAULTSTV_DEFAULT

__declspec(dllimport) extern int imx;

__declspec(dllimport) extern int img(void);

STV_DEFAULTSTV_DEFAULTSTV_DEFAULT

__declspec(dllexport) extern int exy = 42;

__declspec(dllexport) extern int exf() { return img() + imx; }

STV_DEFAULTSTV_DEFAULTSTV_DEFAULT

/* exporting undefs (unusual?) */

__declspec(dllexport) extern int exz;

__declspec(dllexport) extern int exh(void);

STV_HIDDENSTV_HIDDENSTV_HIDDEN

Table 2. RVCT v3.1 for µVision symbol visibility summary for references to run-time functions

Code

--no_dllimport_runtime

--hide_all (default)

--no_hide_all--dllexport_all

/* references to runtime functions, for

example __aeabi_fmul */

float fn(float a, float b) { return a*b; }

STV_HIDDENSTV_DEFAULTSTV_DEFAULT

Show/hideRVCT v4.0 for µVision symbol visibility summary

The following tables summarize the visibility rules in RVCT v4.0 for µVision:

Table 3. RVCT v4.0 for µVision symbol visibility summary

Code--hide_all (default)--no_hide_all--dllexport_all

extern int x;

extern int g(void);

STV_HIDDENSTV_DEFAULTSTV_HIDDEN

extern int y = 42;

extern int f() { return g() + x; }

STV_HIDDENSTV_DEFAULTSTV_PROTECTED

__declspec(dllimport) extern int imx;

__declspec(dllimport) extern int img(void);

STV_DEFAULTSTV_DEFAULTSTV_DEFAULT

__declspec(dllexport) extern int exy = 42;

__declspec(dllexport) extern int exf() { return img() + imx; }

STV_PROTECTEDSTV_PROTECTEDSTV_PROTECTED

/* exporting undefs (unusual?) */

__declspec(dllexport) extern int exz;

__declspec(dllexport) extern int exh(void);

STV_PROTECTEDSTV_PROTECTEDSTV_PROTECTED

Table 4. RVCT v4.0 for µVision symbol visibility summary for references to run-time functions

Code

--no_dllimport_runtime

--hide_all (default)

--no_hide_all--dllexport_all

/* references to runtime functions, for

example __aeabi_fmul */

float fn(float a, float b) { return a*b; }

STV_HIDDENSTV_DEFAULTSTV_DEFAULT

Show/hideSee also

Copyright © 2011-2012 ARM. All rights reserved.ARM DUI 0593B
Non-ConfidentialID062912