Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LIB REQUEST] libc for assembly #4160

Open
jhgorse opened this issue Oct 15, 2022 · 1 comment · May be fixed by #4230
Open

[LIB REQUEST] libc for assembly #4160

jhgorse opened this issue Oct 15, 2022 · 1 comment · May be fixed by #4230
Labels
Assembly enhancement execution Pertaining to running user code, display or output lang-asm new-libs

Comments

@jhgorse
Copy link

jhgorse commented Oct 15, 2022

Greetings,

It'd be nice to add libc -lc to the assemblers, such as NASM, so that examples such as this might link printf and do other useful things.

Cheers,
Joe

Full link example:
https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename:'1',fontScale:14,fontUsePx:'0',j:1,lang:assembly,selection:(endColumn:12,endLineNumber:20,positionColumn:12,positionLineNumber:20,selectionStartColumn:12,selectionStartLineNumber:20,startColumn:12,startLineNumber:20),source:'extern+printf%0A%0Aglobal+_start%0A%0Asection+.data%0A++++message+db+%22Hello+World!!%22,+10,+0%0A%0Asection+.text%0A%0A_start:%0A%0A++++%3B+print+message%0A++++push+dword+message%0A++++call+printf+%0A++++add+esp,+4+%0A%0A++++%3B+exit+with+code+0%0A++++mov+eax,1%0A++++mov+ebx,0%0A++++int+80h'),l:'5',n:'0',o:'Assembly+source+%231',t:'0')),k:44.05904059040591,l:'4',n:'0',o:'',s:0,t:'0'),(g:!((h:output,i:(compilerName:'x86-64+gcc+12.1',editorid:1,fontScale:14,fontUsePx:'0',j:1,wrap:'1'),l:'5',n:'0',o:'Output+of+NASM+2.14.02+(Compiler+%231)',t:'0'),(h:compiler,i:(compiler:nasm21402,filters:(b:'0',binary:'0',commentOnly:'0',demangle:'0',directives:'0',execute:'0',intel:'0',libraryCode:'0',trim:'1'),flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:1,lang:assembly,libs:!(),options:'-lc',selection:(endColumn:23,endLineNumber:3,positionColumn:23,positionLineNumber:3,selectionStartColumn:23,selectionStartLineNumber:3,startColumn:23,startLineNumber:3),source:1,tree:'1'),l:'5',n:'0',o:'NASM+2.14.02+(Assembly,+Editor+%231,+Compiler+%231)',t:'0')),k:55.94095940959409,l:'4',n:'0',o:'',s:1,t:'0')),l:'2',n:'0',o:'',t:'0')),version:4

@partouf
Copy link
Contributor

partouf commented Oct 28, 2022

The linker step for execution is a manual step we do just for giggles in case it can actually execute, but there's no real way to convey the intent to link to a library from the frontend.

Although, maybe we could do it by using the library selection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Assembly enhancement execution Pertaining to running user code, display or output lang-asm new-libs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants