내가 특별히 언급 한 컴파일러 옵션만으로 C 코드를 컴파일하려고합니다. 따라서 자동으로 설정된 모든 컴파일러 옵션을 사용하지 않도록 설정해야합니다. 모든 컴파일 중에 설정되어 표시되지 않는 기본 GCC 옵션을 비활성화하려면 어떻게합니까? 나는이 출력으로 이어지는 다음 명령 gcc -Q -v example.c
을 사용하여 볼 수 있습니다 컴파일러 옵션에 대해 이야기하고있다 : 기본 컴파일러 옵션 options enabled
로 볼 수있다 여기에기본 GCC 컴파일러 옵션을 억제하는 방법이 있습니까?
GNU C (Ubuntu 4.8.4-2ubuntu1~14.04.3) version 4.8.4 (x86_64-linux-gnu)
compiled by GNU C version 4.8.4, GMP version 5.1.3, MPFR version 3.1.2-p3, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
options passed: -v -imultiarch x86_64-linux-gnu example.c -mtune=generic
-march=x86-64 -fstack-protector -Wformat -Wformat-security
options enabled: -faggressive-loop-optimizations
-fasynchronous-unwind-tables -fauto-inc-dec -fbranch-count-reg -fcommon
-fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
-feliminate-unused-debug-types -ffunction-cse -fgcse-lm -fgnu-runtime
-fgnu-unique -fident -finline-atomics -fira-hoist-pressure
-fira-share-save-slots -fira-share-spill-slots -fivopts
-fkeep-static-consts -fleading-underscore -fmath-errno
-fmerge-debug-strings -fmove-loop-invariants -fpeephole
-fprefetch-loop-arrays -freg-struct-return -fsched-critical-path-heuristic
-fsched-dep-count-heuristic -fsched-group-heuristic -fsched-interblock
-fsched-last-insn-heuristic -fsched-rank-heuristic -fsched-spec
-fsched-spec-insn-heuristic -fsched-stalled-insns-dep -fshow-column
-fsigned-zeros -fsplit-ivs-in-unroller -fstack-protector
-fstrict-volatile-bitfields -fsync-libcalls -ftrapping-math
-ftree-coalesce-vars -ftree-cselim -ftree-forwprop -ftree-loop-if-convert
-ftree-loop-im -ftree-loop-ivcanon -ftree-loop-optimize
-ftree-parallelize-loops= -ftree-phiprop -ftree-pta -ftree-reassoc
-ftree-scev-cprop -ftree-slp-vectorize -ftree-vect-loop-version
-funit-at-a-time -funwind-tables -fvar-tracking -fvar-tracking-assignments
-fzero-initialized-in-bss -m128bit-long-double -m64 -m80387
-maccumulate-outgoing-args -malign-stringops -mfancy-math-387
-mfp-ret-in-387 -mfxsr -mglibc -mieee-fp -mlong-double-80 -mmmx -mno-sse4
-mpush-args -mred-zone -msse -msse2 -mtls-direct-seg-refs
Compiler executable checksum: a0a649d344b1ed798e33d30772d46437
. 예 : 예를 사용하지 않고 이러한 옵션을 사용 중지하려면 어떻게해야합니까? 대부분은 -fno-...
입니다. 기본 컴파일러 옵션을 제대로 비활성화하는 쉬운 방법이 있습니까?
'-f ...'옵션을 모두 끄면 무엇을 기대할 수 있습니까? 두 옵션 중 하나를 선택하면 이러한 옵션 중 일부를 '사용 중지'할 수 없습니다. '-mlong-double-80'은 128 비트와 80 비트의'long double'을 선택합니다. – fuz
내가 알고있는 모든 기본 컴파일러 옵션을 해제하고 싶습니다. 그 후 나는 적극적으로 설정 한 컴파일러 옵션 만 설정하려고합니다. 이것은 실제로 특정 코드를 컴파일하기 위해 어떤 컴파일러 옵션이 활성화되는지를 아는 데 필요합니다. – Maximilian
@FUZxxl : gcc는 모든 옵션을 사용할 수 없도록 설정하여 인기있는 1990 년대와 유사한 방언을 처리합니다.이 방안에는 비용이 혜택을 초과하는 플랫폼이 있었거나있을 수 있기 때문에 표준에서 생략 된 많은 유용한 기능과 보증이 포함되어 있습니다. 예를 들어, 부호가 부호있는 값을 양의 정수로 스케일해야하는 경우, gcc는 현재 예를 들어 필요하지 않고'x << = y; '를 지원할 것이라고 생각합니다. 'x = (int32) ((uint32_t) x) << y);'하지만 프로그래머는 다음 gcc 버전이 그것을 만들기 위해 추가로'-fno-silly-signed-shift'를 요구할 지 알 수 없다. 작업. – supercat