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

オープン 初心者向け
#206 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
c
領域
embedded-iot

調査の方向性

AVR の errno 実装と tests/conformance/test_smoke.c の適合性チェックから始め、他の port がどのように __errno_location を提供しているか、また AVR がスレッド間で errno をどのように扱うかを確認します。報告されたプログラムがリンクされ、errno チェックに合格するよう AVR の実装を追加し、その後 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分
マージ済み PR(30日)
73

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

EmbLinkOs/EmbCC のほかの issue

EmbLinkOs/EmbCC の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。