i have experienced following issue gcc 4.8.4 - when replace single *.o corresponding *.a made of *.o makes linker switch non-executable stack.
test *.o, result: executable stack:
$ gcc -m32 -o libtest.so -shared renderingmachine.o matchr.o $ execstack -q libtest.so x libtest.so # shows stack executable
test *.a, result: non-executable stack:
$ ar r matchr.a matchr.o ar: creating matchr.a $ gcc -m32 -o libtest.so -shared renderingmachine.o matchr.a $ execstack -q libtest.so - libtest.so # shows stack not executable
the object matchr.o , library has no .note.gnu-stack section , renderingmachine.o has:
$ readelf -a matchr.o | grep stack $ readelf -a matchr.a | grep stack $ readelf -a renderingmachine.o | grep stack [18] .note.gnu-stack progbits 00000000 0238ea 000000 00 0 0 1
thus, according example http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka14320.html, whic says objects ("may libraries") have not .note.gnu-stack , objects have it), gcc should produce executable stack regardless of if object inside library or not.
could tell me please, if bug or not. , if not, explain me please how gcc "thinks" looking object in library, because on opinion result must same since *.a has same functional content *.o.
thank attention!
p. s. :
asa@cp838:~$ uname -a linux cp838 3.13.0-68-generic #111-ubuntu smp fri nov 6 18:17:06 utc 2015 x86_64 x86_64 x86_64 gnu/linux
--
best regards,
alexander samoylov,
compart ag böblingen, deutschland.
the linked article mentions "--info execstack"
linker option, can try it? should show diagnostic information on objects not have .note.gnu-stack section.
as in example exec stack should not matter if matchr library or object, because obj having exec stack renderingmachine.o same in both cases.
so seem me linker bug (however double check use exact same renderingmachine.o in both cases).
as work-around, if lib needs executable stack (as question implies) can use "--execstack"
option override , make stack executable in both cases.
Comments
Post a Comment