See gcc -dumpspecs that -r essentially implies -nostdlib and suppresses
default -l* and crt*.o. The behavior makes sense because otherwise there will be
assuredly conflicting definitions when the relocatable output is linked into the
final executable/shared object.
Details
Details
- Reviewers
thesamesam phosek - Commits
- rG64da6eb06570: [Driver][Gnu] -r: imply -nostdlib like GCC
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Looks good, although the documentation for -r and other driver options could be better (not your fault though).
From https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html:
-r Produce a relocatable object as output. This is also known as partial linking.