首页 > 其他分享 >Gnu: binutils: ld: .gnu.warning.链接时的主动警告 glibc

Gnu: binutils: ld: .gnu.warning.链接时的主动警告 glibc

时间:2024-09-03 13:54:13浏览次数:3  
标签:__ ld attr gnu section warning pthread glibc

这个是一个gnu的extension,glibc会使用这个功能,标记即将被淘汰的符号,产生链接时的警告,比如:

/* When a reference to SYMBOL is encountered, the linker will emit a
   warning message MSG.  */
/* We want the .gnu.warning.SYMBOL section to be unallocated.  */
#define __make_section_unallocated(section_string)	\
  asm (".section " section_string "\n\t.previous");
  
#define link_warning(symbol, msg) \
  __make_section_unallocated (".gnu.warning." #symbol) \
  static const char __evoke_link_warning_##symbol[]	\
    __attribute__ ((used, section (".gnu.warning." #symbol __sec_comment))) \
    = msg;
    
link_warning (pthread_attr_setstackaddr,
              "the use of `pthread_attr_setstackaddr' is deprecated, use `pthread_attr_setstack'")

效果

/tmp/ccVxpFwZ.o: In function `main':
warning1.c:(.text+0xe): warning: the use of `pthread_attr_setstackaddr' is deprecated, use `pthread_attr_setstack'

需要注意,如果函数和main函数是再一个编译单元,不会trigger这个warning。需要变成成单独的o/so文件,在链接时才会报错。

标签:__,ld,attr,gnu,section,warning,pthread,glibc
From: https://blog.csdn.net/qq_36428903/article/details/141859269

相关文章

  • Unity 脚本编译和构建(Build)说明(官方文档翻译校正)
    目录脚本重要概念事件函数的执行顺序脚本生命周期概述流程图的范围脚本生命周期流程图一般原则第一次场景加载(FirstSceneload)场景加载和卸载之前(Beforesceneloadandunload)Editor第一帧更新之前(Beforethefirstframeupdate)帧之间(Inbetweenframes)更新顺序(Upda......
  • ffmpeg错误Invalid audio stream. Exactly one MP3 audio stream is required. Could
    错误消息Invalidaudiostream.ExactlyoneMP3audiostreamisrequired.Couldnotwriteheaderforoutputfile#0(incorrectcodecparameters?):InvalidargumentErrorinitializingoutputstream0:0--OnlyAACstreamscanbemuxedbytheADTSmuxerCoul......
  • 1.2 hello world
    printf的基本运用printf函数是c程序中的输出函数其的用法是#include<stdio.h>intmain(){printf("xxx")return0}我们打印一个helloworld吧!#include<stdio.h>intmain(){printf("helloworld")return0}在python中的运用 print("helloworld&q......
  • goland idea中debug程序报错-debugger could not patch runtime.mallogc
    idea中debugGo程序报错errorlayer=debuggercouldnotpatchruntime.mallogc一、问题场景在idea中配置了Go编程环境,可以运行Go程序,但是无法debug,报错errorlayer=debuggercouldnotpatchruntime.mallogc:notypeentryfound,use‘types’foralistofvalidtypes......
  • 迅为电子RK3588S开发板第三章Buildroot系统功能测试
      iTOP-3588S开发板采用瑞芯微RK3588S处理器,是全新一代AloT高端应用芯片,采用8nmLP制程,搭载八核64位CPU(四核Cortex-A76+四核Cortex-A55架构),集成MaliG610MP4四核GPU,内置AI加速器NPU,算力达6Tops,支持8K视频硬件编码器和硬件解码器,提供了许多功能强大的嵌入式硬件引擎,性能更强......
  • LDAP统一认证服务解决方案(转)
    原文链接:https://javaforall.cn/126568.htmlLDAP是什么首先LDAP是一种通讯协议,LDAP支持TCP/IP。协议就是标准,并且是抽象的。在这套标准下,AD(ActiveDirectory)是微软出的一套实现。那AD是什么呢?暂且把它理解成是个数据库。也有很多人直接把LDAP说成数据库(可以把LDAP理......
  • HelloWorld详解
    1:随便建立一个文件夹,用于存放代码2:新建一个java文件文件后缀名为.java文件为Hello.java【注意点】系统可能没有显示文件后缀名,需要手动打开3:用notepad++打开,并编写代码publicclassHello{ publicstaticvoidmain(String[]args){ System.out.print("Hello,World!")......
  • GNU与Linux 的关系
    问题1:GNOME是什么?GNOME是一个自由且开放源代码的桌面环境,广泛用于基于Linux和其他类Unix操作系统的计算机上。GNOME(GNUNetworkObjectModelEnvironment)的设计目标是提供一个简单、易于使用且现代化的用户界面,让用户能够轻松管理和操作系统资源。主要特性:用户友好:GNOM......
  • Lecture 03 How to build a Game World
    Lecture03HowtobuildaGameWorldEverythingisaGameObject(GO)面向对象的方式有些GO之间并没有清晰的继承关系Unreal中的UObject、Unity中的Object并不是这里讲的GameObject概念,而是更类似如C#中的Object,用于确定任何对象的生命周期需要的句柄Unreal中的GameOb......
  • 3万元一台,LDAR便携式VOCs总烃分析仪,关注公众享优惠活动价格,转发享更多优惠!
    1、质量保障:两年内设备由于自身质量问题,非人为原因无法维修直接换新机;2、提供设备备用机:设备出现质量问题直接提供备用机不耽误工作;3、案例用户:中石油体系客户、企业以及众多第三方检测公司;4、设备研发已经多年,在我推广前为了验证设备质量,专门联系多个比较有影响力的第三方检测......