From 099995545c532dad0aaffdf7129f55c750b70d1f Mon Sep 17 00:00:00 2001 From: khorben Date: Tue, 7 Nov 2017 16:49:22 +0000 Subject: Teach the wrapper for ld(1) about more cases Building relocatable and omagic files are now recognized. They were previously recognized as executables, which may require a different behaviour in some environments (like when enforcing PIE). Committing this before joerg@'s approval since a call for testing PKGSRC_MKPIE has just been issued, and this helps with some packages. --- pkgtools/cwrappers/files/bin/common.h | 4 +++- pkgtools/cwrappers/files/bin/normalise-ld.c | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'pkgtools/cwrappers') diff --git a/pkgtools/cwrappers/files/bin/common.h b/pkgtools/cwrappers/files/bin/common.h index 1f1e26ceef3..a5126752640 100644 --- a/pkgtools/cwrappers/files/bin/common.h +++ b/pkgtools/cwrappers/files/bin/common.h @@ -1,4 +1,4 @@ -/* $NetBSD: common.h,v 1.7 2017/10/27 20:59:59 khorben Exp $ */ +/* $NetBSD: common.h,v 1.8 2017/11/07 16:49:22 khorben Exp $ */ /*- * Copyright (c) 2009, 2017 Joerg Sonnenberger . @@ -50,6 +50,8 @@ enum operation_mode { mode_assemble, mode_compile, mode_link_executable, + mode_link_omagic, + mode_link_relocatable, mode_link_shared }; extern enum operation_mode current_operation_mode; diff --git a/pkgtools/cwrappers/files/bin/normalise-ld.c b/pkgtools/cwrappers/files/bin/normalise-ld.c index 666a84d0dee..53421d2669d 100644 --- a/pkgtools/cwrappers/files/bin/normalise-ld.c +++ b/pkgtools/cwrappers/files/bin/normalise-ld.c @@ -1,4 +1,4 @@ -/* $NetBSD: normalise-ld.c,v 1.3 2017/06/11 19:34:43 joerg Exp $ */ +/* $NetBSD: normalise-ld.c,v 1.4 2017/11/07 16:49:22 khorben Exp $ */ /*- * Copyright (c) 2009, 2017 Joerg Sonnenberger . @@ -44,6 +44,16 @@ operation_mode_ld(struct arglist *args) TAILQ_FOREACH(arg, args, link) { if (arg->val[0] != '-') continue; + if (strcmp(arg->val, "-N") == 0 || + strcmp(arg->val, "--omagic") == 0) { + current_operation_mode = mode_link_omagic; + continue; + } + if (strcmp(arg->val, "-r") == 0 || + strcmp(arg->val, "--relocatable") == 0) { + current_operation_mode = mode_link_relocatable; + continue; + } if (strcmp(arg->val, "-shared") == 0 || strcmp(arg->val, "-Bshareable") == 0) { current_operation_mode = mode_link_shared; -- cgit v1.2.3