惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
T
Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
Intezer
C
Cyber Attacks, Cyber Crime and Cyber Security
The Register - Security
The Register - Security
量子位
Security Latest
Security Latest
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
C
CXSECURITY Database RSS Feed - CXSecurity.com
MyScale Blog
MyScale Blog
J
Java Code Geeks
Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Spread Privacy
Spread Privacy
Jina AI
Jina AI
博客园 - 【当耐特】
P
Palo Alto Networks Blog
Last Week in AI
Last Week in AI
SecWiki News
SecWiki News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
G
GRAHAM CLULEY
宝玉的分享
宝玉的分享
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
有赞技术团队
有赞技术团队
T
Tor Project blog
H
Hacker News: Front Page
A
Arctic Wolf
NISL@THU
NISL@THU
A
About on SuperTechFans
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
V
V2EX
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
Know Your Adversary
Know Your Adversary
P
Privacy International News Feed
I
InfoQ
D
Docker
L
LINUX DO - 最新话题
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
U
Unit 42

汇编

在浏览器使用 wasm 如何解决兼容性问题 C++中 i=i; 与 *p=i; 对应的汇编代码为什么不一样? - V2EX 汇编问题求解,这个问题我自己确实做不来 - V2EX 有谁能来教我一下汇编的问题吗?我真的因为这个卡了好久了 - V2EX 如何学习汇编语言? - V2EX Lock 指令到底有什么用? 求大神帮忙解答两个题,关于编程的,应付微机原理与应用过关考试的,不胜感激 6.828 lab1 Exercise 2 死循环问题 - V2EX 如何解决 ShellCode 中 call 所产生的 \x00 - V2EX 用 AMD64 汇编写的 web server - V2EX 来做个调查,各位V2exer 有多少学过汇编?有用过否? - V2EX Introduction to UNIX Assembly Programming - V2EX
Linux 下, global variable 在汇编里是什么时候被初始化的呢?
dangyuluo · 2022-10-19 · via 汇编

以下是源码:

int duplicate(int n)
{
    return n * 2;
}
int global_var = duplicate(0x42);

int main(int argc, char** argv){
    return global_var;
}

有一个 global variable, 用以下命令编译,并查看汇编代码:

g++ -o main ./main.c -O0
objdump -C -S -s main

其输出可见: https://controlc.com/70c59b1e

总是听别人说,static storage variable(基本上就是 global variable)在进入main之前就被初始化了,但是在查看汇编代码时,我并没有找到相关的调用。

__static_initialization_and_destruction_0(int, int)看起来像是初始化global_var,被_GLOBAL__sub_I__Z9duplicatei调用,但是我没有在任何地方看到对_GLOBAL__sub_I__Z9duplicatei的调用。因此想请问我的思路对么?