Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,21 @@ The following Unix compiler cc/gcc options are understood by cccl:
- **-pedantic** Removed/ignored, cl.exe does not support any equivalent
- **-std=_standard_** Converts to cl.exe' **/std:_standard_** for **c++14**, **gnu++14**, **c11**, **gnu11** and later **standard**, otherwise removed/ignored
- **-Wl,<option1>(,<option2>)** Options are passed to the linker
- **--dynamicbase** Converts to link.exe's **/DYNAMICBASE**
- **--disable-dynamicbase** Converts to link.exe's **/DYNAMICBASE:NO**
- **--gc-sections** Converts to link.exe's **/OPT:REF**
- **--icf** Converts to link.exe's **/OPT:ICF**
- **--nxcompat** Converts to link.exe's **/NXCOMPAT**
- **--disable-nxcompat** Converts to link.exe's **/NXCOMPAT:NO**
- **--high-entropy-va** Converts to link.exe's **/HIGHENTROPYVA**
- **--disable-high-entropy-va** Converts to link.exe's **/HIGHENTROPYVA:NO**
- **--out-implib** Converts to link.exe's **/IMPLIB**
- **-Werror** Converts to cl.exe's **/WX**
- **-W** Remaining warnings removed/ignored, please provide **/W** options for warning control
- **-fno-strict-aliasing** Removed/ignored
- **-flto** Converted to **/GL**
- **-fdata-sections** Converted to **/Gw**
- **-ffunction-sections** Converted to **/Gy**
- **-isystem** Converted to **/I**
- **-include** Converted to **/FI**
- **-MT** Due to conflict with cl.exe's **/MT** option, there is no support and cccl exits
Expand Down
90 changes: 80 additions & 10 deletions cccl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,65 @@ for arg in $@; do
esac
done

processargs()
process_link_opts()
{
shift # -Wl
while true; do
case $1 in
--)
break;
;;

--dynamicbase)
linkopt+=("${slash}DYNAMICBASE")
;;

--disable-dynamicbase)
linkopt+=("${slash}DYNAMICBASE:NO")
;;

--gc-sections)
linkopt+=("${slash}OPT:REF")
;;

--icf)
linkopt+=("${slash}OPT:ICF")
;;

--nxcompat)
linkopt+=("${slash}NXCOMPAT")
;;

--disable-nxcompat)
linkopt+=("${slash}NXCOMPAT:NO")
;;

--high-entropy-va)
linkopt+=("${slash}HIGHENTROPYVA")
;;

--disable-high-entropy-va)
linkopt+=("${slash}HIGHENTROPYVA:NO")
;;

--out-implib)
shift
linkopt+=("${slash}IMPLIB:$1")
;;

-Bshareable | -shared | --dll)
linkopt+=("${slash}DLL")
;;

*)
linkopt+=("$1")
;;
esac
shift
done
}

process_opts()
{
### Run through every option and convert it to the proper MS one
while test $# -gt 0; do
Expand Down Expand Up @@ -293,10 +351,8 @@ EOF
;;

-Wl,*)
IFS=',' read -ra linkopt2 <<< "$(echo $1 | sed 's/-Wl,//')"
for linkarg in ${linkopt2[@]}; do
linkopt+=("${linkarg}")
done
IFS=',' read -ra linkopt2 <<< "$1"
process_link_opts "${linkopt2[@]}" --
;;

-Werror)
Expand All @@ -306,8 +362,24 @@ EOF
#ignore remaining warnings
;;

-fno-strict-aliasing*)
#ignore aliasing
-f*)
case $1 in
-fno-strict-aliasing*)
#ignore aliasing
;;

-flto | -flto=*)
clopt+=("${slash}GL")
;;

-fdata-sections)
clopt+=("${slash}Gw")
;;

-ffunction-sections)
clopt+=("${slash}Gy")
;;
esac
;;

-isystem)
Expand Down Expand Up @@ -394,9 +466,7 @@ done

# Whitespace in paths is dealt with by setting IFS and using bash arrays
# Except additional arguments in CCCL_OPTIONS need to be space separated
processargs $CCCL_OPTIONS
IFS=""
processargs $@
process_opts ${CCCL_OPTIONS[@]} $@

if test $shared_index -ge 0 -a -n "$debug"; then
clopt[$shared_index]="${slash}LDd"
Expand Down