12.3 Changes to symbol visibility between RVCT v3.1 and RVCT v4.0

Changes to symbol visibility have been made in RVCT v4.0.

The following changes to symbol visibility have been made:

Change the ELF visibility that represents __declspec(dllexport)

When using the --hide_all compiler command-line option, which is the default, the ELF visibility that represents __declspec(dllexport) in RVCT v3.1 and earlier was STV_DEFAULT. In RVCT v4.0 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.1.

__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(visibility("default")) int x = 42;

RVCT v3.1 symbol visibility summary

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

Table 12-1 RVCT v3.1 symbol visibility summary

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

extern int x;

extern int g(void);

STV_HIDDEN STV_DEFAULT STV_HIDDEN

extern int y = 42;

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

STV_HIDDEN STV_DEFAULT STV_DEFAULT

__declspec(dllimport) extern int imx;

__declspec(dllimport) extern int img(void);

STV_DEFAULT STV_DEFAULT STV_DEFAULT

__declspec(dllexport) extern int exy = 42;

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

STV_DEFAULT STV_DEFAULT STV_DEFAULT

/* exporting undefs (unusual?) */

__declspec(dllexport) extern int exz;

__declspec(dllexport) extern int exh(void);

STV_HIDDEN STV_HIDDEN STV_HIDDEN

Table 12-2 RVCT v3.1 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_HIDDEN STV_DEFAULT STV_DEFAULT

RVCT v4.0 symbol visibility summary

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

Table 12-3 RVCT v4.0 symbol visibility summary

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

extern int x;

extern int g(void);

STV_HIDDEN STV_DEFAULT STV_HIDDEN

extern int y = 42;

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

STV_HIDDEN STV_DEFAULT STV_PROTECTED

__declspec(dllimport) extern int imx;

__declspec(dllimport) extern int img(void);

STV_DEFAULT STV_DEFAULT STV_DEFAULT

__declspec(dllexport) extern int exy = 42;

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

STV_PROTECTED STV_PROTECTED STV_PROTECTED

/* exporting undefs (unusual?) */

__declspec(dllexport) extern int exz;

__declspec(dllexport) extern int exh(void);

STV_PROTECTED STV_PROTECTED STV_PROTECTED

Table 12-4 RVCT v4.0 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_HIDDEN STV_DEFAULT STV_DEFAULT
Non-ConfidentialPDF file icon PDF versionARM DUI0530M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.