0

I am trying to build the musl C library using a custom risc-v toolchain that uses GNU gcc version 8.1.0, GNU assembler version 2.34.

The error I get is the following:

home/guillermo/toolchain/as: invalid option -- 'p'

However, using the verbose flags for gcc and as the last call to the assembler is as follows (which includes NO such "--p" flag):

/home/guillermo/toolchain/as -v -I ./arch/riscv64 -I ./arch/generic -I obj/src/internal -I ./src/include -I ./src/internal -I obj/include -I ./include -I /home/guillermo/toolchain/library/common --traditional-format -fpic -march=rv64imafdc -mabi=lp64d --noexecstack -o obj/crt/Scrt1.o

The invocation of gcc before that was:

 /home/guillermo/toolchain/riscv64-gcc -nostdinc -v -I ./arch/riscv64 -I ./arch/generic -I obj/src/internal -I ./src/include -I ./src/internal -I obj/include -I ./include -I /home/guillermo/toolchain/library/common -D _XOPEN_SOURCE=700 -D CRT crt/Scrt1.c -quiet -dumpbase Scrt1.c -march=rv64imafdc -mabi=lp64d -auxbase-strip obj/crt/Scrt1.o -g -Os -Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign -Werror=pointer-arith -Wno-tautological-compare -Wall -std=c99 -version -ffreestanding -fexcess-precision=standard -frounding-math -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -fPIC -fno-stack-protector -o - |

Any help would be greatly appreciated as to what compiler flag could be causing "--p" to be passed to the assembler.

ballsmahoney
  • 141
  • 1
  • 6

1 Answers1

1

-fpic is an option for the compiler in particular. It has no special meaning to the assembler, which treats it the same as -f -p -i -c.

  • Thank you for this great answer. What source did you use for this information? I have similar errors that perhaps are related to other compiler flags having no special meaning to the assembler. Thanks again. – ballsmahoney Nov 02 '21 at 15:04
  • @ballsmahoney I had a gut feeling, so I tried running just `as -fpic` and got the same error you did, then checked its manual to confirm my suspicion. – Joseph Sible-Reinstate Monica Nov 02 '21 at 16:58