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

Aperta Adatta ai principianti
#206 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
c
Ambito
embedded-iot

Direzione di ricerca

Inizia con l’implementazione di errno per AVR e il controllo di conformità in tests/conformance/test_smoke.c; verifica come gli altri port forniscono __errno_location e come AVR gestisce errno tra i thread. Aggiungi l’implementazione per AVR in modo che il programma segnalato venga collegato e il controllo di errno passi, quindi esegui il test di conformità per il target Uno.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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).

Lingua principale
C
Stelle
1
Fork
2
Merge medio
20h 55m
PR unite (30g)
73

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di EmbLinkOs/EmbCC

Tutte le issue di EmbLinkOs/EmbCC

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.