avr: errno does not link: __errno_location is not in the C library

未关闭 适合新手
#206 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
c
领域
embedded-iot

调研方向

从 AVR 的 errno 实现和 tests/conformance/test_smoke.c 中的符合性检查开始;确认其他 port 如何提供 __errno_location,以及 AVR 如何在线程间处理 errno。添加 AVR 实现,使报告中的程序能够链接并通过 errno 检查,然后为 Uno 目标运行符合性测试。

由索引模型根据 Issue 内容生成。

描述

bug

An AVR program that uses errno does not link: <errno.h> defines errno as (*__errno_location()) for every target but Darwin, and the AVR C library does not define __errno_location. EmbCC 0.1.0 (macOS aarch64 release).

#include <errno.h>
#include <stdlib.h>
int main(void) { errno = 0; long v = strtol("99999999999999999999", 0, 10); return (errno == ERANGE && v != 0) ? 0 : 1; }
$ embcc --target=avr -mmcu=atmega328p -Os errno.c -o errno.elf
embld: undefined symbol '__errno_location' (referenced by errno-avr.elf.embcc-tmp.o)

Where EmbLinkRTOS meets it: tests/conformance/test_smoke.c checks errno after an out-of-range strtol, as the C library does it on every port; on the Uno it is the one image that fails to link for this reason.

A single static int and an __errno_location returning its address would do for AVR, which has no threads of its own; the RTOS's tests state that errno is not per thread there.

Part of #184 (AVR).

主要语言
C
星标
1
派生
2
平均合并
20 小时 55 分钟
30 天内合并 PR
73

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

EmbLinkOs/EmbCC 的其他 Issue

查看 EmbLinkOs/EmbCC 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。