From patchwork Wed Oct 9 03:58:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 98576 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 70EEA386197D for ; Wed, 9 Oct 2024 03:59:29 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id 23C8A3858D37 for ; Wed, 9 Oct 2024 03:59:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 23C8A3858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 23C8A3858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::429 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728446346; cv=none; b=EBlj7JwFulyoaKHm5Y283ENK4BHQDA24xZa0/B3eeTau4t0kuIk7Bf8HfS1SFBZ+lEi8JurmIZluNHg1hw31j3Rm0qxHdcsePwaj6J2zY497LqNWg0nKbPQpZbqtzX5mh55RO1gG+6N1kbPAMVvwm6AJiMVUoLJ3EG+KlvUiTRY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728446346; c=relaxed/simple; bh=cKhwBsqu1tVMchDsyWE/Ic8KT+yjfvi/ukNRZCEeorQ=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=w/4UxNkkJQxV+A9aScZUiSGKis7ktcA7v/ePqxCCXMTjyL5vhHzlTq/Di1taVdYeYh8ny9k5FvRURsYOGPfJHse1+gAz7rXrvl0ywQlTvfB79fTrwiWIm8cWVEKdblIN/jlT1jQlGZ5ru2q4YezItLhZHYQVWmvVzAaw4ga7004= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-71df2de4ed4so321869b3a.0 for ; Tue, 08 Oct 2024 20:59:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728446343; x=1729051143; darn=sourceware.org; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=Ji6eX65WBB/Vlgfg45+ESJSy9jvBXodJHD088uqy0zU=; b=B2EqlP+94Xy9pwtxu7ViDqQCaWP9/peYCJ067BGDYh3y+RU5iYIvpDWXUrduRYNZSg 2Ax/GiJ4NF9r7c/aWmwbUVmmfBTnO3sxuCHJ4H8gYSVW9AE4+iMz/oeDmTm+/IRpRjiB mNGYfIyyF1/sSRT7m04x+VzYSkIvUzrofJE0KSWUl5IkpPievuCSHXAWtyI6+RVfIv1x 0xA68jI255JG40pASFNWo9/S9Y4GoxKkiK/isPFGfkUZbqPuy88aQ55BB3ZDOEeigxJQ VX9PN0MH2E3wrDZDDeO5GLFQPmQvDRLAhcjAnok1uNGO7WRT1DlPJ8znrMgVm1g2sYvF wGPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728446343; x=1729051143; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Ji6eX65WBB/Vlgfg45+ESJSy9jvBXodJHD088uqy0zU=; b=jdDofCk59NRz41cjWhIITF0P/hu7m6ecvU4oq55z5cpTNVFm3evL0/2LeKHRtHsbTt gLK8sM1CDLgE0WF01c1cqyqsUTA2546gevdGw4OyRlvCqChZu4C0cbqUU5jDczQ01Ft4 /at3HVKkv2xTXfA49l30Kue3sd4qfWCBvwUlG+HSg7U5JiADJMIcgxh4jMSLWFKCXtIf da0BZkvLlwMI15vpM4HDhRg2PTlx2JgLvUzrFVn55kuxzcI8SzuqhkxHLokiCzCop+sj uwC1QjKS3vrjNmDyNPbJFKz7HB4LJeqxXzvuf2OcU4U8FzlsGqF7TezOLmX+sE25HtDr 3bpg== X-Gm-Message-State: AOJu0YwzesOSVGWddiEoUokK8dKJoIgvV0pcE9ggD9BuOUcBXXswTW7i 8E+/eqMAvNAnoP1sbkZ1Bvpxs5ElJOu/1HQ8YYga9ZNGjssd85MTs1L14w== X-Google-Smtp-Source: AGHT+IFu/HVWLosBj58J6DtYjMUQ9OSs1+hHgyRNLpMB5ygnUi+o7SfEOHDIV6p8cQDaIbV9AloOJw== X-Received: by 2002:a05:6a00:174b:b0:71e:fd5:4efe with SMTP id d2e1a72fcca58-71e1d63e82emr2154820b3a.6.1728446342702; Tue, 08 Oct 2024 20:59:02 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0cd05edsm6886765b3a.71.2024.10.08.20.59.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 20:59:02 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id DDA6D114031D; Wed, 9 Oct 2024 14:28:59 +1030 (ACDT) Date: Wed, 9 Oct 2024 14:28:59 +1030 From: Alan Modra To: binutils@sourceware.org Subject: PR32243, NAME_MAX does not exist on mingw-w64 without _POSIX_ Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3033.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org PR 32243 * dlltool.c: Move forward decls. Delete unnecessary ones. (bfd_errmsg): Delete macro, define as inline function. (PATHMAX): Delete. (NAME_MAX): Define. diff --git a/binutils/dlltool.c b/binutils/dlltool.c index 9acd080b7b6..17e9416a7f1 100644 --- a/binutils/dlltool.c +++ b/binutils/dlltool.c @@ -271,16 +271,8 @@ #define PAGE_MASK ((bfd_vma) (- COFF_PAGE_SIZE)) #endif -/* Get current BFD error message. */ -#define bfd_get_errmsg() (bfd_errmsg (bfd_get_error ())) - -/* Forward references. */ -static char *look_for_prog (const char *, const char *, int); -static char *deduce_name (const char *); - -#ifdef DLLTOOL_MCORE_ELF -static void mcore_elf_cache_filename (const char *); -static void mcore_elf_gen_out_file (void); +#ifndef NAME_MAX +#define NAME_MAX 255 #endif #ifdef HAVE_SYS_WAIT_H @@ -483,9 +475,6 @@ static char * mcore_elf_linker_flags = NULL; #define DRECTVE_SECTION_NAME ".drectve" #endif -/* What's the right name for this ? */ -#define PATHMAX 250 - /* External name alias numbering starts here. */ #define PREFIX_ALIAS_BASE 20000 @@ -805,8 +794,9 @@ struct string_list static struct string_list *excludes; +/* Forward references. */ +static char *deduce_name (const char *); static const char *xlate (const char *); -static bfd *make_delay_head (void); static void dll_name_list_free_contents (dll_name_list_node_type *); static void identify_search_archive (bfd *, void (*) (bfd *, bfd *, void *), void *); @@ -814,6 +804,18 @@ static void identify_search_member (bfd *, bfd *, void *); static void identify_search_section (bfd *, asection *, void *); static void inform (const char *, ...) ATTRIBUTE_PRINTF_1; +#ifdef DLLTOOL_MCORE_ELF +static void mcore_elf_cache_filename (const char *); +static void mcore_elf_gen_out_file (void); +#endif + +/* Get current BFD error message. */ +static inline const char * +bfd_get_errmsg (void) +{ + return bfd_errmsg (bfd_get_error ()); +} + static char * prefix_encode (char *start, unsigned code) { @@ -2778,7 +2780,7 @@ make_head (void) return abfd; } -bfd * +static bfd * make_delay_head (void) { FILE *f = fopen (TMP_HEAD_S, FOPEN_WT);