Hi,
My recent attempt at submitting the GCC patch series to add FDPIC support for arm triggered a discussion about -static-pie support [1], which continued on IRC.
The patch currently supports -static but the resulting binary still needs the dynamic linker to prepare the parameters for __self_reloc, and there are arguments that a static binary should not have a PT_INTERP field.
At present, musl supports -static-pie for sh+FDPIC only.
I think other uclibc-ng targets with FDPIC (frv, bfin) do not support -static, but I'm not sure how to build such toolchains, nor if they are still supported.
It seems I have several options: (a) add support for static-pie to uclibc-ng. This means creating a new rcrt1.o or similar, which would embed parts of the dynamic linker into static-pie executables. I'm not sure how big a task this is?
(b) add support for FDPIC on arm to musl, which I'm not familiar with
(c) declare -static not supported on arm-FDPIC
(d) gather consensus that -static with pt_interp is ok (my preference, since that's what the current patches do :-)
So, my questions are: - does uclibc-ng support -static on some FDPIC targets? which ones? - how much work would option (a) mean? - are uclibc-ng people opposed to option (d)?
Thanks,
Christophe
[1] https://gcc.gnu.org/ml/gcc-patches/2019-05/msg00820.html
Hi Christophe, Christophe Lyon wrote,
Hi,
My recent attempt at submitting the GCC patch series to add FDPIC support for arm triggered a discussion about -static-pie support [1], which continued on IRC.
The patch currently supports -static but the resulting binary still needs the dynamic linker to prepare the parameters for __self_reloc, and there are arguments that a static binary should not have a PT_INTERP field.
At present, musl supports -static-pie for sh+FDPIC only.
I think other uclibc-ng targets with FDPIC (frv, bfin) do not support -static, but I'm not sure how to build such toolchains, nor if they are still supported.
It seems I have several options: (a) add support for static-pie to uclibc-ng. This means creating a new rcrt1.o or similar, which would embed parts of the dynamic linker into static-pie executables. I'm not sure how big a task this is?
(b) add support for FDPIC on arm to musl, which I'm not familiar with
(c) declare -static not supported on arm-FDPIC
(d) gather consensus that -static with pt_interp is ok (my preference, since that's what the current patches do :-)
So, my questions are:
- does uclibc-ng support -static on some FDPIC targets? which ones?
- how much work would option (a) mean?
- are uclibc-ng people opposed to option (d)?
I am fine with c). As for static binaries you could use binfmt. I think blackfin has the same limitation for FDPIC.
best regards Waldemar
On Fri, 24 May 2019 at 12:07, Waldemar Brodkorb wbx@uclibc-ng.org wrote:
Hi Christophe, Christophe Lyon wrote,
Hi,
My recent attempt at submitting the GCC patch series to add FDPIC support for arm triggered a discussion about -static-pie support [1], which continued on IRC.
The patch currently supports -static but the resulting binary still needs the dynamic linker to prepare the parameters for __self_reloc, and there are arguments that a static binary should not have a PT_INTERP field.
At present, musl supports -static-pie for sh+FDPIC only.
I think other uclibc-ng targets with FDPIC (frv, bfin) do not support -static, but I'm not sure how to build such toolchains, nor if they are still supported.
It seems I have several options: (a) add support for static-pie to uclibc-ng. This means creating a new rcrt1.o or similar, which would embed parts of the dynamic linker into static-pie executables. I'm not sure how big a task this is?
(b) add support for FDPIC on arm to musl, which I'm not familiar with
(c) declare -static not supported on arm-FDPIC
(d) gather consensus that -static with pt_interp is ok (my preference, since that's what the current patches do :-)
So, my questions are:
- does uclibc-ng support -static on some FDPIC targets? which ones?
- how much work would option (a) mean?
- are uclibc-ng people opposed to option (d)?
I am fine with c). As for static binaries you could use binfmt. I think blackfin has the same limitation for FDPIC.
Thanks, that's what the updated GCC patch does: https://gcc.gnu.org/ml/gcc-patches/2019-05/msg01591.html
I'm still waiting for feedback on the whole series of GCC patches.
Christophe
best regards Waldemar