Need support for __attribute__((visibility("hidden"))) for variables and functions

Bug #1903763 reported by Amit Shali
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
New
Undecided
Unassigned

Bug Description

Applicable to ARM GCC compiler downloadable along with the Atmel Studio 7.0 available on the link below:
https://www.microchip.com/mplab/avr-support/atmel-studio-7

Customer is writing secure application and needs to adhere to the KCMVP (Korea Cryptographic Module Validation Program) guidelines.
They have a certain requirement to make some of the cryptographic objects, API calls as hidden and want to use the _attribute_((visibility("hidden"))) for functions and variables.

However, the attribute isn't supported by the ARM GCC compiler.
Though the toolchain accepts the attribute without a build error, it don't hide the objects in the map file or the elf file.

Examples of use:
void __attribute__((visibility("hidden"))) visibility_hidden_var;

void __attribute__((visibility("hidden"))) _visibility_test_lib()
{
printf("visibility Test !!!!!!!!!!!!!! \r\n");
}

The symbols "visibility_hidden_var" and "_visibility_test_lib" should not show in the elf file (when read with the readelf utility) and the map file.
This attribute affects the object's visibility of the ELF symbols.

Visibility can be of following types:

default - The assumed visibility of symbols can be changed by other options. Default visibility overrides such changes. Default visibility corresponds toexternal linkage.

hidden - The symbol is not placed into the dynamic symbol table, so no other executable or shared library can directly reference it. Indirect referencesare possible using function pointers.

internal - Unless otherwise specified by the processor-specific Application Binary Interface (psABI), internal visibility means that the function is nevercalled from another module.

protected - The symbol is placed into the dynamic symbol table, but references within the defining module bind to the local symbol. That is, thesymbol cannot be overridden by another module.

This feature is supported by the Keil compiler:
http://www.keil.com/support/man/docs/armcc/armcc_chr1359124983511.htm
http://www.keil.com/support/man/docs/armcc/armcc_chr1359124978628.htm

Need support for __attribute__((visibility("hidden"))) for variables and functions in ARM GCC compiler

Revision history for this message
stewo (wolfer-y) wrote : [Autoreply] [Bug 1903763] [NEW] Need support for __attribute__((visibility("hidden"))) for variables and functions
Download full text (5.7 KiB)

Ich bin bis 16.11. nicht im Haus und kann Ihre Nachricht daher leider nicht bearbeiten. In dringenden Fällen wenden Sie sich bitte an <email address hidden> bzw. für technische Fragen an <email address hidden>.

I am out of office until November 16th and won't be able to read your message. In urgent cases, please refer to <email address hidden> or for technical questions to <email address hidden>.

Mit freundlichen Grüßen / Best regards

Steffen Wolfer

--
Dipl.-Inform. Steffen Wolfer
Software Engineer Embedded Systems

WEISS ROBOTICS GmbH & Co. KG
Karl-Heinrich-Käferle-Str. 8
D-71640 Ludwigsburg, Germany

Phone: +49 7141 94702-22
Fax: +49 7141 94702-99
http://www.weiss-robotics.com

Sitz der Gesellschaft: Ludwigsburg
Registergericht Stuttgart, HRA725006

Pers. haftende Gesellschafterin:
Weiss Robotics Verwaltungs-GmbH, Sitz Ludwigsburg
Registergericht Stuttgart, HRB73310
Geschäftsführer: Dr. Karsten Weiß

Public bug reported:

Applicable to ARM GCC compiler downloadable along with the Atmel Studio 7.0 available on the link below:
https://www.microchip.com/mplab/avr-support/atmel-studio-7

Customer is writing secure application and needs to adhere to the KCMVP (Korea Cryptographic Module Validation Program) guidelines.
They have a certain requirement to make some of the cryptographic objects, API calls as hidden and want to use the _attribute_((visibility("hidden"))) for functions and variables.

However, the attribute isn't supported by the ARM GCC compiler.
Though the toolchain accepts the attribute without a build error, it don't hide the objects in the map file or the elf file.

Examples of use:
void __attribute__((visibility("hidden"))) visibility_hidden_var;

void __attribute__((visibility("hidden"))) _visibility_test_lib()
{
printf("visibility Test !!!!!!!!!!!!!! \r\n");
}

The symbols "visibility_hidden_var" and "_visibility_test_lib" should not show in the elf file (when read with the readelf utility) and the map file.
This attribute affects the object's visibility of the ELF symbols.

Visibility can be of following types:

default - The assumed visibility of symbols can be changed by other
options. Default visibility overrides such changes. Default visibility
corresponds toexternal linkage.

hidden - The symbol is not placed into the dynamic symbol table, so no
other executable or shared library can directly reference it. Indirect
referencesare possible using function pointers.

internal - Unless otherwise specified by the processor-specific
Application Binary Interface (psABI), internal visibility means that the
function is nevercalled from another module.

protected - The symbol is placed into the dynamic symbol table, but
references within the defining module bind to the local symbol. That is,
thesymbol cannot be overridden by another module.

This feature is supported by the Keil compiler:
http://www.keil.com/support/man/docs/armcc/armcc_chr1359124983511.htm
http://www.keil.com/support/man/docs/armcc/armcc_chr1359124978628.htm

Need support for __attribute__((visibility("hidden"))) for variables and
functions in ARM GCC compiler

** Affects: gcc-arm-embedded
     Importance: Undecided
         Status: Ne...

Read more...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.