binutils-gdb/libiberty/choose-temp.c

75 lines
2.0 KiB
C
Raw Normal View History

1999-05-03 15:29:11 +08:00
/* Utility to pick a temporary filename prefix.
Update the libiberty sources with the latest patches found in the master sources. 2017-01-02 Richard Biener <rguenther@suse.de> PR lto/83452 * simple-object-elf.c (simple_object_elf_copy_lto_debug_section): Do not use UNDEF locals for removed symbols but instead just define them in the first prevailing section and with no name. Use the same gnu_lto_v1 name for all removed globals we promote to WEAK UNDEFs so hpux can use a stub to provide this symbol. Clear sh_info and sh_link in removed sections. 2017-10-30 Richard Biener <rguenther@suse.de> PR lto/82757 * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections): Strip two leading _s from the __gnu_lto_* symbols. 2017-10-24 Alan Modra <amodra@gmail.com> PR lto/82687 PR lto/82575 * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections): Only make __gnu_lto symbols hidden. 2017-10-20 Alan Modra <amodra@gmail.com> PR lto/82575 * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections): Make discarded non-local symbols weak and hidden. 2017-10-18 Jakub Jelinek <jakub@redhat.com> PR lto/82598 * simple-object.c (handle_lto_debug_sections): Copy over also .note.GNU-stack section with unchanged name. * simple-object-elf.c (SHF_EXECINSTR): Define. (simple_object_elf_copy_lto_debug_section): Drop SHF_EXECINSTR bit on .note.GNU-stack section. 2017-09-25 Nathan Sidwell <nathan@acm.org> PR demangler/82195 * cp-demangle.c (d_encoding): Strip return type when name is a LOCAL_NAME. (d_local_name): Strip return type of enclosing TYPED_NAME. * testsuite/demangle-expected: Add and adjust tests. 2017-09-21 Nathan Sidwell <nathan@acm.org> PR demangler/82195 * cp-demangle.c (d_name): Revert addition of 'toplevel' parm. (has_return_type): Recurse for DEMANGLE_COMPONENT_LOCAL_NAME. (d_encoding): Revert d_name change. Use is_fnqual_component_type to strip modifiers that do not belong. (d_special_name, d_class_enum_type): Revert d_name call change. (d_expresion_1): Commonize DEMANGLE_COMPONENT_UNARY building. (d_local_name): Revert parsing of a function type. (d_print_comp_inner): An inner LOCAL_NAME might contain a TEMPLATE. * testsuite/demangle-expected: Add & adjust tests
2018-01-10 21:57:48 +08:00
Copyright (C) 1996-2018 Free Software Foundation, Inc.
1999-05-03 15:29:11 +08:00
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
Libiberty is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with libiberty; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
1999-05-03 15:29:11 +08:00
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h> /* May get P_tmpdir. */
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
1999-05-03 15:29:11 +08:00
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
1999-05-03 15:29:11 +08:00
#include "libiberty.h"
/* Name of temporary file.
mktemp requires 6 trailing X's. */
#define TEMP_FILE "ccXXXXXX"
2001-03-22 04:12:30 +08:00
#define TEMP_FILE_LEN (sizeof(TEMP_FILE) - 1)
1999-05-03 15:29:11 +08:00
2001-10-16 10:55:31 +08:00
/*
1999-05-03 15:29:11 +08:00
2001-10-18 06:35:28 +08:00
@deftypefn Extension char* choose_temp_base (void)
2001-10-16 10:55:31 +08:00
Return a prefix for temporary file names or @code{NULL} if unable to
find one. The current directory is chosen if all else fails so the
program is exited if a temporary directory can't be found (@code{mktemp}
fails). The buffer for the result is obtained with @code{xmalloc}.
2007-02-01 04:25:23 +08:00
This function is provided for backwards compatibility only. Its use is
2001-10-16 10:55:31 +08:00
not recommended.
@end deftypefn
*/
1999-05-03 15:29:11 +08:00
char *
2005-03-27 13:28:42 +08:00
choose_temp_base (void)
1999-05-03 15:29:11 +08:00
{
2001-03-22 04:12:30 +08:00
const char *base = choose_tmpdir ();
1999-05-03 15:29:11 +08:00
char *temp_filename;
int len;
len = strlen (base);
2005-05-25 05:01:33 +08:00
temp_filename = XNEWVEC (char, len + TEMP_FILE_LEN + 1);
1999-05-03 15:29:11 +08:00
strcpy (temp_filename, base);
strcpy (temp_filename + len, TEMP_FILE);
if (mktemp (temp_filename) == 0)
1999-05-03 15:29:11 +08:00
abort ();
return temp_filename;
}