digitalmars.D - dmd -Wl=comma_separated_linker_flags (cf clang++ -Wl,
- Timothee Cour via Digitalmars-d (18/18) Dec 11 2016 question 1:
- Guillaume Boucher (3/10) Dec 11 2016 Just use shell expansions?
- Timothee Cour via Digitalmars-d (3/17) Feb 20 2017 This doesn't work : unrecognized switch '-Wl...'
- Nicholas Wilson (2/24) Feb 20 2017 linker flag is prefix is `-L` e.g. `-L-lbar` to link bar.
- Timothee Cour via Digitalmars-d (8/37) Feb 20 2017 relying on the shell (especially involving arrays) seems like a bad
- Jacob Carlborg (5/11) Feb 22 2017 You can pass multiple -L flags:
- Timothee Cour via Digitalmars-d (8/10) Feb 22 2017 I know, but that's inconvenient.
question 1: is there a way to pass linker flags? dmd -Wl=comma_separated_linker_flags eg: dmd -Wl=-lbar,-Ldir,--export-dynamic,-pie (same functionality as clang++ -Wl,-lbar,-Ldir,--export-dynamic,-pie) If not could we support it? Would make a lot of things easier. question 2: Furthermore, on linux, not sure I can pass the -pie flag to dmd ; currently this works: ``` dmd -of=${filelib}.o -c ${FLAGS} fun.d clang++ -o ${filelib} -pie ${filelib}.o -Wl,-lphobos2,--export-dynamic ``` but not: dmd -of=${filelib} ${FLAGS} -L-pie -L--export-dynamic fun.d with question 1 solved, this should automatically work via: dmd -of=${filelib} ${FLAGS} -Wl=-pie,--export-dynamic fun.d
Dec 11 2016
On Sunday, 11 December 2016 at 21:39:26 UTC, Timothee Cour wrote:is there a way to pass linker flags? dmd -Wl=comma_separated_linker_flags eg: dmd -Wl=-lbar,-Ldir,--export-dynamic,-pie (same functionality as clang++ -Wl,-lbar,-Ldir,--export-dynamic,-pie) If not could we support it? Would make a lot of things easier.Just use shell expansions? dmd -Wl,-{lbar,Ldir,-export-dynamic,pie}
Dec 11 2016
Just use shell expansions? dmd -Wl,-{lbar,Ldir,-export-dynamic,pie}This doesn't work : unrecognized switch '-Wl...' On Sun, Dec 11, 2016 at 3:36 PM, Guillaume Boucher via Digitalmars-d <digitalmars-d puremagic.com> wrote:On Sunday, 11 December 2016 at 21:39:26 UTC, Timothee Cour wrote:is there a way to pass linker flags? dmd -Wl=comma_separated_linker_flags eg: dmd -Wl=-lbar,-Ldir,--export-dynamic,-pie (same functionality as clang++ -Wl,-lbar,-Ldir,--export-dynamic,-pie) If not could we support it? Would make a lot of things easier.Just use shell expansions? dmd -Wl,-{lbar,Ldir,-export-dynamic,pie}
Feb 20 2017
On Tuesday, 21 February 2017 at 00:33:27 UTC, Timothee Cour wrote:linker flag is prefix is `-L` e.g. `-L-lbar` to link bar.Just use shell expansions? dmd -Wl,-{lbar,Ldir,-export-dynamic,pie}This doesn't work : unrecognized switch '-Wl...' On Sun, Dec 11, 2016 at 3:36 PM, Guillaume Boucher via Digitalmars-d <digitalmars-d puremagic.com> wrote:On Sunday, 11 December 2016 at 21:39:26 UTC, Timothee Cour wrote:is there a way to pass linker flags? dmd -Wl=comma_separated_linker_flags eg: dmd -Wl=-lbar,-Ldir,--export-dynamic,-pie (same functionality as clang++ -Wl,-lbar,-Ldir,--export-dynamic,-pie) If not could we support it? Would make a lot of things easier.Just use shell expansions? dmd -Wl,-{lbar,Ldir,-export-dynamic,pie}
Feb 20 2017
relying on the shell (especially involving arrays) seems like a bad idea: not portable, easy to mess up: `dmd -L{-lbar,-Ldir,--export-dynamic}` works but what if it's stored in $lflags: lflags="-lbar,-Ldir,--export-dynamic" the function to convert $lflags to a dmd-appropriate flag is not so simple; what do you suggest for that case? On Mon, Feb 20, 2017 at 5:26 PM, Nicholas Wilson via Digitalmars-d <digitalmars-d puremagic.com> wrote:On Tuesday, 21 February 2017 at 00:33:27 UTC, Timothee Cour wrote:linker flag is prefix is `-L` e.g. `-L-lbar` to link bar.Just use shell expansions? dmd -Wl,-{lbar,Ldir,-export-dynamic,pie}This doesn't work : unrecognized switch '-Wl...' On Sun, Dec 11, 2016 at 3:36 PM, Guillaume Boucher via Digitalmars-d <digitalmars-d puremagic.com> wrote:On Sunday, 11 December 2016 at 21:39:26 UTC, Timothee Cour wrote:is there a way to pass linker flags? dmd -Wl=comma_separated_linker_flags eg: dmd -Wl=-lbar,-Ldir,--export-dynamic,-pie (same functionality as clang++ -Wl,-lbar,-Ldir,--export-dynamic,-pie) If not could we support it? Would make a lot of things easier.Just use shell expansions? dmd -Wl,-{lbar,Ldir,-export-dynamic,pie}
Feb 20 2017
On 2017-02-21 03:53, Timothee Cour via Digitalmars-d wrote:relying on the shell (especially involving arrays) seems like a bad idea: not portable, easy to mess up: `dmd -L{-lbar,-Ldir,--export-dynamic}` works but what if it's stored in $lflags: lflags="-lbar,-Ldir,--export-dynamic" the function to convert $lflags to a dmd-appropriate flag is not so simple; what do you suggest for that case?You can pass multiple -L flags: dmd -L-lbar -L-Ldir -L--export-dynamic -- /Jacob Carlborg
Feb 22 2017
You can pass multiple -L flags: dmd -L-lbar -L-Ldir -L--export-dynamicI know, but that's inconvenient. Would make things a lot easier if we had something like what i suggested: `-Wl=comma_separated_linker_flags` advantages: could seemlessly use `comma_separated_linker_flags` with either dmd or rdmd (compile + link in 1 stage) or 2 stages (compile w dmd followed by link w clang [or ld]) or make it easier to migrate code from build tools from C echosystem, or integrate seemlessly with ldc etc.
Feb 22 2017