ld: add page (#7922)

pull/1/head
maniyar1 2022-06-28 07:51:38 -04:00 committed by GitHub
parent 0dd0fcb430
commit 61763b2022
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

16
pages/common/ld.md Normal file
View File

@ -0,0 +1,16 @@
# ld
> Link object files together.
> More information: <https://sourceware.org/binutils/docs-2.38/ld.html>.
- Link a specific object file with no dependencies into an executable:
`ld {{path/to/file.o}} --output {{path/to/output_executable}}`
- Link two object files together:
`ld {{path/to/file1.o}} {{path/to/file2.o}} --output {{path/to/output_executable}}`
- Dynamically link an x86_64 program to glibc (file paths change depending on the system):
`ld --output {{path/to/output_executable}} --dynamic-linker /lib/ld-linux-x86-64.so.2 /lib/crt1.o /lib/crti.o -lc {{path/to/file.o}} /lib/crtn.o`