[PATCH] D23674: Do not set __guard_local to hidden for OpenBSD SSP

Stefan Kempf via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 10:28:42 PDT 2016


Tim Shen wrote:
> timshen added a comment.
> 
> - Do you have a reduced testcase that produces the crash?

Here's a minimal example. You may have to run it several times with
clang -O2 -S until it crashes. Not sure how that could be turned
into something for the test suite.

long __guard_local;

struct S {
	int foo;
};

struct T {
	struct	S *member;
};

int	foo(struct T *s);
int	bar(struct S *);

void
f(void)
{
	struct T t;

	foo(&t);
	bar(t.member);
}


> - Would it be better to call M.getGlobalVariable(), assert on the returned value, and then create an IR cast on the returned GlobalValue?
 
As you mentioned, __guard_local is not always declared. Normally it's
defined in the lib startup code (or kernel). We need
M.getOrInsertGlobal here.

If M.getOrInsertGlobal() does not return with a GlobalVariable,
__guard_local was declared with a different type than long. This
is a programming mistake. I decided against the assert here
because the linker should catch this, and I wanted to avoid triggering
asserts because of programming errors.
 
> https://reviews.llvm.org/D23674
> 
> 
> 


More information about the llvm-commits mailing list