Skip to content

Instantly share code, notes, and snippets.

@lighth7015
Last active March 29, 2019 20:14
Show Gist options
  • Select an option

  • Save lighth7015/127e6877378fd0bbbafdcf7e3de555b5 to your computer and use it in GitHub Desktop.

Select an option

Save lighth7015/127e6877378fd0bbbafdcf7e3de555b5 to your computer and use it in GitHub Desktop.
stdin
$ clang -nostdlib -fno-{stack-protector,jump-tables,addrsig,builtin} -ffreestanding -I../include -oexample.com -Wall \
-Wextra -pedantic -mregparm=3 -std=c99 -Oz -m16 -march=i386 -Wl,--omagic,--script=../lib/doscom.ld -fuse-ld=bfd main.c \
../lib/libdos.a
/usr/bin/ld.bfd: /tmp/main-de9979.o: in function `main':
main.c:(.text+0x20): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(doscrt0.o): in function `argstart':
doscrt0.c:(.text+0x1b): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(conio.o): in function `_getcinfo':
conio.c:(.text+0xf): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(conio.o): in function `setpage':
conio.c:(.text+0x56): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(conio.o): in function `getpage':
conio.c:(.text+0xa6): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(conio.o):conio.c:(.text+0xbf): more undefined references to `_GLOBAL_OFFSET_TABLE_' follow
/usr/bin/ld.bfd: ../lib/libdos.a(rtctimer.o): in function `rtctset':
rtctimer.c:(.text+0xa0): undefined reference to `__stack_chk_fail'
/usr/bin/ld.bfd: ../lib/libdos.a(rtctimer.o): in function `rtctstop':
rtctimer.c:(.text+0xb5): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: rtctimer.c:(.text+0x120): undefined reference to `__stack_chk_fail'
/usr/bin/ld.bfd: ../lib/libdos.a(rtctimer.o): in function `rtctwait':
rtctimer.c:(.text+0x12e): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(rtctimer.o): in function `rtctpoll':
rtctimer.c:(.text+0x176): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(time_time.o): in function `time':
time_time.c:(.text+0x16): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: time_time.c:(.text+0xb5): undefined reference to `__stack_chk_fail'
/usr/bin/ld.bfd: ../lib/libdos.a(stdlib_rand.o): in function `srand':
stdlib_rand.c:(.text+0xb): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(stdlib_rand.o): in function `rand':
stdlib_rand.c:(.text+0x2f): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(string_strtok.o): in function `strtok':
string_strtok.c:(.text+0x16): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(string_strtok.o): in function `strqetok':
string_strtok.c:(.text+0xc4): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(stdio_core.o): in function `puts':
stdio_core.c:(.text+0x11): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(stdio_core.o):stdio_core.c:(.text+0x47): more undefined references to `_GLOBAL_OFFSET_TABLE_' follow
/usr/bin/ld.bfd: ../lib/libdos.a(stdio_printf.o): in function `vsnprintf':
stdio_printf.c:(.text+0x14e): undefined reference to `__stack_chk_fail'
/usr/bin/ld.bfd: ../lib/libdos.a(stdio_printf.o): in function `_fftcharg':
stdio_printf.c:(.text+0x171): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(stdio_printf.o): in function `vfprintf':
stdio_printf.c:(.text+0x49f): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(stdio_printf.o): in function `vprintf':
stdio_printf.c:(.text+0x503): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: stdio_printf.c:(.text+0x5a0): undefined reference to `__stack_chk_fail'
/usr/bin/ld.bfd: ../lib/libdos.a(stdio_printf.o): in function `vsprintf':
stdio_printf.c:(.text+0x5b8): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(stdio_printf.o): in function `snprintf':
stdio_printf.c:(.text+0x5ea): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: stdio_printf.c:(.text+0x63e): undefined reference to `__stack_chk_fail'
/usr/bin/ld.bfd: ../lib/libdos.a(stdio_printf.o): in function `sprintf':
stdio_printf.c:(.text+0x653): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: stdio_printf.c:(.text+0x698): undefined reference to `__stack_chk_fail'
/usr/bin/ld.bfd: ../lib/libdos.a(stdio_printf.o): in function `fprintf':
stdio_printf.c:(.text+0x6ad): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: stdio_printf.c:(.text+0x6f2): undefined reference to `__stack_chk_fail'
/usr/bin/ld.bfd: ../lib/libdos.a(stdio_printf.o): in function `printf':
stdio_printf.c:(.text+0x707): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: stdio_printf.c:(.text+0x746): undefined reference to `__stack_chk_fail'
/usr/bin/ld.bfd: ../lib/libdos.a(stdio_printf.o): in function `_fnumarg':
stdio_printf.c:(.text+0x764): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: stdio_printf.c:(.text+0x888): undefined reference to `__stack_chk_fail'
/usr/bin/ld.bfd: ../lib/libdos.a(curses_core.o): in function `initscr':
curses_core.c:(.text+0x11): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(curses_core.o): in function `endwin':
curses_core.c:(.text+0xd8): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(curses_core.o): in function `wnoutrefresh':
curses_core.c:(.text+0x13a): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(curses_core.o): in function `doupdate':
curses_core.c:(.text+0x203): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(curses_core.o): in function `wrefresh':
curses_core.c:(.text+0x2a1): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(curses_core.o):curses_core.c:(.text+0x2c9): more undefined references to `_GLOBAL_OFFSET_TABLE_' follow
/usr/bin/ld.bfd: ../lib/libdos.a(curses_printw.o): in function `vw_printw':
curses_printw.c:(.text+0x90): undefined reference to `__stack_chk_fail'
/usr/bin/ld.bfd: ../lib/libdos.a(curses_printw.o): in function `mvwprintw':
curses_printw.c:(.text+0xa9): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: curses_printw.c:(.text+0x111): undefined reference to `__stack_chk_fail'
/usr/bin/ld.bfd: ../lib/libdos.a(curses_border.o): in function `wborder':
curses_border.c:(.text+0x17): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(time_getrtctm.o): in function `getrtctm':
time_getrtctm.c:(.text+0x14): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(time_mktime.o): in function `mktime':
time_mktime.c:(.text+0x1a): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(time_readrtc.o): in function `readrtc':
time_readrtc.c:(.text+0x1d): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: time_readrtc.c:(.text+0x213): undefined reference to `__stack_chk_fail'
/usr/bin/ld.bfd: ../lib/libdos.a(stdlib_malloc.o): in function `newchunk':
stdlib_malloc.c:(.text+0x16): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: stdlib_malloc.c:(.text+0x93): undefined reference to `__stack_chk_fail'
/usr/bin/ld.bfd: ../lib/libdos.a(stdlib_malloc.o): in function `malloc':
stdlib_malloc.c:(.text+0xb1): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(stdlib_malloc.o): in function `free':
stdlib_malloc.c:(.text+0x196): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(stdlib_malloc.o): in function `realloc':
stdlib_malloc.c:(.text+0x225): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(string_strerror.o): in function `strerror':
string_strerror.c:(.text+0x11): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(time_completetm.o): in function `completetm':
time_completetm.c:(.text+0x1a): undefined reference to `_GLOBAL_OFFSET_TABLE_'
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment