tool/abi_symbols: omit known internal symbols

This patch prevents the abi_symbols tool from generating symbols that
are known to occur in shared objects but must not be part of a library
ABI. This saves a bit of time during library-porting work.

However, to avoid the accidental use of ABI symbol definitions that lack
any form of manual curation, the abi_symbols tool outputs a special
message, which is explicitly checked-for by the check_abi tool.

Fixes #3112
This commit is contained in:
Norman Feske 2019-01-15 11:42:43 +01:00
parent a155d0e531
commit 7b37546a4d
3 changed files with 41 additions and 18 deletions

View File

@ -21,6 +21,14 @@ set demangled [exec c++filt << $symbols]
set demangled_lines [split $demangled "\n"] set demangled_lines [split $demangled "\n"]
# obtail list of blacklisted symbols
set fd [open "[file dirname $argv0]/internal_abi.list"]
set symbol_blacklist [split [read $fd] "\n"]
close $fd
# add notice that the symbols file hasn't undergone any manual inspection
puts "# Please review the symbols and remove this line."
set i 0 set i 0
set output_lines {} set output_lines {}
foreach line [split $symbols "\n"] { foreach line [split $symbols "\n"] {
@ -78,6 +86,12 @@ foreach line [split $symbols "\n"] {
if {[regexp {W|V} $type] && ($name != $demangled_name)} { if {[regexp {W|V} $type] && ($name != $demangled_name)} {
set keep 0 } set keep 0 }
#
# Drop blacklisted symbols
#
foreach blacklisted_symbol $symbol_blacklist {
if {$name == $blacklisted_symbol} { set keep 0 } }
# write result # write result
if {$keep} { if {$keep} {

View File

@ -31,6 +31,16 @@ proc report_error { message } {
} }
#
# Warn about an ABI symbol definition that was generated by the 'abi_symbols'
# tool but hasn't undergone any manual review. This is most likely an
# accidental omission.
#
foreach line $abi_content {
if {$line == "# Please review the symbols and remove this line."} {
report_error "attempt to use unreviewed $abi_name ABI\n at $abi_path" } }
# #
# Extract symbol list w/o comments and empty lines, check for trailing spaces # Extract symbol list w/o comments and empty lines, check for trailing spaces
# #
@ -57,26 +67,12 @@ foreach line $abi_content {
# #
# Check for absence of Genode-internal linking artifacts from ABI # Check for absence of Genode-internal linking artifacts from ABI
# #
# The listed symbols may appear in shared objects but should not by part
#
# The following symbols may appear in shared objects but should not by part
# of any ABI. # of any ABI.
# #
set symbol_blacklist { set fd [open "[file dirname $argv0]/internal_abi.list"]
__bss_start set symbol_blacklist [split [read $fd] "\n"]
__eh_frame_start__ close $fd
__exidx_end
__exidx_start
__l4sys_invoke_indirect
_ctors_end
_ctors_start
_edata
_end
_init
_parent_cap
_parent_cap_local_name
_parent_cap_thread_id
}
foreach line $abi_symbols { foreach line $abi_symbols {
set name [lindex $line 0] set name [lindex $line 0]

13
tool/internal_abi.list Normal file
View File

@ -0,0 +1,13 @@
__bss_start
__eh_frame_start__
__exidx_end
__exidx_start
__l4sys_invoke_indirect
_ctors_end
_ctors_start
_edata
_end
_init
_parent_cap
_parent_cap_local_name
_parent_cap_thread_id