LINUX.ORG.RU

Флаги безопасности gcc

 


0

2

(Фиг знает помещать тему в Development или в Security, поэтому пишу в General)

Кто использует security-флаги gcc:

-fstack-protector
-Wformat 
-Wformat-security
-pie 
-fPIE

и другие? Есть ли влияние на стабильность и производительность? Много смысла использовать их на домашней машине?

Ответ на: комментарий от anonymous

Sil vy? ;)

Ты не совсем права.

march=core2 генерирует код лучше, чем -mtune generic, поэтому mtune в этом случае - бессмысленная (и даже вредная из-за разбухания кода) опция.

juk4windows
()
Ответ на: комментарий от juk4windows

march=core2 генерирует код лучше, чем -mtune generic, поэтому mtune в этом случае - бессмысленная (и даже вредная из-за разбухания кода) опция.

А ты ничего не спутал? Как раз таки оптимизации увеличивают размер кода.

Kindly_Cat
() автор топика
Ответ на: комментарий от Kindly_Cat

Я - нет ))

-march - генерит код под конкретную архитектуру.

-mtune - добавляет код ещё под некую универсальную (AMD/Intel) архитектуру.

-mtune=generic Produce code optimized for the most common IA32/AMD64/EM64T processors. If you know the CPU on which your code will run, then you should use the corresponding -mtune option instead of -mtune=generic. But, if you do not know exactly what CPU users of your application will have, then you should use this option.

As new processors are deployed in the marketplace, the behavior of this option will change. Therefore, if you upgrade to a newer version of GCC, the code generated option will change to reflect the processors that were most common when that version of GCC was released.

There is no -march=generic option because -march indicates the instruction set the compiler can use, and there is no generic instruction set applicable to all processors. In contrast, -mtune indicates the processor (or, in this case, collection of processors) for which the code is optimized.

-march=cpu-type Generate instructions for the machine type cpu-type. The choices for cpu-type are the same as for -mtune. Moreover, specifying -march=cpu-type implies -mtune=cpu-type.

Итого, в лучшем случае -mtune никогда не использовать.

Дистрибутивы её используют, но (!) только потому, что они не знают на каком процессоре сидит пользователь.

juk4windows
()
Ответ на: комментарий от anonymous

Простите, либо я не русский, но что значит «сделать трапом»?

juk4windows
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.