Re: Why is the fPIC switch missing?

2019-09-23 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 23 September 2019 at 08:19:35 UTC, Boris Carvajal 
wrote:

On Monday, 23 September 2019 at 01:31:03 UTC, Emmanuelle wrote:
Hello. My problem is exactly what it says on the title: my dmd 
(windows 7, x64) doesn't seem to have -fPIC:


I think it's not needed. The generated code on Windows is 
always position independent.


I believe Windows uses relocations. Relocations require patching 
the image after loading using a relocation table. 
Position-independent code does not require relocations, it is 
ready to run from any address straight after loading. This allows 
multiple copies of programs or libraries to be loaded at the same 
time in different processes at different addresses (with ASLR), 
but share their physical memory pages.




Re: Why is the fPIC switch missing?

2019-09-23 Thread IGotD- via Digitalmars-d-learn
On Monday, 23 September 2019 at 08:19:35 UTC, Boris Carvajal 
wrote:

On Monday, 23 September 2019 at 01:31:03 UTC, Emmanuelle wrote:
Hello. My problem is exactly what it says on the title: my dmd 
(windows 7, x64) doesn't seem to have -fPIC:


I think it's not needed. The generated code on Windows is 
always position independent.


Still, DMD should warn about it and keep compiling like GCC, 
not fail miserably.


Is PIC really enabled by default for Windows 32-bit binaries.


Re: Why is the fPIC switch missing?

2019-09-23 Thread Boris Carvajal via Digitalmars-d-learn

On Monday, 23 September 2019 at 01:31:03 UTC, Emmanuelle wrote:
Hello. My problem is exactly what it says on the title: my dmd 
(windows 7, x64) doesn't seem to have -fPIC:


I think it's not needed. The generated code on Windows is always 
position independent.


Still, DMD should warn about it and keep compiling like GCC, not 
fail miserably.


Re: Why is the fPIC switch missing?

2019-09-23 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Sep 23, 2019 at 3:35 AM Emmanuelle via Digitalmars-d-learn
 wrote:
>
> Forgot to say: dmd v2.088.0. Also, weirdly enough, `dmd
> --version` outputs `DMD32 D Compiler v2.088.0-dirty`. Why is
> "dirty" there?

https://forum.dlang.org/post/qqxmnoshytmzflviw...@forum.dlang.org


Re: Why is the fPIC switch missing?

2019-09-23 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Sep 23, 2019 at 3:35 AM Emmanuelle via Digitalmars-d-learn
 wrote:
>
> Hello. My problem is exactly what it says on the title: my dmd
> (windows 7, x64) doesn't seem to have -fPIC:
>
> ---
> > dmd -fPIC
> Error: unrecognized switch '-fPIC'
> run `dmd` to print the compiler manual
> run `dmd -man` to open browser on manual
> ---
>
> `dmd --help` also doesn't have anything about fPIC. Sorry if I'm
> being dense but why is that? Is it only available on Linux?
>
> Thank you!

It seems it is not available for windows and MacOS:

https://github.com/dlang/dmd/blob/639c67162b2be90ebf8dc9a9f8118cb2a9606569/src/dmd/cli.d#L323


Why is the fPIC switch missing?

2019-09-22 Thread Emmanuelle via Digitalmars-d-learn
Hello. My problem is exactly what it says on the title: my dmd 
(windows 7, x64) doesn't seem to have -fPIC:


---

dmd -fPIC

Error: unrecognized switch '-fPIC'
   run `dmd` to print the compiler manual
   run `dmd -man` to open browser on manual
---

`dmd --help` also doesn't have anything about fPIC. Sorry if I'm 
being dense but why is that? Is it only available on Linux?


Thank you!


Re: Why is the fPIC switch missing?

2019-09-22 Thread Emmanuelle via Digitalmars-d-learn
Forgot to say: dmd v2.088.0. Also, weirdly enough, `dmd 
--version` outputs `DMD32 D Compiler v2.088.0-dirty`. Why is 
"dirty" there?