使用 $Super$$ 和 $Sub$$ 覆盖符号定义

     在某些情况下,无法修改现有符号,例如,由于符号位于外部库或 ROM 代码中。可以使用 $Super$$$Sub$$ 模式来修补现有符号。

例如,要修补函数 foo() 的定义,请按如下方式使用 $Super$$foo()$Sub$$foo()

$Super$$foo

标识未修补的原始函数 foo() 。 使用它可以直接调用原函数。

$Sub$$foo

标识调用的新函数,而不是原始函数 foo() 。可以使用此模式在原始函数之前或之后添加处理。

$Sub$Super 机制只在静态链接时起作用,$Super$$ 引用无法导入或导出到动态符号表中。

例如:

extern void ExtraFunc(void);
extern void $Super$$foo(void):

/* this function is called instead of the original foo() */
void $Sub$$foo(void)
{
  ExtraFunc();    /* does some extra setup work */
  $Super$$foo();  /* calls the original foo() function */
}


  

 摘自<ELF for arm..>

  A symbol $Sub$$name is the sub-class version of name. A symbol $Super$$name is the super-class version of
name. In the presence of a defintion of both name and $Sub$$name:


1. A reference to name resovles to the definition of $Sub$$name.
2. A reference to $Super$$name resolves to the definition of name.


It is an error to refer to $Sub$$name, or to define $Super$$name, or to use $Sub$$… or $Super$$… recursively.
A platform standard may mandate support of sub- and super-class symbols.
There are outstanding defects for sub- and super-class symbols DE-316140.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值