@@ -535,7 +535,7 @@ def build_uwsgi(uc, print_only=False, gcll=None):
535535 gcc_list .append ('%s/%s' % (path , cfile ))
536536 for bfile in up .get ('BINARY_LIST' , []):
537537 try :
538- binary_link_cmd = "ld -r -b binary -o %s/%s.o %s/%s" % (path , bfile [1 ], path , bfile [1 ])
538+ binary_link_cmd = "ld -z noexecstack - r -b binary -o %s/%s.o %s/%s" % (path , bfile [1 ], path , bfile [1 ])
539539 print (binary_link_cmd )
540540 if subprocess .call (binary_link_cmd , shell = True ) != 0 :
541541 raise Exception ('unable to link binary file' )
@@ -1150,7 +1150,7 @@ def get_gcll(self):
11501150 if not self .embed_config :
11511151 self .embed_config = self .get ('embed_config' )
11521152 if self .embed_config :
1153- binary_link_cmd = "ld -r -b binary -o %s.o %s" % (binarize (self .embed_config ), self .embed_config )
1153+ binary_link_cmd = "ld -z noexecstack - r -b binary -o %s.o %s" % (binarize (self .embed_config ), self .embed_config )
11541154 print (binary_link_cmd )
11551155 subprocess .call (binary_link_cmd , shell = True )
11561156 self .cflags .append ("-DUWSGI_EMBED_CONFIG=_binary_%s_start" % binarize (self .embed_config ))
@@ -1169,7 +1169,7 @@ def get_gcll(self):
11691169 for directory , directories , files in os .walk (ef ):
11701170 for f in files :
11711171 fname = "%s/%s" % (directory , f )
1172- binary_link_cmd = "ld -r -b binary -o %s.o %s" % (binarize (fname ), fname )
1172+ binary_link_cmd = "ld -z noexecstack - r -b binary -o %s.o %s" % (binarize (fname ), fname )
11731173 print (binary_link_cmd )
11741174 subprocess .call (binary_link_cmd , shell = True )
11751175 if symbase :
@@ -1179,7 +1179,7 @@ def get_gcll(self):
11791179 subprocess .call (objcopy_cmd , shell = True )
11801180 binary_list .append (binarize (fname ))
11811181 else :
1182- binary_link_cmd = "ld -r -b binary -o %s.o %s" % (binarize (ef ), ef )
1182+ binary_link_cmd = "ld -z noexecstack - r -b binary -o %s.o %s" % (binarize (ef ), ef )
11831183 print (binary_link_cmd )
11841184 subprocess .call (binary_link_cmd , shell = True )
11851185 binary_list .append (binarize (ef ))
0 commit comments