log信息:
03-27 09:08:25.887 397 400 W linker : /data/app/com.guagua.qiqi-1/lib/arm/libMedia.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
03-27 09:08:26.807 397 400 W linker : /data/app/com.guagua.qiqi-1/lib/arm/libMedia.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
此log信息在android早期版本也会存在,但是在UI上不会有任何提示。
在7.0和7.1有新加如下的code:
/frameworks/base/core/java/android/app/Activity.java
final void performStart(){ ... 6689 6690 // This property is set for all builds except final release 6691 boolean isDlwarningEnabled = SystemProperties.getInt("ro.bionic.ld.warning", 0) == 1; 6692 boolean isAppDebuggable = 6693 (mApplication.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; 6694 6695 if (isAppDebuggable || isDlwarningEnabled) { 6696 String dlwarning = getDlWarning(); 6697 if (dlwarning != null) { 6698 String appName = getApplicationInfo().loadLabel(getPackageManager()) 6699 .toString(); 6700 String warning = "Detected problems with app native libraries\n" + 6701 "(please consult log for detail):\n" + dlwarning; 6702 if (isAppDebuggable) { 6703 new AlertDialog.Builder(this). 6704 setTitle(appName). 6705 setMessage(warning). 6706 setPositiveButton(android.R.string.ok, null). 6707 setCancelable(false). 6708 show(); 6709 } else { 6710 Toast.makeText(this, appName + "\n" + warning, Toast.LENGTH_LONG).show(); 6711 } 6712 } 6713 }
对于有dlwarning的app,如果此app是debuggable模式或系统ro.bionic.ld.warning属性为1,那么会给app提示(以对话框的方式),需要完善或优化so库。